Author: pwang
Date: 2010-06-28 13:11:02 -0700 (Mon, 28 Jun 2010)
New Revision: 20687
Added:
cytoscape/trunk/src/cytoscape/util/AttributeUtil.java
Log:
Original creation
Added: cytoscape/trunk/src/cytoscape/util/AttributeUtil.java
===================================================================
--- cytoscape/trunk/src/cytoscape/util/AttributeUtil.java
(rev 0)
+++ cytoscape/trunk/src/cytoscape/util/AttributeUtil.java 2010-06-28
20:11:02 UTC (rev 20687)
@@ -0,0 +1,41 @@
+package cytoscape.util;
+
+import cytoscape.Cytoscape;
+import cytoscape.data.CyAttributes;
+
+public class AttributeUtil {
+
+ // Check if all the values for an attribute are NULL
+ public static boolean isNullAttribute(String attributeType, String
attributeName){
+
+ boolean retValue = true;
+
+ CyAttributes attributes = null;
+ if (attributeType.equalsIgnoreCase("node")){
+ attributes = Cytoscape.getNodeAttributes();
+ int[] nodeIndices =
Cytoscape.getCurrentNetwork().getNodeIndicesArray();
+ for (int i=0; i<nodeIndices.length; i++){
+ String nodeID =
Cytoscape.getRootGraph().getNode(nodeIndices[i]).getIdentifier();
+ Object valueObj =
attributes.getAttribute(nodeID, attributeName);
+ if (valueObj != null){
+ retValue = false;
+ break;
+ }
+ }
+ }
+ else {// edge
+ attributes = Cytoscape.getEdgeAttributes();
+ int[] edgeIndices =
Cytoscape.getCurrentNetwork().getEdgeIndicesArray();
+ for (int i=0; i<edgeIndices.length; i++){
+ String edgeID =
Cytoscape.getRootGraph().getEdge(edgeIndices[i]).getIdentifier();
+ Object valueObj =
attributes.getAttribute(edgeID, attributeName);
+ if (valueObj != null){
+ retValue = false;
+ break;
+ }
+ }
+ }
+
+ return retValue;
+ }
+}
--
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.