Ejemplo n.º 1
0
 /** {@inheritDoc} */
 public void transformValues(TFloatFunction function) {
   for (TFloatLink l = head; got(l); ) {
     //
     l.setValue(function.execute(l.getValue()));
     //
     l = l.getNext();
   }
 }
Ejemplo n.º 2
0
  /** {@inheritDoc} */
  public void fill(int fromIndex, int toIndex, float val) {
    if (fromIndex < 0) {
      throw new IndexOutOfBoundsException("begin index can not be < 0");
    }

    TFloatLink l = getLinkAt(fromIndex);
    if (toIndex > size) {
      for (int i = fromIndex; i < size; i++) {
        l.setValue(val);
        l = l.getNext();
      }
      for (int i = size; i < toIndex; i++) {
        add(val);
      }
    } else {
      for (int i = fromIndex; i < toIndex; i++) {
        l.setValue(val);
        l = l.getNext();
      }
    }
  }
Ejemplo n.º 3
0
  /** {@inheritDoc} */
  public float set(int offset, float val) {
    if (offset > size)
      throw new IndexOutOfBoundsException("index " + offset + " exceeds size " + size);

    TFloatLink l = getLinkAt(offset);
    //
    if (no(l)) throw new IndexOutOfBoundsException("at offset " + offset);

    float prev = l.getValue();
    l.setValue(val);
    return prev;
  }