Пример #1
0
 /** @see org.web3d.x3d.sai.MFColorRGBA#append(float[]) */
 public void append(float[] value) {
   checkReadAccess();
   checkWriteAccess();
   synchronized (theEventQueue.eventLock) {
     MFVec3fWrapper queuedElement = (MFVec3fWrapper) theEventQueue.getLast(this);
     boolean newEvent = false;
     if (queuedElement == null || !queuedElement.isSetOneValue) {
       // Input and output buffers do not mix
       if (!storedInput && !storedOutput) {
         queuedElement = this;
         loadInputValue();
         isSetOneValue = true;
       } else {
         queuedElement =
             new MFVec3fWrapper(theNode, fieldIndex, theEventQueue, theEventAdapterFactory, true);
         queuedElement.isSetOneValue = true;
       }
       newEvent = true;
     }
     queuedElement.ensureArraySize(queuedElement.storedInputLength + 3);
     queuedElement.storedInputValue[queuedElement.storedInputLength++] = value[0];
     queuedElement.storedInputValue[queuedElement.storedInputLength++] = value[1];
     queuedElement.storedInputValue[queuedElement.storedInputLength++] = value[2];
     if (newEvent) theEventQueue.processEvent(queuedElement);
   }
 }
Пример #2
0
 /** @see org.web3d.x3d.sai.MFVec3f#insertValue(int, float[]) */
 public void insertValue(int index, float[] value) throws ArrayIndexOutOfBoundsException {
   checkReadAccess();
   checkWriteAccess();
   synchronized (theEventQueue.eventLock) {
     MFVec3fWrapper queuedElement = (MFVec3fWrapper) theEventQueue.getLast(this);
     boolean newEvent = false;
     if (queuedElement == null || !queuedElement.isSetOneValue) {
       // Input and output buffers do not mix
       if (!storedInput && !storedOutput) {
         queuedElement = this;
         loadInputValue();
         isSetOneValue = true;
       } else {
         queuedElement =
             new MFVec3fWrapper(theNode, fieldIndex, theEventQueue, theEventAdapterFactory, true);
         queuedElement.isSetOneValue = true;
       }
       newEvent = true;
     }
     queuedElement.ensureArraySize(queuedElement.storedInputLength + 3);
     System.arraycopy(
         queuedElement.storedInputValue,
         index * 3,
         queuedElement.storedInputValue,
         index * 3 + 3,
         queuedElement.storedInputLength - index * 3);
     queuedElement.storedInputValue[index * 3] = value[0];
     queuedElement.storedInputValue[index * 3 + 1] = value[1];
     queuedElement.storedInputValue[index * 3 + 2] = value[2];
     queuedElement.storedInputLength += 3;
     if (newEvent) theEventQueue.processEvent(queuedElement);
   }
 }
Пример #3
0
 /** @see org.web3d.x3d.sai.MFBool#removeValue(int) */
 public void removeValue(int index) throws ArrayIndexOutOfBoundsException {
   checkReadAccess();
   checkWriteAccess();
   synchronized (theEventQueue.eventLock) {
     MFVec3fWrapper queuedElement = (MFVec3fWrapper) theEventQueue.getLast(this);
     boolean newEvent = false;
     if (queuedElement == null || !queuedElement.isSetOneValue) {
       // Input and output buffers do not mix
       if (!storedInput && !storedOutput) {
         queuedElement = this;
         loadInputValue();
         isSetOneValue = true;
       } else {
         queuedElement =
             new MFVec3fWrapper(theNode, fieldIndex, theEventQueue, theEventAdapterFactory, true);
         queuedElement.isSetOneValue = true;
       }
       newEvent = true;
     }
     if (queuedElement.storedInputLength > 0) {
       if (index * 3 + 3 < queuedElement.storedInputLength)
         System.arraycopy(
             queuedElement.storedInputValue,
             index * 3 + 3,
             queuedElement.storedInputValue,
             index * 3,
             queuedElement.storedInputLength - index * 3 - 3);
       queuedElement.storedInputLength -= 3;
       if (newEvent) theEventQueue.processEvent(queuedElement);
     } else {
       // Free up the buffer before throwing the exception
       if (newEvent) queuedElement.isSetOneValue = false;
       throw new ArrayIndexOutOfBoundsException();
     }
   }
 }