public void setWeight(int w) { for (Iterator<Item> i = getItemIterator(); i.hasNext();) { i.next().setWeight(w); } } }
@Override public void setWeight(int weight) { super.setWeight(weight); for (Iterator<Item> i = getItemIterator(); i.hasNext();) { Item word = i.next(); word.setWeight(weight); } }
public static void initialize(Item item, ItemArguments arguments, ItemContext itemContext) { storeIdInContext(item, arguments.properties, itemContext); Object weight = arguments.properties.get(weightProperty); if (weight != null) { TypeCheck.ensureInstanceOf(weight, Number.class); item.setWeight(((Number)weight).intValue()); } if (item instanceof TaggableItem) { initializeTaggableItem((TaggableItem)item, arguments, itemContext); } if (item instanceof IndexedItem) { initializeIndexedItem((IndexedItem)item, arguments, itemContext); } }
public Item toItem() { Item item = range.toItem(indexName); item.setCreator(creator); item.setRanked(ranked); item.setWeight(weight); return item; }
leaf.setWeight(weight);
private static CanonicalizationResult canonicalizeThis(Item item, ListIterator<Item> parentIterator) { if (item instanceof NullItem) parentIterator.remove(); if ( ! (item instanceof CompositeItem)) return CanonicalizationResult.success(); CompositeItem composite = (CompositeItem)item; boolean replacedByFalse = collapseFalse(composite, parentIterator); if (replacedByFalse) return CanonicalizationResult.success(); collapseLevels(composite); if (composite instanceof EquivItem) { removeDuplicates((EquivItem) composite); } else if (composite instanceof RankItem) { makeDuplicatesCheap((RankItem)composite); } else if (composite instanceof NotItem) { if (((NotItem) composite).getPositiveItem() == null) return CanonicalizationResult.error("Can not search for only negative items"); } if (composite.getItemCount() == 0) parentIterator.remove(); if (composite.getItemCount() == 1 && ! (composite instanceof NonReducibleCompositeItem)) { if (composite instanceof PhraseItem || composite instanceof PhraseSegmentItem) composite.getItem(0).setWeight(composite.getWeight()); parentIterator.set(composite.getItem(0)); } return CanonicalizationResult.success(); }
leaf.setWeight((int)annotation_value.asDouble());
/** * Inserts newItem at the position of this match * TODO: Move to ruleevaluation */ protected void insertMatch(RuleEvaluation e,Match matched, Item newItem,int offset) { newItem.setWeight(getWeight()); int insertPosition=matched.getPosition()+offset; // This check is necessary (?) because earlier items may have been removed // after we recorded the match position. It is sort of hackish. A cleaner // solution would be to update the match position on changes if (insertPosition>matched.getParent().getItemCount()) { insertPosition=matched.getParent().getItemCount(); } e.insertItem(newItem,matched.getParent(),insertPosition,getTermType()); if (e.getTraceLevel()>=6) e.trace(6,"Inserted item '" + newItem + "' at position " + insertPosition + " producing " + e.getEvaluation().getQuery().getModel().getQueryTree()); }
item.setWeight(weight);