incubator-ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From james-mas...@apache.org
Subject svn commit: r1403989 [19/28] - in /incubator/ctakes/branches/SHARPn-cTAKES: Constituency Parser/src/org/chboston/cnlp/ctakes/parser/ Constituency Parser/src/org/chboston/cnlp/ctakes/parser/uima/ae/ Constituency Parser/src/org/chboston/cnlp/ctakes/parse...
Date Wed, 31 Oct 2012 05:26:55 GMT
Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/DictionaryEngine.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/DictionaryEngine.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/DictionaryEngine.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/DictionaryEngine.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,265 +14,265 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import edu.mayo.bmi.dictionary.filter.CollectionFilter;
-import edu.mayo.bmi.dictionary.filter.FilterException;
-import edu.mayo.bmi.dictionary.filter.PostLookupFilter;
-import edu.mayo.bmi.dictionary.filter.PreLookupFilter;
-
-/**
- * The engine adds additional functionality to executing a dictionary.
- * <ol>
- * <li>Pre-lookup filtering. Filters the input text.</li>
- * <li>Post-lookup filtering. Filters individual dictionary hits based on
- * metadata.</li>
- * <li>Collection filtering. Filters the collection of dictionary hits based on
- * metadata and/or collection information.</li>
- * <li>Caching. Caches dictionary hits.</li>
- * <li>Case Sensitivity. Keeps case or makes case irrelevant to lookup.</li>
- * </ol>
- * 
- * @author Mayo Clinic
- */
-public class DictionaryEngine
-{
-    private Dictionary iv_dict;
-
-    // use Lists to store filters to maintain order
-    private List iv_preLookupFilterList = new ArrayList();
-    private List iv_postLookupFilterList = new ArrayList();
-    private List iv_collectionFilterList = new ArrayList();
-
-    // cache objs
-    // key = String text, value = Boolean
-    private Map iv_binaryLookupCacheMap = new HashMap();
-    // key = String text, value = Collection of MetaDataHits
-    private Map iv_metaLookupCacheMap = new HashMap();
-
-    private boolean iv_keepCase = false;
-
-    /**
-     * 
-     * Constructor
-     * 
-     * @param dict
-     *            Dictionary to use for lookup operations.
-     * @param keepCase
-     *            Determines whether to keep character Upper or Lower casing.
-     *            False indicates that casing will be ignored by lower casing
-     *            all lookups.
-     */
-    public DictionaryEngine(Dictionary dict, boolean keepCase)
-    {
-        iv_dict = dict;
-        iv_keepCase = keepCase;
-    }
-
-    /**
-     * Adds a Pre-lookup filter to the engine. Filters will be applied in the
-     * order of addition.
-     * 
-     * @param plf
-     *            PreLookupFilter to add.
-     */
-    public void addPreLookupFilter(PreLookupFilter plf)
-    {
-        iv_preLookupFilterList.add(plf);
-    }
-
-    /**
-     * Adds a Post-lookup filter to the engine. Filters will be applied in the
-     * order of addition.
-     * 
-     * @param plf
-     *            PostLookupFilter to add.
-     */
-    public void addPostLookupFilter(PostLookupFilter plf)
-    {
-        iv_postLookupFilterList.add(plf);
-    }
-
-    /**
-     * Adds a Collection filter to the engine. Filters will be applied in the
-     * order of addition. Filter will be applied after PostLookupFiltering.
-     * 
-     * @param cf
-     *            CollectionFilter to add.
-     */
-    public void addCollectionFilter(CollectionFilter cf)
-    {
-        iv_collectionFilterList.add(cf);
-    }
-
-    /**
-     * Adds an entry to the dictionary lookup cache. The given text will be
-     * cached immediately when this method is invoked. This cache does not
-     * expire.
-     * 
-     * @param text
-     */
-    public void addCacheEntry(String text)
-            throws DictionaryException, FilterException
-    {
-        if (!iv_keepCase)
-        {
-            text = text.toLowerCase();
-        }
-
-        boolean isHit = binaryLookup(text);
-        iv_binaryLookupCacheMap.put(text, new Boolean(isHit));
-
-        Collection c = metaLookup(text);
-        iv_metaLookupCacheMap.put(text, c);
-    }
-
-    /**
-     * Gets a collection of MetaDataHits from the Dictionary based on the input
-     * text. Both Pre-lookup and Post-lookup filtering are applied.
-     * 
-     * @param text
-     *            The input text.
-     * @return Collection of MetaDataHit objects
-     * @throws DictionaryException
-     * @throws FilterException
-     */
-    public Collection metaLookup(String text)
-            throws DictionaryException, FilterException
-    {
-        if (!iv_keepCase)
-        {
-            text = text.toLowerCase();
-        }
-
-        // apply pre-filtering
-        if (isFilteredByPreLookup(text))
-        {
-            // return empty Collection
-            return new HashSet();
-        }
-
-        // not part of filter
-        Collection metaDataHitCol = null;
-        boolean isCached = iv_metaLookupCacheMap.containsKey(text);
-        if (isCached)
-        {
-            metaDataHitCol = (Collection) iv_metaLookupCacheMap.get(text);
-        }
-        else
-        {
-            // not part of cache, go ahead and do lookup
-            metaDataHitCol = iv_dict.getEntries(text);
-        }
-
-        // apply post-filtering
-        if (iv_postLookupFilterList.size() > 0)
-        {
-            Set mdhRemovalSet = new HashSet();
-            Iterator mdhItr = metaDataHitCol.iterator();
-            while (mdhItr.hasNext())
-            {
-                MetaDataHit mdh = (MetaDataHit) mdhItr.next();
-                Iterator plfItr = iv_postLookupFilterList.iterator();
-                while (plfItr.hasNext())
-                {
-                    PostLookupFilter plf = (PostLookupFilter) plfItr.next();
-                    if (plf.contains(mdh))
-                    {
-                        mdhRemovalSet.add(mdh);
-                    }
-                }
-            }
-            metaDataHitCol.removeAll(mdhRemovalSet);
-        }
-
-        // apply collection filtering
-        if (iv_collectionFilterList.size() > 0)
-        {
-            Iterator cfItr = iv_collectionFilterList.iterator();
-            while (cfItr.hasNext())
-            {
-                CollectionFilter cf = (CollectionFilter) cfItr.next();
-                metaDataHitCol = cf.applyFilter(metaDataHitCol);
-            }
-        }
-
-        return metaDataHitCol;
-    }
-
-    /**
-     * Determines whether the input text is contained by the Dictionary. Only
-     * pre-lookup filtering is applied.
-     * 
-     * @param text
-     *            The input text.
-     * @return true if contained by Dictionary, false otherwise
-     * @throws DictionaryException
-     * @throws FilterException
-     */
-    public boolean binaryLookup(String text)
-            throws DictionaryException, FilterException
-    {
-        if (!iv_keepCase)
-        {
-            text = text.toLowerCase();
-        }
-
-        // apply pre-filtering
-        if (isFilteredByPreLookup(text))
-        {
-            return false;
-        }
-
-        // not part of filter, go ahead and do lookup
-
-        Boolean isHit = null;
-        boolean isCached = iv_binaryLookupCacheMap.containsKey(text);
-        if (isCached)
-        {
-            isHit = (Boolean) iv_binaryLookupCacheMap.get(text);
-        }
-        else
-        {
-            // not part of cache, go ahead and do lookup
-            isHit = new Boolean(iv_dict.contains(text));
-        }
-
-        return isHit.booleanValue();
-    }
-
-    /**
-     * Helper method that applies Pre-lookup filtering to the input text.
-     * 
-     * @param text
-     *            The input text to be filtered.
-     * @return true if filtered, false otherwise
-     * @throws FilterException
-     */
-    private boolean isFilteredByPreLookup(String text) throws FilterException
-    {
-        if (iv_preLookupFilterList.size() > 0)
-        {
-            Iterator plfItr = iv_preLookupFilterList.iterator();
-            while (plfItr.hasNext())
-            {
-                PreLookupFilter plf = (PreLookupFilter) plfItr.next();
-                if (plf.contains(text))
-                {
-                    // text is part of filter
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-}
\ No newline at end of file
+package edu.mayo.bmi.dictionary;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import edu.mayo.bmi.dictionary.filter.CollectionFilter;
+import edu.mayo.bmi.dictionary.filter.FilterException;
+import edu.mayo.bmi.dictionary.filter.PostLookupFilter;
+import edu.mayo.bmi.dictionary.filter.PreLookupFilter;
+
+/**
+ * The engine adds additional functionality to executing a dictionary.
+ * <ol>
+ * <li>Pre-lookup filtering. Filters the input text.</li>
+ * <li>Post-lookup filtering. Filters individual dictionary hits based on
+ * metadata.</li>
+ * <li>Collection filtering. Filters the collection of dictionary hits based on
+ * metadata and/or collection information.</li>
+ * <li>Caching. Caches dictionary hits.</li>
+ * <li>Case Sensitivity. Keeps case or makes case irrelevant to lookup.</li>
+ * </ol>
+ * 
+ * @author Mayo Clinic
+ */
+public class DictionaryEngine
+{
+    private Dictionary iv_dict;
+
+    // use Lists to store filters to maintain order
+    private List iv_preLookupFilterList = new ArrayList();
+    private List iv_postLookupFilterList = new ArrayList();
+    private List iv_collectionFilterList = new ArrayList();
+
+    // cache objs
+    // key = String text, value = Boolean
+    private Map iv_binaryLookupCacheMap = new HashMap();
+    // key = String text, value = Collection of MetaDataHits
+    private Map iv_metaLookupCacheMap = new HashMap();
+
+    private boolean iv_keepCase = false;
+
+    /**
+     * 
+     * Constructor
+     * 
+     * @param dict
+     *            Dictionary to use for lookup operations.
+     * @param keepCase
+     *            Determines whether to keep character Upper or Lower casing.
+     *            False indicates that casing will be ignored by lower casing
+     *            all lookups.
+     */
+    public DictionaryEngine(Dictionary dict, boolean keepCase)
+    {
+        iv_dict = dict;
+        iv_keepCase = keepCase;
+    }
+
+    /**
+     * Adds a Pre-lookup filter to the engine. Filters will be applied in the
+     * order of addition.
+     * 
+     * @param plf
+     *            PreLookupFilter to add.
+     */
+    public void addPreLookupFilter(PreLookupFilter plf)
+    {
+        iv_preLookupFilterList.add(plf);
+    }
+
+    /**
+     * Adds a Post-lookup filter to the engine. Filters will be applied in the
+     * order of addition.
+     * 
+     * @param plf
+     *            PostLookupFilter to add.
+     */
+    public void addPostLookupFilter(PostLookupFilter plf)
+    {
+        iv_postLookupFilterList.add(plf);
+    }
+
+    /**
+     * Adds a Collection filter to the engine. Filters will be applied in the
+     * order of addition. Filter will be applied after PostLookupFiltering.
+     * 
+     * @param cf
+     *            CollectionFilter to add.
+     */
+    public void addCollectionFilter(CollectionFilter cf)
+    {
+        iv_collectionFilterList.add(cf);
+    }
+
+    /**
+     * Adds an entry to the dictionary lookup cache. The given text will be
+     * cached immediately when this method is invoked. This cache does not
+     * expire.
+     * 
+     * @param text
+     */
+    public void addCacheEntry(String text)
+            throws DictionaryException, FilterException
+    {
+        if (!iv_keepCase)
+        {
+            text = text.toLowerCase();
+        }
+
+        boolean isHit = binaryLookup(text);
+        iv_binaryLookupCacheMap.put(text, new Boolean(isHit));
+
+        Collection c = metaLookup(text);
+        iv_metaLookupCacheMap.put(text, c);
+    }
+
+    /**
+     * Gets a collection of MetaDataHits from the Dictionary based on the input
+     * text. Both Pre-lookup and Post-lookup filtering are applied.
+     * 
+     * @param text
+     *            The input text.
+     * @return Collection of MetaDataHit objects
+     * @throws DictionaryException
+     * @throws FilterException
+     */
+    public Collection metaLookup(String text)
+            throws DictionaryException, FilterException
+    {
+        if (!iv_keepCase)
+        {
+            text = text.toLowerCase();
+        }
+
+        // apply pre-filtering
+        if (isFilteredByPreLookup(text))
+        {
+            // return empty Collection
+            return new HashSet();
+        }
+
+        // not part of filter
+        Collection metaDataHitCol = null;
+        boolean isCached = iv_metaLookupCacheMap.containsKey(text);
+        if (isCached)
+        {
+            metaDataHitCol = (Collection) iv_metaLookupCacheMap.get(text);
+        }
+        else
+        {
+            // not part of cache, go ahead and do lookup
+            metaDataHitCol = iv_dict.getEntries(text);
+        }
+
+        // apply post-filtering
+        if (iv_postLookupFilterList.size() > 0)
+        {
+            Set mdhRemovalSet = new HashSet();
+            Iterator mdhItr = metaDataHitCol.iterator();
+            while (mdhItr.hasNext())
+            {
+                MetaDataHit mdh = (MetaDataHit) mdhItr.next();
+                Iterator plfItr = iv_postLookupFilterList.iterator();
+                while (plfItr.hasNext())
+                {
+                    PostLookupFilter plf = (PostLookupFilter) plfItr.next();
+                    if (plf.contains(mdh))
+                    {
+                        mdhRemovalSet.add(mdh);
+                    }
+                }
+            }
+            metaDataHitCol.removeAll(mdhRemovalSet);
+        }
+
+        // apply collection filtering
+        if (iv_collectionFilterList.size() > 0)
+        {
+            Iterator cfItr = iv_collectionFilterList.iterator();
+            while (cfItr.hasNext())
+            {
+                CollectionFilter cf = (CollectionFilter) cfItr.next();
+                metaDataHitCol = cf.applyFilter(metaDataHitCol);
+            }
+        }
+
+        return metaDataHitCol;
+    }
+
+    /**
+     * Determines whether the input text is contained by the Dictionary. Only
+     * pre-lookup filtering is applied.
+     * 
+     * @param text
+     *            The input text.
+     * @return true if contained by Dictionary, false otherwise
+     * @throws DictionaryException
+     * @throws FilterException
+     */
+    public boolean binaryLookup(String text)
+            throws DictionaryException, FilterException
+    {
+        if (!iv_keepCase)
+        {
+            text = text.toLowerCase();
+        }
+
+        // apply pre-filtering
+        if (isFilteredByPreLookup(text))
+        {
+            return false;
+        }
+
+        // not part of filter, go ahead and do lookup
+
+        Boolean isHit = null;
+        boolean isCached = iv_binaryLookupCacheMap.containsKey(text);
+        if (isCached)
+        {
+            isHit = (Boolean) iv_binaryLookupCacheMap.get(text);
+        }
+        else
+        {
+            // not part of cache, go ahead and do lookup
+            isHit = new Boolean(iv_dict.contains(text));
+        }
+
+        return isHit.booleanValue();
+    }
+
+    /**
+     * Helper method that applies Pre-lookup filtering to the input text.
+     * 
+     * @param text
+     *            The input text to be filtered.
+     * @return true if filtered, false otherwise
+     * @throws FilterException
+     */
+    private boolean isFilteredByPreLookup(String text) throws FilterException
+    {
+        if (iv_preLookupFilterList.size() > 0)
+        {
+            Iterator plfItr = iv_preLookupFilterList.iterator();
+            while (plfItr.hasNext())
+            {
+                PreLookupFilter plf = (PreLookupFilter) plfItr.next();
+                if (plf.contains(text))
+                {
+                    // text is part of filter
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/DictionaryException.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/DictionaryException.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/DictionaryException.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/DictionaryException.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,18 +14,18 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary;
-
-/**
- *
- * @author Mayo Clinic
- */
-public class DictionaryException extends Exception {
-
-	private static final long serialVersionUID = 1L;
-
-	public DictionaryException(Throwable cause) {
-
-		super(cause);
-	}
-}
+package edu.mayo.bmi.dictionary;
+
+/**
+ *
+ * @author Mayo Clinic
+ */
+public class DictionaryException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+
+	public DictionaryException(Throwable cause) {
+
+		super(cause);
+	}
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/GenericMetaDataHitImpl.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/GenericMetaDataHitImpl.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/GenericMetaDataHitImpl.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/GenericMetaDataHitImpl.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,38 +14,38 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * 
- * @author Mayo Clinic
- */
-public class GenericMetaDataHitImpl extends BaseMetaDataHitImpl
-        implements MetaDataHit
-{
-    private Map iv_nameValueMap;
-
-    public GenericMetaDataHitImpl(Map metaNameValueMap)
-    {
-        iv_nameValueMap = metaNameValueMap;
-    }
-
-    public String getMetaFieldValue(String metaFieldName)
-    {
-        return (String) iv_nameValueMap.get(metaFieldName);
-    }
-
-    public Set getMetaFieldNames()
-    {
-        return iv_nameValueMap.keySet();
-    }
-
-    public Collection getMetaFieldValues()
-    {
-        return iv_nameValueMap.values();
-    }
-}
\ No newline at end of file
+package edu.mayo.bmi.dictionary;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 
+ * @author Mayo Clinic
+ */
+public class GenericMetaDataHitImpl extends BaseMetaDataHitImpl
+        implements MetaDataHit
+{
+    private Map iv_nameValueMap;
+
+    public GenericMetaDataHitImpl(Map metaNameValueMap)
+    {
+        iv_nameValueMap = metaNameValueMap;
+    }
+
+    public String getMetaFieldValue(String metaFieldName)
+    {
+        return (String) iv_nameValueMap.get(metaFieldName);
+    }
+
+    public Set getMetaFieldNames()
+    {
+        return iv_nameValueMap.keySet();
+    }
+
+    public Collection getMetaFieldValues()
+    {
+        return iv_nameValueMap.values();
+    }
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/MetaDataHit.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/MetaDataHit.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/MetaDataHit.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/MetaDataHit.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,22 +14,22 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary;
-
-import java.util.Collection;
-import java.util.Set;
-
-/**
- *
- * @author Mayo Clinic
- */
-public interface MetaDataHit
-{
-    public Set getMetaFieldNames();
-    
-    public Collection getMetaFieldValues();
-
-    public String getMetaFieldValue(String metaFieldName);
-	
-	public boolean equals(MetaDataHit mdh);
-}
+package edu.mayo.bmi.dictionary;
+
+import java.util.Collection;
+import java.util.Set;
+
+/**
+ *
+ * @author Mayo Clinic
+ */
+public interface MetaDataHit
+{
+    public Set getMetaFieldNames();
+    
+    public Collection getMetaFieldValues();
+
+    public String getMetaFieldValue(String metaFieldName);
+	
+	public boolean equals(MetaDataHit mdh);
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/MetaDataHitComparator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/MetaDataHitComparator.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/MetaDataHitComparator.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/MetaDataHitComparator.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,71 +14,71 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary;
-
-import java.util.Comparator;
-
-/**
- * Allows two MetaDataHit objects to be compared based on a specific metadata
- * value that they both contain.
- * 
- * @author Mayo Clinic
- */
-public class MetaDataHitComparator implements Comparator, MetaDataHitConst
-{
-    private int iv_type;
-    private String iv_metaFieldName;
-    private boolean iv_sortAscending;
-
-    /**
-     * Constructor
-     * @param metaFieldName
-     * @param type
-     * @param sortAscending
-     */
-    public MetaDataHitComparator(String metaFieldName, int type, boolean sortAscending)
-    {
-        iv_metaFieldName = metaFieldName;
-        iv_type = type;
-        iv_sortAscending = sortAscending;
-    }
-
-    /**
-     * Implementation
-     */
-    public int compare(Object o1, Object o2)
-    {
-        MetaDataHit mdh1 = (MetaDataHit) o1;
-        MetaDataHit mdh2 = (MetaDataHit) o2;
-
-        String mdv1 = mdh1.getMetaFieldValue(iv_metaFieldName);
-        String mdv2 = mdh2.getMetaFieldValue(iv_metaFieldName);
-
-        int comparison;
-        switch (iv_type)
-        {
-        case INTEGER_TYPE:
-            Integer int1 = new Integer(mdv1);
-            Integer int2 = new Integer(mdv2);
-            comparison = int1.compareTo(int2);
-            break;
-        case FLOAT_TYPE:
-            Float float1 = new Float(mdv1);
-            Float float2 = new Float(mdv2);
-            comparison = float1.compareTo(float2);
-            break;
-        default:
-            comparison = mdv1.compareTo(mdv2);
-        	break;
-        }
-        
-        if (iv_sortAscending)
-        {
-            return comparison;
-        }
-        else
-        {
-            return comparison * -1;
-        }
-    }
-}
\ No newline at end of file
+package edu.mayo.bmi.dictionary;
+
+import java.util.Comparator;
+
+/**
+ * Allows two MetaDataHit objects to be compared based on a specific metadata
+ * value that they both contain.
+ * 
+ * @author Mayo Clinic
+ */
+public class MetaDataHitComparator implements Comparator, MetaDataHitConst
+{
+    private int iv_type;
+    private String iv_metaFieldName;
+    private boolean iv_sortAscending;
+
+    /**
+     * Constructor
+     * @param metaFieldName
+     * @param type
+     * @param sortAscending
+     */
+    public MetaDataHitComparator(String metaFieldName, int type, boolean sortAscending)
+    {
+        iv_metaFieldName = metaFieldName;
+        iv_type = type;
+        iv_sortAscending = sortAscending;
+    }
+
+    /**
+     * Implementation
+     */
+    public int compare(Object o1, Object o2)
+    {
+        MetaDataHit mdh1 = (MetaDataHit) o1;
+        MetaDataHit mdh2 = (MetaDataHit) o2;
+
+        String mdv1 = mdh1.getMetaFieldValue(iv_metaFieldName);
+        String mdv2 = mdh2.getMetaFieldValue(iv_metaFieldName);
+
+        int comparison;
+        switch (iv_type)
+        {
+        case INTEGER_TYPE:
+            Integer int1 = new Integer(mdv1);
+            Integer int2 = new Integer(mdv2);
+            comparison = int1.compareTo(int2);
+            break;
+        case FLOAT_TYPE:
+            Float float1 = new Float(mdv1);
+            Float float2 = new Float(mdv2);
+            comparison = float1.compareTo(float2);
+            break;
+        default:
+            comparison = mdv1.compareTo(mdv2);
+        	break;
+        }
+        
+        if (iv_sortAscending)
+        {
+            return comparison;
+        }
+        else
+        {
+            return comparison * -1;
+        }
+    }
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/MetaDataHitConst.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/MetaDataHitConst.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/MetaDataHitConst.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/MetaDataHitConst.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,20 +14,20 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary;
-
-/**
- * @author Mayo Clinic
- */
-public interface MetaDataHitConst
-{
-    public static final int INTEGER_TYPE = 0;
-    public static final int FLOAT_TYPE = 1;
-    public static final int STRING_TYPE = 2;
-    
-    public static final int EQ_OP = 0;
-    public static final int LT_OP = 1;
-    public static final int LTEQ_OP = 2;
-    public static final int GT_OP = 3;
-    public static final int GTEQ_OP = 4;    
-}
+package edu.mayo.bmi.dictionary;
+
+/**
+ * @author Mayo Clinic
+ */
+public interface MetaDataHitConst
+{
+    public static final int INTEGER_TYPE = 0;
+    public static final int FLOAT_TYPE = 1;
+    public static final int STRING_TYPE = 2;
+    
+    public static final int EQ_OP = 0;
+    public static final int LT_OP = 1;
+    public static final int LTEQ_OP = 2;
+    public static final int GT_OP = 3;
+    public static final int GTEQ_OP = 4;    
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/CollectionFilter.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/filter/CollectionFilter.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/CollectionFilter.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/CollectionFilter.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,25 +14,25 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary.filter;
-
-import java.util.Collection;
-
-/**
- * Filters a Collection of MetaDataHit objects.  Filtering is done by
- * pruning objects from the Collection that meet the filter implementation's
- * match criteria.
- * 
- * @author Mayo Clinic
- */
-public interface CollectionFilter
-{
-    /**
-     * Prunes the Collection of MetaDataHit objects that meet the filter
-     * implementation's match criteria.
-     * 
-     * @param metaDataHitCol
-     * @throws FilterException
-     */
-    public Collection applyFilter(Collection metaDataHitCol) throws FilterException;    
-}
+package edu.mayo.bmi.dictionary.filter;
+
+import java.util.Collection;
+
+/**
+ * Filters a Collection of MetaDataHit objects.  Filtering is done by
+ * pruning objects from the Collection that meet the filter implementation's
+ * match criteria.
+ * 
+ * @author Mayo Clinic
+ */
+public interface CollectionFilter
+{
+    /**
+     * Prunes the Collection of MetaDataHit objects that meet the filter
+     * implementation's match criteria.
+     * 
+     * @param metaDataHitCol
+     * @throws FilterException
+     */
+    public Collection applyFilter(Collection metaDataHitCol) throws FilterException;    
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/FilterException.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/filter/FilterException.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/FilterException.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/FilterException.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,17 +14,17 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary.filter;
-
-/**
- *
- * @author Mayo Clinic
- */
-public class FilterException extends Exception {
-
-	private static final long serialVersionUID = 1L;
-
-	public FilterException(Throwable cause) {
-		super(cause);
-	}
-}
+package edu.mayo.bmi.dictionary.filter;
+
+/**
+ *
+ * @author Mayo Clinic
+ */
+public class FilterException extends Exception {
+
+	private static final long serialVersionUID = 1L;
+
+	public FilterException(Throwable cause) {
+		super(cause);
+	}
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/MetaDataPostLookupFilterImpl.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/filter/MetaDataPostLookupFilterImpl.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/MetaDataPostLookupFilterImpl.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/MetaDataPostLookupFilterImpl.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,66 +14,66 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary.filter;
-
-import edu.mayo.bmi.dictionary.DictionaryEngine;
-import edu.mayo.bmi.dictionary.DictionaryException;
-import edu.mayo.bmi.dictionary.MetaDataHit;
-
-/**
- *
- * @author Mayo Clinic
- */
-public class MetaDataPostLookupFilterImpl implements PostLookupFilter
-{
-    private String[] iv_metaFieldNames;
-    private DictionaryEngine iv_dictEngine;
-    private boolean iv_excludeMatches = false;
-
-    public MetaDataPostLookupFilterImpl(
-        DictionaryEngine dictEngine,
-        String[] metaFieldNames,
-        boolean excludeMatches)
-    {
-        iv_dictEngine = dictEngine;
-        iv_metaFieldNames = metaFieldNames;
-        iv_excludeMatches = excludeMatches;
-    }
-
-    public boolean contains(MetaDataHit mdh) throws FilterException
-    {
-        String mdVal = getMetaDataValue(mdh);
-        
-        try
-        {
-            boolean isContained = iv_dictEngine.binaryLookup(mdVal);
-            if (iv_excludeMatches)
-            {
-                return isContained;
-            }
-            else
-            {
-                return !isContained;
-            }
-        }
-        catch (DictionaryException ge)
-        {
-            throw new FilterException(ge);
-        }
-    }
-
-    private String getMetaDataValue(MetaDataHit mdh) throws FilterException
-    {
-        for (int i = 0; i < iv_metaFieldNames.length; i++)
-        {
-            String mdVal = mdh.getMetaFieldValue(iv_metaFieldNames[i]);
-            if (mdVal != null)
-            {
-                return mdVal;
-            }
-        }
-        throw new FilterException(
-            new Exception("Unable to extract meta data from MetaDataHit object."));
-    }
-
-}
+package edu.mayo.bmi.dictionary.filter;
+
+import edu.mayo.bmi.dictionary.DictionaryEngine;
+import edu.mayo.bmi.dictionary.DictionaryException;
+import edu.mayo.bmi.dictionary.MetaDataHit;
+
+/**
+ *
+ * @author Mayo Clinic
+ */
+public class MetaDataPostLookupFilterImpl implements PostLookupFilter
+{
+    private String[] iv_metaFieldNames;
+    private DictionaryEngine iv_dictEngine;
+    private boolean iv_excludeMatches = false;
+
+    public MetaDataPostLookupFilterImpl(
+        DictionaryEngine dictEngine,
+        String[] metaFieldNames,
+        boolean excludeMatches)
+    {
+        iv_dictEngine = dictEngine;
+        iv_metaFieldNames = metaFieldNames;
+        iv_excludeMatches = excludeMatches;
+    }
+
+    public boolean contains(MetaDataHit mdh) throws FilterException
+    {
+        String mdVal = getMetaDataValue(mdh);
+        
+        try
+        {
+            boolean isContained = iv_dictEngine.binaryLookup(mdVal);
+            if (iv_excludeMatches)
+            {
+                return isContained;
+            }
+            else
+            {
+                return !isContained;
+            }
+        }
+        catch (DictionaryException ge)
+        {
+            throw new FilterException(ge);
+        }
+    }
+
+    private String getMetaDataValue(MetaDataHit mdh) throws FilterException
+    {
+        for (int i = 0; i < iv_metaFieldNames.length; i++)
+        {
+            String mdVal = mdh.getMetaFieldValue(iv_metaFieldNames[i]);
+            if (mdVal != null)
+            {
+                return mdVal;
+            }
+        }
+        throw new FilterException(
+            new Exception("Unable to extract meta data from MetaDataHit object."));
+    }
+
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/PostLookupFilter.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/filter/PostLookupFilter.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/PostLookupFilter.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/PostLookupFilter.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,15 +14,15 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary.filter;
-
-import edu.mayo.bmi.dictionary.MetaDataHit;
-
-/**
- *
- * @author Mayo Clinic
- */
-public interface PostLookupFilter
-{
-	public boolean contains(MetaDataHit mdh) throws FilterException;
-}
+package edu.mayo.bmi.dictionary.filter;
+
+import edu.mayo.bmi.dictionary.MetaDataHit;
+
+/**
+ *
+ * @author Mayo Clinic
+ */
+public interface PostLookupFilter
+{
+	public boolean contains(MetaDataHit mdh) throws FilterException;
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/PostLookupFilterGroupImpl.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/filter/PostLookupFilterGroupImpl.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/PostLookupFilterGroupImpl.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/PostLookupFilterGroupImpl.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,72 +14,72 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary.filter;
-
-import edu.mayo.bmi.dictionary.MetaDataHit;
-
-/**
- * Groups multiple PostLookupFilter objects together and applies boolean logic
- * to them.
- * 
- * @author Mayo Clinic
- */
-public class PostLookupFilterGroupImpl implements PostLookupFilter
-{
-    public static final int OR_RELATION = 0;
-    public static final int AND_RELATION = 1;
-
-    private int iv_relation;
-    private PostLookupFilter[] iv_plfArr;
-    private boolean iv_excludeMatches;
-
-    /**
-     * Constructor
-     * 
-     * @param plfArr
-     * @param relation
-     */
-    public PostLookupFilterGroupImpl(PostLookupFilter[] plfArr, int relation, boolean excludeMatches)
-    {
-        iv_relation = relation;
-        iv_plfArr = plfArr;
-        iv_excludeMatches = excludeMatches;
-    }
-
-    public boolean contains(MetaDataHit mdh) throws FilterException
-    {
-        boolean isContained = false;
-        if (iv_relation == OR_RELATION)
-        {
-            isContained = false;
-            for (int i = 0; i < iv_plfArr.length; i++)
-            {
-                if (iv_plfArr[i].contains(mdh))
-                {
-                    isContained = true;
-                }
-            }
-        }
-        else if (iv_relation == AND_RELATION)
-        {
-            isContained = true;
-            for (int i = 0; i < iv_plfArr.length; i++)
-            {
-                if (iv_plfArr[i].contains(mdh) == false)
-                {
-                    isContained = false;
-                }
-            }
-        }
-        
-        
-        if (iv_excludeMatches)
-        {
-            return isContained;
-        }
-        else
-        {
-            return !isContained;
-        }    
-    }
-}
\ No newline at end of file
+package edu.mayo.bmi.dictionary.filter;
+
+import edu.mayo.bmi.dictionary.MetaDataHit;
+
+/**
+ * Groups multiple PostLookupFilter objects together and applies boolean logic
+ * to them.
+ * 
+ * @author Mayo Clinic
+ */
+public class PostLookupFilterGroupImpl implements PostLookupFilter
+{
+    public static final int OR_RELATION = 0;
+    public static final int AND_RELATION = 1;
+
+    private int iv_relation;
+    private PostLookupFilter[] iv_plfArr;
+    private boolean iv_excludeMatches;
+
+    /**
+     * Constructor
+     * 
+     * @param plfArr
+     * @param relation
+     */
+    public PostLookupFilterGroupImpl(PostLookupFilter[] plfArr, int relation, boolean excludeMatches)
+    {
+        iv_relation = relation;
+        iv_plfArr = plfArr;
+        iv_excludeMatches = excludeMatches;
+    }
+
+    public boolean contains(MetaDataHit mdh) throws FilterException
+    {
+        boolean isContained = false;
+        if (iv_relation == OR_RELATION)
+        {
+            isContained = false;
+            for (int i = 0; i < iv_plfArr.length; i++)
+            {
+                if (iv_plfArr[i].contains(mdh))
+                {
+                    isContained = true;
+                }
+            }
+        }
+        else if (iv_relation == AND_RELATION)
+        {
+            isContained = true;
+            for (int i = 0; i < iv_plfArr.length; i++)
+            {
+                if (iv_plfArr[i].contains(mdh) == false)
+                {
+                    isContained = false;
+                }
+            }
+        }
+        
+        
+        if (iv_excludeMatches)
+        {
+            return isContained;
+        }
+        else
+        {
+            return !isContained;
+        }    
+    }
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/PreLookupFilter.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/filter/PreLookupFilter.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/PreLookupFilter.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/PreLookupFilter.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,13 +14,13 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary.filter;
-
-/**
- *
- * @author Mayo Clinic
- */
-public interface PreLookupFilter
-{
-	public boolean contains(String text) throws FilterException;
-}
+package edu.mayo.bmi.dictionary.filter;
+
+/**
+ *
+ * @author Mayo Clinic
+ */
+public interface PreLookupFilter
+{
+	public boolean contains(String text) throws FilterException;
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/SetValuePostLookupFilterImpl.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/filter/SetValuePostLookupFilterImpl.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/SetValuePostLookupFilterImpl.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/SetValuePostLookupFilterImpl.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,145 +14,145 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary.filter;
-
-import edu.mayo.bmi.dictionary.MetaDataHit;
-import edu.mayo.bmi.dictionary.MetaDataHitConst;
-
-/**
- * A filter that uses a value to filter against a MetaDataHit.
- * 
- * @author Mayo Clinic
- */
-public class SetValuePostLookupFilterImpl
-        implements PostLookupFilter, MetaDataHitConst
-{
-    private Object iv_value;
-    private String iv_metaFieldName;
-    private int iv_metaFieldType;
-    private int iv_metaFieldOp;
-    private boolean iv_excludeMatches = false;
-
-    public SetValuePostLookupFilterImpl(String metaFieldName,
-            int metaFieldType, int metaFieldOp, boolean excludeMatches)
-    {
-        iv_metaFieldName = metaFieldName;
-        iv_metaFieldType = metaFieldType;
-        iv_metaFieldOp = metaFieldOp;
-        iv_excludeMatches = excludeMatches;
-    }
-
-    public void setValue(String value)
-    {
-        if (iv_metaFieldType == MetaDataHitConst.INTEGER_TYPE)
-        {
-            iv_value = new Integer(value);
-        }
-        else if (iv_metaFieldType == MetaDataHitConst.FLOAT_TYPE)
-        {
-            iv_value = new Float(value);
-        }
-        else 
-        {
-            iv_value = value;
-        }
-    }
-
-    public boolean contains(MetaDataHit mdh) throws FilterException
-    {
-        if (iv_value == null)
-        {
-            throw new FilterException(new Exception(
-                    "Value has not been set for PostLookupFilter."));
-        }
-
-        String mdVal = getMetaDataValue(mdh);
-
-        boolean isContained = isContained(mdVal);
-        if (iv_excludeMatches)
-        {
-            return isContained;
-        }
-        else
-        {
-            return !isContained;
-        }
-    }
-
-    /**
-     * Helper method
-     * 
-     * @param mdVal
-     * @return
-     */
-    private boolean isContained(String mdVal)
-    {
-        if (iv_metaFieldType == MetaDataHitConst.INTEGER_TYPE)
-        {
-            Integer mdValInteger = new Integer(mdVal);
-            Integer refValInteger = (Integer) iv_value;
-
-            int comparison = refValInteger.compareTo(mdValInteger);
-            return applyOp(comparison);
-        }
-        else if (iv_metaFieldType == MetaDataHitConst.FLOAT_TYPE)
-        {
-            Float mdValFloat = new Float(mdVal);
-            Float refValFloat = (Float) iv_value;
-
-            int comparison = refValFloat.compareTo(mdValFloat);
-            return applyOp(comparison);
-        }
-        else if (iv_metaFieldType == MetaDataHitConst.STRING_TYPE)
-        {
-            String refValStr = (String) iv_value;
-
-            int comparison = refValStr.compareTo(mdVal);
-            return applyOp(comparison);
-        }
-
-        return false;
-    }
-
-    /**
-     * Checks the comparison value against the specified operation. Based on
-     * this information, being filtered or not can be determined.
-     * 
-     * @param comparisonVal
-     * @return
-     */
-    private boolean applyOp(int comparisonVal)
-    {
-        if (((iv_metaFieldOp == MetaDataHitConst.EQ_OP)
-                || (iv_metaFieldOp == MetaDataHitConst.LTEQ_OP) || (iv_metaFieldOp == MetaDataHitConst.GTEQ_OP))
-                && (comparisonVal == 0))
-        {
-            return true;
-        }
-        else if (((iv_metaFieldOp == MetaDataHitConst.LT_OP) || (iv_metaFieldOp == MetaDataHitConst.LTEQ_OP))
-                && (comparisonVal > 0))
-        {
-            return true;
-        }
-        else if (((iv_metaFieldOp == MetaDataHitConst.GT_OP) || (iv_metaFieldOp == MetaDataHitConst.GTEQ_OP))
-                && (comparisonVal < 0))
-        {
-            return true;
-        }
-        else
-        {
-            return false;
-        }
-    }
-
-    private String getMetaDataValue(MetaDataHit mdh) throws FilterException
-    {
-        String mdVal = mdh.getMetaFieldValue(iv_metaFieldName);
-        if (mdVal != null)
-        {
-            return mdVal;
-        }
-        throw new FilterException(new Exception(
-                "Unable to extract meta data from MetaDataHit object."));
-    }
-}
\ No newline at end of file
+package edu.mayo.bmi.dictionary.filter;
+
+import edu.mayo.bmi.dictionary.MetaDataHit;
+import edu.mayo.bmi.dictionary.MetaDataHitConst;
+
+/**
+ * A filter that uses a value to filter against a MetaDataHit.
+ * 
+ * @author Mayo Clinic
+ */
+public class SetValuePostLookupFilterImpl
+        implements PostLookupFilter, MetaDataHitConst
+{
+    private Object iv_value;
+    private String iv_metaFieldName;
+    private int iv_metaFieldType;
+    private int iv_metaFieldOp;
+    private boolean iv_excludeMatches = false;
+
+    public SetValuePostLookupFilterImpl(String metaFieldName,
+            int metaFieldType, int metaFieldOp, boolean excludeMatches)
+    {
+        iv_metaFieldName = metaFieldName;
+        iv_metaFieldType = metaFieldType;
+        iv_metaFieldOp = metaFieldOp;
+        iv_excludeMatches = excludeMatches;
+    }
+
+    public void setValue(String value)
+    {
+        if (iv_metaFieldType == MetaDataHitConst.INTEGER_TYPE)
+        {
+            iv_value = new Integer(value);
+        }
+        else if (iv_metaFieldType == MetaDataHitConst.FLOAT_TYPE)
+        {
+            iv_value = new Float(value);
+        }
+        else 
+        {
+            iv_value = value;
+        }
+    }
+
+    public boolean contains(MetaDataHit mdh) throws FilterException
+    {
+        if (iv_value == null)
+        {
+            throw new FilterException(new Exception(
+                    "Value has not been set for PostLookupFilter."));
+        }
+
+        String mdVal = getMetaDataValue(mdh);
+
+        boolean isContained = isContained(mdVal);
+        if (iv_excludeMatches)
+        {
+            return isContained;
+        }
+        else
+        {
+            return !isContained;
+        }
+    }
+
+    /**
+     * Helper method
+     * 
+     * @param mdVal
+     * @return
+     */
+    private boolean isContained(String mdVal)
+    {
+        if (iv_metaFieldType == MetaDataHitConst.INTEGER_TYPE)
+        {
+            Integer mdValInteger = new Integer(mdVal);
+            Integer refValInteger = (Integer) iv_value;
+
+            int comparison = refValInteger.compareTo(mdValInteger);
+            return applyOp(comparison);
+        }
+        else if (iv_metaFieldType == MetaDataHitConst.FLOAT_TYPE)
+        {
+            Float mdValFloat = new Float(mdVal);
+            Float refValFloat = (Float) iv_value;
+
+            int comparison = refValFloat.compareTo(mdValFloat);
+            return applyOp(comparison);
+        }
+        else if (iv_metaFieldType == MetaDataHitConst.STRING_TYPE)
+        {
+            String refValStr = (String) iv_value;
+
+            int comparison = refValStr.compareTo(mdVal);
+            return applyOp(comparison);
+        }
+
+        return false;
+    }
+
+    /**
+     * Checks the comparison value against the specified operation. Based on
+     * this information, being filtered or not can be determined.
+     * 
+     * @param comparisonVal
+     * @return
+     */
+    private boolean applyOp(int comparisonVal)
+    {
+        if (((iv_metaFieldOp == MetaDataHitConst.EQ_OP)
+                || (iv_metaFieldOp == MetaDataHitConst.LTEQ_OP) || (iv_metaFieldOp == MetaDataHitConst.GTEQ_OP))
+                && (comparisonVal == 0))
+        {
+            return true;
+        }
+        else if (((iv_metaFieldOp == MetaDataHitConst.LT_OP) || (iv_metaFieldOp == MetaDataHitConst.LTEQ_OP))
+                && (comparisonVal > 0))
+        {
+            return true;
+        }
+        else if (((iv_metaFieldOp == MetaDataHitConst.GT_OP) || (iv_metaFieldOp == MetaDataHitConst.GTEQ_OP))
+                && (comparisonVal < 0))
+        {
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    private String getMetaDataValue(MetaDataHit mdh) throws FilterException
+    {
+        String mdVal = mdh.getMetaFieldValue(iv_metaFieldName);
+        if (mdVal != null)
+        {
+            return mdVal;
+        }
+        throw new FilterException(new Exception(
+                "Unable to extract meta data from MetaDataHit object."));
+    }
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/StringPreLookupFilterImpl.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/filter/StringPreLookupFilterImpl.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/StringPreLookupFilterImpl.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/StringPreLookupFilterImpl.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,26 +14,26 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary.filter;
-
-import java.util.Set;
-
-/**
- *
- * @author Mayo Clinic
- */
-public class StringPreLookupFilterImpl implements PreLookupFilter
-{
-    private Set iv_strSet;
-
-    public StringPreLookupFilterImpl(Set strSet)
-    {
-        iv_strSet = strSet;
-    }
-
-    public boolean contains(String text) throws FilterException
-    {
-	    return iv_strSet.contains(text);
-    }
-
-}
+package edu.mayo.bmi.dictionary.filter;
+
+import java.util.Set;
+
+/**
+ *
+ * @author Mayo Clinic
+ */
+public class StringPreLookupFilterImpl implements PreLookupFilter
+{
+    private Set iv_strSet;
+
+    public StringPreLookupFilterImpl(Set strSet)
+    {
+        iv_strSet = strSet;
+    }
+
+    public boolean contains(String text) throws FilterException
+    {
+	    return iv_strSet.contains(text);
+    }
+
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/TruncateCollectionFilterImpl.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/filter/TruncateCollectionFilterImpl.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/TruncateCollectionFilterImpl.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/filter/TruncateCollectionFilterImpl.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,57 +14,57 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary.filter;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-/**
- * Truncates objects in the collection. The collection is first sorted and then
- * the top N objects are retained. The rest of the objects are truncated.
- * 
- * @author Mayo Clinic
- */
-public class TruncateCollectionFilterImpl implements CollectionFilter
-{
-    private int iv_mdhCount;
-    private Comparator iv_mdhComparator;
-
-    /**
-     * Constructor
-     * 
-     * @param mdhComparator
-     *            Comparator for sorting MetaDataHit objects.
-     * @param mdhCount
-     *            Number of objects (N) to retain.
-     */
-    public TruncateCollectionFilterImpl(Comparator mdhComparator, int mdhCount)
-    {
-        iv_mdhComparator = mdhComparator;
-        iv_mdhCount = mdhCount;
-    }
-
-    /**
-     * Implementation
-     */
-    public Collection applyFilter(Collection metaDataHitCol) throws FilterException
-    {
-        if (iv_mdhCount >= metaDataHitCol.size())
-        {
-            return metaDataHitCol;
-        }
-        
-        List mdhList = new ArrayList(metaDataHitCol);
-
-        // sort the hits
-        Collections.sort(mdhList, iv_mdhComparator);
-
-        // truncate off the hits
-        mdhList.subList(iv_mdhCount, mdhList.size()).clear();
-        
-        return mdhList;
-    }
-}
\ No newline at end of file
+package edu.mayo.bmi.dictionary.filter;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * Truncates objects in the collection. The collection is first sorted and then
+ * the top N objects are retained. The rest of the objects are truncated.
+ * 
+ * @author Mayo Clinic
+ */
+public class TruncateCollectionFilterImpl implements CollectionFilter
+{
+    private int iv_mdhCount;
+    private Comparator iv_mdhComparator;
+
+    /**
+     * Constructor
+     * 
+     * @param mdhComparator
+     *            Comparator for sorting MetaDataHit objects.
+     * @param mdhCount
+     *            Number of objects (N) to retain.
+     */
+    public TruncateCollectionFilterImpl(Comparator mdhComparator, int mdhCount)
+    {
+        iv_mdhComparator = mdhComparator;
+        iv_mdhCount = mdhCount;
+    }
+
+    /**
+     * Implementation
+     */
+    public Collection applyFilter(Collection metaDataHitCol) throws FilterException
+    {
+        if (iv_mdhCount >= metaDataHitCol.size())
+        {
+            return metaDataHitCol;
+        }
+        
+        List mdhList = new ArrayList(metaDataHitCol);
+
+        // sort the hits
+        Collections.sort(mdhList, iv_mdhComparator);
+
+        // truncate off the hits
+        mdhList.subList(iv_mdhCount, mdhList.size()).clear();
+        
+        return mdhList;
+    }
+}

Modified: incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/jdbc/JdbcDictionaryImpl.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/branches/SHARPn-cTAKES/dictionary%20lookup/src/edu/mayo/bmi/dictionary/jdbc/JdbcDictionaryImpl.java?rev=1403989&r1=1403988&r2=1403989&view=diff
==============================================================================
--- incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/jdbc/JdbcDictionaryImpl.java (original)
+++ incubator/ctakes/branches/SHARPn-cTAKES/dictionary lookup/src/edu/mayo/bmi/dictionary/jdbc/JdbcDictionaryImpl.java Wed Oct 31 05:26:43 2012
@@ -1,18 +1,11 @@
 /*
- * Copyright: (c) 2009   Mayo Foundation for Medical Education and 
- * Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the
- * triple-shield Mayo logo are trademarks and service marks of MFMER.
- *
- * Except as contained in the copyright notice above, or as used to identify 
- * MFMER as the author of this software, the trade names, trademarks, service
- * marks, or product names of the copyright holder shall not be used in
- * advertising, promotion or otherwise in connection with this software without
- * prior written authorization of the copyright holder.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0 
  * 
  * Unless required by applicable law or agreed to in writing, software
@@ -21,157 +14,157 @@
  * See the License for the specific language governing permissions and 
  * limitations under the License. 
  */
-package edu.mayo.bmi.dictionary.jdbc;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import edu.mayo.bmi.dictionary.BaseDictionaryImpl;
-import edu.mayo.bmi.dictionary.Dictionary;
-import edu.mayo.bmi.dictionary.DictionaryException;
-import edu.mayo.bmi.dictionary.GenericMetaDataHitImpl;
-import edu.mayo.bmi.dictionary.MetaDataHit;
-
-/**
- *
- * @author Mayo Clinic
- */
-public class JdbcDictionaryImpl extends BaseDictionaryImpl implements Dictionary
-{
-    private Connection iv_dbConn;
-    private String iv_tableName;
-    private String iv_lookupFieldName;
-    private PreparedStatement iv_mdPrepStmt;
-    private PreparedStatement iv_cntPrepStmt;
-
-    public JdbcDictionaryImpl(
-        Connection conn,
-        String tableName,
-        String lookupFieldName)
-    {
-        iv_dbConn = conn;
-        iv_tableName = tableName;
-        iv_lookupFieldName = lookupFieldName;
-    }
-
-    private PreparedStatement initCountPrepStmt(String text)
-        throws SQLException
-    {
-        if (iv_cntPrepStmt == null)
-        {
-            StringBuffer sb = new StringBuffer();
-            sb.append("SELECT COUNT(*) ");
-
-            sb.append(" FROM ");
-            sb.append(iv_tableName);
-
-            sb.append(" WHERE ");
-            sb.append(iv_lookupFieldName);
-            sb.append(" = ?");
-
-            iv_cntPrepStmt = iv_dbConn.prepareStatement(sb.toString());
-        }
-
-        iv_cntPrepStmt.clearParameters();
-        iv_cntPrepStmt.setString(1, text);
-
-        return iv_cntPrepStmt;
-    }
-
-    private PreparedStatement initMetaDataPrepStmt(String text)
-        throws SQLException
-    {
-        if (iv_mdPrepStmt == null)
-        {
-            StringBuffer sb = new StringBuffer();
-            sb.append("SELECT ");
-
-            // translate meta data field names into columns
-            // to be returned in the result set
-            Iterator metaFieldNameItr = getMetaFieldNames();
-            while (metaFieldNameItr.hasNext())
-            {
-                String mdFieldName = (String) metaFieldNameItr.next();
-                sb.append(mdFieldName);
-                sb.append(',');
-            }
-            // chomp off the last comma
-            sb.deleteCharAt(sb.length() - 1);
-
-            sb.append(" FROM ");
-            sb.append(iv_tableName);
-
-            sb.append(" WHERE ");
-            sb.append(iv_lookupFieldName);
-            sb.append(" = ?");
-
-            iv_mdPrepStmt = iv_dbConn.prepareStatement(sb.toString());
-        }
-
-        iv_mdPrepStmt.clearParameters();
-        iv_mdPrepStmt.setString(1, text);
-
-        return iv_mdPrepStmt;
-    }
-
-    public boolean contains(String text) throws DictionaryException
-    {
-        try
-        {
-            PreparedStatement prepStmt = initCountPrepStmt(text);
-            ResultSet rs = prepStmt.executeQuery();
-
-            rs.next();
-            int count = rs.getInt(1);
-            if (count > 0)
-            {
-                return true;
-            }
-            else
-            {
-                return false;
-            }
-        }
-        catch (SQLException e)
-        {
-            throw new DictionaryException(e);
-        }
-    }
-
-    public Collection getEntries(String str) throws DictionaryException
-    {
-        Set metaDataHitSet = new HashSet();
-        try
-        {
-            PreparedStatement prepStmt = initMetaDataPrepStmt(str);
-            ResultSet rs = prepStmt.executeQuery();
-
-            while (rs.next())
-            {
-                Map nameValMap = new HashMap();
-                Iterator metaFieldNameItr = getMetaFieldNames();
-                while (metaFieldNameItr.hasNext())
-                {
-                    String metaFieldName = (String) metaFieldNameItr.next();
-                    String metaFieldValue = rs.getString(metaFieldName);
-                    nameValMap.put(metaFieldName, metaFieldValue);
-                }
-                MetaDataHit mdh = new GenericMetaDataHitImpl(nameValMap);
-                metaDataHitSet.add(mdh);
-            }
-            return metaDataHitSet;
-        }
-        catch (SQLException e)
-        {
-            throw new DictionaryException(e);
-        }
-    }
-}
+package edu.mayo.bmi.dictionary.jdbc;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import edu.mayo.bmi.dictionary.BaseDictionaryImpl;
+import edu.mayo.bmi.dictionary.Dictionary;
+import edu.mayo.bmi.dictionary.DictionaryException;
+import edu.mayo.bmi.dictionary.GenericMetaDataHitImpl;
+import edu.mayo.bmi.dictionary.MetaDataHit;
+
+/**
+ *
+ * @author Mayo Clinic
+ */
+public class JdbcDictionaryImpl extends BaseDictionaryImpl implements Dictionary
+{
+    private Connection iv_dbConn;
+    private String iv_tableName;
+    private String iv_lookupFieldName;
+    private PreparedStatement iv_mdPrepStmt;
+    private PreparedStatement iv_cntPrepStmt;
+
+    public JdbcDictionaryImpl(
+        Connection conn,
+        String tableName,
+        String lookupFieldName)
+    {
+        iv_dbConn = conn;
+        iv_tableName = tableName;
+        iv_lookupFieldName = lookupFieldName;
+    }
+
+    private PreparedStatement initCountPrepStmt(String text)
+        throws SQLException
+    {
+        if (iv_cntPrepStmt == null)
+        {
+            StringBuffer sb = new StringBuffer();
+            sb.append("SELECT COUNT(*) ");
+
+            sb.append(" FROM ");
+            sb.append(iv_tableName);
+
+            sb.append(" WHERE ");
+            sb.append(iv_lookupFieldName);
+            sb.append(" = ?");
+
+            iv_cntPrepStmt = iv_dbConn.prepareStatement(sb.toString());
+        }
+
+        iv_cntPrepStmt.clearParameters();
+        iv_cntPrepStmt.setString(1, text);
+
+        return iv_cntPrepStmt;
+    }
+
+    private PreparedStatement initMetaDataPrepStmt(String text)
+        throws SQLException
+    {
+        if (iv_mdPrepStmt == null)
+        {
+            StringBuffer sb = new StringBuffer();
+            sb.append("SELECT ");
+
+            // translate meta data field names into columns
+            // to be returned in the result set
+            Iterator metaFieldNameItr = getMetaFieldNames();
+            while (metaFieldNameItr.hasNext())
+            {
+                String mdFieldName = (String) metaFieldNameItr.next();
+                sb.append(mdFieldName);
+                sb.append(',');
+            }
+            // chomp off the last comma
+            sb.deleteCharAt(sb.length() - 1);
+
+            sb.append(" FROM ");
+            sb.append(iv_tableName);
+
+            sb.append(" WHERE ");
+            sb.append(iv_lookupFieldName);
+            sb.append(" = ?");
+
+            iv_mdPrepStmt = iv_dbConn.prepareStatement(sb.toString());
+        }
+
+        iv_mdPrepStmt.clearParameters();
+        iv_mdPrepStmt.setString(1, text);
+
+        return iv_mdPrepStmt;
+    }
+
+    public boolean contains(String text) throws DictionaryException
+    {
+        try
+        {
+            PreparedStatement prepStmt = initCountPrepStmt(text);
+            ResultSet rs = prepStmt.executeQuery();
+
+            rs.next();
+            int count = rs.getInt(1);
+            if (count > 0)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        catch (SQLException e)
+        {
+            throw new DictionaryException(e);
+        }
+    }
+
+    public Collection getEntries(String str) throws DictionaryException
+    {
+        Set metaDataHitSet = new HashSet();
+        try
+        {
+            PreparedStatement prepStmt = initMetaDataPrepStmt(str);
+            ResultSet rs = prepStmt.executeQuery();
+
+            while (rs.next())
+            {
+                Map nameValMap = new HashMap();
+                Iterator metaFieldNameItr = getMetaFieldNames();
+                while (metaFieldNameItr.hasNext())
+                {
+                    String metaFieldName = (String) metaFieldNameItr.next();
+                    String metaFieldValue = rs.getString(metaFieldName);
+                    nameValMap.put(metaFieldName, metaFieldValue);
+                }
+                MetaDataHit mdh = new GenericMetaDataHitImpl(nameValMap);
+                metaDataHitSet.add(mdh);
+            }
+            return metaDataHitSet;
+        }
+        catch (SQLException e)
+        {
+            throw new DictionaryException(e);
+        }
+    }
+}



Mime
View raw message