Author: mes
Date: 2010-10-25 09:59:32 -0700 (Mon, 25 Oct 2010)
New Revision: 22351
Modified:
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/ArrayGraph.java
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyNetworkFactoryImpl.java
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyNodeImpl.java
core3/model-impl/trunk/src/test/java/org/cytoscape/model/CyTableManagerTest.java
core3/model-impl/trunk/src/test/java/org/cytoscape/model/TestCyNetworkFactory.java
Log:
updated to reflect model-api changes
Modified:
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/ArrayGraph.java
===================================================================
---
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/ArrayGraph.java
2010-10-25 16:58:58 UTC (rev 22350)
+++
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/ArrayGraph.java
2010-10-25 16:59:32 UTC (rev 22351)
@@ -51,6 +51,7 @@
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyTableEntry;
import org.cytoscape.model.SUIDFactory;
import org.cytoscape.model.events.AboutToRemoveEdgeEvent;
import org.cytoscape.model.events.AboutToRemoveNodeEvent;
@@ -101,14 +102,14 @@
private final List<CySubNetwork> subNetworks;
private final CySubNetwork base;
- private CyTableManager tableMgr;
+ private CyTableManagerImpl tableMgr;
/**
* Creates a new ArrayGraph object.
* @param eh The CyEventHelper used for firing events.
*/
- public ArrayGraph(final CyEventHelper eh, final CyTableManager
tableMgr, final CyTableFactory tableFactory) {
+ public ArrayGraph(final CyEventHelper eh, final CyTableManagerImpl
tableMgr, final CyTableFactory tableFactory) {
this.tableMgr = tableMgr;
suid = SUIDFactory.getNextSUID();
numSubNetworks = 0;
@@ -122,24 +123,25 @@
netAttrMgr.put(CyNetwork.DEFAULT_ATTRS,
tableFactory.createTable( suid + " network", "SUID", Long.class, true));
netAttrMgr.put(CyNetwork.HIDDEN_ATTRS,
tableFactory.createTable( suid + " network", "SUID", Long.class, false));
-
netAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn("name",String.class,false);
- attrs().set("name","");
+
netAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn(CyTableEntry.NAME,String.class,false);
+
netAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn(CyTableEntry.SELECTED,Boolean.class,false);
+ attrs().set(CyTableEntry.NAME,"");
// potential leak since "this" isn't yet fully constructed
nodeAttrMgr = new HashMap<String, CyTable>();
nodeAttrMgr.put(CyNetwork.DEFAULT_ATTRS,
tableFactory.createTable( suid + " node", "SUID", Long.class, true));
nodeAttrMgr.put(CyNetwork.HIDDEN_ATTRS,
tableFactory.createTable( suid + " node", "SUID", Long.class, false));
-
nodeAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn("name",String.class,false);
-
nodeAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn("selected",Boolean.class,false);
+
nodeAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn(CyTableEntry.NAME,String.class,false);
+
nodeAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn(CyTableEntry.SELECTED,Boolean.class,false);
edgeAttrMgr = new HashMap<String, CyTable>();
edgeAttrMgr.put(CyNetwork.DEFAULT_ATTRS,
tableFactory.createTable( suid + " edge", "SUID", Long.class, true));
edgeAttrMgr.put(CyNetwork.HIDDEN_ATTRS,
tableFactory.createTable( suid + " edge", "SUID", Long.class, false));
-
edgeAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn("name",String.class,false);
-
edgeAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn("selected",Boolean.class,false);
-
edgeAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn("interaction",String.class,false);
+
edgeAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn(CyTableEntry.NAME,String.class,false);
+
edgeAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn(CyTableEntry.SELECTED,Boolean.class,false);
+
edgeAttrMgr.get(CyNetwork.DEFAULT_ATTRS).createColumn(CyEdge.INTERACTION,String.class,false);
eventHelper = eh;
@@ -147,9 +149,9 @@
base = addSubNetwork();
- tableMgr.setTableMap("NETWORK", base, netAttrMgr);
- tableMgr.setTableMap("NODE", base, nodeAttrMgr);
- tableMgr.setTableMap("EDGE", base, edgeAttrMgr);
+ tableMgr.setTableMap(CyTableEntry.NETWORK, base, netAttrMgr);
+ tableMgr.setTableMap(CyTableEntry.NODE, base, nodeAttrMgr);
+ tableMgr.setTableMap(CyTableEntry.EDGE, base, edgeAttrMgr);
}
/**
@@ -352,7 +354,7 @@
synchronized (this) {
final int index = nodePointers.size();
- n = new NodePointer(index, new CyNodeImpl(this, index,
nodeAttrMgr));
+ n = new NodePointer(index, new CyNodeImpl(index,
nodeAttrMgr));
nodePointers.add(n);
nodeCount++;
// In ArrayGraph we only ever add the node to the root.
Modified:
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyNetworkFactoryImpl.java
===================================================================
---
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyNetworkFactoryImpl.java
2010-10-25 16:58:58 UTC (rev 22350)
+++
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyNetworkFactoryImpl.java
2010-10-25 16:59:32 UTC (rev 22351)
@@ -51,7 +51,7 @@
private static final Logger logger =
LoggerFactory.getLogger(CyNetworkFactoryImpl.class);
private final CyEventHelper help;
- private final CyTableManager mgr;
+ private final CyTableManagerImpl mgr;
private final CyTableFactory tableFactory;
/**
@@ -59,7 +59,7 @@
*
* @param help An instance of CyEventHelper.
*/
- public CyNetworkFactoryImpl(final CyEventHelper help, final
CyTableManager mgr, final CyTableFactory tableFactory) {
+ public CyNetworkFactoryImpl(final CyEventHelper help, final
CyTableManagerImpl mgr, final CyTableFactory tableFactory) {
if (help == null)
throw new NullPointerException("CyEventHelper is null");
Modified:
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyNodeImpl.java
===================================================================
---
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyNodeImpl.java
2010-10-25 16:58:58 UTC (rev 22350)
+++
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyNodeImpl.java
2010-10-25 16:59:32 UTC (rev 22351)
@@ -47,13 +47,11 @@
class CyNodeImpl extends CyTableEntryImpl implements CyNode {
final private int index;
- final private CyNetwork net;
private CyNetwork nestedNet;
- CyNodeImpl(CyNetwork n, int ind, Map<String, CyTable> attrMgr) {
+ CyNodeImpl(int ind, Map<String, CyTable> attrMgr) {
super(attrMgr);
- net = n;
index = ind;
nestedNet = null;
}
@@ -74,43 +72,9 @@
*/
@Override
public String toString() {
- return "Node suid: " + getSUID() + " index: " + index + "
network suid: " + net.getSUID();
+ return "Node suid: " + getSUID() + " index: " + index;
}
- /**
- * DOCUMENT ME!
- *
- * @param edgeType DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public List<CyNode> getNeighborList(CyEdge.Type edgeType) {
- return net.getNeighborList(this, edgeType);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param edgeType DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public List<CyEdge> getAdjacentEdgeList(CyEdge.Type edgeType) {
- return net.getAdjacentEdgeList(this, edgeType);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param target DOCUMENT ME!
- * @param edgeType DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public List<CyEdge> getConnectingEdgeList(CyNode target, CyEdge.Type
edgeType) {
- return net.getConnectingEdgeList(this, target, edgeType);
- }
-
public synchronized CyNetwork getNestedNetwork() {
return nestedNet;
}
@@ -119,7 +83,4 @@
nestedNet = n;
}
- public CyNetwork getNetwork() {
- return net;
- }
}
Modified:
core3/model-impl/trunk/src/test/java/org/cytoscape/model/CyTableManagerTest.java
===================================================================
---
core3/model-impl/trunk/src/test/java/org/cytoscape/model/CyTableManagerTest.java
2010-10-25 16:58:58 UTC (rev 22350)
+++
core3/model-impl/trunk/src/test/java/org/cytoscape/model/CyTableManagerTest.java
2010-10-25 16:59:32 UTC (rev 22351)
@@ -36,24 +36,23 @@
package org.cytoscape.model;
import org.cytoscape.model.internal.CyTableManagerImpl;
+import org.cytoscape.model.internal.CyTableFactoryImpl;
+import org.cytoscape.model.internal.ArrayGraph;
+import org.cytoscape.event.CyEventHelper;
+import org.cytoscape.event.DummyCyEventHelper;
-/**
- * DOCUMENT ME!
- */
public class CyTableManagerTest extends AbstractCyTableManagerTest {
- /**
- * DOCUMENT ME!
- */
public void setUp() {
super.setUp();
- mgr = new CyTableManagerImpl();
+ CyTableManagerImpl mgrImpl = new CyTableManagerImpl();
+ mgr = mgrImpl;
+ CyEventHelper eh = new DummyCyEventHelper();
+ goodNetwork = new ArrayGraph(eh,mgrImpl,new
CyTableFactoryImpl(eh)).getBaseNetwork();
}
- /**
- * DOCUMENT ME!
- */
public void tearDown() {
mgr = null;
+ goodNetwork = null;
}
}
Modified:
core3/model-impl/trunk/src/test/java/org/cytoscape/model/TestCyNetworkFactory.java
===================================================================
---
core3/model-impl/trunk/src/test/java/org/cytoscape/model/TestCyNetworkFactory.java
2010-10-25 16:58:58 UTC (rev 22350)
+++
core3/model-impl/trunk/src/test/java/org/cytoscape/model/TestCyNetworkFactory.java
2010-10-25 16:59:32 UTC (rev 22351)
@@ -52,13 +52,16 @@
public static CyNetwork getInstance() {
DummyCyEventHelper deh = new DummyCyEventHelper();
- return new ArrayGraph(deh, new CyTableManagerImpl(),new
CyTableFactoryImpl(deh));
+ ArrayGraph ar = new ArrayGraph(deh, new
CyTableManagerImpl(),new CyTableFactoryImpl(deh));
+ return ar.getBaseNetwork();
}
public static CyRootNetwork getRootInstance() {
// This only works because we know that ArrayGraph (returned
from
// getInstance) is also a root network!
- return (CyRootNetwork)getInstance();
+ DummyCyEventHelper deh = new DummyCyEventHelper();
+ ArrayGraph ar = new ArrayGraph(deh, new
CyTableManagerImpl(),new CyTableFactoryImpl(deh));
+ return ar;
}
@Test
--
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.