Java Code Examples for it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry#getIntKey()

The following examples show how to use it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry#getIntKey() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArrayDictionaryRecords.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
@Override
public DictionaryRecords build() {
	int size = records.size();
	int[][] array = new int[size][];
	for (Entry<int[]> entry : records.int2ObjectEntrySet()) {
		int id = entry.getIntKey();
		array[id] = entry.getValue();
	}
	return new ArrayDictionaryRecords(array);
}
 
Example 2
Source File: AbstractRhsValidationTask.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
@Override
public void validate(Iterable<int[]> leftMatches, IntIterable right) {
	Int2ObjectMultimap<int[]> grouped = groupByValue(leftMatches);
	Iterator<Entry<Collection<int[]>>> it = grouped.iterator();
	while (it.hasNext() && shouldUpdate()) {
		Entry<Collection<int[]>> entry = it.next();
		int value = entry.getIntKey();
		Collection<int[]> records = entry.getValue();
		threshold = updateThreshold(value, records, right);
	}
}
 
Example 3
Source File: GroupingRhsValidationTask.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
private double calculateMinSimilarity(Iterable<Entry<Collection<int[]>>> map) {
	Iterator<Entry<Collection<int[]>>> it = map.iterator();
	//does order have an impact on runtime?
	while (it.hasNext() && shouldUpdate(minSimilarity)) {
		Entry<Collection<int[]>> entry = it.next();
		int rightValue = entry.getIntKey();
		Collection<int[]> records = entry.getValue();
		updateMinSimilarity(rightValue, records);
	}
	return minSimilarity;
}
 
Example 4
Source File: Int2Double2ObjectSortedArrayTableTest.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private static <T> Double2ObjectSortedMap<T>[] toArray(
	Int2ObjectMap<Double2ObjectSortedMap<T>> map, int size) {
	Double2ObjectSortedMap<T>[] array = new Double2ObjectSortedMap[size];
	for (Entry<Double2ObjectSortedMap<T>> entry : map.int2ObjectEntrySet()) {
		int columnKey = entry.getIntKey();
		array[columnKey] = entry.getValue();
	}
	return array;
}
 
Example 5
Source File: WorldObjectContainer.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
public<T> int getIndexFor(Function<WorldObject, Boolean> testFunction) {
	for(Entry<WorldObject> entry : worldObjects.int2ObjectEntrySet()) {
		WorldObject worldObject = entry.getValue();
		if (testFunction.apply(worldObject)) {
			return entry.getIntKey();
		}
	}
	return -1;
}
 
Example 6
Source File: WorldObjectContainer.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
public<T> int getIndexFor(ManagedProperty<T> propertyKey) {
	for(Entry<WorldObject> entry : worldObjects.int2ObjectEntrySet()) {
		WorldObject worldObject = entry.getValue();
		if (worldObject.hasProperty(propertyKey)) {
			return entry.getIntKey();
		}
	}
	return -1;
}
 
Example 7
Source File: WorldObjectContainer.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
public<T> int getIndexFor(ManagedProperty<T> propertyKey, Function<WorldObject, Boolean> testFunction) {
	for(Entry<WorldObject> entry : worldObjects.int2ObjectEntrySet()) {
		WorldObject worldObject = entry.getValue();
		if (worldObject.hasProperty(propertyKey) && testFunction.apply(worldObject)) {
			return entry.getIntKey();
		}
	}
	return -1;
}
 
Example 8
Source File: WorldObjectContainer.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
public<T> int getIndexFor(ManagedProperty<T> propertyKey, T value) {
	for(Entry<WorldObject> entry : worldObjects.int2ObjectEntrySet()) {
		WorldObject worldObject = entry.getValue();
		if (worldObject.hasProperty(propertyKey) && worldObject.getProperty(propertyKey) == value) {
			return entry.getIntKey();
		}
	}
	return -1;
}
 
Example 9
Source File: WorldObjectContainer.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
public<T> int getIndexFor(ManagedProperty<T> propertyKey, T value, Function<WorldObject, Boolean> testFunction) {
	for(Entry<WorldObject> entry : worldObjects.int2ObjectEntrySet()) {
		WorldObject worldObject = entry.getValue();
		if (worldObject.hasProperty(propertyKey) && (worldObject.getProperty(propertyKey) == value) && testFunction.apply(worldObject)) {
			return entry.getIntKey();
		}
	}
	return -1;
}
 
Example 10
Source File: WorldObjectContainer.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
public int getIndexFor(StringProperty property, String value, Function<WorldObject, Boolean> testFunction) {
	for(Entry<WorldObject> entry : worldObjects.int2ObjectEntrySet()) {
		WorldObject worldObject = entry.getValue();
		if (worldObject.hasProperty(property) && worldObject.getProperty(property).equals(value)) {
			if (testFunction.apply(worldObject)) {
				return entry.getIntKey();
			}
		}
	}
	return -1;
}
 
Example 11
Source File: WorldObjectContainer.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
public int getIndexFor(WorldObject worldObjectToFind) {
	for(Entry<WorldObject> entry : worldObjects.int2ObjectEntrySet()) {
		WorldObject worldObject = entry.getValue();
		if (worldObject == worldObjectToFind) {
			return entry.getIntKey();
		}
	}
	return -1;
}
 
Example 12
Source File: MapPositionListIndex.java    From metanome-algorithms with Apache License 2.0 4 votes vote down vote up
private static Cluster toCluster(Entry<IntSet> e) {
	return new Cluster(e.getIntKey(), e.getValue());
}