/** * Get the value of an address on the heap. * * @param addr * The target address. * @return The value at the address. */ public int getHeapValue(int addr) { return this.getHeap().heap[addr]; }
@Override public final int ll_getRefArrayValue(int fsRef, int position) { final int pos = getArrayStartAddress(fsRef) + position; return this.getHeap().heap[pos]; }
public int ll_createAuxArray(int typeCode, int arrayLength) { final int addr = this.getHeap().add(arrayContentOffset + 1, typeCode); this.getHeap().heap[(addr + arrayLengthFeatOffset)] = arrayLength; svd.cache_not_in_index = addr; if (traceFSs) { traceFSCreate((FeatureStructureImpl) ll_getFSForRef(addr)); } return addr; }
@Override public int ll_createArray(int typeCode, int arrayLength) { final int addr = this.getHeap().add(arrayContentOffset + arrayLength, typeCode); this.getHeap().heap[(addr + arrayLengthFeatOffset)] = arrayLength; svd.cache_not_in_index = addr; if (traceFSs) { traceFSCreate((FeatureStructureImpl) ll_getFSForRef(addr)); } return addr; }
/** * @see org.apache.uima.cas.IntArrayFS#copyFromArray(int[], int, int, int) */ public void copyFromArray(int[] src, int srcOffset, int destOffset, int length) { casImpl.checkArrayBounds(addr, destOffset, length); destOffset += this.casImpl.getArrayStartAddress(this.addr); System.arraycopy(src, srcOffset, this.casImpl.getHeap().heap, destOffset, length); }
final void checkFsRef(int fsRef) { if ((fsRef <= NULL_FS_REF) || (fsRef >= this.getHeap().heap.length)) { LowLevelException e = new LowLevelException(LowLevelException.INVALID_FS_REF); e.addArgument(Integer.toString(fsRef)); throw e; } }
@Override public final float ll_getFloatArrayValue(int fsRef, int position) { final int pos = getArrayStartAddress(fsRef) + position; return int2float(this.getHeap().heap[pos]); }
@Override public void ll_setIntArrayValue(int fsRef, int position, int value) { final int pos = getArrayStartAddress(fsRef) + position; this.getHeap().heap[pos] = value; if (this.svd.trackingMark != null) { this.logFSUpdate(fsRef, pos, ModifiedHeap.FSHEAP, 1); } }
/** * @see org.apache.uima.cas.CommonArrayFS#copyToArray(int, String[], int, int) */ public void copyToArray(int srcOffset, String[] dest, int destOffset, int length) { casImpl.checkArrayBounds(addr, srcOffset, length); final int startOffset = srcOffset + casImpl.getHeap().heap[casImpl.getArrayStartAddress(addr)]; final byte[] heap = this.casImpl.getByteHeap().heap; for (int i = 0; i < length; i++) { dest[i + destOffset] = Byte.toString(heap[i + startOffset]); } }
/** * @see org.apache.uima.cas.CommonArrayFS#copyFromArray(String[], int, int, int) */ public void copyFromArray(String[] src, int srcOffset, int destOffset, int length) { this.casImpl.checkArrayBounds(this.addr, destOffset, length); final int startOffset = destOffset + casImpl.getHeap().heap[casImpl.getArrayStartAddress(this.addr)]; byte[] heap = this.casImpl.getByteHeap().heap; for (int i = 0; i < length; i++) { heap[i + startOffset] = Byte.parseByte(src[i + srcOffset]); } } }
@Override public byte ll_getByteArrayValue(int fsRef, int position) { final int pos = this.getHeap().heap[getArrayStartAddress(fsRef)]; return this.getByteHeap().getHeapValue(pos + position); }
@Override public short ll_getShortArrayValue(int fsRef, int position) { final int pos = this.getHeap().heap[getArrayStartAddress(fsRef)]; return this.getShortHeap().getHeapValue(pos + position); }
/** * @see org.apache.uima.cas.FloatArrayFS#copyToArray(int, float[], int, int) */ public void copyToArray(int srcOffset, float[] dest, int destOffset, int length) { casImpl.checkArrayBounds(addr, srcOffset, length); final int[] heap = this.casImpl.getHeap().heap; srcOffset += this.casImpl.getArrayStartAddress(this.addr); for (int i = 0; i < length; i++) { dest[i + destOffset] = CASImpl.int2float(heap[i + srcOffset]); } }
@Override public int ll_createLongArray(int arrayLength) { final int addr = ll_createAuxArray(TypeSystemImpl.longArrayTypeCode, arrayLength); this.getHeap().heap[addr + arrayContentOffset] = this.getLongHeap().reserve(arrayLength); return addr; }
/** * @see org.apache.uima.cas.FloatArrayFS#copyFromArray(float[], int, int, int) */ public void copyFromArray(float[] src, int srcOffset, int destOffset, int length) { casImpl.checkArrayBounds(addr, destOffset, length); final int[] heap = this.casImpl.getHeap().heap; destOffset += this.casImpl.getArrayStartAddress(this.addr); for (int i = 0; i < length; i++) { heap[i + destOffset] = CASImpl.float2int(src[i + srcOffset]); } }
@Override public final int ll_createFS(int typeCode) { final int fsAddr = this.getHeap().add(this.svd.casMetadata.fsSpaceReq[typeCode], typeCode); svd.cache_not_in_index = fsAddr; if (traceFSs) { traceFSCreate((FeatureStructureImpl) ll_getFSForRef(fsAddr)); } return fsAddr; }
@Override public void ll_setFloatArrayValue(int fsRef, int position, float value) { final int pos = getArrayStartAddress(fsRef) + position; this.getHeap().heap[pos] = float2int(value); if (this.svd.trackingMark != null) { this.logFSUpdate(fsRef, pos,ModifiedHeap.FSHEAP, 1); } }
@Override public void ll_setStringArrayValue(int fsRef, int position, String value) { final int pos = getArrayStartAddress(fsRef) + position; final int stringCode = (value == null) ? NULL : addString(value); this.getHeap().heap[pos] = stringCode; if (this.svd.trackingMark != null) { this.logFSUpdate(fsRef, pos, ModifiedHeap.FSHEAP, 1); } }
private final void checkFsRefConditions(int fsRef, int featureCode) { checkFsRef(fsRef); final int domTypeCode = this.getHeap().heap[fsRef]; checkLowLevelParams(fsRef, domTypeCode, featureCode); checkFsRan(featureCode); checkFsRef(fsRef + this.svd.casMetadata.featureOffset[featureCode]); }
@Override public void ll_setByteArrayValue(int fsRef, int position, byte value) { final int offset = this.getHeap().heap[getArrayStartAddress(fsRef)]; this.getByteHeap().setHeapValue(value, offset + position); if (this.svd.trackingMark != null) { this.logFSUpdate(fsRef, offset+position, ModifiedHeap.BYTEHEAP, 1); } }