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/23 19:52:06 UTC

svn commit: r1715916 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java

Author: schor
Date: Mon Nov 23 18:52:06 2015
New Revision: 1715916

URL: http://svn.apache.org/viewvc?rev=1715916&view=rev
Log:
[UIMA-4697] update MarkerImpl to use FS java objects

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=1715916&r1=1715915&r2=1715916&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 Mon Nov 23 18:52:06 2015
@@ -22,6 +22,7 @@ package org.apache.uima.cas.impl;
 import org.apache.uima.cas.CASRuntimeException;
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.Marker;
+import org.apache.uima.jcas.cas.TOP;
 
 /**
  * A MarkerImpl holds a high-water "mark" in the CAS,
@@ -42,32 +43,30 @@ public class MarkerImpl implements Marke
   
   CASImpl cas;
 
-  MarkerImpl(int nextFSAddr, CASImpl cas) {
-    this.nextFSId = nextFSAddr;
+  MarkerImpl(int nextFSId, CASImpl cas) {
+    this.nextFSId = nextFSId;
     this.cas = cas;
     this.isValid = true;
   }
 
   
   
-  public boolean isNew(FeatureStructure aFs) {
+  public boolean isNew(FeatureStructure fs) {
   	//check if same CAS instance
   	//TODO: define a CASRuntimeException
-    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(fs.id());
   }
 
-  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.");
+  public boolean isModified(FeatureStructure fs) {
+	  if (isNew(fs)) {
+	    return false;  // new fs's are not modified ones
 	  }
-  return isModified(fs);
+    return this.cas.getModifiedFSList(fs) != null;
   }
-  
+    
   boolean isNew(int id) {
 	  return (id >= nextFSId);
   }