}
@Override
- public List<@NonNull Integer> getSubAttributes(int quark, boolean recursive)
- throws AttributeNotFoundException {
+ public List<@NonNull Integer> getSubAttributes(int quark, boolean recursive) {
return getAttributeTree().getSubAttributes(quark, recursive);
}
@Override
- public List<@NonNull Integer> getSubAttributes(int quark, boolean recursive, String pattern)
- throws AttributeNotFoundException {
+ public List<@NonNull Integer> getSubAttributes(int quark, boolean recursive, String pattern) {
List<Integer> all = getSubAttributes(quark, recursive);
List<@NonNull Integer> ret = new LinkedList<>();
for (Integer attQuark : all) {
}
private void getQuarks(Builder<@NonNull Integer> builder, int quark, List<String> pattern) {
- try {
- String element = pattern.get(0);
- if (element == null) {
- return;
+ String element = pattern.get(0);
+ if (element == null) {
+ return;
+ }
+ List<String> remainder = pattern.subList(1, pattern.size());
+ if (remainder.isEmpty()) {
+ if (element.equals(WILDCARD)) {
+ builder.addAll(getSubAttributes(quark, false));
+ } else if (element.equals(PARENT)){
+ builder.add(getParentAttributeQuark(quark));
+ } else {
+ int subQuark = optQuarkRelative(quark, element);
+ if (subQuark != INVALID_ATTRIBUTE) {
+ builder.add(subQuark);
+ }
}
- List<String> remainder = pattern.subList(1, pattern.size());
- if (remainder.isEmpty()) {
- if (element.equals(WILDCARD)) {
- builder.addAll(getSubAttributes(quark, false));
- } else if (element.equals(PARENT)){
- builder.add(getParentAttributeQuark(quark));
- } else {
- int subQuark = optQuarkRelative(quark, element);
- if (subQuark != INVALID_ATTRIBUTE) {
- builder.add(subQuark);
- }
+ } else {
+ if (element.equals(WILDCARD)) {
+ for (@NonNull Integer subquark : getSubAttributes(quark, false)) {
+ getQuarks(builder, subquark, remainder);
}
+ } else if (element.equals(PARENT)){
+ getQuarks(builder, getParentAttributeQuark(quark), remainder);
} else {
- if (element.equals(WILDCARD)) {
- for (@NonNull Integer subquark : getSubAttributes(quark, false)) {
- getQuarks(builder, subquark, remainder);
- }
- } else if (element.equals(PARENT)){
- getQuarks(builder, getParentAttributeQuark(quark), remainder);
- } else {
- int subQuark = optQuarkRelative(quark, element);
- if (subQuark != INVALID_ATTRIBUTE) {
- getQuarks(builder, subQuark, remainder);
- }
+ int subQuark = optQuarkRelative(quark, element);
+ if (subQuark != INVALID_ATTRIBUTE) {
+ getQuarks(builder, subQuark, remainder);
}
}
- } catch (AttributeNotFoundException e) {
- /* The starting node quark is out of range */
- throw new IndexOutOfBoundsException(String.format("Index: %d, Size: %d", quark, getNbAttributes())); //$NON-NLS-1$
}
}
@Override
public void modifyAttribute(long t, ITmfStateValue value, int attributeQuark)
- throws TimeRangeException, AttributeNotFoundException,
- StateValueTypeException {
+ throws TimeRangeException, StateValueTypeException {
if (value == null) {
/*
* TODO Replace with @NonNull parameter (will require fixing all the
@Deprecated
@Override
public void incrementAttribute(long t, int attributeQuark)
- throws StateValueTypeException, TimeRangeException,
- AttributeNotFoundException {
+ throws StateValueTypeException, TimeRangeException {
ITmfStateValue stateValue = queryOngoingState(attributeQuark);
int prevValue = 0;
/* if the attribute was previously null, start counting at 0 */
@Override
public void pushAttribute(long t, ITmfStateValue value, int attributeQuark)
- throws TimeRangeException, AttributeNotFoundException,
- StateValueTypeException {
+ throws TimeRangeException, StateValueTypeException {
int stackDepth;
int subAttributeQuark;
ITmfStateValue previousSV = transState.getOngoingStateValue(attributeQuark);
* out of control due to buggy insertions
*/
String message = " Stack limit reached, not pushing"; //$NON-NLS-1$
- throw new AttributeNotFoundException(getSSID() + " Quark:" + attributeQuark + message); //$NON-NLS-1$
+ throw new IllegalStateException(getSSID() + " Quark:" + attributeQuark + message); //$NON-NLS-1$
}
stackDepth++;
@Override
public ITmfStateValue popAttribute(long t, int attributeQuark)
- throws AttributeNotFoundException, TimeRangeException,
- StateValueTypeException {
+ throws TimeRangeException, StateValueTypeException {
/* These are the state values of the stack-attribute itself */
ITmfStateValue previousSV = transState.getOngoingStateValue(attributeQuark);
}
/* The attribute should already exist at this point */
- int subAttributeQuark = getQuarkRelative(attributeQuark, String.valueOf(stackDepth));
+ int subAttributeQuark;
+ try {
+ subAttributeQuark = getQuarkRelative(attributeQuark, String.valueOf(stackDepth));
+ } catch (AttributeNotFoundException e) {
+ String message = " Stack attribute missing sub-attribute for depth:" + stackDepth; //$NON-NLS-1$
+ throw new IllegalStateException(getSSID() + " Quark:" + attributeQuark + message); //$NON-NLS-1$
+ }
ITmfStateValue poppedValue = queryOngoingState(subAttributeQuark);
/* Update the state value of the stack-attribute */
@Override
public void removeAttribute(long t, int attributeQuark)
- throws TimeRangeException, AttributeNotFoundException {
- if (attributeQuark < 0) {
- throw new IllegalArgumentException();
- }
-
+ throws TimeRangeException {
/*
* Nullify our children first, recursively. We pass 'false' because we
* handle the recursion ourselves.
//--------------------------------------------------------------------------
@Override
- public ITmfStateValue queryOngoingState(int attributeQuark)
- throws AttributeNotFoundException {
+ public ITmfStateValue queryOngoingState(int attributeQuark) {
return transState.getOngoingStateValue(attributeQuark);
}
@Override
- public long getOngoingStartTime(int attribute)
- throws AttributeNotFoundException {
+ public long getOngoingStartTime(int attribute) {
return transState.getOngoingStartTime(attribute);
}
@Override
- public void updateOngoingState(ITmfStateValue newValue, int attributeQuark)
- throws AttributeNotFoundException {
+ public void updateOngoingState(ITmfStateValue newValue, int attributeQuark) {
transState.changeOngoingStateValue(attributeQuark, newValue);
}
@Override
public ITmfStateInterval querySingleState(long t, int attributeQuark)
- throws AttributeNotFoundException, TimeRangeException,
- StateSystemDisposedException {
+ throws TimeRangeException, StateSystemDisposedException {
if (isDisposed) {
throw new StateSystemDisposedException();
}