FileDocCategorySizeDatePackage
NameAttributeSetPair.javaAPI DocExample2477Thu Nov 08 00:22:56 GMT 2001com.ora.rmibook.chapter15.impl

NameAttributeSetPair

public class NameAttributeSetPair extends Object implements Comparable

Fields Summary
private String
_name
private AttributeSet
_attributes
Constructors Summary
public NameAttributeSetPair(String name, AttributeSet attributes)

        _name = name;
        _attributes = attributes;
    
Methods Summary
private intcompare(java.lang.Comparable comparable1, java.lang.Comparable comparable2)

        if (null == comparable1) {
            if (null == comparable2) {
                return 0;
            }
            return -1; // null is less than non-null
        }
        if (null == comparable2) {
            return 1;
        }
        return comparable1.compareTo(comparable2);
    
public intcompareTo(java.lang.Object object)

        NameAttributeSetPair otherNameAttributePair = (NameAttributeSetPair) object;
        int returnValue;

        returnValue = compare(_name, otherNameAttributePair.getName());
        if (0 != returnValue) {
            return returnValue;
        }
        return compare(_attributes, otherNameAttributePair.getAttributes());
    
public booleanequals(java.lang.Object object)

        if (false == (object instanceof NameAttributeSetPair)) {
            return false;
        }
        NameAttributeSetPair otherNameAttributePair = (NameAttributeSetPair) object;

        if (0 != compareTo(otherNameAttributePair.getName())) {
            return false;
        }
        AttributeSet otherAttributes = otherNameAttributePair.getAttributes();

        return (0 == compare(_attributes, otherAttributes));
    
protected AttributeSetgetAttributes()

        return _attributes;
    
protected java.lang.StringgetName()

        return _name;
    
public booleanmatchesQueryObject(com.ora.rmibook.chapter15.impl.NameAttributeSetPair query)

        String otherName = query.getName();

        if ((null != otherName) && (false == otherName.equals(_name))) {
            return false;
        }
        AttributeSet otherAttributes = query.getAttributes();

        if (null != otherAttributes) {
            return otherAttributes.subsetOf(_attributes);
        }
        return true;