@Override
 public boolean evaluate(Graph graph, Node node) {
   int degree = ((DirectedGraph) graph).getInDegree(node);
   return range.isInRange(degree);
 }
Exemple #2
0
  private void setupHistogram(final RangeFilter rangeFilter, final Range range) {
    histogram.clear();
    for (Object value : values) {
      histogram.addData(value);
    }
    histogram.sortData();
    double rangeLowerBound = 0.0;
    double rangeUpperBound = 0.0;
    if (range.getRangeType().equals(Integer.class)) {
      rangeLowerBound = ((Integer) range.getLowerBound()).doubleValue();
      rangeUpperBound = ((Integer) range.getUpperBound()).doubleValue();
    } else if (range.getRangeType().equals(Float.class)) {
      rangeLowerBound = ((Float) range.getLowerBound()).doubleValue();
      rangeUpperBound = ((Float) range.getUpperBound()).doubleValue();
    } else if (range.getRangeType().equals(Double.class)) {
      rangeLowerBound = ((Double) range.getLowerBound());
      rangeUpperBound = ((Double) range.getUpperBound());
    } else if (range.getRangeType().equals(Long.class)) {
      rangeLowerBound = ((Long) range.getLowerBound()).doubleValue();
      rangeUpperBound = ((Long) range.getUpperBound()).doubleValue();
    }
    histogram.setLowerBound(rangeLowerBound);
    histogram.setUpperBound(rangeUpperBound);

    SwingUtilities.invokeLater(
        new Runnable() {

          @Override
          public void run() {
            revalidate();
            repaint();
          }
        });
  }