Changeset 7244 for RevitalizationWS
- Timestamp:
- 23/07/10 17:02:59 (11 years ago)
- Location:
- RevitalizationWS/common/trunk
- Files:
-
- 8 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
RevitalizationWS/common/trunk/.classpath
r7207 r7244 5 5 <classpathentry kind="src" output="target/test-classes" path="src/test/java"/> 6 6 <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/> 7 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 8 <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> 7 <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"> 8 <attributes> 9 <attribute name="org.eclipse.jst.component.nondependency" value=""/> 10 </attributes> 11 </classpathentry> 12 <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> 13 <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.generic.runtimeTarget/JBoss v5.0"> 14 <attributes> 15 <attribute name="owner.project.facets" value="jst.utility"/> 16 </attributes> 17 </classpathentry> 18 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk6"> 19 <attributes> 20 <attribute name="owner.project.facets" value="jst.java"/> 21 </attributes> 22 </classpathentry> 9 23 <classpathentry kind="output" path="target/classes"/> 10 24 </classpath> -
RevitalizationWS/common/trunk/.project
r7207 r7244 21 21 </arguments> 22 22 </buildCommand> 23 <buildCommand> 24 <name>org.eclipse.wst.validation.validationbuilder</name> 25 <arguments> 26 </arguments> 27 </buildCommand> 23 28 </buildSpec> 24 29 <natures> 30 <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> 31 <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> 25 32 <nature>org.eclipse.jdt.core.javanature</nature> 26 33 <nature>org.maven.ide.eclipse.maven2Nature</nature> -
RevitalizationWS/common/trunk/.settings/org.eclipse.jdt.core.prefs
r7207 r7244 1 # Thu Jul 08 12:10:44 BST 20101 #Mon Jul 19 10:00:14 BST 2010 2 2 eclipse.preferences.version=1 3 3 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 4 4 org.eclipse.jdt.core.compiler.compliance=1.6 5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 5 7 org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 6 8 org.eclipse.jdt.core.compiler.source=1.6 -
RevitalizationWS/common/trunk/pom.xml
r7207 r7244 5 5 <groupId>ndg.services</groupId> 6 6 <artifactId>common</artifactId> 7 <version>1. 0.0</version>7 <version>1.1.0</version> 8 8 9 9 <name>NDG commons</name> … … 46 46 <version>1.5.10</version> 47 47 </dependency> 48 49 <dependency> 50 <groupId>junit</groupId> 51 <artifactId>junit</artifactId> 52 <version>4.8.1</version> 53 <scope>test</scope> 54 </dependency> 48 55 </dependencies> 49 56 -
RevitalizationWS/common/trunk/src/main/java/ndg/common/TermParser.java
r7231 r7244 1 1 package ndg.common; 2 2 3 import java.util.ArrayList; 4 import java.util.List; 3 5 import java.util.regex.Pattern; 4 6 … … 19 21 20 22 /** 21 * @author Maurizio Nagni <maurizio.nagni@stcf.ac.uk> 22 * 23 * Parse a sentence identifying the operators among the words/phrases. 24 * The single phrase should be among a double quotes (ie ""Industrial Activity"") 25 * The parser recognizes several operator (if not included in a single phrase): 26 * <li> 27 * <ol> 28 * &, AND 29 * </ol> 30 * <ol> 31 * |, or 32 * </ol> 33 * <ol> 34 * -, !, not 35 * </ol> 36 * <li> 37 * @author Maurizio Nagni <maurizio.nagni@stcf.ac.uk> 23 38 */ 24 39 public class TermParser { 25 40 public String parseTerm(String term) throws AssembleQueryException { 26 String items[] = term.split("\\s"); 41 if (term == null || term.length() == 0) 42 return ""; 43 44 String items[] = extractWordPhrase(term.trim()); 45 46 //String items[] = term.split("\\s"); 27 47 28 48 int index = 0; … … 119 139 return Pattern.matches("^:$", item); 120 140 } 141 142 private String[] extractWordPhrase(String term) { 143 List<String> ret = new ArrayList<String>(); 144 145 if (term.length() == 0) 146 return new String[]{}; 147 148 int start = 0; 149 int stop = 0; 150 int grouperIndex = 0; 151 int spaceIndex = 0; 152 String item = null; 153 154 while (true) { 155 grouperIndex = findAssociator(term, start); 156 spaceIndex = findSpace(term, start); 157 158 if (grouperIndex == -1 && spaceIndex == -1) 159 break; 160 161 if ((grouperIndex == -1 && spaceIndex != -1) 162 || (grouperIndex != -1 && spaceIndex != -1 && grouperIndex > spaceIndex)) { 163 stop = findSpace(term, start); 164 ret.add(term.substring(start, stop)); 165 start = stop + 1; 166 continue; 167 } 168 169 if ((grouperIndex != -1 && spaceIndex == -1) 170 || (grouperIndex != -1 && spaceIndex != -1 && grouperIndex < spaceIndex)) { 171 stop = findAssociator(term, start+2); 172 ret.add("''" + term.substring(start+2, stop) + "''"); 173 start = stop + 2; 174 continue; 175 } 176 } 177 return ret.toArray(new String[0]); 178 } 179 180 private int findAssociator(String term, int fromOffset) { 181 return term.indexOf("\"\"", fromOffset); 182 } 183 184 private int findSpace(String term, int fromOffset) { 185 return term.indexOf(" ", fromOffset); 186 } 121 187 } -
RevitalizationWS/common/trunk/src/main/resources/ndg/common/messages.properties
r7232 r7244 16 16 empty.searchcriteria = "SearchCriteria cannot be empty"; 17 17 term.target.syntax.error = "The Term {0} has wrong syntax"; 18 execution.error = The command {0} reported the following error: \n {1} 18 execution.error = The command {0} reported the following error\: \n {1} 19 null.object = The {0} parameter is null 20 no.object.with.id = No {0} object exists with id \= {1} 21 more.objects.with.id = More than one {0} objects exist with id = {1} 22 illegal.sql.operation = The process illegally called the following SQL\: \n {0} 23 string.not.number = The parameter {0} with value {1} is not a parsable number 24 no.harvester.found = No harvester has been found associated for ID:{0} Type: {1}
Note: See TracChangeset
for help on using the changeset viewer.