Changeset 2407
- Timestamp:
- 08/15/08 15:53:14 (3 months ago)
- Files:
-
- trunk/plugins/preprocessing/edu.iu.nwb.preprocessing.extractnodesandedges/OSGI-INF/metatype/METADATA.XML (modified) (2 diffs)
- trunk/plugins/preprocessing/edu.iu.nwb.preprocessing.extractnodesandedges/src/edu/iu/nwb/preprocessing/extractnodesandedges/extractedges/top/ExtractTopEdgesAlgorithm.java (modified) (5 diffs)
- trunk/plugins/preprocessing/edu.iu.nwb.preprocessing.extractnodesandedges/src/edu/iu/nwb/preprocessing/extractnodesandedges/extractnodes/top/ExtractTopNodesAlgorithm.java (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plugins/preprocessing/edu.iu.nwb.preprocessing.extractnodesandedges/OSGI-INF/metatype/METADATA.XML
r2369 r2407 4 4 description="Extract the top N nodes from a graph, based on a given attribute "> 5 5 <AD name="Extract N top nodes" id="numTopNodes" type="Integer" description="Extracts this many of the top nodes from the graph" default="1"/> 6 <AD name=" Descending?" id="ascendingOrDescending" type="Boolean" description="Extract from the bottom up or from the top down?" default="true"/>6 <AD name="Extract bottom nodes instead?" id="fromBottomInstead" type="Boolean" description="Extract the bottom nodes instead of the top" default="false"/> 7 7 <AD name="Numeric Attribute" id="numericAttribute" type="String" description="The attribute which the nodes will be sorted by" default=""/> 8 8 </OCD> … … 23 23 description="Extract the top N edges from a graph, based on a given attribute "> 24 24 <AD name="Extract N top edges" id="numTopEdges" type="Integer" description="Extracts this many of the top edges from the graph" default="1"/> 25 <AD name=" Descending?" id="ascendingOrDescending" type="Boolean" description="Extract from the bottom up or from the top down?" default="true"/>25 <AD name="Extract bottom edges instead?" id="fromBottomInstead" type="Boolean" description="Extract the bottom edges instead of the top" default="false"/> 26 26 <AD name="Numeric Attribute" id="numericAttribute" type="String" description="The attribute which the edges will be sorted by" default=""/> 27 27 </OCD> trunk/plugins/preprocessing/edu.iu.nwb.preprocessing.extractnodesandedges/src/edu/iu/nwb/preprocessing/extractnodesandedges/extractedges/top/ExtractTopEdgesAlgorithm.java
r2162 r2407 17 17 import edu.uci.ics.jung.utils.GraphUtils; 18 18 19 public class ExtractTopEdgesAlgorithm implements Algorithm { 20 21 private static final boolean ASCENDING = true; 22 private static final boolean DESCENDING = false; 23 19 public class ExtractTopEdgesAlgorithm implements Algorithm { 24 20 Data[] data; 25 21 Dictionary parameters; 26 22 CIShellContext context; 27 23 private int numTopEdges; 28 private boolean ascendingOrDescending;24 private boolean fromBottomInstead; 29 25 private String numericAttribute; 30 26 … … 44 40 45 41 this.numTopEdges = ((Integer) parameters.get("numTopEdges")).intValue(); 46 this. ascendingOrDescending = ((Boolean) parameters.get("ascendingOrDescending")).booleanValue();42 this.fromBottomInstead = ((Boolean) parameters.get("fromBottomInstead")).booleanValue(); 47 43 this.numericAttribute = (String) parameters.get("numericAttribute"); 48 44 } … … 68 64 Set edgesToRemove = new HashSet(); 69 65 //if we want to keep the top X... 70 if ( ascendingOrDescending == ASCENDING) {66 if (! fromBottomInstead) { 71 67 //delete from the bottom up, until we have X left 72 68 while (edgesByRank.size() > numTopEdges) { … … 76 72 } 77 73 } //else if want to keep the bottom X... 78 else { 74 else {//bottomInstead == FROM_BOTTOM 79 75 //skip the first X from the bottom up 80 76 for (int ii = 0; ii < numTopEdges && (!edgesByRank.isEmpty()); ii++) { … … 95 91 private Data[] formatAsData(Graph extractedGraph) { 96 92 StringBuilder label = new StringBuilder(); 97 if (this.ascendingOrDescending) { 93 if (this.fromBottomInstead) { 94 label.append("bottom "); 95 } else { 98 96 label.append("top "); 99 } else {100 label.append("bottom ");101 97 } 102 98 label.append("" + this.numTopEdges); trunk/plugins/preprocessing/edu.iu.nwb.preprocessing.extractnodesandedges/src/edu/iu/nwb/preprocessing/extractnodesandedges/extractnodes/top/ExtractTopNodesAlgorithm.java
r2162 r2407 18 18 19 19 public class ExtractTopNodesAlgorithm implements Algorithm { 20 private static final boolean ASCENDING = true;21 private static final boolean DESCENDING = false;22 20 23 21 Data[] data; … … 25 23 CIShellContext context; 26 24 private int numTopNodes; 27 private boolean ascendingOrDescending;25 private boolean fromBottomInstead; 28 26 private String numericAttribute; 29 27 … … 43 41 44 42 this.numTopNodes = ((Integer) parameters.get("numTopNodes")).intValue(); 45 this. ascendingOrDescending = ((Boolean) parameters.get("ascendingOrDescending")).booleanValue();43 this.fromBottomInstead = ((Boolean) parameters.get("fromBottomInstead")).booleanValue(); 46 44 this.numericAttribute = (String) parameters.get("numericAttribute"); 47 45 } … … 67 65 Set nodesToRemove = new HashSet(); 68 66 //if we want to keep the top X... 69 if ( ascendingOrDescending == ASCENDING) {67 if (fromBottomInstead != true) { 70 68 //delete from the bottom up, until we have X left 71 69 while (nodesByRank.size() > numTopNodes) { … … 94 92 private Data[] formatAsData(Graph extractedGraph) { 95 93 StringBuilder label = new StringBuilder(); 96 if (this.ascendingOrDescending) { 94 if (this.fromBottomInstead) { 95 label.append("bottom "); 96 } else { 97 97 label.append("top "); 98 } else {99 label.append("bottom ");100 98 } 101 99 label.append("" + this.numTopNodes);
