Package org.eclipse.app4mc.amalthea.model.util

## Class SoftwareUtil

- Object
- - SoftwareUtil

    public class SoftwareUtil
    extends Object

### Method Summary

All Methods
`static EList<ActivityGraphItem>` `collectActivityGraphItems​(IActivityGraphItemContainer container)` Traverse the contained call graph items and collect all items.
`static EList<ActivityGraphItem>` `collectActivityGraphItems​(IActivityGraphItemContainer container, EMap<ModeLabel,​String> modes)` Traverse the contained call graph items and collect all items.
`static <T extends ActivityGraphItem> EList<T>` `collectActivityGraphItems​(IActivityGraphItemContainer container, EMap<ModeLabel,​String> modes, Class<T> targetClass)` Traverse the runnable items graph of a runnable and collect all items.
`static <T extends ActivityGraphItem> EList<T>` `collectActivityGraphItems​(IActivityGraphItemContainer container, EMap<ModeLabel,​String> modes, Class<T> targetClass, Function<T,​Boolean> filter)` Traverse the runnable items graph of a runnable and collect all items.
`static EList<ActivityGraphItem>` `collectActivityGraphItems​(IActivityGraphItemContainer container, EMap<ModeLabel,​String> modes, Function<ActivityGraphItem,​Boolean> filter)` Traverse the contained call graph items and collect all items.
`static List<ClearEvent>` `collectClearEvents​(Process process, EMap<ModeLabel,​String> modes)` Collects a list of clear event calls for a process
`static List<ActivityGraphItem>` `collectEventsOfProcess​(Process process, EMap<ModeLabel,​String> modes)` Collects a list of event calls (clear, set or wait) of a process
`static List<SetEvent>` `collectSetEvents​(Process process, EMap<ModeLabel,​String> modes)` Collects a list of set events calls for a process
`static List<WaitEvent>` `collectWaitEvents​(Process process, EMap<ModeLabel,​String> modes)` Collects a list of wait event calls for a process
`static Set<Label>` `getAccessedLabelSet​(Process process, EMap<ModeLabel,​String> modes)` Returns a set of labels accessed by the process
`static Set<Label>` `getAccessedLabelSet​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a set of labels accessed from the runnable
`static List<Runnable>` `getCalledRunnables​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a list of runnables directly called by the runnable
`static List<Process>` `getCallingProcesses​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a list of processes calling the runnable
`static List<Runnable>` `getCallingRunnables​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a list of runnables directly calling the runnable
`static List<ExecutionNeed>` `getExecutionNeeds​(Process process, EMap<ModeLabel,​String> modes)` Returns a list of all execution needs for a given process
`static List<ExecutionNeed>` `getExecutionNeeds​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a list of all execution needs for a given runnable
`static List<Label>` `getInterTaskCommunication​(Process sender, Process receiver, EMap<ModeLabel,​String> modes)` Returns a list of all exchanged labels that are written by the sender process and read by the receiver process
`static float` `getLabelAccessCountFromStatistics​(LabelAccess labelAcc, RuntimeUtil.TimeType accType)` Returns the number of label accesses from a statistic.
`static List<LabelAccess>` `getLabelAccessList​(Process process, EMap<ModeLabel,​String> modes)` Returns a list of all label accesses of the process
`static List<LabelAccess>` `getLabelAccessList​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a list of all label accesses of the runnable
`static Map<Label,​List<LabelAccessStatistic>>` `getLabelAccessStatisticsMap​(Process process, EMap<ModeLabel,​String> modes)` Returns a map: labels accessed by the process -> the corresponding label access statistics
`static Map<Label,​List<LabelAccessStatistic>>` `getLabelAccessStatisticsMap​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a map: labels accessed by the runnable -> the corresponding LabelAccessStatistics
`static float` `getLabelReadCount​(Label label, Process process, EMap<ModeLabel,​String> modes, RuntimeUtil.TimeType timeType)` Returns the reads from a process to a certain label.
`static Map<Label,​List<LabelAccess>>` `getLabelToLabelAccessMap​(Process process, EMap<ModeLabel,​String> modes)` Returns a map: accessed labels of the process -> the corresponding label accesses
`static Map<Label,​List<LabelAccess>>` `getLabelToLabelAccessMap​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a map: labels accessed from runnable -> the corresponding label accesses
`static float` `getLabelWriteCount​(Label label, Process process, EMap<ModeLabel,​String> modes, RuntimeUtil.TimeType timeType)` Returns the writes from a process to a certain label.
`static List<Runnable>` `getReaderListOfLabel​(Label label, EMap<ModeLabel,​String> modes)` Returns a list of runnables reading the label
`static Set<Runnable>` `getReadersSetOfLabel​(Label label, EMap<ModeLabel,​String> modes)` Returns a set of runnables reading the label
`static List<LabelAccess>` `getReadLabelAccessList​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a list of read label accesses of the runnable
`static Map<Label,​List<LabelAccessStatistic>>` `getReadLabelAccessStatisticsMap​(Process process, EMap<ModeLabel,​String> modes)` Returns a map: labels read the process -> the corresponding label access statistics
`static Map<Label,​List<LabelAccessStatistic>>` `getReadLabelAccessStatisticsMap​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a map: labels read by the runnable -> the corresponding LabelAccessStatistics
`static Set<Label>` `getReadLabelSet​(Process process, EMap<ModeLabel,​String> modes)` Returns a set of labels read by the process
`static Set<Label>` `getReadLabelSet​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a set of labels read by the runnable
`static List<Runnable>` `getRunnableList​(Process process, EMap<ModeLabel,​String> modes)` Returns a list of runnables called by the process
`static Set<Runnable>` `getRunnableSet​(Process process, EMap<ModeLabel,​String> modes)` Returns a set of runnables called by the process - no duplicates
`static Set<ServerCall>` `getServerCallSet​(Process process, EMap<ModeLabel,​String> modes)` Returns a set of server calls for a process
`static Set<ServerCall>` `getServerCallSet​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a set of server calls for a runnable
`static List<Ticks>` `getTicks​(Process process, EMap<ModeLabel,​String> modes)` Returns a list of all ticks for a given process
`static List<Ticks>` `getTicks​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a list of all ticks for a given runnable
`static List<LabelAccess>` `getWriteLabelAccessList​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a list of write label accesses of the runnable
`static Map<Label,​List<LabelAccessStatistic>>` `getWriteLabelAccessStatisticsMap​(Process process, EMap<ModeLabel,​String> modes)` Returns a map: labels written by the process -> the corresponding label access statistics
`static Map<Label,​List<LabelAccessStatistic>>` `getWriteLabelAccessStatisticsMap​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a map: labels written by the runnable -> the corresponding LabelAccessStatistics
`static Set<Label>` `getWriteLabelSet​(Process process, EMap<ModeLabel,​String> modes)` Returns a set of labels written by the process
`static Set<Label>` `getWriteLabelSet​(Runnable runnable, EMap<ModeLabel,​String> modes)` Returns a set of labels written by the runnable
`static List<Runnable>` `getWriterListOfLabel​(Label label, EMap<ModeLabel,​String> modes)` Returns a list of runnables writing the label
`static Set<Runnable>` `getWriterSetOfLabel​(Label label, EMap<ModeLabel,​String> modes)` Returns a set of runnables writing the label

### Methods inherited from class Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### collectActivityGraphItems

    public static EList<ActivityGraphItem> collectActivityGraphItems​(IActivityGraphItemContainer container)

Traverse the contained call graph items and collect all items.

Parameters:
  `container` - call graph, group, ...
Returns:
  List of ActivityGraphItems

#### collectActivityGraphItems

    public static EList<ActivityGraphItem> collectActivityGraphItems​(IActivityGraphItemContainer container,
                                                                     EMap<ModeLabel,​String> modes)

Traverse the contained call graph items and collect all items. Collection can be restricted to specific modes.

Parameters:
  `container` - call graph, group, ...
  `modes` - (optional) - null works
Returns:
  List of ActivityGraphItems

#### collectActivityGraphItems

    public static EList<ActivityGraphItem> collectActivityGraphItems​(IActivityGraphItemContainer container,
                                                                     EMap<ModeLabel,​String> modes,
                                                                     Function<ActivityGraphItem,​Boolean> filter)

Traverse the contained call graph items and collect all items. Collection can be restricted to specific modes and filtered by a lambda expression.

Parameters:
  `container` - call graph, group, ...
  `modes` - (optional) - null works
  `filter` - lambda expression (e.g. "a -> a instanceof LabelAccess")
Returns:
  List of ActivityGraphItems

#### collectActivityGraphItems

    public static <T extends ActivityGraphItem> EList<T> collectActivityGraphItems​(IActivityGraphItemContainer container,
                                                                                   EMap<ModeLabel,​String> modes,
                                                                                   Class<T> targetClass)

Traverse the runnable items graph of a runnable and collect all items. Collection can be restricted to specific modes and filtered by class.

Parameters:
  `container` - call graph, group, ...
  `modes` - (optional) - null works
  `targetClass` - subclass of ActivityGraphItem that restricts the result
Returns:
  List of T extends ActivityGraphItems

#### collectActivityGraphItems

    public static <T extends ActivityGraphItem> EList<T> collectActivityGraphItems​(IActivityGraphItemContainer container,
                                                                                   EMap<ModeLabel,​String> modes,
                                                                                   Class<T> targetClass,
                                                                                   Function<T,​Boolean> filter)

Traverse the runnable items graph of a runnable and collect all items. Collection can be restricted to specific modes and filtered by class and lambda expression.

Parameters:
  `container` - call graph, group, ...
  `modes` - (optional) - null works
  `targetClass` - subclass of ActivityGraphItem that restricts the result
  `filter` - lambda expression (e.g. "a -> a instanceof LabelAccess")
Returns:
  List of T extends ActivityGraphItems

#### getAccessedLabelSet

    public static Set<Label> getAccessedLabelSet​(Runnable runnable,
                                                 EMap<ModeLabel,​String> modes)

Returns a set of labels accessed from the runnable

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  Set of Labels

#### getReadLabelSet

    public static Set<Label> getReadLabelSet​(Runnable runnable,
                                             EMap<ModeLabel,​String> modes)

Returns a set of labels read by the runnable

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  Set of Labels

#### getWriteLabelSet

    public static Set<Label> getWriteLabelSet​(Runnable runnable,
                                              EMap<ModeLabel,​String> modes)

Returns a set of labels written by the runnable

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  Set of Labels

#### getLabelAccessList

    public static List<LabelAccess> getLabelAccessList​(Runnable runnable,
                                                       EMap<ModeLabel,​String> modes)

Returns a list of all label accesses of the runnable

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  List of LabelAccesses

#### getReadLabelAccessList

    public static List<LabelAccess> getReadLabelAccessList​(Runnable runnable,
                                                           EMap<ModeLabel,​String> modes)

Returns a list of read label accesses of the runnable

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  List of LabelAccesses

#### getWriteLabelAccessList

    public static List<LabelAccess> getWriteLabelAccessList​(Runnable runnable,
                                                            EMap<ModeLabel,​String> modes)

Returns a list of write label accesses of the runnable

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  List of LabelAccesses

#### getLabelToLabelAccessMap

    public static Map<Label,​List<LabelAccess>> getLabelToLabelAccessMap​(Runnable runnable,
                                                                              EMap<ModeLabel,​String> modes)

Returns a map: labels accessed from runnable -> the corresponding label accesses

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  Map: Label -> List of LabelAccesses

#### getLabelAccessStatisticsMap

    public static Map<Label,​List<LabelAccessStatistic>> getLabelAccessStatisticsMap​(Runnable runnable,
                                                                                          EMap<ModeLabel,​String> modes)

Returns a map: labels accessed by the runnable -> the corresponding LabelAccessStatistics

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  Map: Label -> List of LabelAccessStatistics

#### getReadLabelAccessStatisticsMap

    public static Map<Label,​List<LabelAccessStatistic>> getReadLabelAccessStatisticsMap​(Runnable runnable,
                                                                                              EMap<ModeLabel,​String> modes)

Returns a map: labels read by the runnable -> the corresponding LabelAccessStatistics

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  Map: Label -> List of LabelAccessStatistics

#### getWriteLabelAccessStatisticsMap

    public static Map<Label,​List<LabelAccessStatistic>> getWriteLabelAccessStatisticsMap​(Runnable runnable,
                                                                                               EMap<ModeLabel,​String> modes)

Returns a map: labels written by the runnable -> the corresponding LabelAccessStatistics

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  Map: Label -> List of LabelAccessStatistics

#### getAccessedLabelSet

    public static Set<Label> getAccessedLabelSet​(Process process,
                                                 EMap<ModeLabel,​String> modes)

Returns a set of labels accessed by the process

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  Set of Labels

#### getReadLabelSet

    public static Set<Label> getReadLabelSet​(Process process,
                                             EMap<ModeLabel,​String> modes)

Returns a set of labels read by the process

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  Set of Labels

#### getWriteLabelSet

    public static Set<Label> getWriteLabelSet​(Process process,
                                              EMap<ModeLabel,​String> modes)

Returns a set of labels written by the process

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  Set of Labels

#### getLabelAccessList

    public static List<LabelAccess> getLabelAccessList​(Process process,
                                                       EMap<ModeLabel,​String> modes)

Returns a list of all label accesses of the process

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  List of LabelAccesses

#### getLabelToLabelAccessMap

    public static Map<Label,​List<LabelAccess>> getLabelToLabelAccessMap​(Process process,
                                                                              EMap<ModeLabel,​String> modes)

Returns a map: accessed labels of the process -> the corresponding label accesses

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  Map: Label -> List of LabelAccess

#### getLabelAccessStatisticsMap

    public static Map<Label,​List<LabelAccessStatistic>> getLabelAccessStatisticsMap​(Process process,
                                                                                          EMap<ModeLabel,​String> modes)

Returns a map: labels accessed by the process -> the corresponding label access statistics

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  Map: Label -> List of LabelAccessStatistic

#### getReadLabelAccessStatisticsMap

    public static Map<Label,​List<LabelAccessStatistic>> getReadLabelAccessStatisticsMap​(Process process,
                                                                                              EMap<ModeLabel,​String> modes)

Returns a map: labels read the process -> the corresponding label access statistics

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  Map: Label -> List of LabelAccessStatistic

#### getWriteLabelAccessStatisticsMap

    public static Map<Label,​List<LabelAccessStatistic>> getWriteLabelAccessStatisticsMap​(Process process,
                                                                                               EMap<ModeLabel,​String> modes)

Returns a map: labels written by the process -> the corresponding label access statistics

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  Map: Label -> List of LabelAccessStatistic

#### getLabelReadCount

    public static float getLabelReadCount​(Label label,
                                          Process process,
                                          EMap<ModeLabel,​String> modes,
                                          RuntimeUtil.TimeType timeType)

Returns the reads from a process to a certain label. Evaluates the LabelAccessStatistic. Definition of TimeType is possible. Null value returns the average case.

#### getLabelWriteCount

    public static float getLabelWriteCount​(Label label,
                                           Process process,
                                           EMap<ModeLabel,​String> modes,
                                           RuntimeUtil.TimeType timeType)

Returns the writes from a process to a certain label. Evaluates the LabelAccessStatistic. Definition of TimeType is possible. Null value returns the average case.

#### getRunnableList

    public static List<Runnable> getRunnableList​(Process process,
                                                 EMap<ModeLabel,​String> modes)

Returns a list of runnables called by the process

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  List of Runnables

#### getRunnableSet

    public static Set<Runnable> getRunnableSet​(Process process,
                                               EMap<ModeLabel,​String> modes)

Returns a set of runnables called by the process - no duplicates

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  Set of runnables called by the process

#### getLabelAccessCountFromStatistics

    public static float getLabelAccessCountFromStatistics​(LabelAccess labelAcc,
                                                          RuntimeUtil.TimeType accType)

Returns the number of label accesses from a statistic. The accType defines if the minimum, maximum or average accesses are returned.

#### getReaderListOfLabel

    public static List<Runnable> getReaderListOfLabel​(Label label,
                                                      EMap<ModeLabel,​String> modes)

Returns a list of runnables reading the label

Parameters:
  `label` - label
  `modes` - (optional) - null works
Returns:
  List of Runnables

#### getReadersSetOfLabel

    public static Set<Runnable> getReadersSetOfLabel​(Label label,
                                                     EMap<ModeLabel,​String> modes)

Returns a set of runnables reading the label

Parameters:
  `label` - label
  `modes` - (optional) - null works
Returns:
  Set of Labels

#### getWriterListOfLabel

    public static List<Runnable> getWriterListOfLabel​(Label label,
                                                      EMap<ModeLabel,​String> modes)

Returns a list of runnables writing the label

Parameters:
  `label` - label
  `modes` - (optional) - null works
Returns:
  List of Runnables

#### getWriterSetOfLabel

    public static Set<Runnable> getWriterSetOfLabel​(Label label,
                                                    EMap<ModeLabel,​String> modes)

Returns a set of runnables writing the label

Parameters:
  `label` - label
  `modes` - (optional) - null works
Returns:
  Set of Runnables

#### collectSetEvents

    public static List<SetEvent> collectSetEvents​(Process process,
                                                  EMap<ModeLabel,​String> modes)

Collects a list of set events calls for a process

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  List of SetEvents

#### collectClearEvents

    public static List<ClearEvent> collectClearEvents​(Process process,
                                                      EMap<ModeLabel,​String> modes)

Collects a list of clear event calls for a process

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  List of ClearEvents

#### collectWaitEvents

    public static List<WaitEvent> collectWaitEvents​(Process process,
                                                    EMap<ModeLabel,​String> modes)

Collects a list of wait event calls for a process

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  List of WaitEvents

#### collectEventsOfProcess

    public static List<ActivityGraphItem> collectEventsOfProcess​(Process process,
                                                                 EMap<ModeLabel,​String> modes)

Collects a list of event calls (clear, set or wait) of a process

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  List of CallSequenceItems

#### getInterTaskCommunication

    public static List<Label> getInterTaskCommunication​(Process sender,
                                                        Process receiver,
                                                        EMap<ModeLabel,​String> modes)

Returns a list of all exchanged labels that are written by the sender process and read by the receiver process

Parameters:
  `sender` - process (Task or ISR)
  `receiver` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  List of Labels

#### getCallingProcesses

    public static List<Process> getCallingProcesses​(Runnable runnable,
                                                    EMap<ModeLabel,​String> modes)

Returns a list of processes calling the runnable

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  List of Processes

#### getCallingRunnables

    public static List<Runnable> getCallingRunnables​(Runnable runnable,
                                                     EMap<ModeLabel,​String> modes)

Returns a list of runnables directly calling the runnable

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  List of Runnables

#### getCalledRunnables

    public static List<Runnable> getCalledRunnables​(Runnable runnable,
                                                    EMap<ModeLabel,​String> modes)

Returns a list of runnables directly called by the runnable

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  List of Runnables

#### getExecutionNeeds

    public static List<ExecutionNeed> getExecutionNeeds​(Runnable runnable,
                                                        EMap<ModeLabel,​String> modes)

Returns a list of all execution needs for a given runnable

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  List of ExecutionNeeds

#### getExecutionNeeds

    public static List<ExecutionNeed> getExecutionNeeds​(Process process,
                                                        EMap<ModeLabel,​String> modes)

Returns a list of all execution needs for a given process

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  List of ExecutionNeeds

#### getTicks

    public static List<Ticks> getTicks​(Runnable runnable,
                                       EMap<ModeLabel,​String> modes)

Returns a list of all ticks for a given runnable

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  List of Ticks

#### getTicks

    public static List<Ticks> getTicks​(Process process,
                                       EMap<ModeLabel,​String> modes)

Returns a list of all ticks for a given process

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  List of Ticks

#### getServerCallSet

    public static Set<ServerCall> getServerCallSet​(Runnable runnable,
                                                   EMap<ModeLabel,​String> modes)

Returns a set of server calls for a runnable

Parameters:
  `runnable` - runnable
  `modes` - (optional) - null works
Returns:
  Set of ServerCall

#### getServerCallSet

    public static Set<ServerCall> getServerCallSet​(Process process,
                                                   EMap<ModeLabel,​String> modes)

Returns a set of server calls for a process

Parameters:
  `process` - process (Task or ISR)
  `modes` - (optional) - null works
Returns:
  Set of ServerCall