Ejemplo n.º 1
0
 @Override
 public void write(DataOutput out) throws IOException {
   out.writeBoolean(isSingleton);
   if (isSingleton) {
     out.writeInt(singletonIndex);
     out.writeFloat(singletonValue);
   } else {
     out.writeInt(entries.size());
     for (int i = 0; i < entries.size(); ++i) {
       out.writeFloat(entries.getFloat(i));
     }
   }
 }
Ejemplo n.º 2
0
 /**
  * Get a particular entry of the vector.
  *
  * @param i the entry
  * @return the value of the entry.
  */
 public float get(int i) {
   // The default value is 0.0
   if (i >= entries.size()) {
     return 0.0f;
   }
   return entries.getFloat(i);
 }
Ejemplo n.º 3
0
 /**
  * Resize the array to be at least the size specified.
  *
  * @param size the size of the array
  */
 private void ensureCapacity(int size) {
   if (entries.size() < size) {
     entries.size(size);
   }
 }