You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2016/05/06 19:41:37 UTC
svn commit: r1742601 -
/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java
Author: schor
Date: Fri May 6 19:41:37 2016
New Revision: 1742601
URL: http://svn.apache.org/viewvc?rev=1742601&view=rev
Log:
[UIMA-4674] change feat offsets to short, for better locality of ref; precompute more boolean values
Modified:
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java?rev=1742601&r1=1742600&r2=1742601&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java Fri May 6 19:41:37 2016
@@ -39,21 +39,24 @@ public class FeatureImpl implements Feat
* the 0 based offset for this feature ignoring ref/int distinction, in feature order, without regard to JCas implemented features; set at commit time
* used by v2 style de/serializers
*/
- private int featureOffset = -1;
- private int adjustedFeatureOffset = -1; // the offset in the storage array for this feature, adjusted to exclude JCas implemented features; set at commit time
+ private short featureOffset = -1;
+ private short adjustedFeatureOffset = -1; // the offset in the storage array for this feature, adjusted to exclude JCas implemented features; set at commit time
// not used 2/29/16 to be removed
// int registryIndex = -1; // set from JCas classes feature registry
// used to setup index corruption bitset
public final boolean isInInt; // specifies which array the data is in
-
+ private final boolean isMultipleRefsAllowed;
+ /**
+ * true if the range is a long or double
+ */
+ public final boolean isLongOrDouble;
private TypeImpl highestDefiningType; // not final, could change
private final TypeImpl rangeType;
// private final TypeSystemImpl ts;
- private final boolean isMultipleRefsAllowed;
/**
* true for the feature which is the AnnotationBase sofa reference.
*/
@@ -77,6 +80,7 @@ public class FeatureImpl implements Feat
shortName = null;
slotKind = null;
rangeTypeClass = 0;
+ isLongOrDouble = false;
}
FeatureImpl(TypeImpl typeImpl, String shortName, TypeImpl rangeType, TypeSystemImpl tsi, boolean isMultipleRefsAllowed, SlotKind slotKind) {
@@ -86,6 +90,7 @@ public class FeatureImpl implements Feat
featureCode = feats.size();
this.rangeType = rangeType;
+ this.isLongOrDouble = rangeType.isLongOrDouble;
this.slotKind = slotKind;
this.shortName = shortName;
this.isMultipleRefsAllowed = isMultipleRefsAllowed;
@@ -145,8 +150,9 @@ public class FeatureImpl implements Feat
@Override
public String toString() {
return String.format(
- "%s [%s: rangeType=%s, isMultipleRefsAllowed=%s]",
- this.getClass().getSimpleName(), getName(), rangeType, isMultipleRefsAllowed);
+ "%s [%s: rangeType=%s, isMultipleRefsAllowed=%s, slotKind=%s]",
+ this.getClass().getSimpleName(), getName(), rangeType, isMultipleRefsAllowed,
+ slotKind);
}
// public String getGetterSetterName(boolean isGet) {
@@ -180,7 +186,10 @@ public class FeatureImpl implements Feat
}
void setOffset(int offset) {
- featureOffset = offset;
+ if (offset > Short.MAX_VALUE) {
+ throw new RuntimeException("Feature Offset exceeds maximum of 32767");
+ }
+ featureOffset = (short) offset;
}
public int getAdjustedOffset() {
@@ -188,7 +197,10 @@ public class FeatureImpl implements Feat
}
void setAdjustedOffset(int offset) {
- adjustedFeatureOffset = offset;
+ if (offset > Short.MAX_VALUE) {
+ throw new RuntimeException("Feature Offset exceeds maximum of 32767");
+ }
+ adjustedFeatureOffset = (short) offset;
}
// /**