Package org.deckfour.xes.extension.std
Class XAbstractNestedAttributeSupport<Type>
- java.lang.Object
-
- org.deckfour.xes.extension.std.XAbstractNestedAttributeSupport<Type>
-
- Direct Known Subclasses:
XCostAmount,XCostDriver,XCostType
public abstract class XAbstractNestedAttributeSupport<Type> extends java.lang.ObjectThis class offers generic support for extracting and assigning values to and from nested attributes.- Author:
- Eric Verbeek (h.m.w.verbeek@tue.nl)
-
-
Constructor Summary
Constructors Constructor Description XAbstractNestedAttributeSupport()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidassignNestedValues(XAttributable element, java.util.Map<java.util.List<java.lang.String>,Type> amounts)Assigns (to the given event) multiple values given their key lists.abstract voidassignValue(XAttribute element, Type value)Abstract method to assign a value to an element.voidassignValues(XAttributable element, java.util.Map<java.lang.String,Type> values)Assigns (to the given element) multiple values given their keys.java.util.Map<java.util.List<java.lang.String>,Type>extractNestedValues(XAttributable element)Retrieves a map containing all values for all descending attributes of an element.abstract TypeextractValue(XAttribute element)Abstract method to extract a value from an element.java.util.Map<java.lang.String,Type>extractValues(XAttributable element)Retrieves a map containing all values for all child attributes of an element.
-
-
-
Method Detail
-
extractValue
public abstract Type extractValue(XAttribute element)
Abstract method to extract a value from an element.- Parameters:
element- The element to extract the value from.- Returns:
- The extracted value.
-
assignValue
public abstract void assignValue(XAttribute element, Type value)
Abstract method to assign a value to an element.- Parameters:
element- The element to assign the value to.value- The value to be assigned.
-
extractValues
public java.util.Map<java.lang.String,Type> extractValues(XAttributable element)
Retrieves a map containing all values for all child attributes of an element. For example, the XES fragment:
should result into the following:<trace> <string key="key.1" value=""> <float key="ext:attr" value="val.1"/> <string key="key.1.1" value=""> <float key="ext:attr" value="val.1.1"/> </string> <string key="key.1.2" value=""> <float key="ext:attr" value="val.1.2"/> </string> </string> <string key="key.2" value=""> <float key="ext:attr" value="val.2"/> </string> <string key="key.3" value=""> <float key="ext:attr" value="val.3"/> </string> </trace>[[key.1 val.1] [key.2 val.2] [key.3 val.3]]
- Parameters:
element- Element to retrieve all values for.- Returns:
- Map from all child keys to values.
-
extractNestedValues
public java.util.Map<java.util.List<java.lang.String>,Type> extractNestedValues(XAttributable element)
Retrieves a map containing all values for all descending attributes of an element. For example, the XES fragment:
should result into the following:<trace> <string key="key.1" value=""> <float key="ext:attr" value="val.1"/> <string key="key.1.1" value=""> <float key="ext:attr" value="val.1.1"/> </string> <string key="key.1.2" value=""> <float key="ext:attr" value="val.1.2"/> </string> </string> <string key="key.2" value=""> <float key="ext:attr" value="val.2"/> </string> <string key="key.3" value=""> <float key="ext:attr" value="val.3"/> </string> </trace>[[[key.1] val.1] [[key.1 key.1.1] val.1.1] [[key.1 key.1.2] val.1.2] [[key.2] val.2] [[key.3] val.3]]
- Parameters:
element- Element to retrieve all values for.- Returns:
- Map from all descending keys to values.
-
assignValues
public void assignValues(XAttributable element, java.util.Map<java.lang.String,Type> values)
Assigns (to the given element) multiple values given their keys. Note that as a side effect this method creates attributes when it does not find an attribute with the proper key. For example, the call:assignValues(event, [[key.1 val.1] [key.2 val.2] [key.3 val.3]])
should result into the following XES fragment:<event> <string key="key.1" value=""> <float key="ext:attr" value="val.1"/> </string> <string key="key.2" value=""> <float key="ext:attr" value="val.2"/> </string> <string key="key.3" value=""> <float key="ext:attr" value="val.3"/> </string> </event>- Parameters:
event- Event to assign the values to.amounts- Mapping from keys to values which are to be assigned.
-
assignNestedValues
public void assignNestedValues(XAttributable element, java.util.Map<java.util.List<java.lang.String>,Type> amounts)
Assigns (to the given event) multiple values given their key lists. The i-th element in the key list should correspond to an i-level attribute with the prescribed key. Note that as a side effect this method creates attributes when it does not find an attribute with the proper key. For example, the call:assignNestedValues(event, [[[key.1] val.1] [[key.1 key.1.1] val.1.1] [[key.1 key.1.2] val.1.2] [[key.2] val.2] [[key.3] val.3]])
should result into the following XES fragment:<event> <string key="key.1" value=""> <float key="ext:attr" value="val.1"/> <string key="key.1.1" value=""> <float key="ext:attr" value="val.1.1"/> </string> <string key="key.1.2" value=""> <float key="ext:attr" value="val.1.2"/> </string> </string> <string key="key.2" value=""> <float key="ext:attr" value="val.2"/> </string> <string key="key.3" value=""> <float key="ext:attr" value="val.3"/> </string> </event>- Parameters:
element- Element to assign the values to.amounts- Mapping from key lists to values which are to be assigned.
-
-