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 2015/11/01 15:26:22 UTC
svn commit: r1711770 -
/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java
Author: schor
Date: Sun Nov 1 14:26:21 2015
New Revision: 1711770
URL: http://svn.apache.org/viewvc?rev=1711770&view=rev
Log:
[UIMA-4663]
Modified:
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java
Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java?rev=1711770&r1=1711769&r2=1711770&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java Sun Nov 1 14:26:21 2015
@@ -38,60 +38,40 @@ import org.apache.uima.cas.Marker;
public class MarkerImpl implements Marker {
protected int nextFSId; //next FS addr
- protected int nextStringHeapAddr;
- protected int nextByteHeapAddr;
- protected int nextShortHeapAddr;
- protected int nextLongHeapAddr;
protected boolean isValid;
CASImpl cas;
- MarkerImpl(int nextFSAddr, int nextStringHeapAddr,
- int nextByteHeapAddr, int nextShortHeapAddr, int nextLongHeapAddr,
- CASImpl cas) {
+ MarkerImpl(int nextFSAddr, CASImpl cas) {
this.nextFSId = nextFSAddr;
- this.nextStringHeapAddr = nextStringHeapAddr;
- this.nextByteHeapAddr = nextByteHeapAddr;
- this.nextShortHeapAddr = nextShortHeapAddr;
- this.nextLongHeapAddr = nextLongHeapAddr;
this.cas = cas;
this.isValid = true;
}
- public boolean isNew(FeatureStructure fs) {
+
+
+ public boolean isNew(FeatureStructure aFs) {
//check if same CAS instance
//TODO: define a CASRuntimeException
- if (!isValid || ((FeatureStructureImpl) fs).getCASImpl() != this.cas) {
- CASRuntimeException e = new CASRuntimeException(
- CASRuntimeException.CAS_MISMATCH,
- new String[] { "FS and Marker are not from the same CAS." });
- throw e;
+ FeatureStructureImplC fs = (FeatureStructureImplC) aFs;
+ if (!isValid || !cas.isInCAS(fs)) {
+ throw new CASRuntimeException(CASRuntimeException.CAS_MISMATCH, "FS and Marker are not from the same CAS.");
}
- return isNew( ((FeatureStructureImpl) fs).getAddress());
+ return isNew(fs.get_id());
}
- public boolean isModified(FeatureStructure fs) {
- if (!isValid || ((FeatureStructureImpl) fs).getCASImpl() != this.cas) {
- CASRuntimeException e = new CASRuntimeException(
- CASRuntimeException.CAS_MISMATCH,
- new String[] { "FS and Marker are not from the same CAS." });
- throw e;
- }
- int addr = ((FeatureStructureImpl) fs).getAddress();
- return isModified(addr);
- }
-
- boolean isNew(int addr) {
- return (addr >= nextFSId);
+ public boolean isModified(FeatureStructure aFs) {
+ FeatureStructureImplC fs = (FeatureStructureImplC) aFs;
+ if (!isValid || !cas.isInCAS(fs)) {
+ throw new CASRuntimeException(CASRuntimeException.CAS_MISMATCH, "FS and Marker are not from the same CAS.");
+ }
+ return isModified(fs);
}
- boolean isModified(int addr) {
- if (isNew(addr)) {
- return false;
- }
- return this.cas.getModifiedFSList().contains(addr);
+ boolean isNew(int id) {
+ return (id >= nextFSId);
}
-
+
public boolean isValid() {
return isValid;
}
@@ -99,21 +79,5 @@ public class MarkerImpl implements Marke
public int getNextFSId() {
return nextFSId;
}
-
- public int getNextStringHeapAddr() {
- return nextStringHeapAddr;
- }
-
- public int getNextByteHeapAddr() {
- return nextByteHeapAddr;
- }
-
- public int getNextShortHeapAddr() {
- return nextShortHeapAddr;
- }
-
- public int getNextLongHeapAddr() {
- return nextLongHeapAddr;
- }
}