Changeset 2409

Show
Ignore:
Timestamp:
08/15/08 16:24:01 (3 months ago)
Author:
mwlinnem
Message:

(For nodes this time). Changed functionality to match the name. Now you can actually extract "below" a value, not just "below or equal to" a value.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plugins/preprocessing/edu.iu.nwb.preprocessing.extractnodesandedges/OSGI-INF/metatype/METADATA.XML

    r2408 r2409  
    1414                 description="Extract all nodes with an attribute above a certain number"> 
    1515                <AD name="Extract from this number" id="fromThisNum" type="Double" description="Extracts all nodes above or below this attribute value" default="1"/> 
    16                 <AD name="Invert?" id="invert" type="Boolean" description="Extract nodes below or equal to this value instead?" default="false" /> 
     16                <AD name="Below?" id="belowInstead" type="Boolean" description="Extract nodes below this value instead of above?" default="false" /> 
    1717                <AD name="Numeric Attribute" id="numericAttribute" type="String" description="The attribute which the nodes will be sorted by" default=""/> 
    1818        </OCD> 
  • trunk/plugins/preprocessing/edu.iu.nwb.preprocessing.extractnodesandedges/src/edu/iu/nwb/preprocessing/extractnodesandedges/extractnodes/abovebelow/ExtractNodesAboveBelowAlgorithm.java

    r2162 r2409  
    1717     
    1818    private Double fromThisNum; 
    19     private Boolean invert
     19    private Boolean belowInstead
    2020    private String numericAttribute; 
    2121     
     
    3535         
    3636        this.fromThisNum = (Double) parameters.get("fromThisNum"); 
    37         this.invert = (Boolean) parameters.get("invert"); 
     37        this.belowInstead = (Boolean) parameters.get("belowInstead"); 
    3838        this.numericAttribute = (String) parameters.get("numericAttribute"); 
    3939    } 
     
    5858    private Graph filter(Graph originalGraph) { 
    5959        NumericDecorationFilter filter = null; 
    60         if (invert.booleanValue() == false) { 
     60        if (belowInstead.booleanValue() == false) { 
    6161                filter = new NumericDecorationFilter(); 
    6262        } else { 
    63                 filter = new InverseNumericDecorationFilter(); 
     63                filter = new ReverseOfNumericDecorationFilter(); 
    6464        } 
    6565         
     
    7373        StringBuilder label = new StringBuilder(); 
    7474        label.append ("all nodes with " + this.numericAttribute); 
    75         if (this.invert.booleanValue() == false) { 
     75        if (this.belowInstead.booleanValue() == false) { 
    7676                label.append(" above "); 
    7777        } else { 
  • trunk/plugins/preprocessing/edu.iu.nwb.preprocessing.extractnodesandedges/src/edu/iu/nwb/preprocessing/extractnodesandedges/extractnodes/abovebelow/ReverseOfNumericDecorationFilter.java

    • Property svn:mergeinfo set
    r2162 r2409  
    44import edu.uci.ics.jung.graph.filters.impl.NumericDecorationFilter; 
    55 
    6 public class InverseNumericDecorationFilter extends NumericDecorationFilter { 
     6/* 
     7* Copyright (c) 2003, the JUNG Project and the Regents of the University  
     8* of California 
     9* All rights reserved. 
     10
     11* This software is open-source under the BSD license; see either 
     12* "license.txt" or 
     13* http://jung.sourceforge.net/license.txt for a description. 
     14*/ 
    715 
    8         public boolean acceptVertex(Vertex vertex) { 
    9                 return ! super.acceptVertex(vertex); 
    10         } 
     16//copied from jung source code, and switched the sign (now it's less than) 
     17 
     18public class ReverseOfNumericDecorationFilter extends NumericDecorationFilter { 
     19 
     20                public boolean acceptVertex(Vertex vertex) { 
     21                        Number n = (Number) vertex.getUserDatum(this.getDecorationKey()); 
     22 
     23                        if (n.doubleValue() < this.getThreshold()) { 
     24                                return true; 
     25                        } 
     26                        return false; 
     27                } 
     28 
    1129}