/** * @see org.apache.uima.cas.ArrayFS#copyFromArray(FeatureStructure[], int, int, int) */ public void copyFromArray(byte[] src, int srcOffset, int destOffset, int length) { copyFromJavaArray(src, srcOffset, this.casImpl.getByteHeap().heap, destOffset, length); }
/** * @see org.apache.uima.cas.ArrayFS#copyToArray(int, FeatureStructure[], int, int) */ public void copyToArray(int srcOffset, byte[] dest, int destOffset, int length) { copyToJavaArray(this.casImpl.getByteHeap().heap, srcOffset, dest, destOffset, length); }
/** * @see org.apache.uima.cas.ArrayFS#toArray() */ public byte[] toArray() { return (byte[]) toArray(this.casImpl.getByteHeap().heap); }
/** * @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]); } } }
sb.append(cas.getByteHeap().getHeapValue(heap[iHeap + 2 + i])); break; case Slot_ShortRef:
@Override public int ll_createByteArray(int arrayLength) { final int addr = ll_createAuxArray(TypeSystemImpl.byteArrayTypeCode, arrayLength); this.getHeap().heap[addr + arrayContentOffset] = this.getByteHeap().reserve(arrayLength); return addr; }
sb.append(cas.getByteHeap().getHeapValue(heap[iHeap + 2 + i])); break; case Slot_ShortRef:
@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 int ll_createBooleanArray(int arrayLength) { final int addr = ll_createAuxArray(TypeSystemImpl.booleanArrayTypeCode, arrayLength); this.getHeap().heap[addr + arrayContentOffset] = this.getByteHeap().reserve(arrayLength); return addr; }
@Override public boolean ll_getBooleanArrayValue(int fsRef, int position) { final int pos = this.getHeap().heap[getArrayStartAddress(fsRef)]; return CASImpl.TRUE == this.getByteHeap().getHeapValue(pos + position); }
@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); } }
@Override public void ll_setBooleanArrayValue(int fsRef, int position, boolean b) { byte value = (byte) (b ? CASImpl.TRUE : CASImpl.FALSE); 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); } }
final int byteHeapSize = cas.getByteHeap().getSize(); this.byteHeapArray = new byte[byteHeapSize]; System.arraycopy(cas.getByteHeap().heap, 0, this.byteHeapArray, 0, byteHeapSize);
void reinit(int[] heapMetadata, int[] heapArray, String[] stringTable, int[] fsIndex, byte[] byteHeapArray, short[] shortHeapArray, long[] longHeapArray) { createStringTableFromArray(stringTable); this.getHeap().reinit(heapMetadata, heapArray); if (byteHeapArray != null) { this.getByteHeap().reinit(byteHeapArray); } if (shortHeapArray != null) { this.getShortHeap().reinit(shortHeapArray); } if (longHeapArray != null) { this.getLongHeap().reinit(longHeapArray); } reinitIndexedFSs(fsIndex); }
String printCasInfo(CASImpl cas) { int heapsz= cas.getHeap().getNextId() * 4; StringHeapDeserializationHelper shdh = cas.getStringHeap().serialize(); int charssz = shdh.charHeap.length * 2; int strintsz = cas.getStringHeap().getSize() * 8; int strsz = charssz + strintsz; int fsindexessz = cas.getIndexedFSs().length * 4; int bytessz = cas.getByteHeap().getSize(); int shortsz = cas.getShortHeap().getSize() * 2; int longsz = cas.getLongHeap().getSize() * 8; int total = heapsz + strsz + fsindexessz + bytessz + shortsz + longsz; return String.format("CAS info before compression: totalSize(bytes): %,d%n" + " mainHeap: %,d(%d%%)%n" + " Strings: [%,d(%d%%): %,d chars %,d ints]%n" + " fsIndexes: %,d(%d%%)%n" + " byte/short/long Heaps: [%,d %,d %,d]", total, heapsz, (100L*heapsz)/total, strsz, (100L*strsz)/ total, charssz, strintsz, fsindexessz, (100L*fsindexessz) / total, bytessz, shortsz, longsz ); }
public String printCasInfo(CASImpl cas) { int heapsz= cas.getHeap().getNextId() * 4; StringHeapDeserializationHelper shdh = cas.getStringHeap().serialize(); int charssz = shdh.charHeap.length * 2; int strintsz = cas.getStringHeap().getSize() * 8; int strsz = charssz + strintsz; int fsindexessz = cas.getIndexedFSs().length * 4; int bytessz = cas.getByteHeap().getSize(); int shortsz = cas.getShortHeap().getSize() * 2; int longsz = cas.getLongHeap().getSize() * 8; int total = heapsz + strsz + fsindexessz + bytessz + shortsz + longsz; return String.format("CAS info before compression: totalSize(bytes): %,d%n" + " mainHeap: %,d(%d%%)%n" + " Strings: [%,d(%d%%): %,d chars %,d ints]%n" + " fsIndexes: %,d(%d%%)%n" + " byte/short/long Heaps: [%,d %,d %,d]", total, heapsz, (100L*heapsz)/total, strsz, (100L*strsz)/ total, charssz, strintsz, fsindexessz, (100L*fsindexessz) / total, bytessz, shortsz, longsz ); }
switch (kind) { case Slot_BooleanRef: case Slot_ByteRef: if (c1.getByteHeap().getHeapValue(c1heap[iHeap + 2] + i) != c2.getByteHeap().getHeapValue(c2heap[iHeap + 2] + i)) { return mismatchFs();
longHeapObj = cas.getLongHeap(); shortHeapObj = cas.getShortHeap(); byteHeapObj = cas.getByteHeap();
longHeapObj = cas.getLongHeap(); shortHeapObj = cas.getShortHeap(); byteHeapObj = cas.getByteHeap();