本文整理汇总了Java中it.unimi.dsi.fastutil.ints.IntOpenHashSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java IntOpenHashSet.add方法的具体用法?Java IntOpenHashSet.add怎么用?Java IntOpenHashSet.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类it.unimi.dsi.fastutil.ints.IntOpenHashSet
的用法示例。
在下文中一共展示了IntOpenHashSet.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: syncMatrixInfos
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
/**
* compare the matrix meta on the master and the matrix meta on ps to find the matrix this parameter server needs to create and delete
* @param matrixReports parameter server matrix report, include the matrix ids this parameter server hold.
* @param needCreateMatrixes use to return the matrix partitions this parameter server need to build
* @param needReleaseMatrixes use to return the matrix ids this parameter server need to remove
* @param needRecoverParts need recover partitions
* @param psId parameter server id
*/
public void syncMatrixInfos(List<MatrixReport> matrixReports,
List<MatrixMeta> needCreateMatrixes, List<Integer> needReleaseMatrixes,
List<RecoverPartKey> needRecoverParts, ParameterServerId psId) {
//get matrix ids in the parameter server report
IntOpenHashSet matrixInPS = new IntOpenHashSet();
int size = matrixReports.size();
for (int i = 0; i < size; i++) {
matrixInPS.add(matrixReports.get(i).matrixId);
}
handleMatrixReports(psId, matrixReports);
Set<RecoverPartKey> parts = getAndRemoveNeedRecoverParts(psId);
if(parts != null) {
needRecoverParts.addAll(parts);
}
//get the matrices parameter server need to create and delete
getPSNeedUpdateMatrix(matrixInPS, needCreateMatrixes, needReleaseMatrixes, psId);
psMatricesUpdate(psId, matrixReports);
}
示例2: aggregate
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
@Override
public IntOpenHashSet aggregate(Block docIdSetBlock, Block[] block) {
IntOpenHashSet ret = new IntOpenHashSet();
int docId = 0;
BlockDocIdIterator docIdIterator = docIdSetBlock.getBlockDocIdSet().iterator();
BlockSingleValIterator blockValIterator = (BlockSingleValIterator) block[0].getBlockValueSet().iterator();
// Assume dictionary is always there for String data type.
// If data type is String, we shouldn't hit here.
while ((docId = docIdIterator.next()) != Constants.EOF) {
if (blockValIterator.skipTo(docId)) {
ret.add(blockValIterator.nextIntVal());
}
}
return ret;
}
示例3: RealtimeDictionaryBasedRangePredicateEvaluator
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
RealtimeDictionaryBasedRangePredicateEvaluator(RangePredicate rangePredicate, MutableDictionary dictionary) {
_matchingDictIdSet = new IntOpenHashSet();
int dictionarySize = dictionary.length();
if (dictionarySize == 0) {
return;
}
String lowerBoundary = rangePredicate.getLowerBoundary();
String upperBoundary = rangePredicate.getUpperBoundary();
boolean includeLowerBoundary = rangePredicate.includeLowerBoundary();
boolean includeUpperBoundary = rangePredicate.includeUpperBoundary();
if (lowerBoundary.equals("*")) {
lowerBoundary = dictionary.getMinVal().toString();
}
if (upperBoundary.equals("*")) {
upperBoundary = dictionary.getMaxVal().toString();
}
for (int dictId = 0; dictId < dictionarySize; dictId++) {
if (dictionary.inRange(lowerBoundary, upperBoundary, dictId, includeLowerBoundary, includeUpperBoundary)) {
_matchingDictIdSet.add(dictId);
}
}
}
示例4: testIntOpenHashSet
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
/**
* Test for ser/de of {@link IntOpenHashSet}.
*/
@Test
public void testIntOpenHashSet()
throws IOException {
for (int i = 0; i < NUM_ITERATIONS; i++) {
int size = RANDOM.nextInt(100);
IntOpenHashSet expected = new IntOpenHashSet(size);
for (int j = 0; j < size; j++) {
expected.add(RANDOM.nextInt());
}
byte[] bytes = ObjectCustomSerDe.serialize(expected);
IntOpenHashSet actual = ObjectCustomSerDe.deserialize(bytes, ObjectType.IntOpenHashSet);
// Use Object comparison instead of Collection comparison because order might change.
Assert.assertEquals((Object) actual, expected, ERROR_MESSAGE);
}
}
示例5: findNewRows
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
private RowIndex findNewRows(RowIndex rowIndex) {
IntOpenHashSet need = new IntOpenHashSet();
IntOpenHashSet fetchingRowIds = fetchingRowSets.get(rowIndex.getMatrixId());
IntIterator iter = rowIndex.getRowIds().iterator();
while (iter.hasNext()) {
int rowId = iter.nextInt();
if (!fetchingRowIds.contains(rowId)) {
need.add(rowId);
fetchingRowIds.add(rowId);
}
}
return new RowIndex(rowIndex.getMatrixId(), need, rowIndex);
}
示例6: addTo
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
public double addTo(IntOpenHashSet another,Int2IntOpenHashMap id2Count){
int totalno=0;
for (int k : occSet) {
if (!another.contains(k)){
totalno+=id2Count.get(k);
another.add(k);
}
}
return (totalno/((totalOccs)*1.0f));
}
示例7: getIntOpenHashSets
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
private static List<Serializable> getIntOpenHashSets(int numberOfElements) {
List<Serializable> intOpenHashSets = new ArrayList<Serializable>();
for (int i = 0; i < numberOfElements; ++i) {
IntOpenHashSet intOpenHashSet = new IntOpenHashSet();
intOpenHashSet.add(i);
intOpenHashSets.add(intOpenHashSet);
}
return intOpenHashSets;
}
示例8: analyzeAsC2W
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
private IntOpenHashSet analyzeAsC2W(DatasetConfiguration config) throws GerbilException {
D2WDataset dataset = (D2WDataset) config.getDataset(ExperimentType.D2KB);
if (dataset == null) {
return null;
}
List<HashSet<Annotation>> goldStandard = dataset.getD2WGoldStandardList();
IntOpenHashSet ids = new IntOpenHashSet();
for (HashSet<Annotation> annotations : goldStandard) {
for (Annotation annotation : annotations) {
ids.add(annotation.getConcept());
}
}
return ids;
}
示例9: analyzeAsD2W
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
private IntOpenHashSet analyzeAsD2W(DatasetConfiguration config) throws GerbilException {
C2WDataset dataset = (C2WDataset) config.getDataset(ExperimentType.C2KB);
if (dataset == null) {
return null;
}
List<HashSet<Tag>> goldStandard = dataset.getC2WGoldStandardList();
IntOpenHashSet ids = new IntOpenHashSet();
for (HashSet<Tag> tags : goldStandard) {
for (Tag tag : tags) {
ids.add(tag.getConcept());
}
}
return ids;
}
示例10: IntegerLabelFilter
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
/** Creates a new integer-label filter.
*
* @param keyAndvalues the key to be queried to filter an arc,
* or the empty string to query the well-known attribute, followed by a list of values that will be preserved.
*/
public IntegerLabelFilter( final String... keyAndvalues ) {
if ( keyAndvalues.length == 0 ) throw new IllegalArgumentException( "You must specificy a key name" );
this.key = keyAndvalues[ 0 ].length() == 0 ? null : keyAndvalues[ 0 ];
values = new IntOpenHashSet( keyAndvalues.length );
for( int i = 1; i < keyAndvalues.length; i++ ) values.add( Integer.parseInt( keyAndvalues[ i ] ) );
}
示例11: DictionaryBasedNotInPredicateEvaluator
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
DictionaryBasedNotInPredicateEvaluator(NotInPredicate notInPredicate, Dictionary dictionary) {
String[] values = notInPredicate.getValues();
_nonMatchingDictIdSet = new IntOpenHashSet(values.length);
for (String value : values) {
int dictId = dictionary.indexOf(value);
if (dictId >= 0) {
_nonMatchingDictIdSet.add(dictId);
}
}
_dictionary = dictionary;
}
示例12: IntRawValueBasedNotInPredicateEvaluator
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
IntRawValueBasedNotInPredicateEvaluator(NotInPredicate notInPredicate) {
String[] values = notInPredicate.getValues();
_nonMatchingValues = new IntOpenHashSet(values.length);
for (String value : values) {
_nonMatchingValues.add(Integer.parseInt(value));
}
}
示例13: DictionaryBasedInPredicateEvaluator
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
DictionaryBasedInPredicateEvaluator(InPredicate inPredicate, Dictionary dictionary) {
String[] values = inPredicate.getValues();
_matchingDictIdSet = new IntOpenHashSet();
for (String value : values) {
int dictId = dictionary.indexOf(value);
if (dictId >= 0) {
_matchingDictIdSet.add(dictId);
}
}
}
示例14: IntRawValueBasedInPredicateEvaluator
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
IntRawValueBasedInPredicateEvaluator(InPredicate inPredicate) {
String[] values = inPredicate.getValues();
_matchingValues = new IntOpenHashSet(values.length);
for (String value : values) {
_matchingValues.add(Integer.parseInt(value));
}
}
示例15: deserializeIntOpenHashSet
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; //导入方法依赖的package包/类
/**
* Helper method to de-serialize an {@link IntOpenHashSet} from a ByteBuffer.
*/
private static IntOpenHashSet deserializeIntOpenHashSet(ByteBuffer byteBuffer) {
int size = byteBuffer.getInt();
IntOpenHashSet intOpenHashSet = new IntOpenHashSet(size);
for (int i = 0; i < size; i++) {
intOpenHashSet.add(byteBuffer.getInt());
}
return intOpenHashSet;
}