Revision: 15091
http://gate.svn.sourceforge.net/gate/?rev=15091&view=rev
Author: markagreenwood
Date: 2012-01-17 06:48:31 +0000 (Tue, 17 Jan 2012)
Log Message:
-----------
code simplification and some generics stuff
Modified Paths:
--------------
gate/trunk/src/gate/creole/morph/PatternParser.java
gate/trunk/src/gate/creole/morph/Storage.java
Modified: gate/trunk/src/gate/creole/morph/PatternParser.java
===================================================================
--- gate/trunk/src/gate/creole/morph/PatternParser.java 2012-01-17 02:28:09 UTC
(rev 15090)
+++ gate/trunk/src/gate/creole/morph/PatternParser.java 2012-01-17 06:48:31 UTC
(rev 15091)
@@ -72,7 +72,7 @@
}
}
- public static Storage variables = new Storage();
+ public final static Storage variables = new Storage();
private static void variableDeclarationCommand(String line)
throws ResourceInstantiationException {
Modified: gate/trunk/src/gate/creole/morph/Storage.java
===================================================================
--- gate/trunk/src/gate/creole/morph/Storage.java 2012-01-17 02:28:09 UTC
(rev 15090)
+++ gate/trunk/src/gate/creole/morph/Storage.java 2012-01-17 06:48:31 UTC
(rev 15091)
@@ -2,6 +2,7 @@
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
/**
* <p>Title: Storage.java </p>
@@ -14,13 +15,13 @@
* Stores variable name as the key, and its variable values as values of
these
* keys
*/
- private HashMap variables;
+ private Map<String, String> variables;
/**
* Constructor
*/
public Storage() {
- variables = new HashMap();
+ variables = new HashMap<String, String>();
}
/**
@@ -51,8 +52,7 @@
* @return value of the variable if variable found in the table,null
otherwise
*/
public String get(String varName) {
- String varValue = (String)(variables.get(varName));
- return varValue;
+ return variables.get(varName);
}
/**
@@ -61,11 +61,7 @@
* @return true if variable exists, false otherwise
*/
public boolean isExist(String varName) {
- if(variables.containsKey(varName)) {
- return true;
- } else {
- return false;
- }
+ return variables.containsKey(varName);
}
/**
@@ -84,13 +80,6 @@
* @return array of Strings - names of the variables
*/
public String [] getVarNames() {
- Iterator iter = variables.keySet().iterator();
- String [] varNames = new String[variables.size()];
- int i=0;
- while(iter.hasNext()) {
- varNames[i] = (String)(iter.next());
- i++;
- }
- return varNames;
+ return variables.keySet().toArray(new String[variables.size()]);
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs