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

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 22:57:38 2016
New Revision: 1730767

URL: http://svn.apache.org/viewvc?rev=1730767&view=rev
Log:
[UIMA-4674] restore the default heap size and reset heap size values; use to 
manage initial size of data structure tracking FSs in creation order.  remove 
cache_not_in_index - using bit flag in fs instead for quick determination if fs 
is not in any index. remove use of AtomicInteger on critical path for FS 
creation. Make IS_THROW_EXCEPTION_CORRUPT_INDEX updatable (not final) for test 
case use. Rename tsi -> tsi_local to avoid accidental shadowing.  Fix many low 
level accessors and also mark them deprecated (because nothing is "holding on" 
to a low-level FS handle and the FS might be GCd.) Many low level accessors 
were making the mistake of assuming no JCas definition was present.  Clean up 
some redundant code around checking for invalid modification.  Add reset of fs 
in any index when doing the corruption removal.  mark some critical path 
methods as final (hoping this might speed up dispatch - but not confirmed). Use 
fast non-checking copiers for copying features of FSs in support of
  CasCopier.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1730767&r1=1730766&r2=1730767&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
 Tue Feb 16 22:57:38 2016
@@ -120,7 +120,7 @@ public class CASImpl extends AbstractCas
   private static final boolean trace = false;
   
   // debug
-  private static final AtomicInteger casIdProvider = new AtomicInteger(0);
+  static final AtomicInteger casIdProvider = new AtomicInteger(0);
 
   // Notes on the implementation
   // ---
@@ -136,6 +136,10 @@ public class CASImpl extends AbstractCas
   public static final int TRUE = 1;
 
   public static final int FALSE = 0;
+  
+  public static final int DEFAULT_INITIAL_HEAP_SIZE = 500_000;
+  
+  public static final int DEFAULT_RESET_HEAP_SIZE = 5_000_000;
 
   /**
* The UIMA framework detects (unless disabled, for high performance) 
updates to indexed FS which update
@@ -154,7 +158,7 @@ public class CASImpl extends AbstractCas
   public static final String THROW_EXCEPTION_FS_UPDATES_CORRUPTS = 
"uima.exception_when_fs_update_corrupts_index";
   
   // public for test case use
-  public static final boolean IS_THROW_EXCEPTION_CORRUPT_INDEX = 
Misc.getNoValueSystemProperty(THROW_EXCEPTION_FS_UPDATES_CORRUPTS);
+  public static boolean IS_THROW_EXCEPTION_CORRUPT_INDEX = 
Misc.getNoValueSystemProperty(THROW_EXCEPTION_FS_UPDATES_CORRUPTS);
   
   /**
* Define this JVM property to enable checking for invalid updates to 
features which are used as 
@@ -247,7 +251,7 @@ public class CASImpl extends AbstractCas
 /**
  * map from FS ids to FSs.  
  */
-final private Id2FS id2fs = new Id2FS();
+ final private Id2FS id2fs;
 
 // private SymbolTable stringTable;
 // private ArrayList stringList;
@@ -261,8 +265,6 @@ public class CASImpl extends AbstractCas
 
 // Base CAS for all views
 final private CASImpl baseCAS;
-
-private FeatureStructure cache_not_in_index = null; // a one item cache of 
a FS guaranteed to not be in any index
 
 /**
  * These fields are here, not in TypeSystemImpl, because different CASes 
may have different indexes but share the same type system
@@ -365,7 +367,14 @@ public class CASImpl extends AbstractCas
 boolean fsTobeAddedbackSingleInUse = false;
 
 // used to generate FSIDs, increments by 1 for each use.  First id == 1
-private AtomicInteger fsIdGenerator = new AtomicInteger(0);
+private int fsIdGenerator = 0;
+
+/**
+ * used to "capture" the fsIdGenerator value for a read-only CAS to be 
visible in
+ * other threads
+ */
+AtomicInteger fsIdLastValue = new AtomicInteger(0);
+
 
 // mostly for debug - counts # times cas is reset
 private final AtomicInteger casResets = new AtomicInteger(0);
@@ -382,17 +391,17 @@ public class CASImpl extends AbstractCas
 
 private final BinaryCasSerDes bcsd;
 
