/** * Replace the values in the list starting at <tt>offset</tt> with * the contents of the <tt>values</tt> array. * * @param offset the first offset to replace * @param values the source of the new values */ public void set(int offset, int[] values) { set(offset, values, 0, values.length); }
public void setLength(int docid, int newLength) { docLengths.set(docid, newLength); }
private void setLength(int sequence, int length) { if (sequence >= lengths.size()) { padSpace(lengths, sequence); } lengths.set(sequence, length); }
public boolean isConverging(DocumentCentroid[] centroids) { boolean reassigned = false; for (int i = 0; i < centroids.length; i++) { DocumentCentroid c = centroids[i]; for (int j = 0; j < c.documents.size(); j++) { int docID = c.documents.get(j); if (_assignments.get(docID) != i) { // At least one document was reassigned. reassigned = true; _assignments.set(docID, i); } } c.features = Clustering.computeDocumentCentroid(new TIntArrayListIterator(c.documents), _index); } if (!reassigned) // Convergence was reached. return true; else // More iterations needed. return false; }
nextIntsIndex += spaceNeeded; indicesPlusOne.set(sequence, index + 1);
/** * Get/allocate spaceNeeded entries for the designated float-based attribute */ private int getFloatSpace(int attrId, int spaceNeeded) { int sequence = AttrDefinitionMgr.getAttrIndex(attrId); // this should be unique across all attributes if (sequence < indicesPlusOne.size()) { int indexPlusOne = indicesPlusOne.getQuick(sequence); if (indexPlusOne > 0) { Assert.state(getLength(attrId) == spaceNeeded, "getLength = " + getLength(attrId) + ", requested = " + spaceNeeded); // dumbo check to ensure not asking for diff size return indexPlusOne - 1; } } else { padSpace(indicesPlusOne, sequence); } // okay, it's not been allocated so ... int index = nextFloatsIndex; nextFloatsIndex += spaceNeeded; indicesPlusOne.set(sequence, index + 1); // Add to list of attrIds for iterator Assert.state( attrIds.contains(attrId) == false); attrIds.add(attrId); setLength(sequence, spaceNeeded); syncToStore(); // we sync here as we've modified return index; }
public GISAttributeModel createUpperModel(final int _numObject, final TIntIntHashMap _newIdxOldIdx) { if (_numObject < getSize()) { throw new IllegalArgumentException("bad num objects"); } if (_numObject == getSize()) { return this; } final TIntArrayList newList = new TIntArrayList(_numObject); newList.fill(((Integer) getAttribute().getDefaultValue()).intValue()); if (_newIdxOldIdx != null) { final TIntIntIterator it = _newIdxOldIdx.iterator(); for (int i = _newIdxOldIdx.size(); i-- > 0;) { it.advance(); final int newIdx = it.key(); newList.set(newIdx, list_.get(it.value())); } } return new GISAttributeModelIntegerList(newList, this); }