Revision: 19663
http://sourceforge.net/p/gate/code/19663
Author: markagreenwood
Date: 2016-10-10 08:44:57 +0000 (Mon, 10 Oct 2016)
Log Message:
-----------
some more bug and performance fixes
Modified Paths:
--------------
gate/branches/sawdust2/gate-core/src/main/java/gate/config/ConfigDataProcessor.java
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/SgmlDocumentFormat.java
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/TextualDocumentFormat.java
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/XmlDocumentFormat.java
gate/branches/sawdust2/gate-core/src/main/java/gate/creole/ResourceData.java
gate/branches/sawdust2/gate-core/src/main/java/gate/creole/SerialController.java
gate/branches/sawdust2/gate-core/src/main/java/gate/creole/annic/Parser.java
Modified:
gate/branches/sawdust2/gate-core/src/main/java/gate/config/ConfigDataProcessor.java
===================================================================
---
gate/branches/sawdust2/gate-core/src/main/java/gate/config/ConfigDataProcessor.java
2016-10-10 08:03:37 UTC (rev 19662)
+++
gate/branches/sawdust2/gate-core/src/main/java/gate/config/ConfigDataProcessor.java
2016-10-10 08:44:57 UTC (rev 19663)
@@ -90,10 +90,10 @@
);
}
} catch (IOException e) {
- Out.prln("conf file:"+nl+configString+nl);
+ if(DEBUG) Out.prln("conf file:"+nl+configString+nl);
throw(new GateException("Config data error 1 on "+configUrl+": "+nl+e));
} catch (SAXException e) {
- Out.prln("conf file:"+nl+configString+nl);
+ if(DEBUG) Out.prln("conf file:"+nl+configString+nl);
throw(new GateException("Config data error 2 on "+configUrl+": "+nl+e));
}
Modified:
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/SgmlDocumentFormat.java
===================================================================
---
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/SgmlDocumentFormat.java
2016-10-10 08:03:37 UTC (rev 19662)
+++
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/SgmlDocumentFormat.java
2016-10-10 08:44:57 UTC (rev 19663)
@@ -103,7 +103,7 @@
SAXParser parser = saxParserFactory.newSAXParser();
// use it
- if (null != doc){
+
// create a new Xml document handler
xmlDocHandler = new XmlDocumentHandler(doc,
this.markupElementsMap,
@@ -115,7 +115,7 @@
parser.parse(xmlUri, xmlDocHandler);
((DocumentImpl) doc).setNextAnnotationId(
xmlDocHandler.getCustomObjectsId());
- }// end if
+
} catch (ParserConfigurationException e){
throw
new DocumentFormatException("XML parser configuration exception ", e);
Modified:
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/TextualDocumentFormat.java
===================================================================
---
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/TextualDocumentFormat.java
2016-10-10 08:03:37 UTC (rev 19662)
+++
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/TextualDocumentFormat.java
2016-10-10 08:44:57 UTC (rev 19663)
@@ -261,8 +261,8 @@
state = 1;
// Create an annotation type paragraph
try{
- annotSet.add( new Long(startOffsetPara),
- new Long(endOffsetPara),
+ annotSet.add(Long.valueOf(startOffsetPara),
+ Long.valueOf(endOffsetPara),
"paragraph",
Factory.newFeatureMap());
} catch (gate.util.InvalidOffsetException ioe){
@@ -283,9 +283,9 @@
if ( state==2 || state==3 ){
// Create an annotation type paragraph
try{
- annotSet.add( new Long(startOffsetPara),
+ annotSet.add( Long.valueOf(startOffsetPara),
// Create the final annotation using the endOffset
- new Long(endOffsetPara),
+ Long.valueOf(endOffsetPara),
"paragraph",
Factory.newFeatureMap());
} catch (gate.util.InvalidOffsetException ioe){
Modified:
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/XmlDocumentFormat.java
===================================================================
---
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/XmlDocumentFormat.java
2016-10-10 08:03:37 UTC (rev 19662)
+++
gate/branches/sawdust2/gate-core/src/main/java/gate/corpora/XmlDocumentFormat.java
2016-10-10 08:44:57 UTC (rev 19663)
@@ -76,7 +76,7 @@
/** We could collect repositioning information during XML parsing */
@Override
public Boolean supportsRepositioning() {
- return new Boolean(true);
+ return Boolean.TRUE;
} // supportsRepositioning
/** Old style of unpackMarkup (without collecting of RepositioningInfo) */
Modified:
gate/branches/sawdust2/gate-core/src/main/java/gate/creole/ResourceData.java
===================================================================
---
gate/branches/sawdust2/gate-core/src/main/java/gate/creole/ResourceData.java
2016-10-10 08:03:37 UTC (rev 19662)
+++
gate/branches/sawdust2/gate-core/src/main/java/gate/creole/ResourceData.java
2016-10-10 08:44:57 UTC (rev 19663)
@@ -16,22 +16,10 @@
package gate.creole;
-import gate.CreoleRegister;
-import gate.DocumentExporter;
-import gate.Gate;
-import gate.LanguageResource;
-import gate.ProcessingResource;
-import gate.Resource;
-import gate.creole.metadata.Sharable;
-import gate.util.AbstractFeatureBearer;
-import gate.util.GateClassLoader;
-import gate.util.GateException;
-
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
-import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URL;
@@ -41,6 +29,17 @@
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
+import gate.CreoleRegister;
+import gate.DocumentExporter;
+import gate.Gate;
+import gate.LanguageResource;
+import gate.ProcessingResource;
+import gate.Resource;
+import gate.creole.metadata.Sharable;
+import gate.util.AbstractFeatureBearer;
+import gate.util.GateClassLoader;
+import gate.util.GateException;
+
/** Models an individual CREOLE resource metadata, plus configuration data,
* plus the instantiations of the resource current within the system.
* Some metadata elements are used by GATE to load resources, or index
@@ -54,7 +53,7 @@
* resource's ResourceData.
* @see CreoleRegister
*/
-public class ResourceData extends AbstractFeatureBearer implements Serializable
+public class ResourceData extends AbstractFeatureBearer
{
private static final long serialVersionUID = -1275311260404979762L;
@@ -90,7 +89,7 @@
int noSmallViews = (smallViews == null) ? 0: smallViews.size();
int noViews = (views == null) ? 0: views.size();
*/
- StringBuffer s = new StringBuffer(
+ return
"ResourceDataImpl, name=" + name + "; className=" + className +
"; jarFileName=" + jarFileName + "; jarFileUrl=" + jarFileUrl +
"; xmlFileName=" + xmlFileName + "; xmlFileUrl=" + xmlFileUrl +
@@ -104,8 +103,8 @@
"; annotationTypeDisplayed=" + annotationTypeDisplayed +
"; parameterList=" + parameterList +
"; features=" + features
- );
- return s.toString();
+ ;
+
} // toString
/** Equality: two resource data objects are the same if they have the
@@ -113,7 +112,9 @@
*/
@Override
public boolean equals(Object other) {
- if (other == null) return false;
+ if(this == other) return true;
+ if(other == null) return false;
+ if(getClass() != other.getClass()) return false;
if(name.equals(((ResourceData) other).getName()))
return true;
return false;
Modified:
gate/branches/sawdust2/gate-core/src/main/java/gate/creole/SerialController.java
===================================================================
---
gate/branches/sawdust2/gate-core/src/main/java/gate/creole/SerialController.java
2016-10-10 08:03:37 UTC (rev 19662)
+++
gate/branches/sawdust2/gate-core/src/main/java/gate/creole/SerialController.java
2016-10-10 08:44:57 UTC (rev 19663)
@@ -161,10 +161,9 @@
Long timeOfPR =
timeMap.get(prList.get(i).getName());
if(timeOfPR == null)
- timeMap.put(prList.get(i).getName(), new Long(
- prof.getLastDuration()));
+ timeMap.put(prList.get(i).getName(), prof.getLastDuration());
else timeMap.put(prList.get(i).getName(),
- new Long(timeOfPR.longValue() + prof.getLastDuration()));
+ timeOfPR.longValue() + prof.getLastDuration());
log.debug("Time taken so far by "
+ prList.get(i).getName() + ": "
+ timeMap.get(prList.get(i).getName()));
@@ -232,9 +231,9 @@
long timeTakenByThePR = System.currentTimeMillis() - startTime;
Long time = prTimeMap.get(currentPR.getName());
if(time == null) {
- time = new Long(0);
+ time = 0L;
}
- time = new Long(time.longValue() + timeTakenByThePR);
+ time = time.longValue() + timeTakenByThePR;
prTimeMap.put(currentPR.getName(), time);
Modified:
gate/branches/sawdust2/gate-core/src/main/java/gate/creole/annic/Parser.java
===================================================================
---
gate/branches/sawdust2/gate-core/src/main/java/gate/creole/annic/Parser.java
2016-10-10 08:03:37 UTC (rev 19662)
+++
gate/branches/sawdust2/gate-core/src/main/java/gate/creole/annic/Parser.java
2016-10-10 08:44:57 UTC (rev 19663)
@@ -186,20 +186,21 @@
Map<String, String> features = annots[j].getFeatures();
sb.append(wrap(FEATURES, true));
// one feature at a time
- if(features != null) {
- Set<String> keySet = features.keySet();
- if(keySet != null) {
- Iterator<String> iter = keySet.iterator();
- while(iter.hasNext()) {
+ //if(features != null) {
+ //Set<String> keySet = features.keySet();
+ //if(keySet != null) {
+ //Iterator<String> iter = keySet.iterator();
+ //while(iter.hasNext()) {
+ for (Map.Entry<String,String> entry : features.entrySet()) {
sb.append(wrap(FEATURE, true));
- String key = iter.next();
+ String key = entry.getKey();
sb.append(wrap(KEY, key));
- String value = features.get(key);
+ String value = entry.getValue();
sb.append(wrap(VALUE, value));
sb.append(wrap(FEATURE, false));
}
- }
- }
+ //}
+ //}
sb.append(wrap(FEATURES, false));
sb.append(wrap(PATTERN_ANNOTATION, false));
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs