Revision: 17429
http://sourceforge.net/p/gate/code/17429
Author: adamfunk
Date: 2014-02-26 13:49:48 +0000 (Wed, 26 Feb 2014)
Log Message:
-----------
Wrapper for score management
Added Paths:
-----------
gate/trunk/plugins/TermRaider/src/gate/termraider/util/ScoreType.java
Added: gate/trunk/plugins/TermRaider/src/gate/termraider/util/ScoreType.java
===================================================================
--- gate/trunk/plugins/TermRaider/src/gate/termraider/util/ScoreType.java
(rev 0)
+++ gate/trunk/plugins/TermRaider/src/gate/termraider/util/ScoreType.java
2014-02-26 13:49:48 UTC (rev 17429)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, The University of Sheffield. See the file
+ * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
+ *
+ * This file is part of GATE (see http://gate.ac.uk/), and is free
+ * software, licenced under the GNU Library General Public License,
+ * Version 2, June 1991 (in the distribution as file licence.html,
+ * and also available at http://gate.ac.uk/gate/licence.html).
+ *
+ * $Id$
+ */
+package gate.termraider.util;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.WordUtils;
+
+public class ScoreType implements Comparable<ScoreType> {
+
+ private String string;
+ private String normalizedString;
+
+ @Override
+ public String toString() {
+ return this.string;
+ }
+
+ public String toNormalizedString() {
+ return this.normalizedString;
+ }
+
+
+ public ScoreType(String string) {
+ if (string == null) {
+ throw new IllegalArgumentException("ScoreType must not be null.");
+ }
+
+ this.string = string;
+
+ // Normalize = remove leading & trailing whitespace then camelCase
+ this.normalizedString =
WordUtils.capitalize(StringUtils.trimToEmpty(string)).replaceAll("\\s+", "");
+
+ if (this.normalizedString.length() == 0) {
+ throw new IllegalArgumentException("ScoreType must contain some
non-whitespace characters.");
+ }
+ }
+
+
+ @Override
+ public int compareTo(ScoreType x) {
+ return this.string.compareTo(x.string);
+ }
+
+ @Override
+ public boolean equals(Object x) {
+ if (x instanceof ScoreType) {
+ return this.string.equals(((ScoreType)x).string);
+ }
+
+ // implied else: x is another class
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return this.string.hashCode();
+ }
+
+}
Property changes on:
gate/trunk/plugins/TermRaider/src/gate/termraider/util/ScoreType.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs