ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1687526 - /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/ListFactory.java
Date Thu, 25 Jun 2015 14:10:14 GMT
Author: tmill
Date: Thu Jun 25 14:10:14 2015
New Revision: 1687526

URL: http://svn.apache.org/r1687526
Log:
New method to list factory for appending elements.

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/ListFactory.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/ListFactory.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/ListFactory.java?rev=1687526&r1=1687525&r2=1687526&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/ListFactory.java (original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/ListFactory.java Thu
Jun 25 14:10:14 2015
@@ -65,4 +65,19 @@ public class ListFactory {
 		
 		return firstList;
 	}
+	
+	public static void append(JCas jcas, FSList list, TOP element){
+	  if(list instanceof EmptyFSList) return;
+	  	  
+	  NonEmptyFSList cur = (NonEmptyFSList) list;
+	  while(cur.getTail() instanceof NonEmptyFSList){
+	    cur = (NonEmptyFSList) cur.getTail();
+	  }
+    NonEmptyFSList newElList = new NonEmptyFSList(jcas);
+    newElList.setHead(element);
+    newElList.setTail(new EmptyFSList(jcas));
+    cur.setTail(newElList);
+    newElList.addToIndexes();
+    newElList.getTail().addToIndexes();
+	}
 }



Mime
View raw message