Author: mes
Date: 2010-08-03 15:57:30 -0700 (Tue, 03 Aug 2010)
New Revision: 21164
Modified:
coreplugins/trunk/QuickFind/src/main/java/csplugins/quickfind/util/QuickFindImpl.java
coreplugins/trunk/QuickFind/src/test/java/csplugins/test/quickfind/test/TestQuickFind.java
Log:
fixed stuff so unit tests now pass
Modified:
coreplugins/trunk/QuickFind/src/main/java/csplugins/quickfind/util/QuickFindImpl.java
===================================================================
---
coreplugins/trunk/QuickFind/src/main/java/csplugins/quickfind/util/QuickFindImpl.java
2010-08-03 22:44:17 UTC (rev 21163)
+++
coreplugins/trunk/QuickFind/src/main/java/csplugins/quickfind/util/QuickFindImpl.java
2010-08-03 22:57:30 UTC (rev 21164)
@@ -204,7 +204,9 @@
_type = "edge";
}
- if
(controllingAttribute.equalsIgnoreCase(QuickFind.UNIQUE_IDENTIFIER)||controllingAttribute.equalsIgnoreCase("biopax.node_label")){
+ if
(controllingAttribute.equalsIgnoreCase(QuickFind.UNIQUE_IDENTIFIER)||
+
controllingAttribute.equalsIgnoreCase(QuickFind.INDEX_ALL_ATTRIBUTES)||
+ controllingAttribute.equalsIgnoreCase("biopax.node_label")){
// do nothing
}
else if
(cytoscape.data.CyAttributesUtils.isNullAttribute(_type, controllingAttribute)){
@@ -415,7 +417,8 @@
if (indexType == QuickFind.INDEX_EDGES){
_type = "edge";
}
- if (cytoscape.data.CyAttributesUtils.isNullAttribute(_type,
controllingAttribute)){
+ if
(!controllingAttribute.equalsIgnoreCase(QuickFind.INDEX_ALL_ATTRIBUTES) &&
+ cytoscape.data.CyAttributesUtils.isNullAttribute(_type,
controllingAttribute)){
return null;
}
Modified:
coreplugins/trunk/QuickFind/src/test/java/csplugins/test/quickfind/test/TestQuickFind.java
===================================================================
---
coreplugins/trunk/QuickFind/src/test/java/csplugins/test/quickfind/test/TestQuickFind.java
2010-08-03 22:44:17 UTC (rev 21163)
+++
coreplugins/trunk/QuickFind/src/test/java/csplugins/test/quickfind/test/TestQuickFind.java
2010-08-03 22:57:30 UTC (rev 21164)
@@ -96,6 +96,8 @@
addNodeAttributes(node0, node1, node2, node3);
addEdgeAttributes(edge0, edge1, edge2);
+ Cytoscape.setCurrentNetwork(cyNetwork.getIdentifier());
+
// Index this network by Node:UNIQUE_IDENTIFIER
TaskMonitorBase monitor = new TaskMonitorBase();
QuickFind quickFind =
QuickFindFactory.getGlobalQuickFindInstance();
@@ -184,6 +186,12 @@
nodeAttributes.setAttribute(node1.getIdentifier(), SCORE,
3.211);
nodeAttributes.setAttribute(node2.getIdentifier(), SCORE, 22.2);
nodeAttributes.setAttribute(node3.getIdentifier(), SCORE, 2.1);
+
+ // make sure UNIQUE_IDENTIFIER attr is set
+ nodeAttributes.setAttribute(node0.getIdentifier(),
QuickFind.UNIQUE_IDENTIFIER, "a");
+ nodeAttributes.setAttribute(node1.getIdentifier(),
QuickFind.UNIQUE_IDENTIFIER, "b");
+ nodeAttributes.setAttribute(node2.getIdentifier(),
QuickFind.UNIQUE_IDENTIFIER, "c");
+ nodeAttributes.setAttribute(node3.getIdentifier(),
QuickFind.UNIQUE_IDENTIFIER, "d");
}
private void addEdgeAttributes(CyEdge edge0, CyEdge edge1, CyEdge
edge2) {
@@ -205,10 +213,12 @@
// do nothing silently, and should not throw any exceptions.
textIndex = (TextIndex) quickFind.reindexNetwork(cyNetwork,
QuickFind.INDEX_NODES, "TYPE",
monitor);
+ assertNull(textIndex);
// Try indexing all attributes
textIndex = (TextIndex) quickFind.reindexNetwork(cyNetwork,
QuickFind.INDEX_NODES,
QuickFind.INDEX_ALL_ATTRIBUTES, monitor);
+ assertNotNull(textIndex);
// First, try unique identifiers
hits = textIndex.getHits("ra", Integer.MAX_VALUE);
--
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.