/** * Multiply the values inplace by a scalar and return this * @param value scalar multiplier * @return this */ public SparseIntArray multiplyInplace(double value) { for (Entry e : entries()) { if (this.isUsed(e.index)) set(e.index, (int)(value * e.value)); } return this; }
/** * sets a word in the document's count. * @param word * @param count */ public void setWordCount(int word, int count){ if(this.getVector().isUsed(word)){ this.length -= this.getVector().get(word); } this.length += this.getVector().set(word, count); }