org.deckfour.xes.extension.std
Class XCostExtension

java.lang.Object
  extended by org.deckfour.xes.extension.XExtension
      extended by org.deckfour.xes.extension.std.XCostExtension
All Implemented Interfaces:
Serializable

public class XCostExtension
extends XExtension

This extension provides costs for traces and events. It defines five attributes: - cost:total: Contains total cost incurred for a trace or an event. The value represents the sum of all the cost amounts within the element. - cost:currecny: Any valid currency format. - cost:amount: The value contains the cost amount for a cost driver. - cost:driver: The value contains the id for the cost driver used to calculate the cost. - cost:type: The value contains the cost type (e.g., Fixed, Overhead, Materials).

Author:
Eric Verbeek (h.m.w.verbeek@tue.nl)
See Also:
Serialized Form

Field Summary
static XAttributeContinuous ATTR_AMOUNT
           
static XAttributeLiteral ATTR_CURRENCY
           
static XAttributeLiteral ATTR_DRIVER
           
static XAttributeContinuous ATTR_TOTAL
          Attribute prototypes
static XAttributeLiteral ATTR_TYPE
           
static URI EXTENSION_URI
          Unique URI of this extension.
static String KEY_AMOUNT
           
static String KEY_CURRENCY
           
static String KEY_DRIVER
           
static String KEY_TOTAL
          Keys for the attributes.
static String KEY_TYPE
           
 
Fields inherited from class org.deckfour.xes.extension.XExtension
allAttributes, eventAttributes, logAttributes, metaAttributes, name, prefix, traceAttributes, uri
 
Method Summary
 void assignAmount(XAttribute attribute, Double amount)
          Assigns any attribute its cost amount, as defined by this extension's amount attribute.
 void assignAmounts(XEvent event, Map<String,Double> amounts)
          Assigns (to the given event) multiple amounts given their keys.
 void assignAmounts(XTrace trace, Map<String,Double> amounts)
          Assigns (to the given trace) multiple amounts given their keys.
 void assignCurrency(XEvent event, String currency)
          Assigns any event its cost currency, as defined by this extension's currency attribute.
 void assignCurrency(XTrace trace, String currency)
          Assigns any trace its cost currency, as defined by this extension's currency attribute.
 void assignDriver(XAttribute attribute, String driver)
          Assigns any attribute its cost driver, as defined by this extension's driver attribute.
 void assignDrivers(XEvent event, Map<String,String> drivers)
          Assigns (to the given event) multiple cost drivers given their key.
 void assignDrivers(XTrace trace, Map<String,String> drivers)
          Assigns (to the given trace) multiple cost drivers given their keys.
 void assignNestedAmounts(XEvent event, Map<List<String>,Double> amounts)
          Assigns (to the given event) multiple amounts given their key lists.
 void assignNestedAmounts(XTrace trace, Map<List<String>,Double> amounts)
          Assigns (to the given trace) multiple amounts given their key lists.
 void assignNestedDrivers(XEvent event, Map<List<String>,String> drivers)
          Assigns (to the given event) multiple cost drivers given their key lists.
 void assignNestedDrivers(XTrace trace, Map<List<String>,String> drivers)
          Assigns (to the given trace) multiple cost drivers given their key lists.
 void assignNestedTypes(XEvent event, Map<List<String>,String> types)
          Assigns (to the given event) multiple cost types given their key lists.
 void assignNestedTypes(XTrace trace, Map<List<String>,String> types)
          Assigns (to the given trace) multiple cost types given their key lists.
 void assignTotal(XEvent event, Double total)
          Assigns any event its total costs, as defined by this extension's total attribute.
 void assignTotal(XTrace trace, Double total)
          Assigns any trace its total costs, as defined by this extension's total attribute.
 void assignType(XAttribute attribute, String type)
          Assigns any attribute its cost type, as defined by this extension's type attribute.
 void assignTypes(XEvent event, Map<List<String>,String> types)
          Assigns (to the given event) multiple cost types given their keys.
 void assignTypes(XTrace trace, Map<List<String>,String> types)
          Assigns (to the given trace) multiple cost types given their keys.
 Double extractAmount(XAttribute attribute)
          Retrieves the cost amount for an attribute, if set by this extension's amount attribute.
 Map<String,Double> extractAmounts(XEvent event)
          Retrieves a map containing all cost amounts for all child attributes of an event.
 Map<String,Double> extractAmounts(XTrace trace)
          Retrieves a map containing all cost amounts for all child attributes of a trace.
 String extractCurrency(XEvent event)
          Retrieves the cost currency for an event, if set by this extension's currency attribute.
 String extractCurrency(XTrace trace)
          Retrieves the cost currency for a trace, if set by this extension's currency attribute.
 String extractDriver(XAttribute attribute)
          Retrieves the cost driver for an attribute, if set by this extension's driver attribute.
 Map<String,String> extractDrivers(XEvent event)
          Retrieves a map containing all cost drivers for all child attributes of an event.
 Map<String,String> extractDrivers(XTrace trace)
          Retrieves a map containing all cost drivers for all child attributes of a trace.
 Map<List<String>,Double> extractNestedAmounts(XEvent event)
          Retrieves a map containing all cost amounts for all descending attributes of an event.
 Map<List<String>,Double> extractNestedAmounts(XTrace trace)
          Retrieves a map containing all cost amounts for all descending attributes of a trace.
 Map<List<String>,String> extractNestedDrivers(XEvent event)
          Retrieves a map containing all cost drivers for all descending attributes of an event.
 Map<List<String>,String> extractNestedDrivers(XTrace trace)
          Retrieves a map containing all cost drivers for all descending attributes of a trace.
 Map<List<String>,String> extractNestedTypes(XEvent event)
          Retrieves a map containing all cost types for all descending attributes of an event.
 Map<List<String>,String> extractNestedTypes(XTrace trace)
          Retrieves a map containing all cost types for all descending attributes of a trace.
 Double extractTotal(XEvent event)
          Retrieves the total costs of an event, if set by this extension's total attribute.
 Double extractTotal(XTrace trace)
          Retrieves the total costs of a trace, if set by this extension's total attribute.
 String extractType(XAttribute attribute)
          Retrieves the cost type for an attribute, if set by this extension's type attribute.
 Map<String,String> extractTypes(XEvent event)
          Retrieves a map containing all cost types for all child attributes of an event.
 Map<String,String> extractTypes(XTrace trace)
          Retrieves a map containing all cost types for all child attributes of a trace.
static XCostExtension instance()
          Provides access to the singleton instance.
 
Methods inherited from class org.deckfour.xes.extension.XExtension
accept, equals, getDefinedAttributes, getEventAttributes, getLogAttributes, getMetaAttributes, getName, getPrefix, getTraceAttributes, getUri, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EXTENSION_URI

public static final URI EXTENSION_URI
Unique URI of this extension.


KEY_TOTAL

public static final String KEY_TOTAL
Keys for the attributes.

See Also:
Constant Field Values

KEY_CURRENCY

public static final String KEY_CURRENCY
See Also:
Constant Field Values

KEY_AMOUNT

public static final String KEY_AMOUNT
See Also:
Constant Field Values

KEY_DRIVER

public static final String KEY_DRIVER
See Also:
Constant Field Values

KEY_TYPE

public static final String KEY_TYPE
See Also:
Constant Field Values

ATTR_TOTAL

public static XAttributeContinuous ATTR_TOTAL
Attribute prototypes


ATTR_CURRENCY

public static XAttributeLiteral ATTR_CURRENCY

ATTR_AMOUNT

public static XAttributeContinuous ATTR_AMOUNT

ATTR_DRIVER

public static XAttributeLiteral ATTR_DRIVER

ATTR_TYPE

public static XAttributeLiteral ATTR_TYPE
Method Detail

