All Downloads are FREE. Search and download functionalities are using the official Maven repository.

test.ca.odell.glazedlists.IntegerArrayMatcherEditor Maven / Gradle / Ivy

There is a newer version: 1.9.1
Show newest version
/* Glazed Lists                                                 (c) 2003-2006 */
/* http://publicobject.com/glazedlists/                      publicobject.com,*/
/*                                                     O'Dell Engineering Ltd.*/
package ca.odell.glazedlists;

import ca.odell.glazedlists.matchers.AbstractMatcherEditor;
import ca.odell.glazedlists.matchers.Matcher;

/**
 * A matcher editor for filtering integer arrays, which are particularly well
 * suited for sorting and filtering tests.
 *
 * @author Kevin Maltby
 */
public class IntegerArrayMatcherEditor extends AbstractMatcherEditor {

    public IntegerArrayMatcherEditor(int index, int threshhold) {
        setFilter(index, threshhold);
    }
    public void setFilter(int index, int threshhold) {
        fireChanged(new IntegerArrayMatcher(index, threshhold));
    }
    private static class IntegerArrayMatcher implements Matcher {
        private int index;
        private int threshhold;
        public IntegerArrayMatcher(int index, int threshhold) {
            this.index = index;
            this.threshhold = threshhold;
        }
        public boolean matches(int[] array) {
            return (array[index] >= threshhold);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy