tmf xml: Add a few package-info to tmf.analysis.xml.core.model.*
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.analysis.xml.core / src / org / eclipse / tracecompass / tmf / analysis / xml / core / model / TmfXmlStateValue.java
index eb7c585c571b734e101e5475052f9fb01600f4ea..db621edd533fa8a4f46a55f6367f2762b35b603b 100644 (file)
@@ -51,7 +51,7 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue {
     /* Path in the State System */
     private final List<ITmfXmlStateAttribute> fPath;
     /* Event field to match with this state value */
-    private final String fEventField;
+    private final @Nullable String fEventField;
 
     /* Whether this state value is an increment of the previous value */
     private final boolean fIncrement;
@@ -110,7 +110,7 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue {
      * @param attributes
      *            The attributes representing the path to this value
      */
-    protected TmfXmlStateValue(ITmfXmlModelFactory modelFactory, Element node, IXmlStateSystemContainer container, List<ITmfXmlStateAttribute> attributes, String eventField) {
+    protected TmfXmlStateValue(ITmfXmlModelFactory modelFactory, Element node, IXmlStateSystemContainer container, List<ITmfXmlStateAttribute> attributes, @Nullable String eventField) {
         fPath = attributes;
         fContainer = container;
         fEventField = eventField;
@@ -146,7 +146,8 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue {
         /*
          * Stack Actions : allow to define a stack with PUSH/POP/PEEK methods
          */
-        String stack = node.getAttribute(TmfXmlStrings.ATTRIBUTE_STACK);
+        @SuppressWarnings("null")
+        @NonNull String stack = node.getAttribute(TmfXmlStrings.ATTRIBUTE_STACK);
         fStackType = ValueTypeStack.getTypeFromString(stack);
     }
 
@@ -177,7 +178,7 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue {
      *
      * @return The state system associated with the state system container
      */
-    protected ITmfStateSystem getStateSystem() {
+    protected @Nullable ITmfStateSystem getStateSystem() {
         return fContainer.getStateSystem();
     }
 
@@ -236,7 +237,11 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue {
      */
     @Override
     public ITmfStateValue getEventFieldValue(@NonNull ITmfEvent event) {
-        return getEventFieldValue(event, fEventField);
+        String eventField = fEventField;
+        if (eventField == null) {
+            throw new IllegalStateException();
+        }
+        return getEventFieldValue(event, eventField);
     }
 
     /**
@@ -248,13 +253,14 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue {
      *            The name of the field of which to get the value
      * @return The value of the event field
      */
-    protected ITmfStateValue getEventFieldValue(@NonNull ITmfEvent event, String fieldName) {
+    protected ITmfStateValue getEventFieldValue(ITmfEvent event, String fieldName) {
 
         ITmfStateValue value = TmfStateValue.nullValue();
 
         final ITmfEventField content = event.getContent();
 
-        /* Exception for "CPU", returns the source CPU of this event */
+        /* Exception for "CPU", returns the source of this event */
+        /* FIXME : Nameclash if a eventfield have "cpu" for name. */
         if (fieldName.equals(TmfXmlStrings.CPU)) {
             /* See if the event advertises a CPU aspect */
             Iterable<TmfCpuAspect> cpuAspects = TmfTraceUtils.getEventAspectsOfClass(
@@ -442,7 +448,7 @@ public abstract class TmfXmlStateValue implements ITmfXmlStateValue {
          * @throws AttributeNotFoundException
          *             Pass through the exception it received
          */
-        public void handleEvent(@NonNull ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException {
+        public void handleEvent(ITmfEvent event, int quark, long timestamp) throws StateValueTypeException, TimeRangeException, AttributeNotFoundException {
             if (fIncrement) {
                 incrementValue(event, quark, timestamp);
             } else {
This page took 0.025752 seconds and 5 git commands to generate.