Methods Summary |
---|
public void | add(org.bouncycastle.asn1.DERObjectIdentifier key, java.lang.String value)Adds an element. The "added" flag is set to false for the element.
add(key, value, false);
|
public void | add(org.bouncycastle.asn1.DERObjectIdentifier key, java.lang.String value, boolean added)Adds an element.
if (size >= 32) {
throw new UnsupportedOperationException(
"no more than 32 elements");
}
if (key == null) {
throw new NullPointerException("key == null");
}
if (value == null) {
throw new NullPointerException("value == null");
}
int sz = size;
switch (sz) {
case 0: {
key0 = key;
value0 = value;
break;
}
case 1: {
key1 = key;
value1 = value;
break;
}
case 2: {
key2 = key;
value2 = value;
break;
}
case 3: {
key3 = key;
value3 = value;
break;
}
case 4: {
// Do initial allocation of rest.
rest = new Object[10];
rest[0] = key;
rest[1] = value;
break;
}
case 9: {
// Grow to accommodate 28 pairs in the array.
Object[] newRest = new Object[56];
System.arraycopy(rest, 0, newRest, 0, 10);
rest = newRest;
// Fall through.
}
default: {
int index = (sz - 4) * 2;
rest[index] = key;
rest[index + 1] = value;
break;
}
}
if (added) {
this.added |= (1 << sz);
}
size = sz + 1;
|
public boolean | getAdded(int n)Gets the nth added flag bit.
if ((n < 0) || (n >= size)) {
throw new IndexOutOfBoundsException(Integer.toString(n));
}
return (added & (1 << n)) != 0;
|
public org.bouncycastle.asn1.DERObjectIdentifier | getKey(int n)Gets the nth key.
if ((n < 0) || (n >= size)) {
throw new IndexOutOfBoundsException(Integer.toString(n));
}
switch (n) {
case 0: return key0;
case 1: return key1;
case 2: return key2;
case 3: return key3;
default: return (DERObjectIdentifier) rest[(n - 4) * 2];
}
|
public java.lang.String | getValue(int n)Gets the nth value.
if ((n < 0) || (n >= size)) {
throw new IndexOutOfBoundsException(Integer.toString(n));
}
switch (n) {
case 0: return value0;
case 1: return value1;
case 2: return value2;
case 3: return value3;
default: return (String) rest[((n - 4) * 2) + 1];
}
|
public org.bouncycastle.asn1.x509.X509NameElementList | reverse()Constructs and returns a new instance which consists of the
elements of this one in reverse order
X509NameElementList result = new X509NameElementList();
for (int i = size - 1; i >= 0; i--) {
result.add(getKey(i), getValue(i), getAdded(i));
}
return result;
|
public void | setLastAddedFlag()Sets the "added" flag on the most recently added element.
added |= 1 << (size - 1);
|
public int | size()Gets the number of elements in this instance.
return size;
|