use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class CySubNetworkImpl method removeNodes.
@Override
public boolean removeNodes(final Collection<CyNode> nodes) {
if (nodes == null || nodes.isEmpty())
return false;
eventHelper.fireEvent(new AboutToRemoveNodesEvent(this, nodes));
CyTable nodeHiddenTable = getTable(CyNode.class, CyNetwork.HIDDEN_ATTRS);
CyTable nodeDefaultTable = getTable(CyNode.class, CyNetwork.DEFAULT_ATTRS);
CyTable edgeHiddenTable = getTable(CyEdge.class, CyNetwork.HIDDEN_ATTRS);
CyTable edgeDefaultTable = getTable(CyEdge.class, CyNetwork.DEFAULT_ATTRS);
List<Long> nodeSuids = new ArrayList<>();
Set<Long> edgeSuids = new HashSet<>();
for (CyNode node : nodes) {
if (this.containsNode(node)) {
Long nodeSuid = node.getSUID();
if (nodeDefaultTable.rowExists(nodeSuid))
nodeSuids.add(nodeSuid);
for (CyEdge edge : getAdjacentEdgeIterable(node, Type.ANY)) {
Long edgeSuid = edge.getSUID();
if (edgeDefaultTable.rowExists(edgeSuid)) {
edgeSuids.add(edgeSuid);
}
}
}
}
boolean ret = removeNodesInternal(nodes);
nodeHiddenTable.deleteRows(nodeSuids);
nodeDefaultTable.deleteRows(nodeSuids);
edgeHiddenTable.deleteRows(edgeSuids);
edgeDefaultTable.deleteRows(edgeSuids);
if (ret) {
parent.subnetworkNodesRemoved(nodes);
}
if (ret) {
eventHelper.fireEvent(new RemovedNodesEvent(this));
}
return ret;
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class CyTableManagerImpl method getLocalTables.
@Override
public Set<CyTable> getLocalTables(final Class<? extends CyIdentifiable> type) {
final Set<CyTable> localTables = new HashSet<CyTable>();
final Set<CyNetwork> networks = networkManager.getNetworkSet();
for (final CyNetwork network : networks) {
final Map<String, CyTable> objTables = networkTableManager.getTables(network, type);
if (network instanceof CySubNetwork) {
final CyTable shared = networkTableManager.getTable(((CySubNetwork) network).getRootNetwork(), type, CyRootNetwork.SHARED_ATTRS);
localTables.add(shared);
}
localTables.addAll(objTables.values());
}
return localTables;
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class CyTableManagerImpl method getGlobalTables.
@Override
public Set<CyTable> getGlobalTables() {
final Set<CyTable> nonGlobalTables = new HashSet<CyTable>();
final Set<CyTable> globalTables = new HashSet<CyTable>();
final Set<CyNetwork> networks = networkTableManager.getNetworkSet();
for (final CyNetwork network : networks) {
for (final Class<? extends CyIdentifiable> type : COMPATIBLE_TYPES) {
final Map<String, CyTable> objTables = networkTableManager.getTables(network, type);
nonGlobalTables.addAll(objTables.values());
}
}
for (final CyTable table : tables.values()) if (nonGlobalTables.contains(table) == false)
globalTables.add(table);
return globalTables;
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class CyTableManagerImpl method refreshTableEquations.
private void refreshTableEquations() {
final EquationCompiler compiler = serviceRegistrar.getService(EquationCompiler.class);
Set<CyTable> tables = getAllTables(true);
for (CyTable table : tables) {
EquationUtil.refreshEquations(table, compiler);
}
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class DefaultTablesNetwork method getRow.
public CyRow getRow(final CyIdentifiable entry, final String tableName) {
if (entry == null)
throw new NullPointerException("null entry");
if (tableName == null)
throw new NullPointerException("null table name");
CyTable table;
// The table returned should be immutable.
if (entry instanceof CyNode && containsNode((CyNode) entry))
table = networkTableManager.getTable(networkRef.get(), CyNode.class, tableName);
else if (entry instanceof CyEdge && containsEdge((CyEdge) entry))
table = networkTableManager.getTable(networkRef.get(), CyEdge.class, tableName);
else if (entry instanceof CyNetwork && entry.equals(this)) {
if (networkRef == null)
throw new IllegalArgumentException("Network reference is null. This should not be null.");
final CyNetwork n = networkRef.get();
table = networkTableManager.getTable(n, CyNetwork.class, tableName);
} else
throw new IllegalArgumentException("unrecognized (table entry): " + entry.toString() + " (table name): " + tableName);
if (table == null)
throw new NullPointerException("Table does not exist: " + tableName);
return table.getRow(entry.getSUID());
}
Aggregations