private static int[] filterBySetPos(int[] members, int[] bySetPos) {
        members = Util.uniquify(members);
        IntSet iset = new IntSet();
        for (int pos : bySetPos) {
            if (pos == 0) {
                continue;
            }
            if (pos < 0) {
                pos += members.length;
            } else {
                --pos;  // Zero-index.
            }
            if (pos >= 0 && pos < members.length) {
                iset.add(members[pos]);
            }
        }
        return iset.toIntArray();
    }
private static int [ ] filterBySetPos ( int [ ] members , int [ ] bySetPos ) { members = Util . uniquify ( members ) ; IntSet iset = new IntSet ( ) ; for ( int pos : bySetPos ) { if ( pos == 0 ) { continue ; } if ( pos < 0 ) { pos += members . length ; } else { -- pos ; } if ( pos >= 0 && pos < members . length ) { iset . add ( members [ pos ] ) ; } } return iset . toIntArray ( ) ; }
Given an array like BYMONTH=2,3,4,5 and a set pos like BYSETPOS=1,-1
reduce both clauses to a single one, BYMONTH=2,5 in the preceding.