558 lines · 20.5 KB · Java
RawDownload
            int[][] otherMembers = ((SetOfIntegerSyntax) object).members;            int m = myMembers.length;            int n = otherMembers.length;            if (m == n) {                for (int i = 0; i < m; ++ i) {                    if (myMembers[i][0] != otherMembers[i][0] ||                        myMembers[i][1] != otherMembers[i][1]) {                        return false;                    }                }                return true;            } else {                return false;            }        } else {            return false;        }    }     /**     * Returns a hash code value for this set-of-integer attribute. The hash     * code is the sum of the lower and upper bounds of the ranges in the     * canonical array form, or 0 for an empty set.     */    public int hashCode() {        int result = 0;        int n = members.length;        for (int i = 0; i < n; ++ i) {            result += members[i][0] + members[i][1];        }        return result;    }     /**     * Returns a string value corresponding to this set-of-integer attribute.     * The string value is a zero-length string if this set is empty. Otherwise,     * the string value is a comma-separated list of the ranges in the canonical     * array form, where each range is represented as <CODE>"<I>i</I>"</CODE> if     * the lower bound equals the upper bound or     * <CODE>"<I>i</I>-<I>j</I>"</CODE> otherwise.     */    public String toString() {        StringBuffer result = new StringBuffer();        int n = members.length;        for (int i = 0; i < n; i++) {            if (i > 0) {                result.append (',');            }            result.append (members[i][0]);            if (members[i][0] != members[i][1]) {                result.append ('-');                result.append (members[i][1]);            }        }        return result.toString();    } }

Lines 501–558 of 558. Previous lines