ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chen...@apache.org
Subject svn commit: r1636663 - in /ctakes/trunk/ctakes-ytex: ./ src/main/java/org/apache/ctakes/ytex/kernel/ src/main/java/org/apache/ctakes/ytex/kernel/dao/ src/main/java/org/apache/ctakes/ytex/umls/dao/
Date Tue, 04 Nov 2014 17:41:43 GMT
Author: chenpei
Date: Tue Nov  4 17:41:43 2014
New Revision: 1636663

URL: http://svn.apache.org/r1636663
Log:
CTAKES-321 - Remove trove as a dependency.

Modified:
    ctakes/trunk/ctakes-ytex/pom.xml
    ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/IntrinsicInfoContentEvaluatorImpl.java
    ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/dao/ConceptDaoImpl.java
    ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/umls/dao/UMLSDao.java
    ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/umls/dao/UMLSDaoImpl.java

Modified: ctakes/trunk/ctakes-ytex/pom.xml
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-ytex/pom.xml?rev=1636663&r1=1636662&r2=1636663&view=diff
==============================================================================
--- ctakes/trunk/ctakes-ytex/pom.xml (original)
+++ ctakes/trunk/ctakes-ytex/pom.xml Tue Nov  4 17:41:43 2014
@@ -178,12 +178,6 @@
 			<artifactId>ehcache-core</artifactId>
 			<version>2.4.6</version>
 		</dependency>
-
-		<dependency>
-			<groupId>net.sf.trove4j</groupId>
-			<artifactId>trove4j</artifactId>
-			<version>3.0.3</version>
-		</dependency>
 		<dependency>
 			<groupId>com.rubiconproject.oss</groupId>
 			<artifactId>jchronic</artifactId>

Modified: ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/IntrinsicInfoContentEvaluatorImpl.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/IntrinsicInfoContentEvaluatorImpl.java?rev=1636663&r1=1636662&r2=1636663&view=diff
==============================================================================
--- ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/IntrinsicInfoContentEvaluatorImpl.java
(original)
+++ ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/IntrinsicInfoContentEvaluatorImpl.java
Tue Nov  4 17:41:43 2014
@@ -18,10 +18,6 @@
  */
 package org.apache.ctakes.ytex.kernel;
 
-import gnu.trove.iterator.TIntIterator;
-import gnu.trove.set.TIntSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 import java.io.BufferedWriter;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -30,6 +26,7 @@ import java.lang.reflect.Array;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -146,18 +143,18 @@ public class IntrinsicInfoContentEvaluat
 	 * @return
 	 * @throws IOException
 	 */
