You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2015/05/20 11:14:31 UTC

svn commit: r1680494 - /uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/

Author: pkluegl
Date: Wed May 20 09:14:30 2015
New Revision: 1680494

URL: http://svn.apache.org/r1680494
Log:
UIMA-4409
- fixed check on recursive type system
- avoid some warnings

Modified:
    uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/AnnotationTreeNode.java
    uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/ArrayFeatureTreeNode.java
    uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/FSFeatureTreeNode.java
    uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/FSTreeNode.java
    uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/PrimitiveFeatureTreeNode.java
    uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/TypeOrderedRootTreeNode.java
    uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/TypeTreeNode.java

Modified: uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/AnnotationTreeNode.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/AnnotationTreeNode.java?rev=1680494&r1=1680493&r2=1680494&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/AnnotationTreeNode.java (original)
+++ uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/AnnotationTreeNode.java Wed May 20 09:14:30 2015
@@ -19,7 +19,7 @@
 
 package org.apache.uima.ruta.caseditor.view.tree;
 
-import java.util.List;
+import java.util.Stack;
 
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.Type;
@@ -33,7 +33,7 @@ public class AnnotationTreeNode extends
     super(parent, annotation);
   }
   
-  public AnnotationTreeNode(ITreeNode parent, AnnotationFS annotation, List<Type> parentTypes) {
+  public AnnotationTreeNode(ITreeNode parent, AnnotationFS annotation, Stack<Type> parentTypes) {
     super(parent, annotation, parentTypes);
   }
 
@@ -46,7 +46,7 @@ public class AnnotationTreeNode extends
     return getAnnotation().getCoveredText();
   }
 