instance

public static XCostExtension instance()
Provides access to the singleton instance.

Returns:
Singleton extension.

extractTotal

public Double extractTotal(XTrace trace)
Retrieves the total costs of a trace, if set by this extension's total attribute.

Parameters:
trace - Trace to retrieve total costs for.
Returns:
The requested total costs.

extractTotal

public Double extractTotal(XEvent event)
Retrieves the total costs of an event, if set by this extension's total attribute.

Parameters:
event - Event to retrieve total costs for.
Returns:
The requested total costs.

assignTotal

public void assignTotal(XTrace trace,
                        Double total)
Assigns any trace its total costs, as defined by this extension's total attribute.

Parameters:
trace - Trace to assign total costs to.
total - The total costs to be assigned.

assignTotal

public void assignTotal(XEvent event,
                        Double total)
Assigns any event its total costs, as defined by this extension's total attribute.

Parameters:
event - Event to assign total costs to.
total - The total costs to be assigned.

extractCurrency

public String extractCurrency(XTrace trace)
Retrieves the cost currency for a trace, if set by this extension's currency attribute.

Parameters:
trace - Trace to retrieve currency for.
Returns:
The requested cost currency.

extractCurrency

public String extractCurrency(XEvent event)
Retrieves the cost currency for an event, if set by this extension's currency attribute.

Parameters:
event - Event to retrieve currency for.
Returns:
The requested cost currency.

assignCurrency

public void assignCurrency(XTrace trace,
                           String currency)
Assigns any trace its cost currency, as defined by this extension's currency attribute.

Parameters:
trace - Trace to assign cost currency to.
currency - The currency to be assigned.

assignCurrency

public void assignCurrency(XEvent event,
                           String currency)
Assigns any event its cost currency, as defined by this extension's currency attribute.

Parameters:
event - Event to assign cost currency to.
currency - The currency to be assigned.

extractAmount

public Double extractAmount(XAttribute attribute)
Retrieves the cost amount for an attribute, if set by this extension's amount attribute.

Parameters:
attribute - Attribute element to retrieve cost amount for.
Returns:
The requested cost amount.

extractAmounts

public Map<String,Double> extractAmounts(XTrace trace)
Retrieves a map containing all cost amounts for all child attributes of a trace. For example, the XES fragment:
 <trace>
     <string key="a" value="">
         <float key="cost:amount" value="10.00"/>
         <string key="b" value="">
         	  <float key="cost:amount" value="20.00"/>
         </string>
         <string key="c" value="">
         	  <float key="cost:amount" value="30.00"/>
         </string>
     </string>
     <string key="b" value="">
        <float key="cost:amount" value="15.00"/>
     </string>
     <string key="c" value="">
        <float key="cost:amount" value="25.00"/>
     </string>
 </trace>
 
 
should result into the following:
 [[a 10.00] [b 15.00] [c 25.00]]
 

Parameters:
trace - Trace to retrieve all cost amounts for.
Returns:
Map from all child keys to cost amounts.

extractAmounts

public Map<String,Double> extractAmounts(XEvent event)
Retrieves a map containing all cost amounts for all child attributes of an event. For example, the XES fragment:
 <event>
     <string key="a" value="">
         <float key="cost:amount" value="10.00"/>
         <string key="b" value="">
         	  <float key="cost:amount" value="20.00"/>
         </string>
         <string key="c" value="">
         	  <float key="cost:amount" value="30.00"/>
         </string>
     </string>
     <string key="b" value="">
        <float key="cost:amount" value="15.00"/>
     </string>
     <string key="c" value="">
        <float key="cost:amount" value="25.00"/>
     </string>
 </event>
 
 
should result into the following:
 [[a 10.00] [b 15.00] [c 25.00]]
 

Parameters:
event - Event to retrieve all cost amounts for.
Returns:
Map from all child keys to cost amounts.

extractNestedAmounts

public Map<List<String>,Double> extractNestedAmounts(XTrace trace)
Retrieves a map containing all cost amounts for all descending attributes of a trace. For example, the XES fragment:
 <trace>
     <string key="a" value="">
         <float key="cost:amount" value="10.00"/>
         <string key="b" value="">
         	  <float key="cost:amount" value="20.00"/>
         </string>
         <string key="c" value="">
         	  <float key="cost:amount" value="30.00"/>
         </string>
     </string>
     <string key="b" value="">
        <float key="cost:amount" value="15.00"/>
     </string>
     <string key="c" value="">
        <float key="cost:amount" value="25.00"/>
     </string>
 </trace>
 
 
should result into the following:
 [[[a] 10.00] [[a b] 20.00] [[a c] 30.00] [[b] 15.00] [[c] 25.00]]
 

Parameters:
trace - Trace to retrieve all cost amounts for.
Returns:
Map from all descending keys to cost amounts.

extractNestedAmounts

public Map<List<String>,Double> extractNestedAmounts(XEvent event)
Retrieves a map containing all cost amounts for all descending attributes of an event. For example, the XES fragment:
 <event>
     <string key="a" value="">
         <float key="cost:amount" value="10.00"/>
         <string key="b" value="">
         	  <float key="cost:amount" value="20.00"/>
         </string>
         <string key="c" value="">
         	  <float key="cost:amount" value="30.00"/>
         </string>
     </string>
     <string key="b" value="">
        <float key="cost:amount" value="15.00"/>
     </string>
     <string key="c" value="">
        <float key="cost:amount" value="25.00"/>
     </string>
 </event>
 
 
should result into the following:
 [[[a] 10.00] [[a b] 20.00] [[a c] 30.00] [[b] 15.00] [[c] 25.00]]
 

Parameters:
event - Event to retrieve all cost amounts for.
Returns:
Map from all descending keys to cost amounts.

assignAmount

public void assignAmount(XAttribute attribute,
                         Double amount)
Assigns any attribute its cost amount, as defined by this extension's amount attribute.

Parameters:
attribute - Attribute to assign cost amount to.
amount - The cost amount to be assigned.

assignAmounts

public void assignAmounts(XTrace trace,
                          Map<String,Double> amounts)
Assigns (to the given trace) multiple amounts 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:
 assignAmounts(trace, [[a 10.00] [b 15.00] [c 25.00]])
 
should result into the following XES fragment:
 <trace>
     <string key="a" value="">
         <float key="cost:amount" value="10.00"/>
     </string>
     <string key="b" value="">
         <float key="cost:amount" value="15.00"/>
     </string>
     <string key="c" value="">
         <float key="cost:amount" value="25.00"/>
     </string>
 </trace>
 
 

Parameters:
trace - Trace to assign the amounts to.
amounts - Mapping from keys to amounts which are to be assigned.

assignAmounts

public void assignAmounts(XEvent event,
                          Map<String,Double> amounts)
Assigns (to the given event) multiple amounts 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:
 assignAmounts(event, [[a 10.00] [b 15.00] [c 25.00]])
 
should result into the following XES fragment:
 <event>
     <string key="a" value="">
         <float key="cost:amount" value="10.00"/>
     </string>
     <string key="b" value="">
         <float key="cost:amount" value="15.00"/>
     </string>
     <string key="c" value="">
         <float key="cost:amount" value="25.00"/>
     </string>
 </event>
 
 

Parameters:
event - Event to assign the amounts to.
amounts - Mapping from keys to amounts which are to be assigned.

assignNestedAmounts

public void assignNestedAmounts(XTrace trace,
                                Map<List<String>,Double> amounts)
Assigns (to the given trace) multiple amounts 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:
 assignAmounts(trace, [[[a] 10.00] [[a b] 20.00] [[a c] 30.00] [[b] 15.00] [[c] 25.00]])
 
