hIndices.add(i); } else
/** * Adds all of the elements in <tt>array</tt> to the set. * * @param array an <code>array</code> of int primitives. * @return true if the set was modified by the add all operation. */ public boolean addAll(int[] array) { boolean changed = false; for (int i = array.length; i-- > 0;) { if (add(array[i])) { changed = true; } } return changed; }
/** * Inserts a value into the set. * * @param true if the set was modified by the insertion */ public boolean add(Object value) { return _set.add(unwrap(value)); }
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); int size = stream.readInt(); setUp(size); while (size-- > 0) { int val = stream.readInt(); add(val); } } } // TIntHashSet
@Override public int nextMacroRankDocument(ContingencyTableSet oldEvaluation, ContingencyTableSet newEvaluation) { nextMacroTable(oldEvaluation, newEvaluation); int docID = getFirstMacro(); macroAlreadySeen.add(docID); return docID; }
@Override public int nextMicroRankDocument(ContingencyTableSet oldEvaluation, ContingencyTableSet newEvaluation) { nextMicroTable(oldEvaluation, newEvaluation); int docID = getFirstMicro(); microAlreadySeen.add(docID); return docID; }
public StaticRank(int trainSize, ClassificationScoreDB classification, TIntHashSet categoriesFilter) { this.trainSize = trainSize; this.classification = classification; this.testSize = classification.getDocumentCount(); if (categoriesFilter == null || categoriesFilter.isEmpty()) { this.categoriesFilter = new TIntHashSet((int) (testSize + testSize * 0.25), (float) 0.75); for (short i = 0; i < classification.getDocumentScoresAsSet(0).size(); i++) { this.categoriesFilter.add(i); } } else { this.categoriesFilter = categoriesFilter; } }
public void processTerm(String term) { /* null means the term has been filtered out (eg stopwords) */ if (term != null) { /* add term to Document tree */ for (String fieldName: termFields) { int tmp = fieldNames.get(fieldName); if (tmp > 0) { fields.add(tmp -1); } } if (ELSE_ENABLED && fields.size() == 0) { fields.add(ELSE_FIELD_ID); } ((FieldDocumentPostingList)termsInDocument).insert(term,fields.toArray()); numOfTokensInDocument++; fields.clear(); } }
public void processTerm(String term) { if (term != null) { TIntHashSet freqs = new TIntHashSet(0); for (String docField : docFields) freqs.add(fieldIDs.get(docField)); if (fieldIDs.containsKey("ELSE") && freqs.size() == 0) freqs.add(fieldIDs.get("ELSE")); ((FieldDocumentPostingList) fdpl).insert(term, freqs.toArray()); } }
/** Insert a term into this document, occurs at given block id, and in the given fields */ public void insert(String t, int[] fieldIds, int blockId) { super.insert(t, fieldIds); TIntHashSet blockids = null; if ((blockids = term_blocks.get(t)) == null) { term_blocks.put(t, blockids = new TIntHashSet(/*TODO */)); } blockids.add(blockId); blockCount++; }
/** Insert a term into this document tf times, occurs at given block id, and in the given fields */ public void insert(int tf, String t, int[] fieldIds, int blockId) { super.insert(tf, t, fieldIds); TIntHashSet blockids = null; if ((blockids = term_blocks.get(t)) == null) { term_blocks.put(t, blockids = new TIntHashSet(/*TODO */)); } blockids.add(blockId); blockCount++; }
public void processTerm(String t) { // null means the term has been filtered out (eg stopwords) if (t != null) { //add term to document posting list for (String fieldName: termFields) { int tmp = fieldNames.get(fieldName); if (tmp > 0) { fields.add(tmp -1); } } if (ELSE_ENABLED && fields.size() == 0) { fields.add(ELSE_FIELD_ID); } ((BlockFieldDocumentPostingList)termsInDocument).insert(t,fields.toArray(), blockId); numOfTokensInDocument++; if (++numOfTokensInBlock >= BLOCK_SIZE && blockId < MAX_BLOCKS) { numOfTokensInBlock = 0; blockId++; } fields.clear(); } }
public void processTerm(String t) { // null means the term has been filtered out (eg stopwords) if (t != null) { //add term to document posting list for (String fieldName: termFields) { int tmp = fieldNames.get(fieldName); if (tmp > 0) { fields.add(tmp -1); } } if (ELSE_ENABLED && fields.size() == 0) { fields.add(ELSE_FIELD_ID); } ((BlockFieldDocumentPostingList)termsInDocument).insert(t,fields.toArray(), blockId); numOfTokensInDocument++; if (++numOfTokensInBlock >= BLOCK_SIZE && blockId < MAX_BLOCKS) { numOfTokensInBlock = 0; blockId++; } fields.clear(); } }
/** Insert a term into this document, occurs at given block id, and in the given field */ public void insert(String t, int fieldId, int blockId) { super.insert(t, fieldId); TIntHashSet blockids = null; if ((blockids = term_blocks.get(t)) == null) { term_blocks.put(t, blockids = new TIntHashSet(/*TODO */)); } blockids.add(blockId); blockCount++; }
/** Insert a term into this document, occurs at given block id */ public void insert(String t, int blockId) { insert(t); TIntHashSet blockids = null; if ((blockids = term_blocks.get(t)) == null) { term_blocks.put(t, blockids = new TIntHashSet(/*TODO */)); } blockids.add(blockId); blockCount++; }
/** * Add an identifier of a relevant document with its relevance grade. * @param docno The identifier of the given relevant document. * @param grade The relevance grade of the given relevant document. */ public void insertRelDocno(String docno, int grade){ if (!relGrade.contains(grade)){ relGrade.add(grade); THashSet<String> gradeDocnos = new THashSet<String>(); gradeDocnos.add(docno); relGradeDocnosMap.put(grade, gradeDocnos); }else{ ((THashSet<String>)relGradeDocnosMap.get(grade)).add(docno); } }
/** * Add an identifier of a relevant document with its relevance grade. * @param docno The identifier of the given relevant document. * @param grade The relevance grade of the given relevant document. */ public void insertRelDocno(String docno, int grade){ if (!relGrade.contains(grade)){ relGrade.add(grade); THashSet<String> gradeDocnos = new THashSet<String>(); gradeDocnos.add(docno); relGradeDocnosMap.put(grade, gradeDocnos); }else{ ((THashSet<String>)relGradeDocnosMap.get(grade)).add(docno); } }
public void processTerm(String term) { /* null means the term has been filtered out (eg stopwords) */ if (term != null) { /* add term to Document tree */ for (String fieldName: termFields) { int tmp = fieldNames.get(fieldName); if (tmp > 0) { fields.add(tmp -1); } } if (ELSE_ENABLED && fields.size() == 0) { fields.add(ELSE_FIELD_ID); } ((FieldDocumentPostingList)termsInDocument).insert(term,fields.toArray()); numOfTokensInDocument++; fields.clear(); } } @Override