2111 lines · 81.6 KB · Java
RawDownload
                    // p is the property pattern, v is the string                    if (Util.wildmatch(v,p.getValueString(cn)))                        continue;                    else                        return false;                }                if (v.equals(p.getValueString(cn))) continue;                return false;            }            return true;        }         // If no pattern, then canonical names must be equal        //        final String p1 = name.getCanonicalKeyPropertyListString();        final String p2 = getCanonicalKeyPropertyListString();        return (p1.equals(p2));    }     /* Method inherited from QueryExp, no implementation needed here       because ObjectName is not relative to an MBeanServer and does       not contain a subquery.    */    public void setMBeanServer(MBeanServer mbs) { }     // Category : QueryExp Interface <=========================     // Category : Comparable Interface ---------------------------------------->     /**     * <p>Compares two ObjectName instances. The ordering relation between     * ObjectNames is not completely specified but is intended to be such     * that a sorted list of ObjectNames will appear in an order that is     * convenient for a person to read.</p>     *     * <p>In particular, if the two ObjectName instances have different     * domains then their order is the lexicographical order of the domains.     * The ordering of the key property list remains unspecified.</p>     *     * <p>For example, the ObjectName instances below:</p>     * <ul>     * <li>Shapes:type=Square,name=3</li>     * <li>Colors:type=Red,name=2</li>     * <li>Shapes:type=Triangle,side=isosceles,name=2</li>     * <li>Colors:type=Red,name=1</li>     * <li>Shapes:type=Square,name=1</li>     * <li>Colors:type=Blue,name=1</li>     * <li>Shapes:type=Square,name=2</li>     * <li>JMImplementation:type=MBeanServerDelegate</li>     * <li>Shapes:type=Triangle,side=scalene,name=1</li>     * </ul>     * <p>could be ordered as follows:</p>     * <ul>     * <li>Colors:type=Blue,name=1</li>     * <li>Colors:type=Red,name=1</li>     * <li>Colors:type=Red,name=2</li>     * <li>JMImplementation:type=MBeanServerDelegate</li>     * <li>Shapes:type=Square,name=1</li>     * <li>Shapes:type=Square,name=2</li>     * <li>Shapes:type=Square,name=3</li>     * <li>Shapes:type=Triangle,side=scalene,name=1</li>     * <li>Shapes:type=Triangle,side=isosceles,name=2</li>     * </ul>     *     * @param name the ObjectName to be compared.     *     * @return a negative integer, zero, or a positive integer as this     *         ObjectName is less than, equal to, or greater than the     *         specified ObjectName.     *     * @since 1.6     */    public int compareTo(ObjectName name) {        // Quick optimization:        //        if (name == this) return 0;         // (1) Compare domains        //        int domainValue = this.getDomain().compareTo(name.getDomain());        if (domainValue != 0)            return domainValue;         // (2) Compare "type=" keys        //        // Within a given domain, all names with missing or empty "type="        // come before all names with non-empty type.        //        // When both types are missing or empty, canonical-name ordering        // applies which is a total order.        //        String thisTypeKey = this.getKeyProperty("type");        String anotherTypeKey = name.getKeyProperty("type");        if (thisTypeKey == null)            thisTypeKey = "";        if (anotherTypeKey == null)            anotherTypeKey = "";        int typeKeyValue = thisTypeKey.compareTo(anotherTypeKey);        if (typeKeyValue != 0)            return typeKeyValue;         // (3) Compare canonical names        //        return this.getCanonicalName().compareTo(name.getCanonicalName());    }     // Category : Comparable Interface <=========================     // Public methods <======================================== }

Lines 2001–2111 of 2111. Previous lines