Package org.apache.uima.cas.impl
Class FeatureStructureImplC
- java.lang.Object
-
- org.apache.uima.cas.impl.FeatureStructureImplC
-
- All Implemented Interfaces:
java.lang.Cloneable,FeatureStructure,FeatureStructureImpl
- Direct Known Subclasses:
TOP
public class FeatureStructureImplC extends java.lang.Object implements FeatureStructureImpl
Feature structure implementation (for non JCas and JCas) Each FS has - int data - used for boolean, byte, short, int, long, float, double data -- long and double use 2 int slots - may be null if all slots are in JCas cover objects as fields - ref data - used for references to other Java objects, such as -- strings -- other feature structures -- arbitrary Java Objects - may be null if all slots are in JCas cover objects as fields - an id: an incrementing integer, starting at 1, per CAS, of all FSs created for that CAS - a ref to the casView where this FS was created - a ref to the TypeImpl for this class -- can't be static - may be multiple type systems in use
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFeatureStructureImplC.PrintReferences
-
Field Summary
Fields Modifier and Type Field Description private static int_BIT_IN_SET_SORTED_INDEXprivate static int_BIT_JCASHASHMAP_RESERVEprivate static int_BIT_PEAR_TRAMPOLINECASImpl_casViewThe view this Feature Structure was originally created in.private int_flagsprotected int_idprivate int[]_intDataExperiment: goal: speed up allocation and maybe improve locality of reference a) have _intData and _refData point to 1) for array sizes < 256, a common shared array used with an offset 2) for array sizes > 256, individual arrays as is the previous design case b) have accesses use an offset kept in the flags; allocate in blocks of 1k the larger, the less java object overhead per the larger, the less "breakage" waste the smaller, the better GC offset = 10 bits * 2 (one for int, one for ref) results: on 16-way processor (64 hyperthreaded cores), caused 2x slowdown, probably due to cache contention.private java.lang.Object[]_refDataprivate TypeImpl_typeImplstatic java.lang.StringDISABLE_RUNTIME_FEATURE_VALIDATIONstatic java.lang.StringDISABLE_RUNTIME_FEATURE_VALUE_VALIDATIONstatic booleanIS_ENABLE_RUNTIME_FEATURE_VALIDATIONstatic booleanIS_ENABLE_RUNTIME_FEATURE_VALUE_VALIDATIONstatic booleanIS_V2_PRETTY_PRINTprivate static booleantraceFSsstatic java.lang.StringV2_PRETTY_PRINT
-
Constructor Summary
Constructors Modifier Constructor Description FeatureStructureImplC()protectedFeatureStructureImplC(int id)For use in creating search keysprotectedFeatureStructureImplC(TypeImpl type, CASImpl casView)For non-JCas use, Internal Use Only, called by cas.createFS via generatorsprotectedFeatureStructureImplC(JCasImpl jcasImpl)For JCas use (done this way to allow "final") The TypeImpl is derived from the JCas cover class nameprotectedFeatureStructureImplC(JCasImpl jcasImpl, int aId)For temporary marker annotations.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private int[]_allocIntData()private java.lang.Object[]_allocRefData()private void_Check_feature_defined_for_this_type(Feature feat)Validation checkingprivate void_check_feature_range_is_FeatureStructure(Feature feat, FeatureStructureImplC fs)void_copyIntAndRefArraysEqTypesFrom(FeatureStructureImplC src)copy int and ref data for two instances, each having the exact same typevoid_copyIntAndRefArraysFrom(FeatureStructureImplC src)void_copyIntArrayEqTypesFrom(FeatureStructureImplC src)boolean_getBooleanValueNc(int adjOffset)boolean_getBooleanValueNc(FeatureImpl fi)byte_getByteValueNc(int adjOffset)byte_getByteValueNc(FeatureImpl feat)double_getDoubleValueNc(int adjOffset)double_getDoubleValueNc(FeatureImpl fi)protected FeatureImpl_getFeatFromAdjOffset(int adjOffset, boolean isInInt)TOP_getFeatureValueNc(int adjOffset)TOP_getFeatureValueNc(FeatureImpl feat)float_getFloatValueNc(int adjOffset)float_getFloatValueNc(FeatureImpl fi)int_getIntLikeValue(SlotKinds.SlotKind slotKind, FeatureImpl f)for compressed form 4 - for getting the prev value of int-like slots Uses unchecked forms for feature accessprivate int_getIntValueCommon(int adjOffset)private int_getIntValueCommon(FeatureImpl feat)int_getIntValueNc(int adjOffset)int_getIntValueNc(FeatureImpl feat)long_getLongValueNc(int adjOffset)long_getLongValueNc(FeatureImpl feat)java.lang.Object_getRefValueCommon(int adjOffset)private java.lang.Object_getRefValueCommon(FeatureImpl feat)short_getShortValueNc(int adjOffset)short_getShortValueNc(FeatureImpl feat)java.lang.String_getStringValueNc(int adjOffset)java.lang.String_getStringValueNc(FeatureImpl feat)int_getTypeCode()starts with _TypeImpl_getTypeImpl()CASImpl_getView()int_id()return the unique (to this CAS) id of this feature structureprotected boolean_inSetSortedIndex()boolean_isJCasHashMapReserve()protected boolean_isPearTrampoline()<N extends TOP>
N_maybeGetBaseForPearFs()Called to convert to the base FS from a Pear versionprotected <N extends TOP>
N_maybeGetBaseForPearFs(N v)Called when setting a FS value which might be a trampoline<N extends TOP>
N_maybeGetPearFs()protected <N extends TOP>
N_maybeGetPearFs(N v)Called when getting a FS value which might need to return a Pear context's trampolineprotected void_resetInSetSortedIndex()All callers of this must insure fs is not indexed in **Any** Viewvoid_setBooleanValueNcNj(int adjOffset, boolean v)void_setBooleanValueNcNj(FeatureImpl fi, boolean v)void_setBooleanValueNfc(int adjOffset, boolean v)void_setByteValueNcNj(int adjOffset, byte v)void_setByteValueNcNj(FeatureImpl fi, byte v)void_setByteValueNfc(int adjOffset, byte v)void_setDoubleValueNcNj(int adjOffset, double v)void_setDoubleValueNcNj(FeatureImpl fi, double v)protected void_setDoubleValueNfc(int adjOffset, double v)void_setFeatureValueNcNj(int adjOffset, java.lang.Object v)void_setFeatureValueNcNj(FeatureImpl fi, java.lang.Object v)void_setFeatureValueNcWj(int adjOffset, FeatureStructure v)Nc - no check, Wj = with journaling if neededvoid_setFloatValueNcNj(int adjOffset, float v)void_setFloatValueNcNj(FeatureImpl fi, float v)protected void_setFloatValueNfc(int adjOffset, float v)protected void_setInSetSortedIndexed()void_setIntLikeValue(SlotKinds.SlotKind slotKind, FeatureImpl fi, int v)Internal Use onlyvoid_setIntLikeValueNcNj(SlotKinds.SlotKind slotKind, FeatureImpl fi, int v)Internal Use only - no feature check, no journalingprotected void_setIntValueCJ(FeatureImpl fi, int v)All 3 checksprivate void_setIntValueCommon(int adjOffset, int v)private void_setIntValueCommon(FeatureImpl fi, int v)void_setIntValueNcNj(int adjOffset, int v)void_setIntValueNcNj(FeatureImpl fi, int v)void_setIntValueNfc(int adjOffset, int v)protected void_setIntValueNfcCJ(int adjOffset, int v)2 checks, no feature checkprotected void_setJCasHashMapReserve()protected void_setLongValueCJ(FeatureImpl fi, long v)All 3 checks for longvoid_setLongValueNcNj(int adjOffset, long v)void_setLongValueNcNj(FeatureImpl fi, long v)void_setLongValueNfc(int adjOffset, long v)protected void_setLongValueNfcCJ(FeatureImpl fi, long v)2 checks, no feature checkprotected void_setPearTrampoline()protected void_setRefValueCJ(FeatureImpl fi, java.lang.Object v)void_setRefValueCommon(int adjOffset, java.lang.Object v)private void_setRefValueCommon(FeatureImpl fi, java.lang.Object v)protected void_setRefValueCommonWj(FeatureImpl fi, java.lang.Object v)protected void_setRefValueNfcCJ(FeatureImpl fi, java.lang.Object v)2 checks, no feature checkvoid_setShortValueNcNj(int adjOffset, short v)void_setShortValueNcNj(FeatureImpl fi, short v)void_setShortValueNfc(int adjOffset, short v)void_setStringValueNcNj(FeatureImpl fi, java.lang.String v)void_setStringValueNcWj(int adjOffset, java.lang.String v)Skips substring range checking, but maybe does journallingvoid_setStringValueNfc(int adjOffset, java.lang.String v)protected void_setTypeImpl(TypeImpl ti)java.lang.StringBuilderaddStringOrPrimitive(java.lang.StringBuilder sb, FeatureImpl fi)voidaddToIndexes()add the corresponding FeatureStructure to all Cas indexes in the view where this FS was createdvoidaddToIndexes(CAS cas)voidaddToIndexes(JCas jcas)add this FS to indexes in a specific view, perhaps different from the creation viewprivate voidappendOrNull(java.lang.StringBuilder sb, java.lang.String v)private voidcheckFeatRange(Feature feat, java.lang.String shortRangeName)S E T T E R S 4 levels of checking: - check feature for validity (fv) -- this is skipped with feature comes from fs type info (internal calls) - check for setting something which could corrupt indexes (ci) -- this is skipped when the caller knows --- the FS is not in the index, perhaps because they just created it -- skipped when the range is not a valid index key - check for needing to log (journal) setting (jrnl) -- this is skipped when the caller knows --- no journalling is enabled or --- the FS is a new (above-the-line) FS - check the value is suitable -- this can be skipped if Java is doing the checking (via the type of the argument) -- done for string subtypes and Feature References --- skipped if the caller knows the value is OK (e.g., it is copying an existing FS) The jrnl and ic checks require the FeatureImpl.FeatureStructureImplCclone()See http://www.javaworld.com/article/2076332/java-se/how-to-avoid-traps-and-correctly-override-methods-from-java-lang-object.html for suggestions on avoiding bugs in implementing clone Because we have final fields for _intData, _refData, and _id, we can't use clone.static intcompare(FeatureStructureImplC a, FeatureStructureImplC b)booleanequals(java.lang.Object obj)A feature structure is equal to another feature structure iff it is identical in the underlying representation.private voidfeatureValueValidation(Feature feat, java.lang.Object v)intgetAddress()NOTE: Possible name collisionbooleangetBooleanValue(Feature feat)G E T T E R S (The array getters are part of the Classes for the built-in arrays, here are only the non-array ones) getXyzValue(Feature feat) - this is the standard from V2 plain API - it does validity checking (normally) that the feature belongs to the type getXyzValueNc(FeatureImpl feat) - skips the validity checking that the feature belongs to the type.bytegetByteValue(Feature feat)Get the byte value of a feature.CASgetCAS()CASImplgetCASImpl()doublegetDoubleValue(Feature feat)Get the double value of a feature.TOPgetFeatureValue(Feature feat)Get a feature value.java.lang.StringgetFeatureValueAsString(Feature feat)Get the value of the feature as a string if the type of the feature is one of the primitive type.floatgetFloatValue(Feature feat)Get the float value of a feature.intgetIntValue(Feature feat)Get the int value of a feature.longgetLongValue(Feature feat)Get the long value of a feature.LowLevelCASgetLowLevelCas()private voidgetPrintRefs(FeatureStructureImplC.PrintReferences printRefs)private voidgetPrintRefs(FeatureStructureImplC.PrintReferences printRefs, FeatureStructureImplC fs)This is called, once, at the top level thing being printed.shortgetShortValue(Feature feat)Get the short value of a feature.java.lang.StringgetStringValue(Feature feat)Get the string value under a feature.TypegetType()Returns the UIMA TypeImpl valueintgetTypeIndexID()inthashCode()Will return a hash code that's consistent with equality, i.e., if two FSs are equal, they will also return the same hash code.private booleanisOkArray(TypeImpl range, java.lang.Object v)private voidppval(FeatureStructureImplC val, int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames, FeatureStructureImplC.PrintReferences printRefs, boolean isShortForm)voidprettyPrint(int indent, int incr, java.lang.StringBuffer buf, boolean useShortNames)voidprettyPrint(int indent, int incr, java.lang.StringBuffer buf, boolean useShortNames, java.lang.String s)Deprecated.use form with StringBuilder (not StringBuffer)voidprettyPrint(int indent, int incr, java.lang.StringBuffer buf, boolean useShortNames, java.lang.String s, FeatureStructureImplC.PrintReferences printRefs)Deprecated.because uses StringBuffer, not builder, for version 2 compatibility onlyvoidprettyPrint(int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames)voidprettyPrint(int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames, java.lang.String s)Top level, does computation of self-ref Pretty prints this Feature Structure, no trailing nlvoidprettyPrint(int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames, java.lang.String s, FeatureStructureImplC.PrintReferences printRefs)private voidprettyPrint(int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames, java.lang.String s, FeatureStructureImplC.PrintReferences printRefs, boolean isShortForm_arg)recursively called by ppvalvoidprettyPrintShort(java.lang.StringBuilder sb)private voidprintArrayElements(int arrayLen, java.util.function.IntConsumer f, int indent, int incr, java.lang.StringBuilder buf)For printing arrays except FSArrays; called after printing the type:nnn prints the length if the length = 0 that's all otherwise: uses Misc.addElementsToStringBuilder to output the elements.private voidprintFSArrayElements(FSArray fsarray, int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames, FeatureStructureImplC.PrintReferences printRefs, boolean isShortForm)For printing FSArrays; called after printing the type:nnn Only called if ! IS_V2_PRETTY_PRINT, since v2 didn't print the array contents prints the length if the length = 0 that's all otherwise:voidremoveFromIndexes()remove the corresponding FeatureStructure from all Cas indexes in the view where this FS was createdvoidremoveFromIndexes(CAS cas)remove this FS from indexes in a specific view, perhaps different from the view where this was created.voidremoveFromIndexes(JCas jcas)remove this FS from indexes in a specific view, perhaps different from the view where this was created.voidsetBooleanValue(Feature feat, boolean v)Set the boolean value of a feature.voidsetByteValue(Feature feat, byte v)Set the byte (8 bit) value of a feature.voidsetDoubleValue(Feature feat, double v)Set the double value of a feature.voidsetFeatureValue(Feature feat, FeatureStructure v)Set a feature value to another FS.voidsetFeatureValueFromString(Feature feat, java.lang.String s)Sets the value of a feature from a string input if the feature type is one of the primitive types.voidsetFloatValue(Feature feat, float v)Set the float value of a feature.voidsetIntValue(Feature feat, int v)Set the int value of a feature.voidsetLongValue(Feature feat, long v)Set the long (64 bit) value of a feature.voidsetShortValue(Feature feat, short v)Set the short (16 bit) value of a feature.voidsetStringValue(Feature feat, java.lang.String v)Set the string value of a feature.private voidsubStringRangeCheck(Feature feat, java.lang.String v)java.lang.StringtoShortString()java.lang.StringtoString()java.lang.StringtoString(int indent)protected static intwrapGetIntCatchException(java.lang.invoke.MethodHandle mh)-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.uima.cas.FeatureStructure
getJCas
-
-
-
-
Field Detail
-
DISABLE_RUNTIME_FEATURE_VALIDATION
public static final java.lang.String DISABLE_RUNTIME_FEATURE_VALIDATION
- See Also:
- Constant Field Values
-
IS_ENABLE_RUNTIME_FEATURE_VALIDATION
public static final boolean IS_ENABLE_RUNTIME_FEATURE_VALIDATION
-
DISABLE_RUNTIME_FEATURE_VALUE_VALIDATION
public static final java.lang.String DISABLE_RUNTIME_FEATURE_VALUE_VALIDATION
- See Also:
- Constant Field Values
-
IS_ENABLE_RUNTIME_FEATURE_VALUE_VALIDATION
public static final boolean IS_ENABLE_RUNTIME_FEATURE_VALUE_VALIDATION
-
V2_PRETTY_PRINT
public static final java.lang.String V2_PRETTY_PRINT
- See Also:
- Constant Field Values
-
IS_V2_PRETTY_PRINT
public static final boolean IS_V2_PRETTY_PRINT
-
traceFSs
private static final boolean traceFSs
-
_BIT_IN_SET_SORTED_INDEX
private static final int _BIT_IN_SET_SORTED_INDEX
- See Also:
- Constant Field Values
-
_BIT_PEAR_TRAMPOLINE
private static final int _BIT_PEAR_TRAMPOLINE
- See Also:
- Constant Field Values
-
_BIT_JCASHASHMAP_RESERVE
private static final int _BIT_JCASHASHMAP_RESERVE
- See Also:
- Constant Field Values
-
_intData
private final int[] _intData
Experiment: goal: speed up allocation and maybe improve locality of reference a) have _intData and _refData point to 1) for array sizes < 256, a common shared array used with an offset 2) for array sizes > 256, individual arrays as is the previous design case b) have accesses use an offset kept in the flags; allocate in blocks of 1k the larger, the less java object overhead per the larger, the less "breakage" waste the smaller, the better GC offset = 10 bits * 2 (one for int, one for ref) results: on 16-way processor (64 hyperthreaded cores), caused 2x slowdown, probably due to cache contention.
-
_refData
private final java.lang.Object[] _refData
-
_id
protected final int _id
-
_flags
private int _flags
-
_casView
public final CASImpl _casView
The view this Feature Structure was originally created in. Feature Structures may be indexed in multiple views, or in no views. Also used to access other metadata including the type system
-
_typeImpl
private TypeImpl _typeImpl
-
-
Constructor Detail
-
FeatureStructureImplC
public FeatureStructureImplC()
-
FeatureStructureImplC
protected FeatureStructureImplC(int id)
For use in creating search keys- Parameters:
id- -
-
FeatureStructureImplC
protected FeatureStructureImplC(TypeImpl type, CASImpl casView)
For non-JCas use, Internal Use Only, called by cas.createFS via generators
-
FeatureStructureImplC
protected FeatureStructureImplC(JCasImpl jcasImpl)
For JCas use (done this way to allow "final") The TypeImpl is derived from the JCas cover class name- Parameters:
jcasImpl- - the view this is being created in
-
FeatureStructureImplC
protected FeatureStructureImplC(JCasImpl jcasImpl, int aId)
For temporary marker annotations. Does not assign an ID from the CAS ID generator and never retains the annotation. We also do not trace this annotation.
-
-
Method Detail
-
_allocIntData
private int[] _allocIntData()
-
_allocRefData
private java.lang.Object[] _allocRefData()
-
addToIndexes
public void addToIndexes()
add the corresponding FeatureStructure to all Cas indexes in the view where this FS was created
-
addToIndexes
public void addToIndexes(JCas jcas)
add this FS to indexes in a specific view, perhaps different from the creation view- Parameters:
jcas- the JCas
-
addToIndexes
public void addToIndexes(CAS cas)
-
removeFromIndexes
public void removeFromIndexes()
remove the corresponding FeatureStructure from all Cas indexes in the view where this FS was created
-
removeFromIndexes
public void removeFromIndexes(CAS cas)
remove this FS from indexes in a specific view, perhaps different from the view where this was created.- Parameters:
cas- the Cas
-
removeFromIndexes
public void removeFromIndexes(JCas jcas)
remove this FS from indexes in a specific view, perhaps different from the view where this was created.- Parameters:
jcas- the Cas
-
getLowLevelCas
public LowLevelCAS getLowLevelCas()
-
getAddress
public final int getAddress()
NOTE: Possible name collision- Specified by:
getAddressin interfaceFeatureStructure- Returns:
- the internal id of this fs - unique to this CAS, a positive int
-
_id
public final int _id()
Description copied from interface:FeatureStructurereturn the unique (to this CAS) id of this feature structure- Specified by:
_idin interfaceFeatureStructure- Returns:
- the id
-
getType
public Type getType()
Returns the UIMA TypeImpl value- Specified by:
getTypein interfaceFeatureStructure- Returns:
- The type.
-
_getTypeCode
public int _getTypeCode()
starts with _- Specified by:
_getTypeCodein interfaceFeatureStructure- Returns:
- the UIMA TypeImpl for this Feature Structure
-
_getView
public CASImpl _getView()
-
checkFeatRange
private void checkFeatRange(Feature feat, java.lang.String shortRangeName)
S E T T E R S 4 levels of checking: - check feature for validity (fv) -- this is skipped with feature comes from fs type info (internal calls) - check for setting something which could corrupt indexes (ci) -- this is skipped when the caller knows --- the FS is not in the index, perhaps because they just created it -- skipped when the range is not a valid index key - check for needing to log (journal) setting (jrnl) -- this is skipped when the caller knows --- no journalling is enabled or --- the FS is a new (above-the-line) FS - check the value is suitable -- this can be skipped if Java is doing the checking (via the type of the argument) -- done for string subtypes and Feature References --- skipped if the caller knows the value is OK (e.g., it is copying an existing FS) The jrnl and ic checks require the FeatureImpl. For setters using these checks, there are two versions: - one with the arg being the FeatureImpl (if it is available at the caller) and - one with the int offset (common code coverts this to the Feature Impl). all 4 checks are normally done by the standard API call in the FeatureStructure interface setXyzValue(Feature, value) Besides the standard API call, other setter methods have suffixes and prefixes to the setter name - prefix is "_" to avoid conflicting with existing other names - suffixes are: -- Nfc: skip feature validity checking, ( ! fv, jrnl, ci ) (int/Feat) -- NcNj: implies Nfc, ( ! fv, ! jrnl, ! ci ) (int/Feat) -- NcWj: implies Nfc, ( ! fv, jrnl, ! ci ) (int) The is for setters where value checking might be needed (i.e., Java checking isn't sufficient) -- NcNjNv: implies Nfc, skips all checks For JCas setters: convert offset to feature
-
setBooleanValue
public void setBooleanValue(Feature feat, boolean v)
Description copied from interface:FeatureStructureSet the boolean value of a feature.- Specified by:
setBooleanValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.v- The boolean value we're setting the feature to.
-
_setBooleanValueNfc
public void _setBooleanValueNfc(int adjOffset, boolean v)
-
_setBooleanValueNcNj
public final void _setBooleanValueNcNj(FeatureImpl fi, boolean v)
-
_setBooleanValueNcNj
public final void _setBooleanValueNcNj(int adjOffset, boolean v)
-
setByteValue
public void setByteValue(Feature feat, byte v)
Description copied from interface:FeatureStructureSet the byte (8 bit) value of a feature.- Specified by:
setByteValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.v- The 8bit value we're setting the feature to.
-
_setByteValueNfc
public void _setByteValueNfc(int adjOffset, byte v)
-
_setByteValueNcNj
public void _setByteValueNcNj(FeatureImpl fi, byte v)
-
_setByteValueNcNj
public void _setByteValueNcNj(int adjOffset, byte v)
-
setShortValue
public void setShortValue(Feature feat, short v)
Description copied from interface:FeatureStructureSet the short (16 bit) value of a feature.- Specified by:
setShortValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.v- The short (16bit) value we're setting the feature to.
-
_setShortValueNfc
public void _setShortValueNfc(int adjOffset, short v)
-
_setShortValueNcNj
public void _setShortValueNcNj(FeatureImpl fi, short v)
-
_setShortValueNcNj
public void _setShortValueNcNj(int adjOffset, short v)
-
setIntValue
public void setIntValue(Feature feat, int v)
Description copied from interface:FeatureStructureSet the int value of a feature.- Specified by:
setIntValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.v- The int we're setting the feature to.
-
_setIntValueNfc
public void _setIntValueNfc(int adjOffset, int v)
-
_setIntValueNcNj
public void _setIntValueNcNj(FeatureImpl fi, int v)
-
_setIntValueNcNj
public void _setIntValueNcNj(int adjOffset, int v)
-
setLongValue
public void setLongValue(Feature feat, long v)
Description copied from interface:FeatureStructureSet the long (64 bit) value of a feature.- Specified by:
setLongValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.v- The long (64bit) value we're setting the feature to.
-
_setLongValueNfc
public void _setLongValueNfc(int adjOffset, long v)
-
_setLongValueNcNj
public void _setLongValueNcNj(FeatureImpl fi, long v)
-
_setLongValueNcNj
public void _setLongValueNcNj(int adjOffset, long v)
-
setFloatValue
public void setFloatValue(Feature feat, float v)
Description copied from interface:FeatureStructureSet the float value of a feature.- Specified by:
setFloatValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.v- The float we're setting the feature to.
-
_setFloatValueNfc
protected void _setFloatValueNfc(int adjOffset, float v)
-
_setFloatValueNcNj
public void _setFloatValueNcNj(FeatureImpl fi, float v)
-
_setFloatValueNcNj
public void _setFloatValueNcNj(int adjOffset, float v)
-
setDoubleValue
public void setDoubleValue(Feature feat, double v)
Description copied from interface:FeatureStructureSet the double value of a feature.- Specified by:
setDoubleValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.v- The double value we're setting the feature to.
-
_setDoubleValueNfc
protected void _setDoubleValueNfc(int adjOffset, double v)
-
_setDoubleValueNcNj
public void _setDoubleValueNcNj(FeatureImpl fi, double v)
-
_setDoubleValueNcNj
public void _setDoubleValueNcNj(int adjOffset, double v)
-
setStringValue
public void setStringValue(Feature feat, java.lang.String v)
Description copied from interface:FeatureStructureSet the string value of a feature.- Specified by:
setStringValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.v- The string we're setting the feature to.
-
_setStringValueNfc
public void _setStringValueNfc(int adjOffset, java.lang.String v)
-
_setStringValueNcNj
public void _setStringValueNcNj(FeatureImpl fi, java.lang.String v)
-
_setStringValueNcWj
public void _setStringValueNcWj(int adjOffset, java.lang.String v)Skips substring range checking, but maybe does journalling- Parameters:
adjOffset- offsetv- to set
-
setFeatureValue
public void setFeatureValue(Feature feat, FeatureStructure v)
Description copied from interface:FeatureStructureSet a feature value to another FS.- Specified by:
setFeatureValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value should be set.v- The value FS.
-
_setFeatureValueNcNj
public void _setFeatureValueNcNj(FeatureImpl fi, java.lang.Object v)
-
_setFeatureValueNcNj
public void _setFeatureValueNcNj(int adjOffset, java.lang.Object v)
-
_maybeGetBaseForPearFs
protected <N extends TOP> N _maybeGetBaseForPearFs(N v)
Called when setting a FS value which might be a trampoline- Type Parameters:
N- the type of the FS- Parameters:
v- the FS to check- Returns:
- the FS or if it was a trampoline, the base FS
-
_maybeGetBaseForPearFs
public <N extends TOP> N _maybeGetBaseForPearFs()
Called to convert to the base FS from a Pear version- Type Parameters:
N- the type of the FS- Returns:
- the FS or if it was a trampoline, the base FS
-
_maybeGetPearFs
protected <N extends TOP> N _maybeGetPearFs(N v)
Called when getting a FS value which might need to return a Pear context's trampoline- Type Parameters:
N- the type of the FS- Parameters:
v- the FS to check- Returns:
- the FS or if we're in a Pear context, perhaps the trampoline (only some classes might have trampolines)
-
_maybeGetPearFs
public <N extends TOP> N _maybeGetPearFs()
- Type Parameters:
N- the type of the FS- Returns:
- the FS or if we're in a Pear context and the PEAR defines a different version, the PEAR version.
-
_setFeatureValueNcWj
public void _setFeatureValueNcWj(int adjOffset, FeatureStructure v)Nc - no check, Wj = with journaling if needed- Parameters:
adjOffset- -v- -
-
setFeatureValueFromString
public void setFeatureValueFromString(Feature feat, java.lang.String s) throws CASRuntimeException
Description copied from interface:FeatureStructureSets the value of a feature from a string input if the feature type is one of the primitive types.- Specified by:
setFeatureValueFromStringin interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.s- The string value that the feature will be set to.- Throws:
CASRuntimeException- Iffeatis not a primitive type or the value cannot be converted to this type.
-
_setIntValueCJ
protected void _setIntValueCJ(FeatureImpl fi, int v)
All 3 checks- Parameters:
fi- - the featurev- - the value
-
_setLongValueCJ
protected void _setLongValueCJ(FeatureImpl fi, long v)
All 3 checks for long- Parameters:
fi- - the featurev- - the value
-
_setIntValueNfcCJ
protected void _setIntValueNfcCJ(int adjOffset, int v)2 checks, no feature check- Parameters:
adjOffset- - the feature offsetv- - the value
-
_setLongValueNfcCJ
protected void _setLongValueNfcCJ(FeatureImpl fi, long v)
2 checks, no feature check- Parameters:
fi- - the featurev- - the value
-
_setRefValueCJ
protected void _setRefValueCJ(FeatureImpl fi, java.lang.Object v)
-
_setRefValueNfcCJ
protected void _setRefValueNfcCJ(FeatureImpl fi, java.lang.Object v)
2 checks, no feature check- Parameters:
fi- - the featurev- - the value
-
getBooleanValue
public boolean getBooleanValue(Feature feat)
G E T T E R S (The array getters are part of the Classes for the built-in arrays, here are only the non-array ones) getXyzValue(Feature feat) - this is the standard from V2 plain API - it does validity checking (normally) that the feature belongs to the type getXyzValueNc(FeatureImpl feat) - skips the validity checking that the feature belongs to the type.- Specified by:
getBooleanValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value int;
0if the value has not been set.
-
_getBooleanValueNc
public boolean _getBooleanValueNc(FeatureImpl fi)
-
_getBooleanValueNc
public boolean _getBooleanValueNc(int adjOffset)
-
getByteValue
public byte getByteValue(Feature feat)
Description copied from interface:FeatureStructureGet the byte value of a feature. This method will throw an exception if the feature is not byte valued.- Specified by:
getByteValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to set.- Returns:
- The value byte;
0if the value has not been set.
-
_getByteValueNc
public byte _getByteValueNc(FeatureImpl feat)
-
_getByteValueNc
public byte _getByteValueNc(int adjOffset)
-
getShortValue
public short getShortValue(Feature feat)
Description copied from interface:FeatureStructureGet the short value of a feature. This method will throw an exception if the feature is not short valued.- Specified by:
getShortValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value int;
0if the value has not been set.
-
_getShortValueNc
public short _getShortValueNc(FeatureImpl feat)
-
_getShortValueNc
public short _getShortValueNc(int adjOffset)
-
getIntValue
public int getIntValue(Feature feat)
Description copied from interface:FeatureStructureGet the int value of a feature. This method will throw an exception if the feature is not int valued.- Specified by:
getIntValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value int;
0if the value has not been set.
-
_getIntValueNc
public int _getIntValueNc(FeatureImpl feat)
-
_getIntValueNc
public int _getIntValueNc(int adjOffset)
-
getLongValue
public long getLongValue(Feature feat)
Description copied from interface:FeatureStructureGet the long value of a feature. This method will throw an exception if the feature is not long valued.- Specified by:
getLongValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value int;
0if the value has not been set.
-
_getLongValueNc
public long _getLongValueNc(FeatureImpl feat)
-
_getLongValueNc
public long _getLongValueNc(int adjOffset)
-
getFloatValue
public float getFloatValue(Feature feat)
Description copied from interface:FeatureStructureGet the float value of a feature. This method will throw an exception if the feature is not float valued.- Specified by:
getFloatValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value float;
0.0if the value has not been set.
-
_getFloatValueNc
public float _getFloatValueNc(FeatureImpl fi)
-
_getFloatValueNc
public float _getFloatValueNc(int adjOffset)
-
getDoubleValue
public double getDoubleValue(Feature feat)
Description copied from interface:FeatureStructureGet the double value of a feature. This method will throw an exception if the feature is not double valued.- Specified by:
getDoubleValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value int;
0if the value has not been set.
-
_getDoubleValueNc
public double _getDoubleValueNc(FeatureImpl fi)
-
_getDoubleValueNc
public double _getDoubleValueNc(int adjOffset)
-
getStringValue
public java.lang.String getStringValue(Feature feat)
Description copied from interface:FeatureStructureGet the string value under a feature.- Specified by:
getStringValuein interfaceFeatureStructure- Parameters:
feat- The feature for which we want the value.- Returns:
- The value of this feature; may be
nullif the value has not been set.
-
_getStringValueNc
public java.lang.String _getStringValueNc(FeatureImpl feat)
-
_getStringValueNc
public java.lang.String _getStringValueNc(int adjOffset)
-
getFeatureValue
public TOP getFeatureValue(Feature feat)
Description copied from interface:FeatureStructureGet a feature value.- Specified by:
getFeatureValuein interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get.- Returns:
- The value; may be
nullif the value has not been set.
-
_getFeatureValueNc
public TOP _getFeatureValueNc(FeatureImpl feat)
-
_getFeatureValueNc
public TOP _getFeatureValueNc(int adjOffset)
-
getCAS
public CAS getCAS()
- Specified by:
getCASin interfaceFeatureStructure- Returns:
- the CAS view where this FS was created
-
getCASImpl
public CASImpl getCASImpl()
-
clone
public FeatureStructureImplC clone() throws CASRuntimeException
See http://www.javaworld.com/article/2076332/java-se/how-to-avoid-traps-and-correctly-override-methods-from-java-lang-object.html for suggestions on avoiding bugs in implementing clone Because we have final fields for _intData, _refData, and _id, we can't use clone. Instead, we use the createFS to create the FS of the right type. This will use the generators. Strategy for cloning: Goal is to create an independent instance of some subtype of this class, with all the fields properly copied from this instance. - some fields could be in the _intData and _refData - some fields could be stored as features Subcases to handle: - arrays - these have no features. Note: CasCopier doesn't call this because it needs to do a deep copy This is not used by the framework- Specified by:
clonein interfaceFeatureStructure- Overrides:
clonein classjava.lang.Object- Returns:
- a new Feature Structure as a new instance of the same class, with a new _id field, with its features set to the values of the features in this Feature Structure
- Throws:
CASRuntimeException- (different from Object.clone()) if an exception occurs
-
hashCode
public int hashCode()
Description copied from interface:FeatureStructureWill return a hash code that's consistent with equality, i.e., if two FSs are equal, they will also return the same hash code.- Specified by:
hashCodein interfaceFeatureStructure- Overrides:
hashCodein classjava.lang.Object- Returns:
- The hash code.
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:FeatureStructureA feature structure is equal to another feature structure iff it is identical in the underlying representation.- Specified by:
equalsin interfaceFeatureStructure- Overrides:
equalsin classjava.lang.Object
-
getPrintRefs
private final void getPrintRefs(FeatureStructureImplC.PrintReferences printRefs)
-
getPrintRefs
private final void getPrintRefs(FeatureStructureImplC.PrintReferences printRefs, FeatureStructureImplC fs)
This is called, once, at the top level thing being printed. It recursively descends any references, and updates the PrintReferences with info needed to handle circular structures- Parameters:
printRefs- the PrintReferences to updatefs- the top level FS being pretty printed, to descend if needed
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(int indent)
- Specified by:
toStringin interfaceFeatureStructureImpl
-
prettyPrint
public void prettyPrint(int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames)- Specified by:
prettyPrintin interfaceFeatureStructureImpl
-
prettyPrint
public void prettyPrint(int indent, int incr, java.lang.StringBuffer buf, boolean useShortNames)- Specified by:
prettyPrintin interfaceFeatureStructureImpl
-
prettyPrint
@Deprecated public void prettyPrint(int indent, int incr, java.lang.StringBuffer buf, boolean useShortNames, java.lang.String s)Deprecated.use form with StringBuilder (not StringBuffer)Top level, does computation of self-ref Pretty prints this Feature Structure, no trailing nl Old form - uses string buffer.- Specified by:
prettyPrintin interfaceFeatureStructureImpl- Parameters:
indent- the indent amountincr- the amount the indent is increased for a levelbuf- where the resulting string is builtuseShortNames- true to use short names- extra string to print
-
prettyPrint
public void prettyPrint(int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames, java.lang.String s)Top level, does computation of self-ref Pretty prints this Feature Structure, no trailing nl- Specified by:
prettyPrintin interfaceFeatureStructureImpl- Parameters:
indent- the indent amountincr- the amount the indent is increased for a levelbuf- where the resulting string is builtuseShortNames- true to use short names- extra string to print
-
prettyPrint
@Deprecated public void prettyPrint(int indent, int incr, java.lang.StringBuffer buf, boolean useShortNames, java.lang.String s, FeatureStructureImplC.PrintReferences printRefs)Deprecated.because uses StringBuffer, not builder, for version 2 compatibility onlyInternal Use Only, public only for backwards compatibility- Parameters:
indent- -incr- -buf- -useShortNames- -s- -printRefs- -
-
prettyPrint
public void prettyPrint(int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames, java.lang.String s, FeatureStructureImplC.PrintReferences printRefs)
-
prettyPrintShort
public void prettyPrintShort(java.lang.StringBuilder sb)
- Parameters:
sb- -
-
prettyPrint
private void prettyPrint(int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames, java.lang.String s, FeatureStructureImplC.PrintReferences printRefs, boolean isShortForm_arg)recursively called by ppval- Parameters:
indent- -incr- -buf- -useShortNames- -s- -printRefs- -isShortForm_arg- -
-
addStringOrPrimitive
public java.lang.StringBuilder addStringOrPrimitive(java.lang.StringBuilder sb, FeatureImpl fi)
-
ppval
private void ppval(FeatureStructureImplC val, int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames, FeatureStructureImplC.PrintReferences printRefs, boolean isShortForm)
-
printArrayElements
private void printArrayElements(int arrayLen, java.util.function.IntConsumer f, int indent, int incr, java.lang.StringBuilder buf)For printing arrays except FSArrays; called after printing the type:nnn prints the length if the length = 0 that's all otherwise: uses Misc.addElementsToStringBuilder to output the elements. This routine does [ + array contents + ], unless the line is too long, in which case it switches to multi-line- Parameters:
arrayLen- the lengthf- the feature structureindent- the current indentincr- the indent incrbuf- the stringbuilder where the result is added
-
printFSArrayElements
private void printFSArrayElements(FSArray fsarray, int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames, FeatureStructureImplC.PrintReferences printRefs, boolean isShortForm)
For printing FSArrays; called after printing the type:nnn Only called if ! IS_V2_PRETTY_PRINT, since v2 didn't print the array contents prints the length if the length = 0 that's all otherwise:- Parameters:
arrayLen- the lengthf- the feature structureindent- the current indentincr- the indent incrbuf- the stringbuilder where the result is added
-
appendOrNull
private void appendOrNull(java.lang.StringBuilder sb, java.lang.String v)
-
getTypeIndexID
public int getTypeIndexID()
-
_setIntLikeValue
public void _setIntLikeValue(SlotKinds.SlotKind slotKind, FeatureImpl fi, int v)
Internal Use only- Parameters:
slotKind- -fi- -v- -
-
_setIntLikeValueNcNj
public void _setIntLikeValueNcNj(SlotKinds.SlotKind slotKind, FeatureImpl fi, int v)
Internal Use only - no feature check, no journaling- Parameters:
slotKind- -fi- -v- -
-
_getIntLikeValue
public int _getIntLikeValue(SlotKinds.SlotKind slotKind, FeatureImpl f)
for compressed form 4 - for getting the prev value of int-like slots Uses unchecked forms for feature access- Parameters:
slotKind- -f- -- Returns:
- -
-
getFeatureValueAsString
public java.lang.String getFeatureValueAsString(Feature feat)
Description copied from interface:FeatureStructureGet the value of the feature as a string if the type of the feature is one of the primitive type.- Specified by:
getFeatureValueAsStringin interfaceFeatureStructure- Parameters:
feat- The feature whose value we want to get and whose type is one of the primitive types.- Returns:
- A string representation of the feature value.
-
_inSetSortedIndex
protected boolean _inSetSortedIndex()
-
_setInSetSortedIndexed
protected void _setInSetSortedIndexed()
-
_resetInSetSortedIndex
protected void _resetInSetSortedIndex()
All callers of this must insure fs is not indexed in **Any** View
-
_setJCasHashMapReserve
protected void _setJCasHashMapReserve()
-
_isJCasHashMapReserve
public boolean _isJCasHashMapReserve()
-
_setPearTrampoline
protected void _setPearTrampoline()
-
_isPearTrampoline
protected boolean _isPearTrampoline()
-
_getFeatFromAdjOffset
protected FeatureImpl _getFeatFromAdjOffset(int adjOffset, boolean isInInt)
-
_getIntValueCommon
private int _getIntValueCommon(FeatureImpl feat)
-
_getIntValueCommon
private int _getIntValueCommon(int adjOffset)
-
_getRefValueCommon
private java.lang.Object _getRefValueCommon(FeatureImpl feat)
-
_getRefValueCommon
public java.lang.Object _getRefValueCommon(int adjOffset)
-
_setIntValueCommon
private void _setIntValueCommon(FeatureImpl fi, int v)
-
_setIntValueCommon
private void _setIntValueCommon(int adjOffset, int v)
-
_setRefValueCommon
private void _setRefValueCommon(FeatureImpl fi, java.lang.Object v)
-
_setRefValueCommon
public void _setRefValueCommon(int adjOffset, java.lang.Object v)
-
_setRefValueCommonWj
protected void _setRefValueCommonWj(FeatureImpl fi, java.lang.Object v)
-
_Check_feature_defined_for_this_type
private void _Check_feature_defined_for_this_type(Feature feat)
Validation checking
-
_check_feature_range_is_FeatureStructure
private void _check_feature_range_is_FeatureStructure(Feature feat, FeatureStructureImplC fs)
-
featureValueValidation
private void featureValueValidation(Feature feat, java.lang.Object v)
-
isOkArray
private boolean isOkArray(TypeImpl range, java.lang.Object v)
-
subStringRangeCheck
private void subStringRangeCheck(Feature feat, java.lang.String v)
-
_copyIntAndRefArraysFrom
public void _copyIntAndRefArraysFrom(FeatureStructureImplC src)
- Parameters:
src- the FS to copy features from
-
_copyIntAndRefArraysEqTypesFrom
public void _copyIntAndRefArraysEqTypesFrom(FeatureStructureImplC src)
copy int and ref data for two instances, each having the exact same type- Parameters:
src- the FS to copy features from
-
_copyIntArrayEqTypesFrom
public void _copyIntArrayEqTypesFrom(FeatureStructureImplC src)
- Parameters:
src- the FS to copy features from
-
toShortString
public java.lang.String toShortString()
-
_getTypeImpl
public final TypeImpl _getTypeImpl()
-
_setTypeImpl
protected final void _setTypeImpl(TypeImpl ti)
-
compare
public static int compare(FeatureStructureImplC a, FeatureStructureImplC b)
-
wrapGetIntCatchException
protected static final int wrapGetIntCatchException(java.lang.invoke.MethodHandle mh)
-
-