Methods Summary |
---|
public void | add(Annotation annotation)Adds an element to this instance. There must not already be an
element of the same type.
throwIfImmutable();
if (annotation == null) {
throw new NullPointerException("annotation == null");
}
CstType type = annotation.getType();
if (annotations.containsKey(type)) {
throw new IllegalArgumentException("duplicate type: " +
type.toHuman());
}
annotations.put(type, annotation);
|
public void | addAll(com.android.dexgen.rop.annotation.Annotations toAdd)Adds all of the elements of the given instance to this one. The
instances must not have any duplicate types.
throwIfImmutable();
if (toAdd == null) {
throw new NullPointerException("toAdd == null");
}
for (Annotation a : toAdd.annotations.values()) {
add(a);
}
|
public static com.android.dexgen.rop.annotation.Annotations | combine(com.android.dexgen.rop.annotation.Annotations a1, com.android.dexgen.rop.annotation.Annotations a2)Constructs an immutable instance which is the combination of the
two given instances. The two instances must contain disjoint sets
of types.
Annotations result = new Annotations();
result.addAll(a1);
result.addAll(a2);
result.setImmutable();
return result;
|
public static com.android.dexgen.rop.annotation.Annotations | combine(com.android.dexgen.rop.annotation.Annotations annotations, Annotation annotation)Constructs an immutable instance which is the combination of the
given instance with the given additional annotation. The latter's
type must not already appear in the former.
Annotations result = new Annotations();
result.addAll(annotations);
result.add(annotation);
result.setImmutable();
return result;
|
public int | compareTo(com.android.dexgen.rop.annotation.Annotations other){@inheritDoc}
Iterator<Annotation> thisIter = annotations.values().iterator();
Iterator<Annotation> otherIter = other.annotations.values().iterator();
while (thisIter.hasNext() && otherIter.hasNext()) {
Annotation thisOne = thisIter.next();
Annotation otherOne = otherIter.next();
int result = thisOne.compareTo(otherOne);
if (result != 0) {
return result;
}
}
if (thisIter.hasNext()) {
return 1;
} else if (otherIter.hasNext()) {
return -1;
}
return 0;
|
public boolean | equals(java.lang.Object other){@inheritDoc}
if (! (other instanceof Annotations)) {
return false;
}
Annotations otherAnnotations = (Annotations) other;
return annotations.equals(otherAnnotations.annotations);
|
public java.util.Collection | getAnnotations()Gets the set of annotations contained in this instance. The
result is always unmodifiable.
return Collections.unmodifiableCollection(annotations.values());
|
public int | hashCode(){@inheritDoc}
return annotations.hashCode();
|
public int | size()Gets the number of elements in this instance.
return annotations.size();
|
public java.lang.String | toString(){@inheritDoc}
StringBuilder sb = new StringBuilder();
boolean first = true;
sb.append("annotations{");
for (Annotation a : annotations.values()) {
if (first) {
first = false;
} else {
sb.append(", ");
}
sb.append(a.toHuman());
}
sb.append("}");
return sb.toString();
|