package org.grouplens.lenskit.knn.item;

import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.LongSortedSet;

import org.grouplens.lenskit.data.vector.SparseVector;

/**
 * Encapsulation of data needed during an item-item model build.  This class
 * provides access to item vectors, the item universe, and user-item sets to
 * be used by the build strategies to build up the model in the accumulator.
 * 
 * @see ItemItemModelBuildStrategy
 * @see ItemItemModelBuilder
 * 
 * @author Michael Ekstrand <ekstrand@cs.umn.edu>
 *
 */
public class ItemItemBuildContext {
    private LongSortedSet items;
    private Long2ObjectMap<SparseVector> itemVectors;
    private Long2ObjectMap<LongSortedSet> userItemSets;
    
    public ItemItemBuildContext(LongSortedSet universe,
                                Long2ObjectMap<SparseVector> vectors,
                                Long2ObjectMap<LongSortedSet> userSets) {
        items = universe;
        itemVectors = vectors;
        userItemSets = userSets;
    }
    
    public LongSortedSet getItems() {
        return items;
    }
    
    public SparseVector itemVector(long item) {
        return itemVectors.get(item);
    }
    
    public LongSortedSet userItems(long user) {
        return userItemSets.get(user);
    }
}

@@ -1,8 +1,872 @@
+/*%0A * LensKit, a reference implementation of recommender algorithms.%0A * Copyright 2010-2011 Regents of the University of Minnesota%0A *%0A * This program is free software; you can redistribute it and/or modify%0A * it under the terms of the GNU Lesser General Public License as%0A * published by the Free Software Foundation; either version 2.1 of the%0A * License, or (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful, but WITHOUT%0A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS%0A * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more%0A * details.%0A *%0A * You should have received a copy of the GNU General Public License along with%0A * this program; if not, write to the Free Software Foundation, Inc., 51%0A * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%0A */%0A
 package 

Add license header