Package org.gephi.filters.api

Examples of org.gephi.filters.api.Range


                min = Math.min(min, degree);
                max = Math.max(max, degree);
                values.add(degree);
            }
            if (range == null) {
                range = new Range(min, max, min, max);
            } else {
                range.setMinMax(min, max);
            }
        }
View Full Code Here


        }

        public void setRange(Range range) {
            if (range.getMinimum() == null && range.getMaximum() == null) {
                //Opening project
                this.range = new Range(range.getLowerBound(), range.getUpperBound(), this.range.getMinimum(), this.range.getMaximum());
            } else {
                this.range = range;
            }
        }
View Full Code Here

                min = Math.min(min, degree);
                max = Math.max(max, degree);
                values.add(degree);
            }
            if (range == null) {
                range = new Range(min, max, min, max);
            } else {
                range.setMinMax(min, max);
            }
        }
View Full Code Here

        }

        public void setRange(Range range) {
            if (range.getMinimum() == null && range.getMaximum() == null) {
                //Opening project
                this.range = new Range(range.getLowerBound(), range.getUpperBound(), this.range.getMinimum(), this.range.getMaximum());
            } else {
                this.range = range;
            }
        }
View Full Code Here

                min = Math.min(min, weight);
                max = Math.max(max, weight);
                values.add(weight);
            }
            if (range == null) {
                range = new Range(min, max, min, max);
            } else {
                range.setMinMax(min, max);
            }
        }
View Full Code Here

        }

        public void setRange(Range range) {
            if (range.getMinimum() == null && range.getMaximum() == null) {
                //Opening project
                this.range = new Range(range.getLowerBound(), range.getUpperBound(), this.range.getMinimum(), this.range.getMaximum());
            } else {
                this.range = range;
            }
        }
View Full Code Here

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        if (!text.equals("null")) {
            String[] arr = text.split(" - ");
            if (arr[0].equals("Float")) {
                range = new Range(Float.parseFloat(arr[1]), Float.parseFloat(arr[2]));
            } else if (arr[0].equals("Double")) {
                range = new Range(Double.parseDouble(arr[1]), Double.parseDouble(arr[2]));
            } else if (arr[0].equals("Integer")) {
                range = new Range(Integer.parseInt(arr[1]), Integer.parseInt(arr[2]));
            } else if (arr[0].equals("Long")) {
                range = new Range(Long.parseLong(arr[1]), Long.parseLong(arr[2]));
            }
        }
    }
View Full Code Here

        new Thread(new Runnable() {

            public void run() {
                final JRangeSliderPanel rangeSlider = (JRangeSliderPanel) rangeSliderPanel;
                values = rangeFilter.getValues();
                final Range range = (Range) rangeFilter.getRangeProperty().getValue();

                rangeSlider.addPropertyChangeListener(new PropertyChangeListener() {

                    public void propertyChange(PropertyChangeEvent evt) {
                        try {
                            if (evt.getPropertyName().equals(JRangeSliderPanel.LOWER_BOUND)) {
                                Range oldRange = (Range) filter.getRangeProperty().getValue();
                                final Range newRange = new Range((Number) rangeSlider.getRange().getLowerBound(), (Number) rangeSlider.getRange().getUpperBound(), oldRange.getMinimum(), oldRange.getMaximum());
                                if (!oldRange.equals(newRange)) {
                                    filter.getRangeProperty().setValue(newRange);
                                    new Thread(new Runnable() {

                                        public void run() {
                                            setupHistogram(filter, newRange);
                                        }
                                    }).start();
                                }
                            } else if (evt.getPropertyName().equals(JRangeSliderPanel.UPPER_BOUND)) {
                                final Range oldRange = (Range) filter.getRangeProperty().getValue();
                                final Range newRange = new Range((Number) rangeSlider.getRange().getLowerBound(), (Number) rangeSlider.getRange().getUpperBound(), oldRange.getMinimum(), oldRange.getMaximum());
                                if (!oldRange.equals(newRange)) {
                                    filter.getRangeProperty().setValue(newRange);
                                    new Thread(new Runnable() {

                                        public void run() {
View Full Code Here

                    min = min == null ? n : comparator.min(min, n);
                    max = max == null ? n : comparator.max(max, n);
                }
            }

            Range previousRange = (Range) rangeFilter.getRangeProperty().getValue();
            Range newRange;
            if (min == null || max == null) {
                newRange = null;
                rangeFilter.getRangeProperty().setValue(newRange);
            } else {
                if (previousRange == null) {
                    newRange = new Range(min, max, min, max, values);
                    rangeFilter.getRangeProperty().setValue(newRange);
                } else if(previousRange != null && (previousRange.getMinimum() == null || previousRange.getMaximum() == null)) {
                    //Opening projects
                    newRange = new Range(previousRange.getLowerBound(), previousRange.getUpperBound(), min, max, previousRange.isLeftInclusive(), previousRange.isRightInclusive(), values);
                    rangeFilter.getRangeProperty().setValue(newRange);
                } else {
                    //Collect some info
                    boolean stickyLeft = previousRange.getMinimum().equals(previousRange.getLowerBound());
                    boolean stickyRight = previousRange.getMaximum().equals(previousRange.getUpperBound());
                    Number lowerBound = previousRange.getLowerBound();
                    Number upperBound = previousRange.getUpperBound();

                    //The inteval grows on the right
                    if (stickyRight && comparator.superior(max, upperBound)) {
                        upperBound = max;
                    }

                    //The interval grows on the left
                    if (stickyLeft && comparator.inferior(min, lowerBound)) {
                        lowerBound = min;
                    }

                    //The interval shrinks on the right
                    if (comparator.superior(upperBound, max)) {
                        upperBound = max;
                    }

                    //The interval shrinks on the left
                    if (comparator.inferior(lowerBound, min)) {
                        lowerBound = min;
                    }

                    newRange = new Range(lowerBound, upperBound, min, max, previousRange.isLeftInclusive(), previousRange.isRightInclusive(), values);
                    if (!newRange.equals(previousRange)) {
                        rangeFilter.getRangeProperty().setValue(newRange);
                    }
                }
            }
        }
View Full Code Here

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        if (!text.equals("null")) {
            String[] arr = text.split(" - ");
            if (arr[0].equals("Float")) {
                range = new Range(Float.parseFloat(arr[1]), Float.parseFloat(arr[2]));
            } else if (arr[0].equals("Double")) {
                range = new Range(Double.parseDouble(arr[1]), Double.parseDouble(arr[2]));
            } else if (arr[0].equals("Integer")) {
                range = new Range(Integer.parseInt(arr[1]), Integer.parseInt(arr[2]));
            } else if (arr[0].equals("Long")) {
                range = new Range(Long.parseLong(arr[1]), Long.parseLong(arr[2]));
            } else if (arr[0].equals("Short")) {
                range = new Range(Short.parseShort(arr[1]), Short.parseShort(arr[2]));
            } else if (arr[0].equals("Byte")) {
                range = new Range(Byte.parseByte(arr[1]), Byte.parseByte(arr[2]));
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.gephi.filters.api.Range

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.