@Override protected Long2DoubleMap makeVector(List<Entity> entities) { Long2DoubleOpenHashMap counts = new Long2DoubleOpenHashMap(); counts.defaultReturnValue(0); for (Entity e: entities) { long item = e.getLong(CommonAttributes.ITEM_ID); int count = e.getInteger(CommonAttributes.COUNT); counts.addTo(item, count); } return counts; } }
@Override public InteractionStatistics get() { Long2IntOpenHashMap counts = new Long2IntOpenHashMap(); try (ObjectStream<Entity> stream = dao.query(entityType).stream()) { for (Entity e : stream) { long item = e.getLong(CommonAttributes.ITEM_ID); counts.addTo(item, e.getInteger(CommonAttributes.COUNT)); } } return new InteractionStatistics(entityType, counts); } }
@Override protected Long2DoubleMap makeVector(List<Entity> entities) { Long2DoubleOpenHashMap counts = new Long2DoubleOpenHashMap(); counts.defaultReturnValue(0); for (Entity e: entities) { long item = e.getLong(CommonAttributes.ITEM_ID); int count = e.getInteger(CommonAttributes.COUNT); counts.addTo(item, count); } return counts; } }
@Override public InteractionStatistics get() { Long2IntOpenHashMap counts = new Long2IntOpenHashMap(); try (ObjectStream<Entity> stream = dao.query(entityType).stream()) { for (Entity e : stream) { long item = e.getLong(CommonAttributes.ITEM_ID); counts.addTo(item, e.getInteger(CommonAttributes.COUNT)); } } return new InteractionStatistics(entityType, counts); } }