-	private TIntSet getLeaves(ConcRel concept,
-			SoftReference<TIntSet>[] leafCache,
+	private HashSet<Integer> getLeaves(ConcRel concept,
+			SoftReference<HashSet<Integer>>[] leafCache,
 			Map<String, IntrinsicICInfo> icInfoMap, ConceptGraph cg,
-			BufferedWriter w, TIntSet visitedNodes) throws IOException {
+			BufferedWriter w, HashSet<Integer> visitedNodes) throws IOException {
 		// look in cache
-		SoftReference<TIntSet> refLeaves = leafCache[concept.getNodeIndex()];
+		SoftReference<HashSet<Integer>> refLeaves = leafCache[concept.getNodeIndex()];
 		if (refLeaves != null && refLeaves.get() != null) {
 			return refLeaves.get();
 		}
 		// not in cache - compute recursively
-		TIntSet leaves = new TIntHashSet();
-		leafCache[concept.getNodeIndex()] = new SoftReference<TIntSet>(leaves);
+		HashSet<Integer> leaves = new HashSet<Integer>();
+		leafCache[concept.getNodeIndex()] = new SoftReference<HashSet<Integer>>(leaves);
 		if (concept.isLeaf()) {
 			// for leaves, just add the concept id
 			leaves.add(concept.getNodeIndex());
@@ -168,7 +165,7 @@ public class IntrinsicInfoContentEvaluat
 			// if no, then compute it now and revisit previously visited nodes
 			// if we have to
 			boolean needLeaves = (icInfo != null && icInfo.getLeafCount() == 0);
-			TIntSet visitedNodesLocal = visitedNodes;
+			HashSet<Integer> visitedNodesLocal = visitedNodes;
 			if (needLeaves || visitedNodesLocal == null) {
 				// allocate a set to keep track of nodes we've already visited
 				// so that we don't revisit them. if we have already computed
@@ -177,7 +174,7 @@ public class IntrinsicInfoContentEvaluat
 				// if we haven't already computed this node's leaf count,
 				// allocate a new set to avoid duplications in the traversal for
 				// this node
-				visitedNodesLocal = new TIntHashSet();
+				visitedNodesLocal = new HashSet<Integer>();
 			}
 			// for inner nodes, recurse
 			for (ConcRel child : concept.getChildren()) {
@@ -204,7 +201,7 @@ public class IntrinsicInfoContentEvaluat
 					w.write("\t");
 					w.write(Integer.toString(leaves.size()));
 					w.write("\t");
-					TIntIterator iter = leaves.iterator();
+					Iterator<Integer> iter = leaves.iterator();
 					while (iter.hasNext()) {
 						w.write(cg.getConceptList().get(iter.next())
 								.getConceptID());
@@ -359,8 +356,8 @@ public class IntrinsicInfoContentEvaluat
 		}
 		log.info("computing leaf counts");
 		@SuppressWarnings("unchecked")
-		SoftReference<TIntSet>[] leafCache = (SoftReference<TIntSet>[]) Array
-				.newInstance((new SoftReference<TIntSet>(new TIntHashSet()))
+		SoftReference<HashSet<Integer>>[] leafCache = (SoftReference<HashSet<Integer>>[])
Array
+				.newInstance((new SoftReference<HashSet<Integer>>(new HashSet<Integer>()))
 						.getClass(), cg.getConceptList().size());
 		// compute leaf count of all concepts in this graph
 		try {

Modified: ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/dao/ConceptDaoImpl.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/dao/ConceptDaoImpl.java?rev=1636663&r1=1636662&r2=1636663&view=diff
==============================================================================
--- ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/dao/ConceptDaoImpl.java
(original)
+++ ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/dao/ConceptDaoImpl.java
Tue Nov  4 17:41:43 2014
@@ -18,9 +18,6 @@
  */
 package org.apache.ctakes.ytex.kernel.dao;
 
-import gnu.trove.set.TIntSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.io.File;
@@ -425,7 +422,7 @@ public class ConceptDaoImpl implements C
 	}
 
 	private boolean checkCycle(ConcRel crPar, ConcRel crChild) {
-		TIntSet visitedNodes = new TIntHashSet();
+		HashSet<Integer> visitedNodes = new HashSet<Integer>();
 		return hasAncestor(crPar, crChild, visitedNodes);
 	}
 
@@ -442,7 +439,7 @@ public class ConceptDaoImpl implements C
 	 * @return true if crChild is an ancestor of crPar
 	 */
 	private boolean hasAncestor(ConcRel crPar, ConcRel crChild,
-			TIntSet visitedNodes) {
+			HashSet<Integer> visitedNodes) {
 		// see if we've already visited this node - if yes then no need to redo
 		// this
 		if (visitedNodes.contains(crPar.getNodeIndex()))

Modified: ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/umls/dao/UMLSDao.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/umls/dao/UMLSDao.java?rev=1636663&r1=1636662&r2=1636663&view=diff
==============================================================================
--- ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/umls/dao/UMLSDao.java (original)
+++ ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/umls/dao/UMLSDao.java Tue
Nov  4 17:41:43 2014
@@ -18,9 +18,7 @@
  */
 package org.apache.ctakes.ytex.umls.dao;
 
-import gnu.trove.set.TIntSet;
-import gnu.trove.set.TShortSet;
-
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
@@ -65,7 +63,7 @@ public interface UMLSDao {
 	 * 
 	 * @return
 	 */
-	public abstract TIntSet getRXNORMCuis();
+	public abstract HashSet<Integer> getRXNORMCuis();
 
 	public abstract boolean isRXNORMCui(String cui);
 

Modified: ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/umls/dao/UMLSDaoImpl.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/umls/dao/UMLSDaoImpl.java?rev=1636663&r1=1636662&r2=1636663&view=diff
==============================================================================
--- ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/umls/dao/UMLSDaoImpl.java
(original)
+++ ctakes/trunk/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/umls/dao/UMLSDaoImpl.java
Tue Nov  4 17:41:43 2014
@@ -18,10 +18,8 @@
  */
 package org.apache.ctakes.ytex.umls.dao;
 
-import gnu.trove.set.TIntSet;
-import gnu.trove.set.hash.TIntHashSet;
-
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Matcher;
@@ -149,8 +147,8 @@ public class UMLSDaoImpl implements UMLS
 
 	@Override
 	@SuppressWarnings("unchecked")
-	public TIntSet getRXNORMCuis() {
-		TIntSet cuis = new TIntHashSet();
+	public HashSet<Integer> getRXNORMCuis() {
+		HashSet<Integer> cuis = new HashSet();
 		for (String cui : (List<String>) sessionFactory.getCurrentSession()
 				.getNamedQuery("getRXNORMCuis").list()) {
 			Matcher m = UMLSDao.cuiPattern.matcher(cui);



Mime
View raw message