FSIteratorWrapper(IntPointerIterator it, CASImpl casImpl) { this.it = it; this.casImpl = casImpl; TypeSystemImpl tsi = casImpl.getTypeSystemImpl(); beginOffset = casImpl.getFeatureOffset(TypeSystemImpl.startFeatCode); endOffset = casImpl.getFeatureOffset(TypeSystemImpl.endFeatCode); }
/** * Serialize in compress binary form 4, only the delta part of a CAS * @param cas the CAS to serialize * @param out - an OutputStream, a DataOutputStream, or a File * @param marker identifying where the delta starts * @throws IOException if IO exception */ public static void serializeWithCompression(CAS cas, Object out, Marker marker) throws IOException { (new BinaryCasSerDes4(((CASImpl)cas).getTypeSystemImpl(), false)).serialize(cas, out, marker); }
/** * Serialize in compressed binary form 4 * @param cas the CAS to serialize * @param out - an OutputStream, a DataOutputStream, or a File * @throws IOException if IO exception */ public static void serializeWithCompression(CAS cas, Object out) throws IOException { (new BinaryCasSerDes4(((CASImpl)cas).getTypeSystemImpl(), false)).serialize(cas, out); }
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 static TypeSystemImpl getTypeSystemImpl(ProcessingResourceMetaData resource) throws ResourceInitializationException { CASMgr casMgr = CASFactory.createCAS(8, false); try { CasCreationUtils.setupTypeSystem(casMgr, resource.getTypeSystem()); ((CASImpl) casMgr).commitTypeSystem(); } catch (ResourceInitializationException e) { UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, "AggregateAnalysisEngineController_impl", "getTypeSystemImpl", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", e); throw e; } return ((CASImpl) casMgr).getTypeSystemImpl(); }
private final void setNullValue(int featCode, int rangeType) { if (this.getCASImpl().isIntType(rangeType) || this.getCASImpl().isFloatType(rangeType) || this.getCASImpl().isStringType(rangeType)) { CASRuntimeException e = new CASRuntimeException(CASRuntimeException.PRIMITIVE_VAL_FEAT, new String[] { this.getCASImpl().getTypeSystemImpl().ll_getFeatureForCode(featCode).getName() }); throw e; } // a null fsref is never an index key this.getCASImpl().setFeatureValueNoIndexCorruptionCheck(this.getAddress(), featCode, CASImpl.NULL); }
public float getFloatValue(Feature feat) throws CASRuntimeException { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(feat.getDomain(), getType())) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(feat.getRange(), ts.getType(CAS.TYPE_NAME_FLOAT))) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_FLOAT)); } final int featCode = ((FeatureImpl) feat).getCode(); return this.getCASImpl().getFloatValue(this.getAddress(), featCode); }
public double getDoubleValue(Feature feat) throws CASRuntimeException { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(feat.getDomain(), getType())) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(feat.getRange(), ts.getType(CAS.TYPE_NAME_DOUBLE))) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_DOUBLE)); } final int featCode = ((FeatureImpl) feat).getCode(); return this.getCASImpl().getDoubleValue(this.getAddress(), featCode); }
public byte getByteValue(Feature feat) throws CASRuntimeException { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(feat.getDomain(), getType())) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(feat.getRange(), ts.getType(CAS.TYPE_NAME_BYTE))) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_BYTE)); } final int featCode = ((FeatureImpl) feat).getCode(); return this.getCASImpl().getByteValue(this.getAddress(), featCode); }
public short getShortValue(Feature feat) throws CASRuntimeException { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(feat.getDomain(), getType())) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(feat.getRange(), ts.getType(CAS.TYPE_NAME_SHORT))) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_SHORT)); } final int featCode = ((FeatureImpl) feat).getCode(); return this.getCASImpl().getShortValue(this.getAddress(), featCode); }
public boolean getBooleanValue(Feature feat) throws CASRuntimeException { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(feat.getDomain(), getType())) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(feat.getRange(), ts.getType(CAS.TYPE_NAME_BOOLEAN))) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_BOOLEAN)); } final int featCode = ((FeatureImpl) feat).getCode(); return this.getCASImpl().getBooleanValue(this.getAddress(), featCode); }
public long getLongValue(Feature feat) throws CASRuntimeException { final TypeSystemImpl ts = this.getCASImpl().getTypeSystemImpl(); if (!ts.subsumes(feat.getDomain(), getType())) { throwUndefinedFeatureExc(feat, getType()); } if (!ts.subsumes(feat.getRange(), ts.getType(CAS.TYPE_NAME_LONG))) { throwIllegalRangeExc(feat, ts.getType(CAS.TYPE_NAME_LONG)); } final int featCode = ((FeatureImpl) feat).getCode(); return this.getCASImpl().getLongValue(this.getAddress(), featCode); }
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); }
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 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 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); }