Author: ruschein
Date: 2010-12-09 14:19:39 -0800 (Thu, 09 Dec 2010)
New Revision: 23153

Modified:
   
core3/model-impl/trunk/impl/src/main/java/org/cytoscape/model/internal/CyTableImpl.java
Log:
Cleaned up isSetX().

Modified: 
core3/model-impl/trunk/impl/src/main/java/org/cytoscape/model/internal/CyTableImpl.java
===================================================================
--- 
core3/model-impl/trunk/impl/src/main/java/org/cytoscape/model/internal/CyTableImpl.java
     2010-12-09 22:18:00 UTC (rev 23152)
+++ 
core3/model-impl/trunk/impl/src/main/java/org/cytoscape/model/internal/CyTableImpl.java
     2010-12-09 22:19:39 UTC (rev 23153)
@@ -492,10 +492,6 @@
                eventHelper.getMicroListener(RowSetMicroListener.class, 
getRow(key)).handleRowSet(columnName, null);
        }
 
-       private static boolean isScalarColumnType(final Class type) {
-               return type != List.class && type != Map.class;
-       }
-
        private void removeFromReverseMap(final String columnName, final Object 
key, final Object value) {
                final Map<Object, Set<Object>> valueTokeysMap = 
reverse.get(columnName);
                Set<Object> keys = valueTokeysMap.get(value);
@@ -565,19 +561,16 @@
        private <T> boolean isSetX(final Object key, final String columnName,
                                   final Class<? extends T> type)
        {
-               final Map<Object, Object> keyToValueMap = 
attributes.get(columnName);
-               if (keyToValueMap == null)
+               if (!attributes.containsKey(columnName))
                        return false;
 
-               Object value = keyToValueMap.get(key);
-               if (value == null)
-                       return false;
-
-               if (types.get(columnName).isAssignableFrom(type))
-                       return true;
-               else
-                       throw new IllegalArgumentException("isSet(): expected 
\"" + types.get(columnName).getName()
+               if (!types.get(columnName).isAssignableFrom(type))
+                       throw new IllegalArgumentException("type mismatch: 
expected \""
+                                                          + 
types.get(columnName).getName()
                                                           + "\" got \"" + 
type.getName() + "\"!");
+
+               final Map<Object, Object> keyToValueMap = 
attributes.get(columnName);
+               return keyToValueMap.get(key) != null;
        }
 
        private Class<?> getClass(Class<?> c) {

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to