public int getTypeCode(int fsAddr) { return getHeapValue(fsAddr); }
@Override int getEnd() { return casImpl.getHeapValue(it.get() + endOffset); }
@Override int getBegin() { return casImpl.getHeapValue(it.get() + beginOffset); }
public int[] fsListToAddressArray(int curNode) throws SAXException { final int type = cas.getHeapValue(curNode); int length = getLength(type, curNode, neFsListType, fsTailFeat); int[] array = new int[length]; // now populate list for (int i = 0; i < length; i++) { array[i] = cas.getHeapValue(curNode + cas.getFeatureOffset(fsHeadFeat)); curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(fsTailFeat)); } if (foundCycle) { reportWarning("Found a cycle in an FSList. List truncated where cycle occurs."); } return array; }
public int getavoidcollisionTypeCode() { return this.getCASImpl().getHeapValue(this.getAddress()); }
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)); } }
private void enqueueFSArray(int addr) { final int size = cas.ll_getArraySize(addr); int pos = cas.getArrayStartAddress(addr); int val; for (int i = 0; i < size; i++) { val = cas.getHeapValue(pos); if (val != CASImpl.NULL) { enqueue(val); } ++pos; } }
int filterType(int addr) { if (isFiltering) { String typeName = tsi.ll_getTypeForCode(cas.getHeapValue(addr)).getName(); if (filterTypeSystem.getType(typeName) == null) { return 0; } } return addr; }
private void enqueueFeaturesOfFSs(final IntVector fss) throws SAXException { final int max = fss.size(); for (int i = 0; i < max; i++) { int addr = fss.get(i); int heapVal = cas.getHeapValue(addr); enqueueFeatures(addr, heapVal); } }
protected void checkType(int inst) { if (!casImpl.getTypeSystemImpl().subsumes(casTypeCode, casImpl.getHeapValue(inst))) invalidTypeArg(inst); }
protected void invalidTypeArg(int inst) { CASRuntimeException e = new CASRuntimeException(CASRuntimeException.INAPPROP_TYPE, new String[] { casType.getName(), this.casImpl.getTypeSystemImpl().ll_getTypeForCode(casImpl.getHeapValue(inst)).getName() }); throw e; }
public Type getType() { return this.getCASImpl().getTypeSystemImpl().ll_getTypeForCode( this.getCASImpl().getHeapValue(this.getAddress())); }
public boolean match(FeatureStructure fs) { compile(((FeatureStructureImpl) fs).getCAS().getTypeSystem()); final FeatureStructureImpl fsi = (FeatureStructureImpl) fs; final int typeCode = fsi.getCASImpl().getHeapValue(fsi.getAddress()); TypeSystemImpl tsi = (TypeSystemImpl) this.ts; for (int i = 0; i < typeSet.size(); i++) { if (tsi.subsumes(typeSet.get(i), typeCode)) { return true; } } return false; }
public void setBooleanValue(Feature feat, boolean b) throws CASRuntimeException { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(((TypeImpl) feat.getDomain()).getCode(), this.getCASImpl().getHeapValue( this.getAddress()))) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(((TypeImpl) feat.getRange()).getCode(), ((TypeImpl) ts .getType(CAS.TYPE_NAME_BOOLEAN)).getCode())) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_BOOLEAN)); } final int featCode = ((FeatureImpl) feat).getCode(); this.getCASImpl().setFeatureValue(this.getAddress(), featCode, b); }
public void setLongValue(Feature feat, long val) throws CASRuntimeException { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(((TypeImpl) feat.getDomain()).getCode(), this.getCASImpl().getHeapValue( this.getAddress()))) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(((TypeImpl) feat.getRange()).getCode(), ((TypeImpl) ts .getType(CAS.TYPE_NAME_LONG)).getCode())) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_LONG)); } final int featCode = ((FeatureImpl) feat).getCode(); this.getCASImpl().setFeatureValue(this.getAddress(), featCode, val); }
public void setDoubleValue(Feature feat, double val) throws CASRuntimeException { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(((TypeImpl) feat.getDomain()).getCode(), this.getCASImpl().getHeapValue( this.getAddress()))) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(((TypeImpl) feat.getRange()).getCode(), ((TypeImpl) ts .getType(CAS.TYPE_NAME_DOUBLE)).getCode())) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_DOUBLE)); } final int featCode = ((FeatureImpl) feat).getCode(); this.getCASImpl().setFeatureValue(this.getAddress(), featCode, val); }
public void setShortValue(Feature feat, short val) throws CASRuntimeException { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(((TypeImpl) feat.getDomain()).getCode(), this.getCASImpl().getHeapValue( this.getAddress()))) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(((TypeImpl) feat.getRange()).getCode(), ((TypeImpl) ts .getType(CAS.TYPE_NAME_SHORT)).getCode())) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_SHORT)); } final int featCode = ((FeatureImpl) feat).getCode(); this.getCASImpl().setFeatureValue(this.getAddress(), featCode, val); }
public void setIntValue(Feature feat, int val) { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(((TypeImpl) feat.getDomain()).getCode(), this.getCASImpl().getHeapValue( this.getAddress()))) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(((TypeImpl) feat.getRange()).getCode(), ((TypeImpl) ts .getType(CAS.TYPE_NAME_INTEGER)).getCode())) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_INTEGER)); } final int featCode = ((FeatureImpl) feat).getCode(); this.getCASImpl().setFeatureValue(this.getAddress(), featCode, val); }
public void setFloatValue(Feature feat, float val) { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(((TypeImpl) feat.getDomain()).getCode(), this.getCASImpl().getHeapValue( this.getAddress()))) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(((TypeImpl) feat.getRange()).getCode(), ((TypeImpl) ts .getType(CAS.TYPE_NAME_FLOAT)).getCode())) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_FLOAT)); } final int featCode = ((FeatureImpl) feat).getCode(); this.getCASImpl().setFloatValue(this.getAddress(), featCode, val); }
public void setByteValue(Feature feat, byte val) throws CASRuntimeException { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(((TypeImpl) feat.getDomain()).getCode(), this.getCASImpl().getHeapValue( this.getAddress()))) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(((TypeImpl) feat.getRange()).getCode(), ((TypeImpl) ts .getType(CAS.TYPE_NAME_BYTE)).getCode())) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_BYTE)); } final int featCode = ((FeatureImpl) feat).getCode(); this.getCASImpl().setFeatureValue(this.getAddress(), featCode, val); }