Methods Summary |
---|
public synchronized void | add(java.lang.String name, java.lang.String value)
if (null == name) {
return;
}
if (null == value) {
_underlyingMap.remove(name);
} else {
_underlyingMap.put(name, value);
}
|
public synchronized int | compareTo(java.lang.Object object)
if (null == object) {
return -1;
}
AttributeSet otherAttributeSet = (AttributeSet) object;
int sizeDifferential = _underlyingMap.size() - otherAttributeSet.getSize();
if (0 != sizeDifferential) {
return (sizeDifferential > 0) ? -1 : 1; //doesn't matter as long as we're consistent.
}
Iterator otherIterator = otherAttributeSet.getNames();
Iterator internalIterator = getNames();
while (otherIterator.hasNext()) {
String foreignName = (String) otherIterator.next();
String internalName = (String) internalIterator.next();
int firstComparison = internalName.compareTo(foreignName);
if (0 != firstComparison) {
return firstComparison;
}
String foreignValue = otherAttributeSet.getValue(foreignName);
String internalValue = getValue(foreignName);
int secondComparison = internalValue.compareTo(foreignValue);
if (0 != secondComparison) {
return secondComparison;
}
}
return 0;
|
public synchronized boolean | contains(java.lang.String name)
return (null != _underlyingMap.get(name));
|
public synchronized boolean | contains(java.lang.String name, java.lang.String value)
String internalValue = (String) _underlyingMap.get(name);
if (null != internalValue) {
return internalValue.equals(value);
}
return null == value;
|
public synchronized boolean | equals(java.lang.Object object)
if (null == object) {
return false;
}
if (false == (object instanceof AttributeSet)) {
return false;
}
return (0 == compareTo(object));
|
public synchronized java.util.Iterator | getNames()
return _underlyingMap.keySet().iterator();
|
public synchronized int | getSize()
return _underlyingMap.size();
|
public synchronized java.lang.String | getValue(java.lang.String name)
return (String) _underlyingMap.get(name);
|
public synchronized void | remove(java.lang.String name)
_underlyingMap.remove(name);
|
public synchronized boolean | subsetOf(com.ora.rmibook.chapter15.AttributeSet otherAttributeSet)
if (null == otherAttributeSet) {
return false;
}
Iterator i = getNames();
while (i.hasNext()) {
String name = (String) i.next();
String value = getValue(name);
if (false == otherAttributeSet.contains(name, value)) {
return false;
}
}
return true;
|