/** * @see org.apache.uima.cas.ArrayFS#set(int, FeatureStructure) */ public void set(int i, String str) throws ArrayIndexOutOfBoundsException { this.casImpl.setArrayValue(this.addr, i, this.casImpl.addString(str)); }
void setNewValueInNewNode(int newNode, List<String> stringValues, int i) { String newValue = stringValues.get(i++); cas.setFeatureValueNoIndexCorruptionCheck(newNode, stringHeadFeat, cas.addString(newValue)); } }
public int createStringList(List<String> stringValues) { int first = cas.ll_createFS(eStringListType); ListIterator<String> iter = stringValues.listIterator(stringValues.size()); while (iter.hasPrevious()) { String value = iter.previous(); int node = cas.ll_createFS(neStringListType); cas.setFeatureValueNotJournaled(node, stringHeadFeat, cas.addString(value)); cas.setFeatureValueNotJournaled(node, stringTailFeat, first); first = node; } return first; }
void setNewValueInExistingNode(int curNode, List<String> stringValues, int i) { String curValue = cas.getStringForCode(cas.getHeapValue(curNode + cas.getFeatureOffset(stringHeadFeat))); String newValue = stringValues.get(i++); if (!curValue.equals(newValue)) { cas.setFeatureValueNoIndexCorruptionCheck(curNode, stringHeadFeat, cas.addString(newValue)); } }
/** * @see org.apache.uima.cas.ArrayFS#copyFromArray(FeatureStructure[], int, int, int) */ public void copyFromArray(String[] src, int srcOffset, int destOffset, int length) throws ArrayIndexOutOfBoundsException { if ((destOffset < 0) || ((destOffset + length) > size())) { throw new ArrayIndexOutOfBoundsException(); } destOffset += this.casImpl.getArrayStartAddress(this.addr); for (int i = 0; i < length; i++) { // cas.getHeap().heap[destOffset] = // ((FeatureStructureImpl)src[srcOffset]).getAddress(); this.casImpl.getHeap().heap[destOffset] = this.casImpl.addString(src[srcOffset]); ++destOffset; ++srcOffset; } }
@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); } }
void setArrayValueFromString(final int addr, final int index, final String value) { int arrayType = this.getHeap().heap[addr]; if (arrayType == TypeSystemImpl.intArrayTypeCode) { setArrayValue(addr, index, Integer.parseInt(value)); } else if (arrayType == TypeSystemImpl.floatArrayTypeCode) { setArrayValue(addr, index, CASImpl.float2int(Float.parseFloat(value))); } else if (arrayType == TypeSystemImpl.stringArrayTypeCode) { setArrayValue(addr, index, addString(value)); } else if (arrayType == TypeSystemImpl.booleanArrayTypeCode) { ll_setBooleanArrayValue(addr, index, Boolean.valueOf(value).booleanValue()); } else if (arrayType == TypeSystemImpl.byteArrayTypeCode) { ll_setByteArrayValue(addr, index, Byte.parseByte(value)); } else if (arrayType == TypeSystemImpl.shortArrayTypeCode) { ll_setShortArrayValue(addr, index, Short.parseShort(value)); } else if (arrayType == TypeSystemImpl.longArrayTypeCode) { ll_setLongArrayValue(addr, index, Long.parseLong(value)); } else if (arrayType == TypeSystemImpl.doubleArrayTypeCode) { ll_setDoubleArrayValue(addr, index, Double.parseDouble(value)); } else if (arrayType == TypeSystemImpl.fsArrayTypeCode) { setArrayValue(addr, index, Integer.parseInt(value)); } }