Author: scooter
Date: 2010-02-11 09:45:41 -0800 (Thu, 11 Feb 2010)
New Revision: 19295

Modified:
   cytoscape/trunk/src/cytoscape/data/CyAttributesUtils.java
Log:
Added toByte method (inverse of toString).  Approved on cytostaff conference 
call on 2/11/2010.


Modified: cytoscape/trunk/src/cytoscape/data/CyAttributesUtils.java
===================================================================
--- cytoscape/trunk/src/cytoscape/data/CyAttributesUtils.java   2010-02-11 
17:30:50 UTC (rev 19294)
+++ cytoscape/trunk/src/cytoscape/data/CyAttributesUtils.java   2010-02-11 
17:45:41 UTC (rev 19295)
@@ -650,6 +650,42 @@
        }
 
        /**
+        * Return a byte representation of the various CyAttributes
+        * types returned by methods like CyAttributes.getType() and
+        * MultiHashMapDefinition.getAttributeKeysapceDimensionTypes().
+        * This is useful to return the byte when you have an Attribute String.
+        * @see cytoscape.data.CyAttributes#getType
+        * @see 
cytoscape.data.attr.MultiHashMapDefinition#getAttributeKeyspaceDimensionTypes
+        */
+       static public byte toByte(String attributeType) {
+               if (attributeType.equals("COMPLEX"))
+                       return CyAttributes.TYPE_COMPLEX;
+
+               if (attributeType.equals("SIMPLE_MAP"))
+                       return CyAttributes.TYPE_SIMPLE_MAP;
+
+               if (attributeType.equals("SIMPLE_LIST"))
+                       return CyAttributes.TYPE_SIMPLE_LIST;
+
+               if (attributeType.equals("UNDEFINED"))
+                       return CyAttributes.TYPE_UNDEFINED;
+
+               if (attributeType.equals("BOOLEAN"))
+                       return CyAttributes.TYPE_BOOLEAN;
+
+               if (attributeType.equals("INTEGER"))
+                       return CyAttributes.TYPE_INTEGER;
+
+               if (attributeType.equals("FLOATING"))
+                       return CyAttributes.TYPE_FLOATING;
+
+               if (attributeType.equals("STRING"))
+                       return CyAttributes.TYPE_STRING;
+
+               return CyAttributes.TYPE_UNDEFINED;
+       }
+
+       /**
         * Convenience method for throwing an IllegalArgumentException given
         * a message.
         */

-- 
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