public TFloatLinkedList(TFloatList list) {
   no_entry_value = list.getNoEntryValue();
   //
   for (TFloatIterator iterator = list.iterator(); iterator.hasNext(); ) {
     float next = iterator.next();
     add(next);
   }
 }
 /** {@inheritDoc} */
 public boolean containsAll(TFloatCollection collection) {
   TFloatIterator iter = collection.iterator();
   while (iter.hasNext()) {
     if (!TLongFloatHashMap.this.containsValue(iter.next())) {
       return false;
     }
   }
   return true;
 }
  /** {@inheritDoc} */
  public boolean addAll(TFloatCollection collection) {
    boolean ret = false;
    for (TFloatIterator it = collection.iterator(); it.hasNext(); ) {
      float i = it.next();
      if (add(i)) ret = true;
    }

    return ret;
  }
  /** {@inheritDoc} */
  public boolean containsAll(TFloatCollection collection) {
    if (isEmpty()) return false;

    for (TFloatIterator it = collection.iterator(); it.hasNext(); ) {
      float i = it.next();
      if (!(contains(i))) return false;
    }
    return true;
  }
 /** {@inheritDoc} */
 public boolean removeAll(TFloatCollection collection) {
   boolean modified = false;
   TFloatIterator iter = iterator();
   while (iter.hasNext()) {
     if (collection.contains(iter.next())) {
       iter.remove();
       modified = true;
     }
   }
   return modified;
 }
 /** {@inheritDoc} */
 public boolean retainAll(Collection<?> collection) {
   boolean modified = false;
   TFloatIterator iter = iterator();
   while (iter.hasNext()) {
     if (!collection.contains(Float.valueOf(iter.next()))) {
       iter.remove();
       modified = true;
     }
   }
   return modified;
 }
 /** {@inheritDoc} */
 @SuppressWarnings({"SuspiciousMethodCalls"})
 public boolean retainAll(Collection<?> collection) {
   boolean modified = false;
   TFloatIterator iter = iterator();
   while (iter.hasNext()) {
     if (!collection.contains(Float.valueOf(iter.next()))) {
       iter.remove();
       modified = true;
     }
   }
   return modified;
 }
 @Override
 public String toString() {
   final StringBuilder buf = new StringBuilder("{");
   TFloatIterator it = iterator();
   while (it.hasNext()) {
     float next = it.next();
     buf.append(next);
     if (it.hasNext()) buf.append(", ");
   }
   buf.append("}");
   return buf.toString();
 }
Exemplo n.º 9
0
 /** {@inheritDoc} */
 @Override
 public boolean retainAll(Collection<?> collection) {
   boolean modified = false;
   TFloatIterator iter = iterator();
   while (iter.hasNext()) {
     //noinspection SuspiciousMethodCalls
     if (!collection.contains(Float.valueOf(iter.next()))) {
       iter.remove();
       modified = true;
     }
   }
   return modified;
 }
Exemplo n.º 10
0
 /** {@inheritDoc} */
 @Override
 public boolean containsAll(TFloatCollection collection) {
   if (collection == this) {
     return true;
   }
   TFloatIterator iter = collection.iterator();
   while (iter.hasNext()) {
     if (!TFloatObjectHashMap.this.containsKey(iter.next())) {
       return false;
     }
   }
   return true;
 }
Exemplo n.º 11
0
  /** {@inheritDoc} */
  public boolean removeAll(float[] array) {
    Arrays.sort(array);

    boolean modified = false;
    TFloatIterator iter = iterator();
    while (iter.hasNext()) {
      if (Arrays.binarySearch(array, iter.next()) >= 0) {
        iter.remove();
        modified = true;
      }
    }
    return modified;
  }
Exemplo n.º 12
0
  /** {@inheritDoc} */
  public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION
    out.writeByte(0);

    // NO_ENTRY_VALUE
    out.writeFloat(no_entry_value);

    // ENTRIES
    out.writeInt(size);
    for (TFloatIterator iterator = iterator(); iterator.hasNext(); ) {
      float next = iterator.next();
      out.writeFloat(next);
    }
  }
Exemplo n.º 13
0
 /** {@inheritDoc} */
 @Override
 public boolean retainAll(TFloatCollection collection) {
   if (this == collection) {
     return false;
   }
   boolean modified = false;
   TFloatIterator iter = iterator();
   while (iter.hasNext()) {
     if (!collection.contains(iter.next())) {
       iter.remove();
       modified = true;
     }
   }
   return modified;
 }
Exemplo n.º 14
0
 /** {@inheritDoc} */
 public boolean removeAll(TFloatCollection collection) {
   if (this == collection) {
     clear();
     return true;
   }
   boolean changed = false;
   TFloatIterator iter = collection.iterator();
   while (iter.hasNext()) {
     float element = iter.next();
     if (remove(element)) {
       changed = true;
     }
   }
   return changed;
 }
  private int calculateTotal(int base, TFloatList multipliers, TIntList modifiers) {
    // For now, add all modifiers and multiply by all multipliers. Negative modifiers cap to zero,
    // but negative
    // multipliers remain (so damage can be flipped to healing)

    float total = base;
    TIntIterator modifierIter = modifiers.iterator();
    while (modifierIter.hasNext()) {
      total += modifierIter.next();
    }
    total = Math.max(0, total);
    if (total == 0) {
      return 0;
    }
    TFloatIterator multiplierIter = multipliers.iterator();
    while (multiplierIter.hasNext()) {
      total *= multiplierIter.next();
    }
    return TeraMath.floorToInt(total);
  }