should result into the following XES fragment:
 <trace>
     <string key="a" value="">
         <float key="cost:amount" value="10.00"/>
         <string key="b" value="">
         	  <float key="cost:amount" value="20.00"/>
         </string>
         <string key="c" value="">
         	  <float key="cost:amount" value="30.00"/>
         </string>
     </string>
     <string key="b" value="">
        <float key="cost:amount" value="15.00"/>
     </string>
     <string key="c" value="">
        <float key="cost:amount" value="25.00"/>
     </string>
 </trace>
 
 

Parameters:
trace - Trace to assign the amounts to.
amounts - Mapping from key lists to amounts which are to be assigned.

assignNestedAmounts

public void assignNestedAmounts(XEvent event,
                                Map<List<String>,Double> amounts)
Assigns (to the given event) multiple amounts 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:
 assignAmounts(event, [[[a] 10.00] [[a b] 20.00] [[a c] 30.00] [[b] 15.00] [[c] 25.00]])
 
should result into the following XES fragment:
 <event>
     <string key="a" value="">
         <float key="cost:amount" value="10.00"/>
         <string key="b" value="">
         	  <float key="cost:amount" value="20.00"/>
         </string>
         <string key="c" value="">
         	  <float key="cost:amount" value="30.00"/>
         </string>
     </string>
     <string key="b" value="">
        <float key="cost:amount" value="15.00"/>
     </string>
     <string key="c" value="">
        <float key="cost:amount" value="25.00"/>
     </string>
 </event>
 
 

Parameters:
event - Event to assign the amounts to.
amounts - Mapping from key lists to amounts which are to be assigned.

extractDriver

public String extractDriver(XAttribute attribute)
Retrieves the cost driver for an attribute, if set by this extension's driver attribute.

Parameters:
attribute - Attribute element to retrieve cost driver for.
Returns:
The requested cost driver.

extractDrivers

public Map<String,String> extractDrivers(XTrace trace)
Retrieves a map containing all cost drivers for all child attributes of a trace.

Parameters:
trace - Trace to retrieve all cost drivers for.
Returns:
Map from all child keys to cost drivers.
See Also:
extractAmounts(XTrace)

extractDrivers

public Map<String,String> extractDrivers(XEvent event)
Retrieves a map containing all cost drivers for all child attributes of an event.

Parameters:
event - Event to retrieve all cost drivers for.
Returns:
Map from all child keys to cost drivers.
See Also:
extractAmounts(XEvent)

extractNestedDrivers

public Map<List<String>,String> extractNestedDrivers(XTrace trace)
Retrieves a map containing all cost drivers for all descending attributes of a trace.

Parameters:
trace - Trace to retrieve all cost drivers for.
Returns:
Map from all descending keys to cost drivers.
See Also:
extractNestedAmounts(XTrace)

extractNestedDrivers

public Map<List<String>,String> extractNestedDrivers(XEvent event)
Retrieves a map containing all cost drivers for all descending attributes of an event.

Parameters:
event - Event to retrieve all cost drivers for.
Returns:
Map from all descending keys to cost drivers.
See Also:
extractNestedDrivers(XEvent)

assignDriver

public void assignDriver(XAttribute attribute,
                         String driver)
Assigns any attribute its cost driver, as defined by this extension's driver attribute.

Parameters:
attribute - Attribute to assign cost driver to.
driver - The cost driver to be assigned.

assignDrivers

public void assignDrivers(XTrace trace,
                          Map<String,String> drivers)
Assigns (to the given trace) multiple cost drivers given their keys. Note that as a side effect this method creates attributes when it does not find an attribute with the proper key.

Parameters:
trace - Trace to assign the cost drivers to.
drivers - Mapping from keys to cost drivers which are to be assigned.
See Also:
assignAmounts(XTrace, Map)

assignDrivers

public void assignDrivers(XEvent event,
                          Map<String,String> drivers)
Assigns (to the given event) multiple cost drivers given their key. Note that as a side effect this method creates attributes when it does not find an attribute with the proper key.

