+ @Override
+ public ITmfStateInterval querySingleStackTop(long t, int stackAttributeQuark)
+ throws StateValueTypeException, AttributeNotFoundException,
+ TimeRangeException, StateSystemDisposedException {
+ ITmfStateValue curStackStateValue = querySingleState(t, stackAttributeQuark).getStateValue();
+
+ if (curStackStateValue.isNull()) {
+ /* There is nothing stored in this stack at this moment */
+ return null;
+ }
+ Integer curStackDepth = curStackStateValue.unboxInt();
+ if (curStackDepth <= 0) {
+ /*
+ * This attribute is an integer attribute, but it doesn't seem like
+ * it's used as a stack-attribute...
+ */
+ throw new StateValueTypeException();
+ }
+
+ int subAttribQuark = getQuarkRelative(stackAttributeQuark, curStackDepth.toString());
+ return querySingleState(t, subAttribQuark);
+ }
+