Author: ruschein
Date: 2010-09-27 10:30:50 -0700 (Mon, 27 Sep 2010)
New Revision: 22069
Modified:
cytoscape/trunk/application/src/main/java/cytoscape/data/CyAttributesImpl.java
cytoscape/trunk/application/src/main/java/cytoscape/data/attr/util/MultiHashMapModel.java
cytoscape/trunk/coreplugins/browser/src/main/java/browser/DataEditAction.java
Log:
Fixed a problem with IF() return types at the cost of runtime error detection
instead of compile-time error detection in attribute equations.
Modified:
cytoscape/trunk/application/src/main/java/cytoscape/data/CyAttributesImpl.java
===================================================================
---
cytoscape/trunk/application/src/main/java/cytoscape/data/CyAttributesImpl.java
2010-09-27 14:24:35 UTC (rev 22068)
+++
cytoscape/trunk/application/src/main/java/cytoscape/data/CyAttributesImpl.java
2010-09-27 17:30:50 UTC (rev 22069)
@@ -385,19 +385,19 @@
if (type == MultiHashMapDefinition.TYPE_STRING)
/* Everything is compatible w/ this! */;
else if (type == MultiHashMapDefinition.TYPE_INTEGER) {
- if (returnType != Long.class && returnType !=
Double.class && returnType != Boolean.class)
+ if (returnType != Long.class && returnType !=
Double.class && returnType != Boolean.class && returnType != Object.class)
throw new IllegalArgumentException("an
equation of type " + returnType
+ "
is not compatible with TYPE_INTEGER for attribute \""
+
attributeName + "\"!");
}
else if (type ==
MultiHashMapDefinition.TYPE_FLOATING_POINT) {
- if (returnType != Double.class && returnType !=
Long.class && returnType != Boolean.class)
+ if (returnType != Double.class && returnType !=
Long.class && returnType != Boolean.class && returnType != Object.class)
throw new IllegalArgumentException("an
equation of type " + returnType
+ "
is not compatible with TYPE_FLOATING_POINT for attribute \""
+
attributeName + "\"!");
}
else if (type == MultiHashMapDefinition.TYPE_BOOLEAN) {
- if (returnType != Boolean.class && returnType
!= Long.class && returnType != Double.class)
+ if (returnType != Boolean.class && returnType
!= Long.class && returnType != Double.class && returnType != Object.class)
throw new IllegalArgumentException("an
equation of type " + returnType
+ "
is not compatible with TYPE_BOOLEAN for attribute \""
+
attributeName + "\"!");
Modified:
cytoscape/trunk/application/src/main/java/cytoscape/data/attr/util/MultiHashMapModel.java
===================================================================
---
cytoscape/trunk/application/src/main/java/cytoscape/data/attr/util/MultiHashMapModel.java
2010-09-27 14:24:35 UTC (rev 22068)
+++
cytoscape/trunk/application/src/main/java/cytoscape/data/attr/util/MultiHashMapModel.java
2010-09-27 17:30:50 UTC (rev 22069)
@@ -451,18 +451,18 @@
switch (def.valueType) { // I'm wondering what the most
efficient way of doing this is.
case MultiHashMapDefinition.TYPE_BOOLEAN:
if (actualType == Boolean.class
- || (isEquation && (actualType == Long.class
|| actualType == Double.class || actualType == BooleanList.class)))
+ || (isEquation && (actualType == Long.class
|| actualType == Double.class || actualType == BooleanList.class || actualType
== Object.class)))
break;
throw new ClassCastException("found " +
actualType + " for \"" + attributeName + "\", expected Boolean!");
case MultiHashMapDefinition.TYPE_FLOATING_POINT:
if (actualType == Double.class
- || (isEquation && (actualType == Long.class
|| actualType == Boolean.class || actualType == DoubleList.class)))
+ || (isEquation && (actualType == Long.class
|| actualType == Boolean.class || actualType == DoubleList.class || actualType
== Object.class)))
break;
throw new ClassCastException("found " +
actualType + " for \"" + attributeName + "\", expected Double!");
case MultiHashMapDefinition.TYPE_INTEGER:
if (actualType == Integer.class
|| (isEquation && (actualType ==
Double.class || actualType == Boolean.class
- || actualType ==
Long.class || actualType == LongList.class)))
+ || actualType ==
Long.class || actualType == LongList.class || actualType == Object.class)))
break;
throw new ClassCastException("found " +
actualType + " for \"" + attributeName + "\", expected Integer!");
case MultiHashMapDefinition.TYPE_STRING:
Modified:
cytoscape/trunk/coreplugins/browser/src/main/java/browser/DataEditAction.java
===================================================================
---
cytoscape/trunk/coreplugins/browser/src/main/java/browser/DataEditAction.java
2010-09-27 14:24:35 UTC (rev 22068)
+++
cytoscape/trunk/coreplugins/browser/src/main/java/browser/DataEditAction.java
2010-09-27 17:30:50 UTC (rev 22069)
@@ -164,7 +164,7 @@
}
final Class returnType = equation.getType();
- if (returnType != Long.class && returnType !=
Double.class && returnType != Boolean.class) {
+ if (returnType != Long.class && returnType !=
Double.class && returnType != Boolean.class && returnType != Object.class) {
showErrorWindow("Error in attribute \"" +
attrName
+ "\": equation is of type " +
getLastDotComponent(returnType.toString())
+ " but should be of type
Integer!");
@@ -208,7 +208,7 @@
}
final Class returnType = equation.getType();
- if (returnType != Double.class && returnType !=
Long.class && returnType != Boolean.class) {
+ if (returnType != Double.class && returnType !=
Long.class && returnType != Boolean.class && returnType != Object.class) {
showErrorWindow("Error in attribute \"" +
attrName
+ "\": equation is of type " +
getLastDotComponent(returnType.toString())
+ " but should be of type
Floating Point!");
@@ -252,7 +252,7 @@
}
final Class returnType = equation.getType();
- if (returnType != Boolean.class && returnType !=
Long.class && returnType != Double.class) {
+ if (returnType != Boolean.class && returnType !=
Long.class && returnType != Double.class && returnType != Object.class) {
objectAndEditString = new
ValidatedObjectAndEditString(null, newValueStr, "#TYPE");
attrs.deleteAttribute(id, attrName);
showErrorWindow("Error in attribute \"" +
attrName
@@ -323,7 +323,7 @@
}
final Class returnType = equation.getType();
- if (!FunctionUtil.isSomeKindOfList(returnType)) {
+ if (!FunctionUtil.isSomeKindOfList(returnType) &&
returnType != Object.class) {
objectAndEditString = new
ValidatedObjectAndEditString(null, newValueStr, "#TYPE");
attrs.deleteAttribute(id, attrName);
showErrorWindow("Error in attribute \"" +
attrName
--
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.