use of org.cytoscape.filter.internal.quickfind.util.TaskMonitorBase in project cytoscape-impl by cytoscape.
the class RangeSelectionListener method handleNetworkModified.
private void handleNetworkModified(final CyNetwork cyNetwork) {
if (!networkManager.networkExists(cyNetwork.getSUID()))
return;
if (cyNetwork.getNodeCount() > 0) {
// this can happen if an empty network was added
if (quickFind.getIndex(cyNetwork) == null) {
// Run Indexer in separate background daemon thread.
Thread thread = new Thread() {
public void run() {
quickFind.addNetwork(cyNetwork, new TaskMonitorBase());
}
};
thread.start();
} else // very large networks.
if (cyNetwork.getNodeCount() < QuickFindApp.REINDEX_THRESHOLD) {
// Run Indexer in separate background daemon thread.
Thread thread = new Thread() {
public void run() {
GenericIndex index = quickFind.getIndex(cyNetwork);
quickFind.reindexNetwork(cyNetwork, index.getIndexType(), index.getControllingAttribute(), new TaskMonitorBase());
}
};
thread.start();
}
}
}
use of org.cytoscape.filter.internal.quickfind.util.TaskMonitorBase in project cytoscape-impl by cytoscape.
the class FilterSettingPanel method createNumberIndex.
private NumberIndex createNumberIndex(NumericFilter pNumericFilter) {
CyNetwork currentNetwork = applicationManager.getCurrentNetwork();
if (currentNetwork == null)
return null;
int indexType = pNumericFilter.getIndexType();
quickFind.reindexNetwork(currentNetwork, indexType, pNumericFilter.getControllingAttribute(), new TaskMonitorBase());
GenericIndex currentIndex = quickFind.getIndex(currentNetwork);
if (currentIndex == null || !(currentIndex instanceof NumberIndex)) {
return null;
}
return (NumberIndex) currentIndex;
}
use of org.cytoscape.filter.internal.quickfind.util.TaskMonitorBase in project cytoscape-impl by cytoscape.
the class FilterSettingPanel method getAtomicFilterFromStr.
private AtomicFilter getAtomicFilterFromStr(String pCtrlAttribute, int pIndexType) {
AtomicFilter retFilter = null;
// quickFind.addNetwork(cyNetwork, new TaskMonitorBase());
// index_by_UniqueIdentification = (TextIndex) quickFind.getIndex(cyNetwork);
CyNetwork cyNetwork = applicationManager.getCurrentNetwork();
quickFind.reindexNetwork(cyNetwork, pIndexType, pCtrlAttribute, new TaskMonitorBase());
Class<?> attributeType = null;
if (pIndexType == QuickFind.INDEX_NODES) {
if (cyNetwork.getNodeCount() > 0) {
attributeType = cyNetwork.getDefaultNodeTable().getColumn(pCtrlAttribute).getType();
}
} else if (pIndexType == QuickFind.INDEX_EDGES) {
if (cyNetwork.getEdgeCount() > 0) {
attributeType = cyNetwork.getDefaultEdgeTable().getColumn(pCtrlAttribute).getType();
}
}
if ((attributeType == Integer.class) || (attributeType == Double.class)) {
retFilter = new NumericFilter(quickFind);
retFilter.setControllingAttribute(pCtrlAttribute);
retFilter.setIndexType(pIndexType);
// NumberIndex index_by_thisAttr = (NumberIndex) quickFind.getIndex(Cytoscape.getCurrentNetwork());
retFilter.setIndex(quickFind.getIndex(cyNetwork));
} else if ((attributeType == String.class || (attributeType == List.class || (attributeType == Boolean.class)))) {
retFilter = new StringFilter(quickFind);
retFilter.setControllingAttribute(pCtrlAttribute);
retFilter.setIndexType(pIndexType);
// TextIndex index_by_thisAttr = (TextIndex) quickFind.getIndex(Cytoscape.getCurrentNetwork());
retFilter.setIndex(quickFind.getIndex(cyNetwork));
} else {
logger.error("AttributeType is not numeric/string/list/boolean.");
}
if (retFilter != null) {
retFilter.setNetwork(cyNetwork);
}
return retFilter;
}
use of org.cytoscape.filter.internal.quickfind.util.TaskMonitorBase in project cytoscape-impl by cytoscape.
the class FilterSettingPanel method createTextIndex.
private TextIndex createTextIndex(StringFilter pFilter) {
CyNetwork cyNetwork = applicationManager.getCurrentNetwork();
quickFind.reindexNetwork(cyNetwork, pFilter.getIndexType(), pFilter.getControllingAttribute(), new TaskMonitorBase());
return (TextIndex) quickFind.getIndex(cyNetwork);
}
Aggregations