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 2012/07/06 12:44:45 UTC
svn commit: r1358109 - in
/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker:
TextMarkerStream.java engine/BasicEngine.xml engine/TextMarkerEngine.java
Author: pkluegl
Date: Fri Jul 6 10:44:45 2012
New Revision: 1358109
URL: http://svn.apache.org/viewvc?rev=1358109&view=rev
Log:
UIMA-2397
- lowMemoryProfile is now configurable in descriptor
Modified:
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/BasicEngine.xml
uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/TextMarkerEngine.java
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java?rev=1358109&r1=1358108&r2=1358109&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java Fri Jul 6 10:44:45 2012
@@ -78,12 +78,15 @@ public class TextMarkerStream extends FS
private double anchoringFactor;
+ private boolean lowMemoryProfile;
+
protected TextMarkerStream(CAS cas, FSIterator<AnnotationFS> current, Type basicType,
- FilterManager filter) {
+ FilterManager filter, boolean lowMemoryProfile) {
super();
this.cas = cas;
this.filter = filter;
this.basicType = basicType;
+ this.lowMemoryProfile = lowMemoryProfile;
AnnotationFS additionalWindow = filter.getWindowAnnotation();
updateIterators(cas, basicType, filter, additionalWindow);
// really an if? sub it of basic should fix this
@@ -127,8 +130,8 @@ public class TextMarkerStream extends FS
currentIt = filter.createFilteredIterator(cas, basicType);
}
- public TextMarkerStream(CAS cas, Type basicType, FilterManager filter) {
- this(cas, null, basicType, filter);
+ public TextMarkerStream(CAS cas, Type basicType, FilterManager filter, boolean lowMemoryProfile) {
+ this(cas, null, basicType, filter, lowMemoryProfile);
}
public void initalizeBasics() {
@@ -144,6 +147,7 @@ public class TextMarkerStream extends FS
Integer first = anchors.pollFirst();
Integer second = anchors.first();
TextMarkerBasic newTMB = new TextMarkerBasic(getJCas(), first, second);
+ newTMB.setLowMemoryProfile(lowMemoryProfile);
beginAnchors.put(first, newTMB);
endAnchors.put(second, newTMB);
basics.add(newTMB);
@@ -252,12 +256,12 @@ public class TextMarkerStream extends FS
FilterManager filterManager = new FilterManager(filter.getDefaultFilterTypes(),
filter.getCurrentFilterTypes(), filter.getCurrentRetainTypes(), windowAnnotation,
windowType, cas);
- TextMarkerStream stream = new TextMarkerStream(cas, basicIt, basicType, filterManager);
+ TextMarkerStream stream = new TextMarkerStream(cas, basicIt, basicType, filterManager, lowMemoryProfile);
return stream;
}
public FSIterator<AnnotationFS> copy() {
- return new TextMarkerStream(cas, currentIt.copy(), basicType, filter);
+ return new TextMarkerStream(cas, currentIt.copy(), basicType, filter, lowMemoryProfile);
}
public AnnotationFS get() throws NoSuchElementException {
@@ -605,7 +609,7 @@ public class TextMarkerStream extends FS
public TextMarkerStream getCompleteStream() {
FilterManager defaultFilter = new FilterManager(filter.getDefaultFilterTypes(), getCas());
- return new TextMarkerStream(getCas(), basicIt, basicType, defaultFilter);
+ return new TextMarkerStream(getCas(), basicIt, basicType, defaultFilter, lowMemoryProfile);
}
public int getHistogram(Type type) {
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/BasicEngine.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/BasicEngine.xml?rev=1358109&r1=1358108&r2=1358109&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/BasicEngine.xml (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/BasicEngine.xml Fri Jul 6 10:44:45 2012
@@ -137,6 +137,12 @@
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
+ <configurationParameter>
+ <name>lowMemoryProfile</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
</configurationParameters>
<configurationParameterSettings>
<nameValuePair>
Modified: uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/TextMarkerEngine.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/TextMarkerEngine.java?rev=1358109&r1=1358108&r2=1358109&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/TextMarkerEngine.java (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/engine/TextMarkerEngine.java Fri Jul 6 10:44:45 2012
@@ -115,6 +115,8 @@ public class TextMarkerEngine extends JC
public static final String RELOAD_SCRIPT = "reloadScript";
+ public static final String LOW_MEMORY_PROFILE = "lowMemoryProfile";
+
private String[] seeders;
private Boolean createDebugInfo;
@@ -165,8 +167,10 @@ public class TextMarkerEngine extends JC
private Boolean reloadScript;
- private boolean initialized = false;
+ private Boolean lowMemoryProfile;
+ private boolean initialized = false;
+
private List<Type> seedTypes;
@Override
@@ -197,7 +201,8 @@ public class TextMarkerEngine extends JC
defaultFilteredTypes = (String[]) aContext.getConfigParameterValue(DEFAULT_FILTERED_TYPES);
dynamicAnchoring = (Boolean) aContext.getConfigParameterValue(DYNAMIC_ANCHORING);
reloadScript = (Boolean) aContext.getConfigParameterValue(RELOAD_SCRIPT);
-
+ lowMemoryProfile = (Boolean) aContext.getConfigParameterValue(LOW_MEMORY_PROFILE);
+
removeBasics = removeBasics == null ? false : removeBasics;
createDebugInfo = createDebugInfo == null ? false : createDebugInfo;
createDebugOnlyFor = createDebugOnlyFor == null ? new String[0] : createDebugOnlyFor;
@@ -209,7 +214,8 @@ public class TextMarkerEngine extends JC
defaultFilteredTypes = defaultFilteredTypes == null ? new String[0] : defaultFilteredTypes;
dynamicAnchoring = dynamicAnchoring == null ? false : dynamicAnchoring;
reloadScript = reloadScript == null ? false : reloadScript;
-
+ lowMemoryProfile = lowMemoryProfile == null ? false : lowMemoryProfile;
+
this.context = aContext;
factory = new TextMarkerExternalFactory();
@@ -378,7 +384,8 @@ public class TextMarkerEngine extends JC
FilterManager filter = new FilterManager(filterTypes, cas);
Type basicType = typeSystem.getType(BASIC_TYPE);
seedTypes = seedAnnotations(cas);
- TextMarkerStream stream = new TextMarkerStream(cas, basicType, filter);
+ TextMarkerStream stream = new TextMarkerStream(cas, basicType, filter, lowMemoryProfile);
+
stream.initalizeBasics();
return stream;
}