-private SharedViewData(CASImpl baseCAS, TypeSystemImpl tsi) {
+private SharedViewData(CASImpl baseCAS, int initialHeapSize, 
TypeSystemImpl tsi) {
   this.baseCAS = baseCAS;
   this.tsi = tsi;
   bcsd = new BinaryCasSerDes(baseCAS);
+  id2fs = new Id2FS(initialHeapSize);
 }
 
 void clearCasReset() {
   // fss
-  fsIdGenerator.

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

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 22:39:49 2016
New Revision: 1730766

URL: http://svn.apache.org/viewvc?rev=1730766&view=rev
Log:
[UIMA-4674] based on profiling, add non-checking forms for some iterator 
operations, to be used when the context guarantees the check isn't needed.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java?rev=1730766&r1=1730765&r2=1730766&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java
 Tue Feb 16 22:39:49 2016
@@ -89,6 +89,11 @@ class FilteredIterator

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

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 22:39:19 2016
New Revision: 1730765

URL: http://svn.apache.org/viewvc?rev=1730765&view=rev
Log:
[UIMA-4674] clarify flags meaning - only for use in index corruption checking, 
doesn't apply to bag indexes. Rename some methods with more appropriate names.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java?rev=1730765&r1=1730764&r2=1730765&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
 Tue Feb 16 22:39:19 2016
@@ -90,6 +90,7 @@ public class FeatureStructureImplC imple
   public static final String DISABLE_RUNTIME_FEATURE_VALUE_VALIDATION = 
"uima.disable_runtime_feature_validation";
   public static final boolean IS_ENABLE_RUNTIME_FEATURE_VALUE_VALIDATION  = 
!Misc.getNoValueSystemProperty(DISABLE_RUNTIME_FEATURE_VALUE_VALIDATION);
 
+  public static final int IN_SET_SORTED_INDEX = 1;
   // data storage
   // slots start with _ to prevent name collision with JCas style getters and 
setters.
   
@@ -97,10 +98,9 @@ public class FeatureStructureImplC imple
   protected final Object[] _refData;
   protected final int _id;  // a separate slot for access without loading 
_intData object
   protected int flags = 0;  // a set of flags
-// bit 0 (least significant): fs is in one or more 
indexes
+// bit 0 (least significant): fs is in one or more 
non-bag indexes
 // bits 1-31 reserved

-
   
   /**
* These next two object references are the same for every FS of this class 
created in one view.
@@ -436,7 +436,7 @@ public class FeatureStructureImplC imple
   ((JCas_setter_long)setter).set(this, v);
 } else {
   if (IS_ENABLE_RUNTIME_FEATURE_VALIDATION) featureValidation(feat);
-  _casView.setFeatureValue(this, (FeatureImpl) feat, (int)(v & 
0x), (int)(v >> 32));
+  _casView.setLongValue(this, (FeatureImpl) feat, (int)(v & 0x), 
(int)(v >> 32));
 }
   }
 
@@ -445,7 +445,7 @@ public class FeatureStructureImplC imple
 if (setter != null) {
   ((JCas_setter_long)setter).set(this, v);
 } else {
-  _casView.setFeatureValueNcNj(this, fi, (int)(v & 0x), (int)(v >> 
32));
+  _casView.setLongValueNcNj(this, fi, (int)(v & 0x), (int)(v >> 
32));
 }
   }
 
@@ -536,7 +536,7 @@ public class FeatureStructureImplC imple
 }
   }
 
-  public void setFeatureValueNoIndexCorruptionCheck(Feature feat, Object v) {
+  public void setFeatureValueNoIndexCorruptionCheck(Feature feat, TOP v) {
 FeatureImpl fi = (FeatureImpl) feat;
  
 if (fi.isInInt) {
@@ -548,7 +548,7 @@ public class FeatureStructureImplC imple
  
 Object setter =  fi.getJCasSetter();
 if (setter != null) {
-  ((JCas_setter_generic)setter).set(this, v);
+  ((JCas_setter_generic)setter).set(this, v);  // also may do 
logging
 } else {
   _refData[fi.getAdjustedOffset()] = v;
   if (_casView.isLogging()) { 
@@ -1184,11 +1184,11 @@ public class FeatureStructureImplC imple
 return Integer.compare(this._id, o.id());
   }
   
-  protected boolean _isIndexed() { return (flags & 1) != 0;}
-  protected void _setIsIndexed() { flags |= 1; }
+  protected boolean _inSetSortedIndex() { return (flags & IN_SET_SORTED_INDEX) 
!= 0;}
+  protected void _setInSetSortedIndexed() { flags |= IN_SET_SORTED_INDEX; }
   /**
* All callers of this must insure fs is not indexed in **Any** View
*/
-  protected void _resetIsIndexed() { flags &= 0xfffe; }
-  
+  protected void _resetInSetSortedIndex() { flags &= ~IN_SET_SORTED_INDEX; }
+   
 }
\ No newline at end of file




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

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 22:36:36 2016
New Revision: 1730764

URL: http://svn.apache.org/viewvc?rev=1730764&view=rev
Log:
[UIMA-4674] allow initial heap size spec to set the size for this structure.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/Id2FS.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/Id2FS.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/Id2FS.java?rev=1730764&r1=1730763&r2=1730764&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/Id2FS.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/Id2FS.java
 Tue Feb 16 22:36:36 2016
@@ -24,7 +24,6 @@ import java.util.ArrayList;
 import java.util.function.Consumer;
 
 import org.apache.uima.cas.CASRuntimeException;
-import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.jcas.cas.TOP;
 
 /**
@@ -45,8 +44,8 @@ public class Id2FS {

   final private ArrayList> id2fsw;
   
-  public Id2FS() {  
-id2fsw = new ArrayList<>();
+  public Id2FS(int initialHeapSize) {  
+id2fsw = new ArrayList<>(initialHeapSize >> 4);  
 id2fsw.add(null);  // because id's start with 1
   }
   
@@ -76,10 +75,19 @@ public class Id2FS {
 return id2fsw.size(); 
   }
   
+  /**
+   * adjusts the underlying array down in size if grew beyond the reset heap 
size value
+   */
   void clear() {
-id2fsw.clear();
-id2fsw.add(null); // so that ids start at 1
-id2fsw.trimToSize();
+if (id2fsw.size() > (CASImpl.DEFAULT_RESET_HEAP_SIZE >> 4)) {
+  id2fsw.clear();
+  id2fsw.add(null); // so that ids start at 1
+  id2fsw.trimToSize();  
+  id2fsw.ensureCapacity(CASImpl.DEFAULT_INITIAL_HEAP_SIZE >> 4); 
+} else {
+  id2fsw.clear();
+  id2fsw.add(null); // so that ids start at 1  
+}
   }
   
   /**




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

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 22:35:41 2016
New Revision: 1730763

URL: http://svn.apache.org/viewvc?rev=1730763&view=rev
Log:
[UIMA-4674] based on profiling, add non-checking forms for some iterator 
operations, to be used when the context guarantees the check isn't needed.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_aggregation_common.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_ordered.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_snapshot.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_unordered.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LLUnambiguousIteratorImpl.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LowLevelIterator.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_aggregation_common.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_aggregation_common.java?rev=1730763&r1=1730762&r2=1730763&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_aggregation_common.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_aggregation_common.java
 Tue Feb 16 22:35:41 2016
@@ -63,6 +63,10 @@ class FsIterator_aggregation_common= 0 &&
@@ -131,6 +135,25 @@ class FsIterator_aggregation_common it = iterators[lastValidIndex];
+it.moveToNextNvc();
+
+if (it.isValid()) {
+  return;
+}
+
+final int nbrIt = iterators.length;
+for (int i = lastValidIndex + 1; i < nbrIt; i++) {
+  it = iterators[i];
+  it.moveToFirst();
+  if (it.isValid()) {
+lastValidIndex = i;
+return;
+  }
+}
+lastValidIndex = iterators.length;  // invalid position
+  }
 
   public void moveToPrevious() {
 // No point in going anywhere if iterator is not valid.

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java?rev=1730763&r1=1730762&r2=1730763&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java
 Tue Feb 16 22:35:41 2016
@@ -61,6 +61,11 @@ class FsIterator_baghttp://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted.java?rev=1730763&r1=1730762&r2=1730763&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted.java
 Tue Feb 16 22:35:41 2016
@@ -83,7 +83,11 @@ class FsIterator_set_sortedhttp://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java?rev=1730763&r1=1730762&r2=1730763&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java
 Tue Feb 16 22:35:41 2016
@@ -37,7 +37,7 @@ public abstract class FsIterator_singlet
 // subtypes do moveToFirst after they finish initialization
   }
 
-  protected > I checkConcurrentModification() {
+  final protected > I checkConcurrentModification() {
 if ((null != detectIllegalIndexUpdates) && (modificationSna

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

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 22:34:07 2016
New Revision: 1730762

URL: http://svn.apache.org/viewvc?rev=1730762&view=rev
Log:
[UIMA-4674] based on profiling, add non-checking forms for some iterator 
operations, to be used when the context guarantees the check isn't needed.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java?rev=1730762&r1=1730761&r2=1730762&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
 Tue Feb 16 22:34:07 2016
@@ -164,7 +164,7 @@ public class Subiterator this.boundingEnd)) {
+  while (it.isValid() && (it.getNvc().getEnd() > this.boundingEnd)) {
 it.moveToNext();
   }
 }
@@ -299,6 +303,19 @@ public class Subiterator boundingEnd)) {
+  it.moveToLast();
+  it.moveToNext();  // mark invalid
+} else {
+  setPrevEnd();
+}
+  }
+
 
   /*
* (non-Javadoc)




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

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 22:31:38 2016
New Revision: 1730761

URL: http://svn.apache.org/viewvc?rev=1730761&view=rev
Log:
[UIMA-4673] make the hash map from short feat names to features permanent, 
final. Speed up isAppropriateFeature test. Add a boolean hasRef, true if any 
slot is an fs ref - used for lazy init in form 4 deserialization

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java?rev=1730761&r1=1730760&r2=1730761&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java
 Tue Feb 16 22:31:38 2016
@@ -118,7 +118,7 @@ public class TypeImpl implements Type, C
   private final List directSubtypes = new ArrayList<>();
 
   //   Features  *
-  private   Map staticMergedFeatures = new 
LinkedHashMap<>(1); // set to null at commit time
+  private final Map staticMergedFeatures = new 
LinkedHashMap<>(1); // set to null at commit time
   private final List staticMergedFeaturesList = new 
ArrayList<>(0);  // set after commit
   private final List staticMergedFeaturesIntroducedByThisType = 
new ArrayList<>(0);
   
@@ -331,11 +331,12 @@ public class TypeImpl implements Type, C
*/
   @Override
   public int getNumberOfFeatures() {
-return (staticMergedFeatures != null) ? staticMergedFeatures.size() : 
staticMergedFeaturesList.size();
+return staticMergedFeatures.size();
   }
   
   public boolean isAppropriateFeature(Feature feature) {
-return feature == getFeatureByBaseName(feature.getShortName());
+TypeImpl domain = (TypeImpl) feature.getDomain();
+return domain.subsumes(this);
   }
 
   /**
@@ -389,15 +390,7 @@ public class TypeImpl implements Type, C
*/
   @Override
   public FeatureImpl getFeatureByBaseName(String featureShortName) {
-if (staticMergedFeatures != null) {
-  return staticMergedFeatures.get(featureShortName);
-}
-for (FeatureImpl fi : staticMergedFeaturesList) {
-  if (fi.getShortName().equals(featureShortName)) {
-return fi;
-  }
-}
-return null;
+return staticMergedFeatures.get(featureShortName);
   }
 
   /**
@@ -453,7 +446,7 @@ public class TypeImpl implements Type, C
*/
   @Override
   public List getFeatures() {
-return new ArrayList<>( (staticMergedFeatures != null) ? 
staticMergedFeatures.values() : staticMergedFeaturesList);
+return new ArrayList<>(getFeatureImpls());
   }
   
   /** 
@@ -462,8 +455,7 @@ public class TypeImpl implements Type, C
* @return the list of feature impls
*/
   public List getFeatureImpls() {
-if (staticMergedFeatures != null) {
-  // means not yet committed
+if (!tsi.isCommitted()) {
   // recompute the list if needed
   int nbrOfFeats = staticMergedFeatures.size();
   if (nbrOfFeats != staticMergedFeaturesList.size()) {
@@ -477,18 +469,21 @@ public class TypeImpl implements Type, C
 synchronized (staticMergedFeaturesList) {
   staticMergedFeaturesList.clear();
   staticMergedFeaturesList.addAll(superType.getFeatureImpls());
-  
staticMergedFeaturesList.addAll(staticMergedFeaturesIntroducedByThisType);
-  if (superType.hasRefFeature) {
-hasRefFeature = true;
-  } else {
-for (FeatureImpl fi : staticMergedFeaturesIntroducedByThisType) {
-  if (fi.getRangeImpl().isRefType) {
-hasRefFeature = true;
-break;
-  }
+  
staticMergedFeaturesList.addAll(staticMergedFeaturesIntroducedByThisType);   
+}
+  }
+  
+  private void computeHasRef() {
+if (superType.hasRefFeature) {
+  hasRefFeature = true;
+} else {
+  for (FeatureImpl fi : staticMergedFeaturesIntroducedByThisType) {
+if (fi.getRangeImpl().isRefType) {
+  hasRefFeature = true;
+  break;
 }
   }
-}
+}
   }
   
   Stream getFeaturesAsStream() {
@@ -739,11 +734,15 @@ public class TypeImpl implements Type, C
 //creator = fi;
 //  }
   
-  public boolean subsumes(TypeImpl ti) {
+  final public boolean subsumes(TypeImpl ti) {
+if (depthFirstCode <= ti.depthFirstCode && ti.depthFirstCode < 
depthFirstNextSibling) {
+  return true;
+}
 
 if (depthFirstNextSibling != 0) {
-  return (depthFirstCode <= ti.depthFirstCode && ti.depthFirstCode < 
depthFirstNextSibling);
+  return false;
 }
+
 return getTypeSystem().subsumes(this, ti);
   }
   
@@ -766,9 +765,8 @@ public class TypeImpl implements Type, C
 if

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

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 22:27:29 2016
New Revision: 1730760

URL: http://svn.apache.org/viewvc?rev=1730760&view=rev
Log:
[UIMA-4674] some of the computation during commit depends on the commit 
(locked) flag being false, so move the setting of this to the end of commit.  
Also make one method public - the one that returns the type array size.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?rev=1730760&r1=1730759&r2=1730760&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
 Tue Feb 16 22:27:29 2016
@@ -675,7 +675,7 @@ public class TypeSystemImpl implements T
 return LEAST_FEATURE_CODE;
   }
 
-  final int getTypeArraySize() {
+  public final int getTypeArraySize() {
 return getNumberOfTypes() + getSmallestType();
   }
 
@@ -1307,7 +1307,6 @@ public class TypeSystemImpl implements T
   if (this.locked) {
 return this; // might be called multiple times, but only need to do 
once
   }
-  this.locked = true;
   // because subsumes depends on it
   // and generator initialization uses subsumes
   //this.numCommittedTypes = this.getNumberOfTypes(); // do before
@@ -1346,6 +1345,7 @@ public class TypeSystemImpl implements T
   fsClassRegistry = new FSClassRegistry(this, true);
   
   computeAdjustedFeatureOffsets(topType, 0, 0);
+  this.locked = true;
   return this;
 } // of sync block 
   }
@@ -2380,7 +2380,21 @@ public class TypeSystemImpl implements T
 return result;
   }
 
+  // debug - compare two type systems, print first different type
+  public static void compareTs(TypeSystem t1, TypeSystem t2) {
+TypeSystemImpl ts1 = (TypeSystemImpl) t1;
+TypeSystemImpl ts2 = (TypeSystemImpl) t2;
+if (ts1.types.size() != ts2.types.size()) {
+  System.out.format("ts1 size: %,d ts2 size: %d%n", ts1.types.size(), 
ts2.types.size());
+}
 
+for (int i = 1; i < ts1.types.size(); i++) {
+  if (ts1.types.get(i).hashCode() != ts2.types.get(i).hashCode()) {
+System.out.format("ts1 type: %s%n%nts2 type: %s%n", ts1.types.get(i), 
ts2.types.get(i));
+  }
+}
+System.out.println("done");
+  }
 
   @Override
   public boolean equals(Object obj) {




svn commit: r1730746 - in /uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator: ProcessAccounting.java StateJobAccounting.java user/UserLogging.java

2016-02-16 Thread degenaro
Author: degenaro
Date: Tue Feb 16 20:40:23 2016
New Revision: 1730746

URL: http://svn.apache.org/viewvc?rev=1730746&view=rev
Log:
UIMA-4799 DUCC Orchestrator (OR) Service Instance failures are not captured in 
any user viewable log

Modified:

uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/ProcessAccounting.java

uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateJobAccounting.java

uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/user/UserLogging.java

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/ProcessAccounting.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/ProcessAccounting.java?rev=1730746&r1=1730745&r2=1730746&view=diff
==
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/ProcessAccounting.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/ProcessAccounting.java
 Tue Feb 16 20:40:23 2016
@@ -29,6 +29,7 @@ import org.apache.uima.ducc.common.utils
 import org.apache.uima.ducc.common.utils.DuccLoggerComponents;
 import org.apache.uima.ducc.common.utils.TimeStamp;
 import org.apache.uima.ducc.common.utils.id.DuccId;
+import org.apache.uima.ducc.orchestrator.user.UserLogging;
 import org.apache.uima.ducc.orchestrator.utilities.TrackSync;
 import org.apache.uima.ducc.transport.agent.IUimaPipelineAEComponent;
 import org.apache.uima.ducc.transport.event.common.DuccWorkJob;
@@ -423,6 +424,14 @@ public class ProcessAccounting {
logger.debug(methodName, job.getDuccId(), 
process.getDuccId(), messages.fetchLabel("process 
state")+inventoryProcess.getProcessState()+" => "+messages.fetchLabel("resource 
state")+process.getResourceState());
break;
}
+   switch(job.getDuccType()) {
+   case Service:
+   IDuccWorkJob service = job;
+   String userName = 
service.getStandardInfo().getUser();
+   String userLogDir = service.getUserLogsDir();
+   UserLogging.error(userName, userLogDir, 
process.getReasonForStoppingProcess());
+   break;
+   }
break;
default:
logger.debug(methodName, job.getDuccId(), 
process.getDuccId(), messages.fetchLabel("process 
state")+inventoryProcess.getProcessState()+" => "+messages.fetchLabel("resource 
state")+process.getResourceState());

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateJobAccounting.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateJobAccounting.java?rev=1730746&r1=1730745&r2=1730746&view=diff
==
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateJobAccounting.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/StateJobAccounting.java
 Tue Feb 16 20:40:23 2016
@@ -354,11 +354,10 @@ public class StateJobAccounting {
jobid = job.getDuccId();
String userName = job.getStandardInfo().getUser();
String userLogDir = 
job.getUserLogsDir()+job.getDuccId().getFriendly()+File.separator;
-   UserLogging userLogging = new UserLogging(userName, 
userLogDir);
JobState jobState = job.getJobState();
if(jobState != null) {
text = jobState.toString();
-   userLogging.toUserDuccLog(text);
+   UserLogging.record(userName, userLogDir, text);
logger.debug(methodName, job.getDuccId(), text);
}
}
@@ -375,17 +374,16 @@ public class StateJobAccounting {
jobid = job.getDuccId();
String userName = job.getStandardInfo().getUser();
String userLogDir = 
job.getUserLogsDir()+job.getDuccId().getFriendly()+File.separator;
-   UserLogging userLogging = new UserLogging(userName, 
userLogDir);
JobCompletionType jobCompletionType = 
job.getCompletionType();
  

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

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 16:12:58 2016
New Revision: 1730710

URL: http://svn.apache.org/viewvc?rev=1730710&view=rev
Log:
no Jira - minor cleanup

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java?rev=1730710&r1=1730709&r2=1730710&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
 Tue Feb 16 16:12:58 2016
@@ -630,10 +630,7 @@ public class FeatureStructureImplC imple
   @Override
   public boolean getBooleanValue(Feature feat) {
 if (IS_ENABLE_RUNTIME_FEATURE_VALIDATION) featureValidation(feat);
-FeatureImpl fi = (FeatureImpl) feat;
-Object getter =  fi.getJCasGetter();
-return (getter != null) ? ((JCas_getter_boolean)getter).get(this)
-: getIntValueCommon(fi) == 1;
+return getBooleanValueNc((FeatureImpl) feat);
   }
 
   public boolean getBooleanValueNc(FeatureImpl fi) {




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

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 16:07:56 2016
New Revision: 1730709

URL: http://svn.apache.org/viewvc?rev=1730709&view=rev
Log:
[UIMA-4674] Performance: add flags word to FSs, one bit used so far - on means 
this fs is in some index.  Add non-checking accessors (for use by cas copier 
and other callers who know their feature objects are valid, and the object 
values are valid, and the FS being modified is not indexed, and is new (above 
any "mark" line).  Remove the 1 word FS cache not-in-index, now that there's a 
flag per FS.  Speed up the featureValidation test.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java?rev=1730709&r1=1730708&r2=1730709&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
 Tue Feb 16 16:07:56 2016
@@ -96,6 +96,10 @@ public class FeatureStructureImplC imple
   protected final int[] _intData;  
   protected final Object[] _refData;
   protected final int _id;  // a separate slot for access without loading 
_intData object
+  protected int flags = 0;  // a set of flags
+// bit 0 (least significant): fs is in one or more 
indexes
+// bits 1-31 reserved
+   
 
   
   /**
@@ -165,7 +169,6 @@ public class FeatureStructureImplC imple
 _refData = (c == 0) ? null : new Object[c];
 
 _id = _casView.setId2fs((TOP)this); 
-_casView.setCacheNotInIndex(this);
   }
   
   
@@ -265,7 +268,9 @@ public class FeatureStructureImplC imple
*   - if no, then converge the code to an _intData or _refData reference
***/
   protected void featureValidation(Feature feat) {
-if (!_typeImpl.isAppropriateFeature(feat)) {
+
+if (!(((TypeImpl) (feat.getDomain()) ).subsumes(_typeImpl))) {
+
   /* Feature "{0}" is not defined for type "{1}". */
   throw new CASRuntimeException(CASRuntimeException.INAPPROP_FEAT, 
feat.getName(), _typeImpl.getName());
 }
@@ -285,10 +290,10 @@ public class FeatureStructureImplC imple
   return true;
 }
 
-final int rtc = range.getCode();
+final int rangeTypeCode = range.getCode();
 
 /* The assignment is stricter than the Java rules - must match */
-switch (rtc) {
+switch (rangeTypeCode) {
 case TypeSystemImpl.booleanArrayTypeCode:
   return v instanceof BooleanArray;
 case TypeSystemImpl.byteArrayTypeCode:
@@ -307,42 +312,16 @@ public class FeatureStructureImplC imple
   return v instanceof StringArray;
 case TypeSystemImpl.javaObjectArrayTypeCode:
   return v instanceof JavaObjectArray;
+case TypeSystemImpl.fsArrayTypeCode:
+  return v instanceof FSArray;
 }
 
-if (!(v instanceof FeatureStructureImplC)) { return false; }
-final TypeImpl vType = ((FeatureStructureImplC) v)._typeImpl;
-if (!vType.isArray()) { return false; }
-
-if (rtc == TypeSystemImpl.fsArrayTypeCode) {
-  return !vType.isPrimitive();
-}
-
-// because we cannot create xyz[] instances (10/2015) 
-// but can only create instances of FSArray
-// we violate the typing restrictions and allow
-// assigning FSArray  == TOP[] to some xyz[] type.
-// This should be fixed.
-final int vCode = vType.getCode();
-if (vCode == TypeSystemImpl.fsArrayTypeCode) {
-  // range type isArray
-  // range type is not one of the built-in primitive arrays
-  // 
-  // case where range type is TOP or ArrayBase is handled by 
-  //   the caller
-  return true;
-}
+// it is possible that the array has a special type code corresponding to 
a type "someUserType"[]
+//   meaning an array of some user type.  UIMA implements these as 
instances of FSArray (I think)
 
-// Both range and value are arrays, but 
-//   - neither are primitive arrays, and 
-//   - neither are fsArrays.
+if (!(v instanceof FSArray)) { return false; }
 
-// this case will only happen if we can create non FSArrays
-//   of particular types
-
-Misc.internalError();  //System.out.println("Debug - should never hit 
this");
-return false;
-
-//return (range.getComponentType() == 
((TypeImpl)(vc._typeImpl)).getComponentType());
+return true;
   }
 
   /**
@@ -363,6 +342,10 @@ public class FeatureStructureImplC imple
   protected void setRef

svn commit: r1730707 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCopier.java

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 16:02:20 2016
New Revision: 1730707

URL: http://svn.apache.org/viewvc?rev=1730707&view=rev
Log:
[UIMA-4674] cas copier speedups - use non-checking forms of feature 
getters/setters, faster iterators; presize some internal data structures.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCopier.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCopier.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCopier.java?rev=1730707&r1=1730706&r2=1730707&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCopier.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCopier.java
 Tue Feb 16 16:02:20 2016
@@ -202,8 +202,8 @@ public class CasCopier {
   private final TypeSystemImpl srcTsi;
   private final TypeSystemImpl tgtTsi;
   
-  private final Int2ObjListMapsrc2TgtType = new 
Int2ObjListMap<>();  
-  private final Int2ObjListMap src2TgtFeat = new 
Int2ObjListMap<>();
+  private final Int2ObjListMapsrc2TgtType;  
+  private final Int2ObjListMap src2TgtFeat;
   
 //  
 //  private final TypeImpl srcStringType;
@@ -233,7 +233,7 @@ public class CasCopier {
* Target not set for DocumentAnnotation or SofaFSs
* Target not set if lenient specified and src type isn't in target
*/
-  final private Map mFsMap = new IdentityHashMap<>();
+  final private Map mFsMap;
   
   /**
* Deferred calls to copy Features of a FS
@@ -275,6 +275,7 @@ public class CasCopier {
*/
   public CasCopier(CAS aSrcCas, CAS aDestCas, boolean lenient) {
 
+mFsMap = new 
IdentityHashMap<>(((CASImpl)(aSrcCas.getLowLevelCAS())).getLastUsedFsId());
 originalSrcCas = aSrcCas;
 originalTgtCas = aDestCas;
 
@@ -283,7 +284,11 @@ public class CasCopier {
 
 srcTsi = originalSrcCasImpl.getTypeSystemImpl();
 tgtTsi = originalTgtCasImpl.getTypeSystemImpl();
+
+src2TgtType = (srcTsi == tgtTsi) ? null : new 
Int2ObjListMap(srcTsi.getTypeArraySize());
+src2TgtFeat = (srcTsi == tgtTsi) ? null : new 
Int2ObjListMap(srcTsi.getNumberOfFeatures() + 1);
 
+
 //tInfoArray = new TypeInfo[srcTsi.getLargestTypeCode() + 1];
 
 //srcStringType = srcTsi.stringType;
@@ -551,7 +556,8 @@ public class CasCopier {
 //LowLevelIterator it = 
((FSIndexRepositoryImpl)(srcCasViewImpl.getIndexRepository())).ll_getAllIndexedFS(srcTsi.getTopType());
 
 while (it.hasNext()) {
-  final TOP fs = it.next();
+  final TOP fs = it.nextNvc();
+//  System.out.format("debug  id: %,d  type: %s%n", fs.id(), 
fs._typeImpl.getShortName());
 //Iterator indexes = 
srcCasViewImpl.getIndexRepository().ll_getIndexes();
 //while (indexes.hasNext()) {
 //  LowLevelIndex index = indexes.next();
@@ -792,9 +798,9 @@ public class CasCopier {
 if (fi.isAnnotBaseSofaRef) {
   continue;
 }
-TOP refFs = srcFS.getFeatureValue(fi);
+TOP refFs = srcFS.getFeatureValueNc(fi);
 if (null != refFs) {
-  tgtFS.setFeatureValue(tgtFi, copyFsInner(refFs));  
+  tgtFS.setFeatureValueNcNj(tgtFi, copyFsInner(refFs));  // recursive 
call
 }
   }
 }
@@ -943,6 +949,9 @@ public class CasCopier {
   }
   
   private TypeImpl getTargetType(TypeImpl srcTi) {
+if (srcTsi == tgtTsi) {
+  return srcTi;
+}
 int srcTypeCode = srcTi.getCode();
 TypeImpl r = src2TgtType.get(srcTypeCode);
 if (r == null) {
@@ -952,7 +961,15 @@ public class CasCopier {
 return (r == MISSING_TYPE) ? null : r;
   }
   
+  // tiny method to inline
   private FeatureImpl getTargetFeature(FeatureImpl srcFi) {
+if (srcTsi == tgtTsi) {
+  return srcFi;
+}
+return getTargetFeature2(srcFi);
+  }
+  
+  private FeatureImpl getTargetFeature2(FeatureImpl srcFi) {
 int srcFeatCode = srcFi.getCode();
 FeatureImpl r = src2TgtFeat.get(srcFeatCode);
 if (r == null) {




svn commit: r1730706 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 15:58:58 2016
New Revision: 1730706

URL: http://svn.apache.org/viewvc?rev=1730706&view=rev
Log:
[UIMA-4674] restore APIs that pass in the initial heap size (used internally to 
presize some data structures)

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java?rev=1730706&r1=1730705&r2=1730706&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java
 Tue Feb 16 15:58:58 2016
@@ -563,6 +563,18 @@ public class CasCreationUtils {
   throw new ResourceInitializationException(e);
 }
 
+ // get initial heap size
+String initialHeapSizeStr = null;
+if (aPerformanceTuningSettings != null) {
+  initialHeapSizeStr = aPerformanceTuningSettings
+  .getProperty(UIMAFramework.CAS_INITIAL_HEAP_SIZE);
+}
+
+int initialHeapSize = (null == initialHeapSizeStr) 
+? CASImpl.DEFAULT_INITIAL_HEAP_SIZE
+: Integer.parseInt(initialHeapSizeStr);
+
+
 // Check Jcas cache performance setting.  Defaults to true.
 boolean useJcasCache = true;
 if (aPerformanceTuningSettings != null) {
@@ -576,7 +588,7 @@ public class CasCreationUtils {
 // create CAS using either aTypeSystem or aTypeSystemDesc
 CASMgr casMgr;
 if (aTypeSystem != null) {
-  casMgr = CASFactory.createCAS(aTypeSystem, useJcasCache);
+  casMgr = CASFactory.createCAS(initialHeapSize, aTypeSystem, 
useJcasCache);
   
   // Set JCas ClassLoader - before setupTypeSystem
   if (aResourceManager.getExtensionClassLoader() != null) {




svn commit: r1730704 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2ObjListMap.java

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 15:56:00 2016
New Revision: 1730704

URL: http://svn.apache.org/viewvc?rev=1730704&view=rev
Log:
[UIMA-4674] for performance, add ability to set initial capacity

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2ObjListMap.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2ObjListMap.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2ObjListMap.java?rev=1730704&r1=1730703&r2=1730704&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2ObjListMap.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2ObjListMap.java
 Tue Feb 16 15:56:00 2016
@@ -41,22 +41,30 @@ import org.apache.uima.util.Misc;
  */
 public class Int2ObjListMap {
   
-  private final ArrayList values = new ArrayList<>();
+  private final ArrayList values;
+  
+  public Int2ObjListMap() {
+values = new ArrayList<>();
+  }
+  
+  public Int2ObjListMap(int initialSize) {
+values = new ArrayList<>(initialSize);
+  }
   
   public void clear() {
 values.clear();
   }
 
- public T get(int key) {
-   return (key < 0 || key >= values.size()) 
-? null 
-: values.get(key);
- }
-  
- public T put(int key, T value) {
-   T prev = get(key);
-   Misc.setWithExpand(values,  key,  value);
-   return prev;
- }
+  public T get(int key) {
+return (key < 0 || key >= values.size()) 
+ ? null 
+ : values.get(key);
+  }
+  
+  public T put(int key, T value) {
+T prev = get(key);
+Misc.setWithExpand(values,  key,  value);
+return prev;
+  }
   
 }




svn commit: r1730703 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2ObjHashMap.java

2016-02-16 Thread schor
Author: schor
Date: Tue Feb 16 15:55:06 2016
New Revision: 1730703

URL: http://svn.apache.org/viewvc?rev=1730703&view=rev
Log:
[UIMA-4674] conform the impl of key iterator to Java list iterator standards, 
improve efficiency.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2ObjHashMap.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2ObjHashMap.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2ObjHashMap.java?rev=1730703&r1=1730702&r2=1730703&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2ObjHashMap.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2ObjHashMap.java
 Tue Feb 16 15:55:06 2016
@@ -50,30 +50,43 @@ public class Int2ObjHashMap {
 
   private class KeyIterator implements IntListIterator {
 
+/**
+ * Keep this always pointing to a non-0 entry, or
+ * if not valid, outside the range
+ */
 private int curPosition;
+
+private final int firstPosition;
 
 private KeyIterator() {
   this.curPosition = 0;
+  moveToNextFilled();
+  firstPosition = curPosition;
 }
 
 public final boolean hasNext() {
-  curPosition = moveToNextFilled(curPosition);
   return curPosition < keys.length;
 }
 
 public final int next() {
-  if (!hasNext()) {
+  
+//  if (!hasNext()) {
+//throw new NoSuchElementException();
+//  }
+  try {
+final int r = keys[curPosition++];
+moveToNextFilled();
+return r;
+  } catch (IndexOutOfBoundsException e) {
 throw new NoSuchElementException();
   }
-  return keys[curPosition++];
 }
 
 /**
  * @see org.apache.uima.internal.util.IntListIterator#hasPrevious()
  */
 public boolean hasPrevious() {
-  curPosition = moveToPreviousFilled(curPosition);
-  return (curPosition >= 0);
+  return (curPosition > firstPosition);
 }
 
 /**
@@ -83,7 +96,9 @@ public class Int2ObjHashMap {
   if (!hasPrevious()) {
 throw new NoSuchElementException();
   }
-  return keys[curPosition--];
+  curPosition --;
+  moveToPreviousFilled();
+  return keys[curPosition];
 }
 
 /**
@@ -91,6 +106,7 @@ public class Int2ObjHashMap {
  */
 public void moveToEnd() {
   curPosition = keys.length - 1;
+  moveToPreviousFilled();
 }
 
 /**
@@ -98,6 +114,47 @@ public class Int2ObjHashMap {
  */
 public void moveToStart() {
   curPosition = 0;
+  moveToNextFilled();
+}
+
+/**
+ * advance pos until it points to a non 0 or is 1 past end
+ * @param pos
+ * @return updated pos
+ */
+private void moveToNextFilled() {  
+  final int max = keys.length;
+  while (true) {
+if (curPosition >= max) {
+  return;
+}
+if (keys[curPosition] != 0) {
+  return;
+}
+curPosition ++;
+  }
+}
+ 
+/**
+ * decrement pos until it points to a non 0 or is -1
+ * @param pos
+ * @return updated pos
+ */
+private void moveToPreviousFilled() {
+  final int max = keys.length;
+  if (curPosition > max) {
+curPosition = max - 1;
+  }
+  
+  while (true) {
+if (curPosition < 0) {
+  return;
+}
+if (keys[curPosition] != 0) {
+  return;
+}
+curPosition --;
+  }
 }
   }
   
@@ -345,50 +402,6 @@ public class Int2ObjHashMap {
  public int size() {
return size;
  }
- 
- /**
-  * advance pos until it points to a non 0 or is 1 past end
-  * @param pos
-  * @return updated pos
-  */
- private int moveToNextFilled(int pos) {
-   if (pos < 0) {
- pos = 0;
-   }
-   
-   final int max = keys.length;
-   while (true) {
- if (pos >= max) {
-   return pos;
- }
- if (keys[pos] != 0) {
-   return pos;
- }
- pos ++;
-   }
- }
-  
- /**
-  * decrement pos until it points to a non 0 or is -1
-  * @param pos
-  * @return updated pos
-  */
- private int moveToPreviousFilled(int pos) {
-   final int max = keys.length;
-   if (pos > max) {
- pos = max - 1;
-   }
-   
-   while (true) {
- if (pos < 0) {
-   return pos;
- }
- if (keys[pos] != 0) {
-   return pos;
- }
- pos --;
-   }
- }
   
   public int[] getSortedKeys() {
 final int size = size();




svn commit: r1730702 - /uima/sandbox/uima-ducc/trunk/src/main/admin/rm_qoccupancy

2016-02-16 Thread challngr
Author: challngr
Date: Tue Feb 16 15:48:22 2016
New Revision: 1730702

URL: http://svn.apache.org/viewvc?rev=1730702&view=rev
Log:
UIMA-4577 Eliminate color prefix-chars doing cqlsh in rm_qoccupancy.

Modified:
uima/sandbox/uima-ducc/trunk/src/main/admin/rm_qoccupancy

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/rm_qoccupancy
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/rm_qoccupancy?rev=1730702&r1=1730701&r2=1730702&view=diff
==
--- uima/sandbox/uima-ducc/trunk/src/main/admin/rm_qoccupancy (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/rm_qoccupancy Tue Feb 16 
15:48:22 2016
@@ -80,10 +80,6 @@ class DuccRmQOccupancy(DuccUtil):
 shares = {}
 header = []
 for l in lines:
-# First character of first line may be 0x1B ESC
-if len(l) > 0 and not l[0] in string.printable:
-print 'Ignoring line', '[' + l + '] hex:', binascii.hexlify(l)
-continue
 if ( l == '' ):
 continue
 if ( '---' in l ):
@@ -124,6 +120,7 @@ class DuccRmQOccupancy(DuccUtil):
 DH = self.DUCC_HOME
 dbn = self.ducc_properties.get('ducc.database.host')
 
+os.environ['TERM'] = 'dumb'  # insure no colors.  --no-color isn't 
inhibiting colors in this shell for some reason.
 CMD = [DH + '/cassandra-server/bin/cqlsh', dbn, '-u', 'guest', '-p', 
'guest', '-e', '"select * from ducc.rmnodes; select * from ducc.rmshares;"']
 CMD = ' '.join(CMD)
 
@@ -131,7 +128,7 @@ class DuccRmQOccupancy(DuccUtil):
 proc = subprocess.Popen(CMD, bufsize=0, stdout=subprocess.PIPE, 
shell=True)
 for line in proc.stdout:
 # print line.strip()
-lines.append(line)
+lines.append(line.strip())
 
 nodes, shares = self.rmnodes(lines)
 self.format(nodes, shares)




svn commit: r1730700 - in /uima/ruta/branches/UIMA-4798: example-projects/ruta-ep-example-extensions/ example-projects/ruta-ep-example-extensions/src/main/java/org/apache/uima/ruta/example/extensions/

2016-02-16 Thread pkluegl
Author: pkluegl
Date: Tue Feb 16 15:27:24 2016
New Revision: 1730700

URL: http://svn.apache.org/viewvc?rev=1730700&view=rev
Log:
UIMA-4798
- upgrade DLTK version
- add ep parent

Added:
uima/ruta/branches/UIMA-4798/ruta-ep-parent/
uima/ruta/branches/UIMA-4798/ruta-ep-parent/pom.xml   (with props)
Modified:

uima/ruta/branches/UIMA-4798/example-projects/ruta-ep-example-extensions/pom.xml

uima/ruta/branches/UIMA-4798/example-projects/ruta-ep-example-extensions/src/main/java/org/apache/uima/ruta/example/extensions/ExampleActionIDEExtension.java

uima/ruta/branches/UIMA-4798/example-projects/ruta-ep-example-extensions/src/main/java/org/apache/uima/ruta/example/extensions/ExampleBooleanFunctionIDEExtension.java

uima/ruta/branches/UIMA-4798/example-projects/ruta-ep-example-extensions/src/main/java/org/apache/uima/ruta/example/extensions/ExampleConditionIDEExtension.java

uima/ruta/branches/UIMA-4798/example-projects/ruta-ep-example-extensions/src/main/java/org/apache/uima/ruta/example/extensions/ExampleNumberFunctionIDEExtension.java

uima/ruta/branches/UIMA-4798/example-projects/ruta-ep-example-extensions/src/main/java/org/apache/uima/ruta/example/extensions/ExampleStringFunctionIDEExtension.java

uima/ruta/branches/UIMA-4798/example-projects/ruta-ep-example-extensions/src/main/java/org/apache/uima/ruta/example/extensions/ExampleTypeFunctionIDEExtension.java
uima/ruta/branches/UIMA-4798/ruta-ep-addons/pom.xml
uima/ruta/branches/UIMA-4798/ruta-ep-caseditor/pom.xml
uima/ruta/branches/UIMA-4798/ruta-ep-core-ext/pom.xml

uima/ruta/branches/UIMA-4798/ruta-ep-core-ext/src/main/java/org/apache/uima/ruta/string/BooleanOperationsIDEExtension.java

uima/ruta/branches/UIMA-4798/ruta-ep-core-ext/src/main/java/org/apache/uima/ruta/string/StringOperationsIDEExtension.java
uima/ruta/branches/UIMA-4798/ruta-ep-ide-ui/pom.xml

uima/ruta/branches/UIMA-4798/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/formatter/RutaFormattedPrinter.java

uima/ruta/branches/UIMA-4798/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/console/RutaFileHyperlink.java

uima/ruta/branches/UIMA-4798/ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/ui/editor/ReferenceFinder.java
uima/ruta/branches/UIMA-4798/ruta-ep-ide/pom.xml

uima/ruta/branches/UIMA-4798/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ActionFactory.java

uima/ruta/branches/UIMA-4798/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ConditionFactory.java

uima/ruta/branches/UIMA-4798/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ExpressionFactory.java

uima/ruta/branches/UIMA-4798/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaAction.java

uima/ruta/branches/UIMA-4798/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaCondition.java

uima/ruta/branches/UIMA-4798/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaFunction.java

uima/ruta/branches/UIMA-4798/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaListExpression.java

uima/ruta/branches/UIMA-4798/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaLogAction.java

uima/ruta/branches/UIMA-4798/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStringExpression.java

uima/ruta/branches/UIMA-4798/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/RutaStructureAction.java

uima/ruta/branches/UIMA-4798/ruta-ep-ide/src/main/java/org/apache/uima/ruta/ide/parser/ast/ScriptFactory.java
uima/ruta/branches/UIMA-4798/ruta-ep-textruler/pom.xml

uima/ruta/branches/UIMA-4798/ruta-ep-textruler/src/main/java/org/apache/uima/ruta/textruler/ui/ConfigureLearnersHandler.java
uima/ruta/branches/UIMA-4798/ruta-maven-plugin/pom.xml
uima/ruta/branches/UIMA-4798/ruta-parent/pom.xml

Modified: 
uima/ruta/branches/UIMA-4798/example-projects/ruta-ep-example-extensions/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/ruta/branches/UIMA-4798/example-projects/ruta-ep-example-extensions/pom.xml?rev=1730700&r1=1730699&r2=1730700&view=diff
==
--- 
uima/ruta/branches/UIMA-4798/example-projects/ruta-ep-example-extensions/pom.xml
 (original)
+++ 
uima/ruta/branches/UIMA-4798/example-projects/ruta-ep-example-extensions/pom.xml
 Tue Feb 16 15:27:24 2016
@@ -24,9 +24,9 @@
   Apache UIMA Ruta: ${project.artifactId}
   
 org.apache.uima
-ruta-parent
+ruta-ep-parent
 2.4.1-SNAPSHOT
-../../ruta-parent/pom.xml
+../../ruta-ep-parent/pom.xml
   
   
 
@@ -50,12 +50,6 @@
   ruta-ep-ide-ui
   ${project.parent.version}
 
-
-  org.eclipse.dltk
-  core
-  [3.0.1,5.0.0)
-  provided
-

   org.antlr
   antlr-runtime

Modified: 
uima/ruta/branches/UIMA-4798/example-projects/ruta-ep-example-extensions/src/main/java/org/apache/uima/ruta/exa

svn commit: r1730698 - /uima/ruta/branches/UIMA-4798/

2016-02-16 Thread pkluegl
Author: pkluegl
Date: Tue Feb 16 15:25:12 2016
New Revision: 1730698

URL: http://svn.apache.org/viewvc?rev=1730698&view=rev
Log:
UIMA-4798
- upgrade DLTK version
- add ep parent

Added:
uima/ruta/branches/UIMA-4798/   (props changed)
  - copied from r1730697, uima/ruta/trunk/

Propchange: uima/ruta/branches/UIMA-4798/
--
--- svn:ignore (added)
+++ svn:ignore Tue Feb 16 15:25:12 2016
@@ -0,0 +1,5 @@
+.project
+.settings
+.classpath
+issuesFixed
+target

Propchange: uima/ruta/branches/UIMA-4798/
--
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Feb 16 15:25:12 2016
@@ -0,0 +1,2 @@
+/uima/ruta/branches/UIMA-4408:1711496-1722822
+/uima/ruta/branches/trunk:1711495