/* 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;
* @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;
/*
* 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);
}
*
* @return The state system associated with the state system container
*/
- protected ITmfStateSystem getStateSystem() {
+ protected @Nullable ITmfStateSystem getStateSystem() {
return fContainer.getStateSystem();
}
*/
@Override
public ITmfStateValue getEventFieldValue(@NonNull ITmfEvent event) {
- return getEventFieldValue(event, fEventField);
+ String eventField = fEventField;
+ if (eventField == null) {
+ throw new IllegalStateException();
+ }
+ return getEventFieldValue(event, eventField);
}
/**
* 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(
* @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 {