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 class
FeatureStructureImplC.PrintReferences
-
Field Summary
Fields Modifier and Type Field Description private static int
_BIT_IN_SET_SORTED_INDEX
private static int
_BIT_JCASHASHMAP_RESERVE
private static int
_BIT_PEAR_TRAMPOLINE
CASImpl
_casView
The view this Feature Structure was originally created in.private int
_flags
protected int
_id
private 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.private java.lang.Object[]
_refData
private TypeImpl
_typeImpl
static java.lang.String
DISABLE_RUNTIME_FEATURE_VALIDATION
static java.lang.String
DISABLE_RUNTIME_FEATURE_VALUE_VALIDATION
static boolean
IS_ENABLE_RUNTIME_FEATURE_VALIDATION
static boolean
IS_ENABLE_RUNTIME_FEATURE_VALUE_VALIDATION
static boolean
IS_V2_PRETTY_PRINT
private static boolean
traceFSs
static java.lang.String
V2_PRETTY_PRINT
-
Constructor Summary
Constructors Modifier Constructor Description FeatureStructureImplC()
protected
FeatureStructureImplC(int id)
For use in creating search keysprotected
FeatureStructureImplC(TypeImpl type, CASImpl casView)
For non-JCas use, Internal Use Only, called by cas.createFS via generatorsprotected
FeatureStructureImplC(JCasImpl jcasImpl)
For JCas use (done this way to allow "final") The TypeImpl is derived from the JCas cover class nameprotected
FeatureStructureImplC(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.StringBuilder
addStringOrPrimitive(java.lang.StringBuilder sb, FeatureImpl fi)
void
addToIndexes()
add the corresponding FeatureStructure to all Cas indexes in the view where this FS was createdvoid
addToIndexes(CAS cas)
void
addToIndexes(JCas jcas)
add this FS to indexes in a specific view, perhaps different from the creation viewprivate void
appendOrNull(java.lang.StringBuilder sb, java.lang.String v)
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.FeatureStructureImplC
clone()
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 int
compare(FeatureStructureImplC a, FeatureStructureImplC b)
boolean
equals(java.lang.Object obj)
A feature structure is equal to another feature structure iff it is identical in the underlying representation.private void
featureValueValidation(Feature feat, java.lang.Object v)
int
getAddress()
NOTE: Possible name collisionboolean
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.byte
getByteValue(Feature feat)
Get the byte value of a feature.CAS
getCAS()
CASImpl
getCASImpl()
double
getDoubleValue(Feature feat)
Get the double value of a feature.TOP
getFeatureValue(Feature feat)
Get a feature value.java.lang.String
getFeatureValueAsString(Feature feat)
Get the value of the feature as a string if the type of the feature is one of the primitive type.float
getFloatValue(Feature feat)
Get the float value of a feature.int
getIntValue(Feature feat)
Get the int value of a feature.long
getLongValue(Feature feat)
Get the long value of a feature.LowLevelCAS
getLowLevelCas()
private void
getPrintRefs(FeatureStructureImplC.PrintReferences printRefs)
private void
getPrintRefs(FeatureStructureImplC.PrintReferences printRefs, FeatureStructureImplC fs)
This is called, once, at the top level thing being printed.short
getShortValue(Feature feat)
Get the short value of a feature.java.lang.String
getStringValue(Feature feat)
Get the string value under a feature.Type
getType()
Returns the UIMA TypeImpl valueint
getTypeIndexID()
int
hashCode()
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 boolean
isOkArray(TypeImpl range, java.lang.Object v)
private void
ppval(FeatureStructureImplC val, int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames, FeatureStructureImplC.PrintReferences printRefs, boolean isShortForm)
void
prettyPrint(int indent, int incr, java.lang.StringBuffer buf, boolean useShortNames)
void
prettyPrint(int indent, int incr, java.lang.StringBuffer buf, boolean useShortNames, java.lang.String s)
Deprecated.use form with StringBuilder (not StringBuffer)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 onlyvoid
prettyPrint(int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames)
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 nlvoid
prettyPrint(int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames, java.lang.String s, FeatureStructureImplC.PrintReferences printRefs)
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 ppvalvoid
prettyPrintShort(java.lang.StringBuilder sb)
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.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:void
removeFromIndexes()
remove the corresponding FeatureStructure from all Cas indexes in the view where this FS was createdvoid
removeFromIndexes(CAS cas)
remove this FS from indexes in a specific view, perhaps different from the view where this was created.void
removeFromIndexes(JCas jcas)
remove this FS from indexes in a specific view, perhaps different from the view where this was created.void
setBooleanValue(Feature feat, boolean v)
Set the boolean value of a feature.void
setByteValue(Feature feat, byte v)
Set the byte (8 bit) value of a feature.void
setDoubleValue(Feature feat, double v)
Set the double value of a feature.void
setFeatureValue(Feature feat, FeatureStructure v)
Set a feature value to another FS.void
setFeatureValueFromString(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.void
setFloatValue(Feature feat, float v)
Set the float value of a feature.void
setIntValue(Feature feat, int v)
Set the int value of a feature.void
setLongValue(Feature feat, long v)
Set the long (64 bit) value of a feature.void
setShortValue(Feature feat, short v)
Set the short (16 bit) value of a feature.void
setStringValue(Feature feat, java.lang.String v)
Set the string value of a feature.private void
subStringRangeCheck(Feature feat, java.lang.String v)
java.lang.String
toShortString()
java.lang.String
toString()
java.lang.String
toString(int indent)
protected static int
wrapGetIntCatchException(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:
getAddress
in interfaceFeatureStructure
- Returns:
- the internal id of this fs - unique to this CAS, a positive int
-
_id
public final int _id()
Description copied from interface:FeatureStructure
return the unique (to this CAS) id of this feature structure- Specified by:
_id
in interfaceFeatureStructure
- Returns:
- the id
-
getType
public Type getType()
Returns the UIMA TypeImpl value- Specified by:
getType
in interfaceFeatureStructure
- Returns:
- The type.
-
_getTypeCode
public int _getTypeCode()
starts with _- Specified by:
_getTypeCode
in 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:FeatureStructure
Set the boolean value of a feature.- Specified by:
setBooleanValue
in 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:FeatureStructure
Set the byte (8 bit) value of a feature.- Specified by:
setByteValue
in 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:FeatureStructure
Set the short (16 bit) value of a feature.- Specified by:
setShortValue
in 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:FeatureStructure
Set the int value of a feature.- Specified by:
setIntValue
in 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:FeatureStructure
Set the long (64 bit) value of a feature.- Specified by:
setLongValue
in 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:FeatureStructure
Set the float value of a feature.- Specified by:
setFloatValue
in 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:FeatureStructure
Set the double value of a feature.- Specified by:
setDoubleValue
in 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:FeatureStructure
Set the string value of a feature.- Specified by:
setStringValue
in 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:FeatureStructure
Set a feature value to another FS.- Specified by:
setFeatureValue
in 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:FeatureStructure
Sets the value of a feature from a string input if the feature type is one of the primitive types.- Specified by:
setFeatureValueFromString
in interfaceFeatureStructure
- Parameters:
feat
- The feature whose value we want to set.s
- The string value that the feature will be set to.- Throws:
CASRuntimeException
- Iffeat
is 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:
getBooleanValue
in interfaceFeatureStructure
- Parameters:
feat
- The feature whose value we want to get.- Returns:
- The value int;
0
if 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:FeatureStructure
Get the byte value of a feature. This method will throw an exception if the feature is not byte valued.- Specified by:
getByteValue
in interfaceFeatureStructure
- Parameters:
feat
- The feature whose value we want to set.- Returns:
- The value byte;
0
if 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:FeatureStructure
Get the short value of a feature. This method will throw an exception if the feature is not short valued.- Specified by:
getShortValue
in interfaceFeatureStructure
- Parameters:
feat
- The feature whose value we want to get.- Returns:
- The value int;
0
if 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:FeatureStructure
Get the int value of a feature. This method will throw an exception if the feature is not int valued.- Specified by:
getIntValue
in interfaceFeatureStructure
- Parameters:
feat
- The feature whose value we want to get.- Returns:
- The value int;
0
if 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:FeatureStructure
Get the long value of a feature. This method will throw an exception if the feature is not long valued.- Specified by:
getLongValue
in interfaceFeatureStructure
- Parameters:
feat
- The feature whose value we want to get.- Returns:
- The value int;
0
if 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:FeatureStructure
Get the float value of a feature. This method will throw an exception if the feature is not float valued.- Specified by:
getFloatValue
in interfaceFeatureStructure
- Parameters:
feat
- The feature whose value we want to get.- Returns:
- The value float;
0.0
if 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:FeatureStructure
Get the double value of a feature. This method will throw an exception if the feature is not double valued.- Specified by:
getDoubleValue
in interfaceFeatureStructure
- Parameters:
feat
- The feature whose value we want to get.- Returns:
- The value int;
0
if 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:FeatureStructure
Get the string value under a feature.- Specified by:
getStringValue
in interfaceFeatureStructure
- Parameters:
feat
- The feature for which we want the value.- Returns:
- The value of this feature; may be
null
if 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:FeatureStructure
Get a feature value.- Specified by:
getFeatureValue
in interfaceFeatureStructure
- Parameters:
feat
- The feature whose value we want to get.- Returns:
- The value; may be
null
if the value has not been set.
-
_getFeatureValueNc
public TOP _getFeatureValueNc(FeatureImpl feat)
-
_getFeatureValueNc
public TOP _getFeatureValueNc(int adjOffset)
-
getCAS
public CAS getCAS()
- Specified by:
getCAS
in 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:
clone
in interfaceFeatureStructure
- Overrides:
clone
in 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:FeatureStructure
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.- Specified by:
hashCode
in interfaceFeatureStructure
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- The hash code.
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:FeatureStructure
A feature structure is equal to another feature structure iff it is identical in the underlying representation.- Specified by:
equals
in interfaceFeatureStructure
- Overrides:
equals
in 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:
toString
in classjava.lang.Object
-
toString
public java.lang.String toString(int indent)
- Specified by:
toString
in interfaceFeatureStructureImpl
-
prettyPrint
public void prettyPrint(int indent, int incr, java.lang.StringBuilder buf, boolean useShortNames)
- Specified by:
prettyPrint
in interfaceFeatureStructureImpl
-
prettyPrint
public void prettyPrint(int indent, int incr, java.lang.StringBuffer buf, boolean useShortNames)
- Specified by:
prettyPrint
in 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:
prettyPrint
in 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:
prettyPrint
in 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:FeatureStructure
Get the value of the feature as a string if the type of the feature is one of the primitive type.- Specified by:
getFeatureValueAsString
in 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)
-
-