ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1590312 [2/2] - in /ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup: ./ ae/ algorithms/ filter/ jdbc/ lucene/ phrasebuilder/ strtable/ vo/
Date Sat, 26 Apr 2014 22:04:50 GMT
Modified: ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/phrasebuilder/VariantPhraseBuilderImpl.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/phrasebuilder/VariantPhraseBuilderImpl.java?rev=1590312&r1=1590311&r2=1590312&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/phrasebuilder/VariantPhraseBuilderImpl.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/phrasebuilder/VariantPhraseBuilderImpl.java
Sat Apr 26 22:04:49 2014
@@ -42,7 +42,7 @@ public class VariantPhraseBuilderImpl im
     * @param useOriginalText  flag that determines whether to use the original text or not.
     */
    public VariantPhraseBuilderImpl( final String[] variantAttrNames, final boolean useOriginalText
) {
-      iv_textExtractorList = new ArrayList<TextExtractor>();
+      iv_textExtractorList = new ArrayList<>();
 
       if ( useOriginalText ) {
          // use original text as a variant
@@ -54,13 +54,12 @@ public class VariantPhraseBuilderImpl im
       }
    }
 
-   public String[] getPhrases( final List lookupTokenList ) {
-      final Set<String> phraseSet = new HashSet<String>();
+   public String[] getPhrases( final List<LookupToken> lookupTokenList ) {
+      final Set<String> phraseSet = new HashSet<>();
       for ( TextExtractor extractor : iv_textExtractorList ) {
          final StringBuilder sb = new StringBuilder();
          LookupToken previousLt = null;
-         for ( Object value : lookupTokenList ) {
-            final LookupToken lt = (LookupToken)value;
+         for ( LookupToken lt : lookupTokenList ) {
             String variant = extractor.getText( lt );
             if ( variant == null ) {
                variant = lt.getText();

Modified: ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/FieldConstraintImpl.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/FieldConstraintImpl.java?rev=1590312&r1=1590311&r2=1590312&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/FieldConstraintImpl.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/FieldConstraintImpl.java
Sat Apr 26 22:04:49 2014
@@ -37,10 +37,10 @@ public class FieldConstraintImpl impleme
     private String iv_fieldName;
     private Object iv_fieldValue;
     private int iv_op;
-    private Class iv_fieldValueClass;
+    private Class<?> iv_fieldValueClass;
 
     public FieldConstraintImpl(String fieldName, int op, String fieldValue,
-            Class fieldValueClass)
+            Class<?> fieldValueClass)
     {
         iv_fieldName = fieldName;
         iv_op = op;

Modified: ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTable.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTable.java?rev=1590312&r1=1590311&r2=1590312&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTable.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTable.java
Sat Apr 26 22:04:49 2014
@@ -34,7 +34,7 @@ final public class StringTable {
    // key = indexed field value (String), value = set of StringTableRows
 
    public StringTable( final String[] indexedFieldNames ) {
-      iv_nameMap = new HashMap<String, Map<String, Set<StringTableRow>>>();
+      iv_nameMap = new HashMap<>();
       for ( String fieldName : indexedFieldNames ) {
          iv_nameMap.put( fieldName, new HashMap<String, Set<StringTableRow>>()
);
       }
@@ -47,7 +47,7 @@ final public class StringTable {
 
          Set<StringTableRow> rowSet = valueMap.get( indexedFieldValue );
          if ( rowSet == null ) {
-            rowSet = new HashSet<StringTableRow>();
+            rowSet = new HashSet<>();
          }
          rowSet.add( strTableRow );
          valueMap.put( indexedFieldValue, rowSet );
@@ -60,13 +60,12 @@ final public class StringTable {
       Set<StringTableRow> rowSet = valueMap.get( fieldVal );
       if ( rowSet != null ) {
          return rowSet.toArray( new StringTableRow[rowSet.size()] );
-      } else {
-         return new StringTableRow[0];
       }
+      return new StringTableRow[0];
    }
 
    public StringTableRow[] getAllRows() {
-      final Set<StringTableRow> allRows = new HashSet<StringTableRow>();
+      final Set<StringTableRow> allRows = new HashSet<>();
       for ( Map<String, Set<StringTableRow>> valueMap : iv_nameMap.values() )
{
          for ( Set<StringTableRow> rowSet : valueMap.values() ) {
             if ( !rowSet.isEmpty() ) {

Modified: ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableDictionaryImpl.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableDictionaryImpl.java?rev=1590312&r1=1590311&r2=1590312&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableDictionaryImpl.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableDictionaryImpl.java
Sat Apr 26 22:04:49 2014
@@ -18,21 +18,20 @@
  */
 package org.apache.ctakes.dictionary.lookup.strtable;
 
-import org.apache.ctakes.dictionary.lookup.AbstractBaseDictionary;
-import org.apache.ctakes.dictionary.lookup.Dictionary;
-import org.apache.ctakes.dictionary.lookup.DictionaryException;
-import org.apache.ctakes.dictionary.lookup.MetaDataHit;
-
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.ctakes.dictionary.lookup.AbstractBaseDictionary;
+import org.apache.ctakes.dictionary.lookup.DictionaryException;
+import org.apache.ctakes.dictionary.lookup.MetaDataHit;
+
 
 /**
  * @author Mayo Clinic
  */
-public class StringTableDictionaryImpl extends AbstractBaseDictionary implements Dictionary
{
+public class StringTableDictionaryImpl extends AbstractBaseDictionary {
    final private StringTable iv_strTable;
    final private String iv_lookupFieldName;
 
@@ -58,7 +57,7 @@ public class StringTableDictionaryImpl e
       if ( strTableRows.length == 0 ) {
          return Collections.emptySet();
       }
-      final Set<MetaDataHit> metaDataHitSet = new HashSet<MetaDataHit>();
+      final Set<MetaDataHit> metaDataHitSet = new HashSet<>();
       for ( StringTableRow tableRow : strTableRows ) {
          final MetaDataHit metaDataHit = new StringTableRowMetaDataHitImpl( tableRow );
          metaDataHitSet.add( metaDataHit );

Modified: ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableFactory.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableFactory.java?rev=1590312&r1=1590311&r2=1590312&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableFactory.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableFactory.java
Sat Apr 26 22:04:49 2014
@@ -108,39 +108,39 @@ public class StringTableFactory
             boolean ignoreCase) throws IOException
     {
         StringTable strTable = new StringTable(indexedFieldNames);
-        BufferedReader br = new BufferedReader(charReader);
-        String line = br.readLine();
-        while (line != null)
-        {
+        try(BufferedReader br = new BufferedReader(charReader)){
+          String line = br.readLine();
+          while (line != null)
+          {
             StringTableRow strTableRow = new StringTableRow();
             StringTokenizer st = new StringTokenizer(line, delimiter);
             int fieldCnt = 0;
             boolean isConstrained = false;
             while (st.hasMoreTokens())
             {
-                String fieldName = String.valueOf(fieldCnt);
-                String fieldValue = st.nextToken();
-                if (ignoreCase)
-                {
-                    fieldValue = fieldValue.toLowerCase();
-                }
-                strTableRow.addField(fieldName, fieldValue);
-                fieldCnt++;
+              String fieldName = String.valueOf(fieldCnt);
+              String fieldValue = st.nextToken();
+              if (ignoreCase)
+              {
+                fieldValue = fieldValue.toLowerCase();
+              }
+              strTableRow.addField(fieldName, fieldValue);
+              fieldCnt++;
 
-                if ((constraint != null)
-                        && constraint.isConstrained(fieldName, fieldValue))
-                {
-                    isConstrained = true;
-                }
+              if ((constraint != null)
+                  && constraint.isConstrained(fieldName, fieldValue))
+              {
+                isConstrained = true;
+              }
             }
 
             if (!isConstrained)
             {
-                strTable.addRow(strTableRow);
+              strTable.addRow(strTableRow);
             }
             line = br.readLine();
+          }
         }
-        br.close();
 
         return strTable;
     }

Modified: ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableRow.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableRow.java?rev=1590312&r1=1590311&r2=1590312&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableRow.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableRow.java
Sat Apr 26 22:04:49 2014
@@ -28,7 +28,7 @@ import java.util.Set;
  */
 final public class StringTableRow {
 
-   final private Map<String, String> iv_fieldMap = new HashMap<String, String>();
+   final private Map<String, String> iv_fieldMap = new HashMap<>();
 
    public Set<String> getNames() {
       return iv_fieldMap.keySet();

Modified: ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableRowMetaDataHitImpl.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableRowMetaDataHitImpl.java?rev=1590312&r1=1590311&r2=1590312&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableRowMetaDataHitImpl.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/strtable/StringTableRowMetaDataHitImpl.java
Sat Apr 26 22:04:49 2014
@@ -18,19 +18,19 @@
  */
 package org.apache.ctakes.dictionary.lookup.strtable;
 
-import org.apache.ctakes.dictionary.lookup.AbstractBaseMetaDataHit;
-import org.apache.ctakes.dictionary.lookup.MetaDataHit;
-
-import javax.annotation.concurrent.Immutable;
 import java.util.Collection;
 import java.util.Set;
 
+import javax.annotation.concurrent.Immutable;
+
+import org.apache.ctakes.dictionary.lookup.AbstractBaseMetaDataHit;
+
 
 /**
  * @author Mayo Clinic
  */
 @Immutable
-final public class StringTableRowMetaDataHitImpl extends AbstractBaseMetaDataHit implements
MetaDataHit {
+final public class StringTableRowMetaDataHitImpl extends AbstractBaseMetaDataHit {
    final private StringTableRow _strTableRow;
 
    public StringTableRowMetaDataHitImpl( final StringTableRow strTableRow ) {

Modified: ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/vo/LookupAnnotationToTokAdapter.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/vo/LookupAnnotationToTokAdapter.java?rev=1590312&r1=1590311&r2=1590312&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/vo/LookupAnnotationToTokAdapter.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/vo/LookupAnnotationToTokAdapter.java
Sat Apr 26 22:04:49 2014
@@ -33,9 +33,9 @@ import org.apache.ctakes.core.nlp.tokeni
  *
  */
 public class LookupAnnotationToTokAdapter
-        implements LookupToken, LookupAnnotation
+        implements LookupToken
 {
-        private Map iv_attrMap = new HashMap();
+        private Map<String, String> iv_attrMap = new HashMap<>();
 
         private Token iv_tok;
 
@@ -66,7 +66,7 @@ public class LookupAnnotationToTokAdapte
 
         public String getStringAttribute(String attrKey)
         {
-            return (String) iv_attrMap.get(attrKey);
+            return iv_attrMap.get(attrKey);
         }
 
         public String getText()

Modified: ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/vo/LookupHit.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/vo/LookupHit.java?rev=1590312&r1=1590311&r2=1590312&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/vo/LookupHit.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/vo/LookupHit.java
Sat Apr 26 22:04:49 2014
@@ -100,11 +100,11 @@ final public class LookupHit {
       key.append( iv_endOffset );
       key.append( "/" );
 
-      List mfNameList = new ArrayList( iv_mdh.getMetaFieldNames() );
+      List<String> mfNameList = new ArrayList<>( iv_mdh.getMetaFieldNames() );
       Collections.sort( mfNameList );
-      Iterator mfNameItr = mfNameList.iterator();
+      Iterator<String> mfNameItr = mfNameList.iterator();
       while ( mfNameItr.hasNext() ) {
-         String mfName = (String) mfNameItr.next();
+         String mfName = mfNameItr.next();
          String mfValue = iv_mdh.getMetaFieldValue( mfName );
          key.append( mfName );
          key.append( "=" );



Mime
View raw message