Methods Summary |
---|
public void | add(int value, int target)Adds the given item.
throwIfImmutable();
if (target < 0) {
throw new IllegalArgumentException("target < 0");
}
values.add(value);
targets.add(target);
|
public int | getDefaultTarget()Gets the default target. This is just a shorthand for
{@code getTarget(size())}.
return targets.get(size);
|
public int | getTarget(int n)Gets the indicated target. Asking for the target at {@code size()}
returns the default target.
return targets.get(n);
|
public com.android.dx.util.IntList | getTargets()Gets the list of all targets. This includes one extra element at the
end of the list, which holds the default target.
return targets;
|
public int | getValue(int n)Gets the indicated test value.
return values.get(n);
|
public com.android.dx.util.IntList | getValues()Gets the list of all case values.
return values;
|
public void | removeSuperfluousDefaults()Shrinks this instance if possible, removing test elements that
refer to the default target. This is only valid after the instance
is fully populated, including the default target (naturally).
throwIfImmutable();
int sz = size;
if (sz != (targets.size() - 1)) {
throw new IllegalArgumentException("incomplete instance");
}
int defaultTarget = targets.get(sz);
int at = 0;
for (int i = 0; i < sz; i++) {
int target = targets.get(i);
if (target != defaultTarget) {
if (i != at) {
targets.set(at, target);
values.set(at, values.get(i));
}
at++;
}
}
if (at != sz) {
values.shrink(at);
targets.set(at, defaultTarget);
targets.shrink(at + 1);
size = at;
}
|
public void | setDefaultTarget(int target)Sets the default target. It is only valid to call this method
when all the non-default elements have been set.
throwIfImmutable();
if (target < 0) {
throw new IllegalArgumentException("target < 0");
}
if (targets.size() != size) {
throw new RuntimeException("non-default elements not all set");
}
targets.add(target);
|
public void | setImmutable(){@inheritDoc}
values.setImmutable();
targets.setImmutable();
super.setImmutable();
|
public int | size()Gets the size of the list.
return size;
|