-  public Object getAdapter(Class adapter) {
+  public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
 
     if (FSTreeNode.class.equals(adapter)) {
       return this;

Modified: uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/ArrayFeatureTreeNode.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/ArrayFeatureTreeNode.java?rev=1680494&r1=1680493&r2=1680494&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/ArrayFeatureTreeNode.java (original)
+++ uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/ArrayFeatureTreeNode.java Wed May 20 09:14:30 2015
@@ -93,7 +93,7 @@ public class ArrayFeatureTreeNode implem
     // nothing to do
   }
 
-  public Object getAdapter(Class adapter) {
+  public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
 
     if (ArrayFeatureTreeNode.class.equals(adapter)) {
       return this;

Modified: uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/FSFeatureTreeNode.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/FSFeatureTreeNode.java?rev=1680494&r1=1680493&r2=1680494&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/FSFeatureTreeNode.java (original)
+++ uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/FSFeatureTreeNode.java Wed May 20 09:14:30 2015
@@ -19,7 +19,7 @@
 
 package org.apache.uima.ruta.caseditor.view.tree;
 
-import java.util.List;
+import java.util.Stack;
 
 import org.apache.uima.cas.Feature;
 import org.apache.uima.cas.FeatureStructure;
@@ -37,7 +37,7 @@ public class FSFeatureTreeNode extends F
   }
 
   public FSFeatureTreeNode(ITreeNode parent,Feature feature, FeatureStructure fs,
-          List<Type> parentTypes) {
+          Stack<Type> parentTypes) {
     super(parent, fs, parentTypes);
     this.feature = feature;
   }
@@ -51,7 +51,7 @@ public class FSFeatureTreeNode extends F
     return feature.getShortName() + ": " + getAnnotation().getCoveredText();
   }
 
-  public Object getAdapter(Class adapter) {
+  public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
     if (FSTreeNode.class.equals(adapter)) {
       return this;
     } else if (AnnotationFS.class.equals(adapter) || FeatureStructure.class.equals(adapter)) {

Modified: uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/FSTreeNode.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/FSTreeNode.java?rev=1680494&r1=1680493&r2=1680494&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/FSTreeNode.java (original)
+++ uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/FSTreeNode.java Wed May 20 09:14:30 2015
@@ -19,9 +19,9 @@
 
 package org.apache.uima.ruta.caseditor.view.tree;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Stack;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.uima.cas.ArrayFS;
@@ -37,16 +37,17 @@ public class FSTreeNode extends Abstract
   protected FeatureStructure fs;
 
   public FSTreeNode(ITreeNode parent, FeatureStructure annotation) {
-    this(parent, annotation, new ArrayList<Type>());
+    this(parent, annotation, new Stack<Type>());
   }
 
-  public FSTreeNode(ITreeNode parent, FeatureStructure annotation, List<Type> parentTypes) {
+  public FSTreeNode(ITreeNode parent, FeatureStructure annotation, Stack<Type> parentTypes) {
     super(parent);
     this.fs = annotation;
-    parentTypes.add(fs.getType());
+    parentTypes.push(fs.getType());
     for (Feature f : annotation.getType().getFeatures()) {
       addFeatures(this, f, annotation, parentTypes);
     }
+    parentTypes.pop();
   }
 
   public String getName() {
@@ -58,7 +59,7 @@ public class FSTreeNode extends Abstract
   }
 
   public void addFeatures(ITreeNode parent, Feature f, FeatureStructure featureStructure,
-          List<Type> parentTypes) {
+          Stack<Type> parentTypes) {
     if (f.getRange().isArray()) {
       // handle all kinds of arrays
       FeatureStructure featureValue = featureStructure.getFeatureValue(f);
@@ -109,10 +110,10 @@ public class FSTreeNode extends Abstract
 
   private boolean expandable(Type type, List<Type> parentTypes) {
     int frequency = Collections.frequency(parentTypes, type);
-    return frequency < 5;
+    return frequency < 2;
   }
 
-  public Object getAdapter(Class adapter) {
+  public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
     if (FSTreeNode.class.equals(adapter)) {
       return this;
     } else if (FeatureStructure.class.equals(adapter)) {

Modified: uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/PrimitiveFeatureTreeNode.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/PrimitiveFeatureTreeNode.java?rev=1680494&r1=1680493&r2=1680494&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/PrimitiveFeatureTreeNode.java (original)
+++ uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/PrimitiveFeatureTreeNode.java Wed May 20 09:14:30 2015
@@ -90,7 +90,7 @@ public class PrimitiveFeatureTreeNode im
     // nothing to do
   }
 
-  public Object getAdapter(Class adapter) {
+  public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
 
     if (PrimitiveFeatureTreeNode.class.equals(adapter)) {
       return this;

Modified: uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/TypeOrderedRootTreeNode.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/TypeOrderedRootTreeNode.java?rev=1680494&r1=1680493&r2=1680494&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/TypeOrderedRootTreeNode.java (original)
+++ uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/TypeOrderedRootTreeNode.java Wed May 20 09:14:30 2015
@@ -19,11 +19,11 @@
 
 package org.apache.uima.ruta.caseditor.view.tree;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.Map;
+import java.util.Stack;
 
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.Type;
@@ -90,7 +90,7 @@ public class TypeOrderedRootTreeNode ext
 
   private FSTreeNode createFSNode(ITreeNode parent, FeatureStructure fs) {
     if (fs instanceof AnnotationFS) {
-      return new AnnotationTreeNode(parent, (AnnotationFS) fs, new ArrayList<Type>());
+      return new AnnotationTreeNode(parent, (AnnotationFS) fs, new Stack<Type>());
     }
     return new FSTreeNode(parent, fs);
   }
@@ -151,7 +151,7 @@ public class TypeOrderedRootTreeNode ext
     sort(new TreeComparator());
   }
 
-  public Object getAdapter(Class adapter) {
+  public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
 
     if (TypeTreeNode.class.equals(adapter)) {
       return this;

Modified: uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/TypeTreeNode.java
URL: http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/TypeTreeNode.java?rev=1680494&r1=1680493&r2=1680494&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/TypeTreeNode.java (original)
+++ uima/ruta/trunk/ruta-ep-caseditor/src/main/java/org/apache/uima/ruta/caseditor/view/tree/TypeTreeNode.java Wed May 20 09:14:30 2015
@@ -57,7 +57,7 @@ public class TypeTreeNode extends Abstra
     return type.hashCode();
   }
 
-  public Object getAdapter(Class adapter) {
+  public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
 
     if (TypeTreeNode.class.equals(adapter)) {
       return this;