Parameters:
event - Event to assign the cost drivers to.
drivers - Mapping from keys to cost drivers which are to be assigned.
See Also:
assignAmounts(XEvent, Map)

assignNestedDrivers

public void assignNestedDrivers(XTrace trace,
                                Map<List<String>,String> drivers)
Assigns (to the given trace) multiple cost drivers 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.

Parameters:
trace - Trace to assign the cost drivers to.
drivers - Mapping from key lists to cost drivers which are to be assigned.
See Also:
assignNestedAmounts(XTrace, Map)

assignNestedDrivers

public void assignNestedDrivers(XEvent event,
                                Map<List<String>,String> drivers)
Assigns (to the given event) multiple cost drivers 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.

Parameters:
event - Event to assign the cost drivers to.
drivers - Mapping from key lists to cost drivers which are to be assigned.
See Also:
assignNestedAmounts(XEvent, Map)

extractType

public String extractType(XAttribute attribute)
Retrieves the cost type for an attribute, if set by this extension's type attribute.

Parameters:
attribute - Attribute element to retrieve cost type for.
Returns:
The requested cost type.

extractTypes

public Map<String,String> extractTypes(XTrace trace)
Retrieves a map containing all cost types for all child attributes of a trace.

Parameters:
trace - Trace to retrieve all cost types for.
Returns:
Map from all child keys to cost types.
See Also:
extractAmounts(XTrace)

extractTypes

public Map<String,String> extractTypes(XEvent event)
Retrieves a map containing all cost types for all child attributes of an event.

Parameters:
event - Event to retrieve all cost types for.
Returns:
Map from all child keys to cost types.
See Also:
extractAmounts(XEvent)

extractNestedTypes

public Map<List<String>,String> extractNestedTypes(XTrace trace)
Retrieves a map containing all cost types for all descending attributes of a trace.

Parameters:
trace - Trace to retrieve all cost types for.
Returns:
Map from all descending keys to cost types.
See Also:
extractNestedAmounts(XTrace)

extractNestedTypes

public Map<List<String>,String> extractNestedTypes(XEvent event)
Retrieves a map containing all cost types for all descending attributes of an event.

Parameters:
event - Event to retrieve all cost types for.
Returns:
Map from all descending keys to cost types.
See Also:
extractNestedAmounts(XEvent)

assignType

public void assignType(XAttribute attribute,
                       String type)
Assigns any attribute its cost type, as defined by this extension's type attribute.

Parameters:
attribute - Attribute to assign cost type to.
type - The cost type to be assigned.

assignTypes

public void assignTypes(XTrace trace,
                        Map<List<String>,String> types)
Assigns (to the given trace) multiple cost types given their keys. Note that as a side effect this method creates attributes when it does not find an attribute with the proper key.

Parameters:
trace - Trace to assign the cost types to.
types - Mapping from keys to cost types which are to be assigned.
See Also:
assignAmounts(XTrace, Map)

assignTypes

public void assignTypes(XEvent event,
                        Map<List<String>,String> types)
Assigns (to the given event) multiple cost types given their keys. Note that as a side effect this method creates attributes when it does not find an attribute with the proper key.

Parameters:
event - Event to assign the cost types to.
types - Mapping from keys to cost types which are to be assigned.
See Also:
assignAmounts(XEvent, Map)

assignNestedTypes

public void assignNestedTypes(XTrace trace,
                              Map<List<String>,String> types)
Assigns (to the given trace) multiple cost types 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.

Parameters:
trace - Trace to assign the cost types to.
types - Mapping from key lists to cost types which are to be assigned.
See Also:
assignNestedAmounts(XTrace, Map)

assignNestedTypes

public void assignNestedTypes(XEvent event,
                              Map<List<String>,String> types)
Assigns (to the given event) multiple cost types 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.

Parameters:
event - Event to assign the cost types to.
types - Mapping from key lists to cost types which are to be assigned.
See Also:
assignNestedAmounts(XEvent, Map)