You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by ja...@apache.org on 2017/03/16 21:55:01 UTC

svn commit: r1787257 [5/5] - in /ctakes/trunk: ./ ctakes-dictionary-gui/ ctakes-dictionary-gui/resources/ ctakes-dictionary-gui/resources/org/ ctakes-dictionary-gui/resources/org/apache/ ctakes-dictionary-gui/resources/org/apache/ctakes/ ctakes-diction...

Added: ctakes/trunk/ctakes-dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/collection/EnumSetMap.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/collection/EnumSetMap.java?rev=1787257&view=auto
==============================================================================
--- ctakes/trunk/ctakes-dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/collection/EnumSetMap.java (added)
+++ ctakes/trunk/ctakes-dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/collection/EnumSetMap.java Thu Mar 16 21:55:00 2017
@@ -0,0 +1,215 @@
+package org.apache.ctakes.dictionary.creator.util.collection;
+
+import java.util.*;
+
+/**
+ * @author SPF , chip-nlp
+ * @version %I%
+ * @since 9/23/2014
+ */
+final public class EnumSetMap<K extends Enum<K>, V> implements CollectionMap<K, V, Set<V>> {
+
+   private final CollectionMap<K, V, Set<V>> _delegate;
+
+
+   public EnumSetMap( final Class<K> enumType ) {
+      final EnumMap<K, Set<V>> enumMap = new EnumMap<>( enumType );
+      final CollectionCreator<V, Set<V>> creator = CollectionCreatorFactory.createSetCreator();
+      _delegate = new DefaultCollectionMap<>( enumMap, creator );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Iterator<Entry<K, Set<V>>> iterator() {
+      return _delegate.iterator();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Collection<Set<V>> getAllCollections() {
+      return new HashSet<>( _delegate.values() );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<V> getCollection( final K key ) {
+      return _delegate.getCollection( key );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<V> obtainCollection( final K key ) {
+      return _delegate.obtainCollection( key );
+   }
+
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean containsValue( final K key, final V value ) {
+      return _delegate.containsValue( key, value );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean placeValue( final K key, final V value ) {
+      return _delegate.placeValue( key, value );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean placeMap( final Map<K, V> map ) {
+      return _delegate.placeMap( map );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void removeValue( final K key, final V value ) {
+      _delegate.removeValue( key, value );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public <C extends Collection<V>> int addAllValues( final K key, final C collection ) {
+      return _delegate.addAllValues( key, collection );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void clearCollection( final K key ) {
+      _delegate.clearCollection( key );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public int size() {
+      return _delegate.size();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean isEmpty() {
+      return _delegate.isEmpty();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean containsKey( final Object key ) {
+      return _delegate.containsKey( key );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean containsValue( final Object value ) {
+      return _delegate.containsValue( value );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<V> get( final Object key ) {
+      return _delegate.get( key );
+   }
+
+   // Modification Operations
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<V> put( final K key, final Set<V> value ) {
+      return _delegate.put( key, value );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<V> remove( final Object key ) {
+      return _delegate.remove( key );
+   }
+
+
+   // Bulk Operations
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void putAll( final Map<? extends K, ? extends Set<V>> map ) {
+      _delegate.putAll( map );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void clear() {
+      _delegate.clear();
+   }
+
+
+   // Views
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<K> keySet() {
+      return _delegate.keySet();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Collection<Set<V>> values() {
+      return _delegate.values();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<Entry<K, Set<V>>> entrySet() {
+      return _delegate.entrySet();
+   }
+
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Map<K, Set<V>> toSimpleMap() {
+      return _delegate;
+   }
+
+}

Added: ctakes/trunk/ctakes-dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/collection/HashSetMap.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/collection/HashSetMap.java?rev=1787257&view=auto
==============================================================================
--- ctakes/trunk/ctakes-dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/collection/HashSetMap.java (added)
+++ ctakes/trunk/ctakes-dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/collection/HashSetMap.java Thu Mar 16 21:55:00 2017
@@ -0,0 +1,225 @@
+package org.apache.ctakes.dictionary.creator.util.collection;
+
+import java.util.*;
+
+/**
+ * Author: SPF
+ * Affiliation: CHIP-NLP
+ * Date: 6/24/14
+ */
+final public class HashSetMap<K, V> implements CollectionMap<K, V, Set<V>> {
+
+   private final CollectionMap<K, V, Set<V>> _delegate;
+
+
+   public HashSetMap() {
+      final Map<K, Set<V>> hashMap = new HashMap<>();
+      final CollectionCreator<V, Set<V>> creator = CollectionCreatorFactory.createSetCreator();
+      _delegate = new DefaultCollectionMap<>( hashMap, creator );
+   }
+
+   /**
+    * @param size initial size of the HashSetMap
+    */
+   public HashSetMap( final int size ) {
+      final Map<K, Set<V>> hashMap = new HashMap<>( size );
+      final CollectionCreator<V, Set<V>> creator = CollectionCreatorFactory.createSetCreator();
+      _delegate = new DefaultCollectionMap<>( hashMap, creator );
+   }
+
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Iterator<Entry<K, Set<V>>> iterator() {
+      return _delegate.iterator();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Collection<Set<V>> getAllCollections() {
+      return new HashSet<>( _delegate.values() );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<V> getCollection( final K key ) {
+      return _delegate.getCollection( key );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<V> obtainCollection( final K key ) {
+      return _delegate.obtainCollection( key );
+   }
+
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean containsValue( final K key, final V value ) {
+      return _delegate.containsValue( key, value );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean placeValue( final K key, final V value ) {
+      return _delegate.placeValue( key, value );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean placeMap( final Map<K, V> map ) {
+      return _delegate.placeMap( map );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void removeValue( final K key, final V value ) {
+      _delegate.removeValue( key, value );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public <C extends Collection<V>> int addAllValues( final K key, final C collection ) {
+      return _delegate.addAllValues( key, collection );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void clearCollection( final K key ) {
+      _delegate.clearCollection( key );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public int size() {
+      return _delegate.size();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean isEmpty() {
+      return _delegate.isEmpty();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean containsKey( final Object key ) {
+      return _delegate.containsKey( key );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean containsValue( final Object value ) {
+      return _delegate.containsValue( value );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<V> get( final Object key ) {
+      return _delegate.get( key );
+   }
+
+   // Modification Operations
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<V> put( final K key, final Set<V> value ) {
+      return _delegate.put( key, value );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<V> remove( final Object key ) {
+      return _delegate.remove( key );
+   }
+
+
+   // Bulk Operations
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void putAll( final Map<? extends K, ? extends Set<V>> map ) {
+      _delegate.putAll( map );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void clear() {
+      _delegate.clear();
+   }
+
+
+   // Views
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<K> keySet() {
+      return _delegate.keySet();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Collection<Set<V>> values() {
+      return _delegate.values();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<Entry<K, Set<V>>> entrySet() {
+      return _delegate.entrySet();
+   }
+
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Map<K, Set<V>> toSimpleMap() {
+      return _delegate;
+   }
+
+}

Added: ctakes/trunk/ctakes-dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/collection/ImmutableCollectionMap.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/collection/ImmutableCollectionMap.java?rev=1787257&view=auto
==============================================================================
--- ctakes/trunk/ctakes-dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/collection/ImmutableCollectionMap.java (added)
+++ ctakes/trunk/ctakes-dictionary-gui/src/main/java/org/apache/ctakes/dictionary/creator/util/collection/ImmutableCollectionMap.java Thu Mar 16 21:55:00 2017
@@ -0,0 +1,214 @@
+package org.apache.ctakes.dictionary.creator.util.collection;
+
+import java.util.*;
+
+/**
+ * Author: SPF
+ * Affiliation: CHIP-NLP
+ * Date: 9/5/2014
+ */
+final public class ImmutableCollectionMap<K, V, T extends Collection<V>> implements CollectionMap<K, V, T> {
+
+   private final CollectionMap<K, V, T> _protectedMap;
+
+   public ImmutableCollectionMap( final CollectionMap<K, V, T> collectionMap ) {
+      _protectedMap = collectionMap;
+   }
+
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Iterator<Entry<K, T>> iterator() {
+      return _protectedMap.iterator();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Collection<T> getAllCollections() {
+      return Collections.unmodifiableCollection( _protectedMap.values() );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public T getCollection( final K key ) {
+      // unfortunately, we cannot use an unmodifiable from Collections
+      return _protectedMap.getCollection( key );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public T obtainCollection( final K key ) {
+      return getCollection( key );
+   }
+
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean containsValue( final K key, final V value ) {
+      return _protectedMap.containsValue( key, value );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean placeValue( final K key, final V value ) {
+      throw new UnsupportedOperationException();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean placeMap( final Map<K, V> map ) {
+      throw new UnsupportedOperationException();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void removeValue( final K key, final V value ) {
+      throw new UnsupportedOperationException();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public <C extends Collection<V>> int addAllValues( final K key, final C collection ) {
+      throw new UnsupportedOperationException();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void clearCollection( final K key ) {
+      throw new UnsupportedOperationException();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public int size() {
+      return _protectedMap.size();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean isEmpty() {
+      return _protectedMap.isEmpty();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean containsKey( final Object key ) {
+      return _protectedMap.containsKey( key );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public boolean containsValue( final Object value ) {
+      return _protectedMap.containsValue( value );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public T get( final Object key ) {
+      return _protectedMap.get( key );
+   }
+
+   // Modification Operations
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public T put( final K key, final T value ) {
+      throw new UnsupportedOperationException();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public T remove( final Object key ) {
+      throw new UnsupportedOperationException();
+   }
+
+
+   // Bulk Operations
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void putAll( final Map<? extends K, ? extends T> map ) {
+      throw new UnsupportedOperationException();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void clear() {
+      throw new UnsupportedOperationException();
+   }
+
+
+   // Views
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<K> keySet() {
+      return _protectedMap.keySet();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Collection<T> values() {
+      return _protectedMap.values();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Set<Entry<K, T>> entrySet() {
+      return _protectedMap.entrySet();
+   }
+
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public Map<K, T> toSimpleMap() {
+      return Collections.unmodifiableMap( _protectedMap );
+   }
+
+}

Added: ctakes/trunk/ctakes-dictionary-gui/src/test/java/org/apache/ctakes/dictionary/creator/gui/umls/DoseUtilTester.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-gui/src/test/java/org/apache/ctakes/dictionary/creator/gui/umls/DoseUtilTester.java?rev=1787257&view=auto
==============================================================================
--- ctakes/trunk/ctakes-dictionary-gui/src/test/java/org/apache/ctakes/dictionary/creator/gui/umls/DoseUtilTester.java (added)
+++ ctakes/trunk/ctakes-dictionary-gui/src/test/java/org/apache/ctakes/dictionary/creator/gui/umls/DoseUtilTester.java Thu Mar 16 21:55:00 2017
@@ -0,0 +1,30 @@
+package org.apache.ctakes.dictionary.creator.gui.umls;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.logging.Logger;
+
+/**
+ * @author SPF , chip-nlp
+ * @version %I%
+ * @since 7/5/2016
+ */
+public class DoseUtilTester {
+
+   static private final Logger LOGGER = Logger.getLogger( "DoseUtilTester" );
+
+   @Test
+   public void testHasUnit() {
+      Assert.assertTrue( "No ml detected!",
+            DoseUtil.hasUnit( "alcohol . 31 ml in 1 ml topical cloth [ alcohol wipes ]" ) );
+      Assert.assertTrue( "No mpa detected!",
+            DoseUtil.hasUnit( "polyquaternium - 32 ( 30000 mpa . s at 2 % )" ) );
+      Assert.assertTrue( "No mg detected!",
+            DoseUtil.hasUnit( "myasthenia gravis ( mg )" ) );
+      Assert.assertTrue( "No % detected!",
+            DoseUtil.hasUnit( "imiquimod 2 . 5 % top cream" ) );
+
+   }
+
+}

Modified: ctakes/trunk/pom.xml
URL: http://svn.apache.org/viewvc/ctakes/trunk/pom.xml?rev=1787257&r1=1787256&r2=1787257&view=diff
==============================================================================
--- ctakes/trunk/pom.xml (original)
+++ ctakes/trunk/pom.xml Thu Mar 16 21:55:00 2017
@@ -138,6 +138,7 @@
 		<module>ctakes-ytex-web</module>
 		<module>ctakes-dictionary-lookup-fast</module>
 		<module>ctakes-dictionary-lookup-fast-res</module>
+		<module>ctakes-dictionary-gui</module>
 	</modules>
 	<dependencyManagement>
 		<dependencies>
@@ -864,7 +865,7 @@
 										</goals>
 									</pluginExecutionFilter>
 									<action>
-										<ignore />
+										<ignore/>
 									</action>
 								</pluginExecution>																
 							</pluginExecutions>
@@ -885,4 +886,4 @@
 			</properties>
 		</profile>
 	</profiles>
-</project>
+</project>
\ No newline at end of file