Author: clopes
Date: 2012-08-21 13:51:12 -0700 (Tue, 21 Aug 2012)
New Revision: 30242
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/ReadCache.java
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/SUIDUpdater.java
Log:
Refactored the SUID Updater: DEFAULT_ATTRS and SHARED_DEFAULT_ATTRS tables are
ignored, in order to prevent the same column from being updated twice.
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/ReadCache.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/ReadCache.java
2012-08-21 16:57:37 UTC (rev 30241)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/ReadCache.java
2012-08-21 20:51:12 UTC (rev 30242)
@@ -39,6 +39,7 @@
import org.cytoscape.model.CyNetworkTableManager;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyTable;
+import org.cytoscape.model.subnetwork.CyRootNetwork;
import org.cytoscape.model.subnetwork.CySubNetwork;
import org.cytoscape.view.model.CyNetworkView;
import org.slf4j.Logger;
@@ -208,6 +209,9 @@
return nodeByNameMap;
}
+ /**
+ * @return All network tables, except DEFAULT_ATTRS and
SHARED_DEFAULT_ATTRS ones.
+ */
@SuppressWarnings({ "rawtypes", "unchecked" })
public Set<CyTable> getNetworkTables() {
final Set<CyTable> tables = new HashSet<CyTable>();
@@ -219,17 +223,20 @@
for (final CyNetwork n : networks) {
for (final Class t : types) {
- Map<String, CyTable> tabMap =
netTblMgr.getTables(n, t);
+ Map<String, CyTable> tblMap = new
HashMap<String, CyTable>(netTblMgr.getTables(n, t));
+ tblMap.remove(CyNetwork.DEFAULT_ATTRS);
- if (tabMap != null)
- tables.addAll(tabMap.values());
+ if (tblMap != null)
+ tables.addAll(tblMap.values());
if (n instanceof CySubNetwork) {
// Don't forget the root-network tables.
- tabMap =
netTblMgr.getTables(((CySubNetwork) n).getRootNetwork(), t);
+ tblMap = new HashMap<String,
CyTable>(netTblMgr.getTables(((CySubNetwork) n).getRootNetwork(), t));
+
tblMap.remove(CyRootNetwork.DEFAULT_ATTRS);
+
tblMap.remove(CyRootNetwork.SHARED_DEFAULT_ATTRS);
- if (tabMap != null)
- tables.addAll(tabMap.values());
+ if (tblMap != null)
+ tables.addAll(tblMap.values());
}
}
}
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/SUIDUpdater.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/SUIDUpdater.java
2012-08-21 16:57:37 UTC (rev 30241)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/SUIDUpdater.java
2012-08-21 20:51:12 UTC (rev 30242)
@@ -69,22 +69,15 @@
}
public void updateSUIDColumns() {
- final Set<String/*tableName_columnName*/> updated = new
HashSet<String>();
-
for (final CyTable tbl : tables) {
final Collection<CyColumn> columns = tbl.getColumns();
for (final CyColumn c : columns) {
- final String columnId = tbl.getTitle() + "_" +
c.getName();
-
- if (isUpdatable(c) &&
!updated.contains(columnId)) {
+ if (isUpdatable(c)) {
Set<String> ignoredNames =
ignoredColumns.get(tbl);
- if (ignoredNames != null &&
ignoredNames.contains(c.getName()))
- continue;
-
- updateRows(tbl, c);
- updated.add(columnId);
+ if (ignoredNames == null ||
!ignoredNames.contains(c.getName()))
+ updateRows(tbl, c);
}
}
}
@@ -96,7 +89,7 @@
for (final DiscreteMappingEntry entry :
dm.getDiscreteMappingEntry()) {
final String attrVal =
entry.getAttributeValue();
- // TODO hanlde list od SUIDs
+ // TODO handle list of SUIDs
final Long oldSUID = attrVal != null ?
Long.parseLong(attrVal) : null;
final Long newSUID = getNewSUID(oldSUID);
--
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.