net.sf.opendse.model
Class Models

java.lang.Object
  extended by net.sf.opendse.model.Models

public class Models
extends java.lang.Object

The Graphs provides several useful static methods and classes.


Nested Class Summary
static class Models.DirectedLink
          The DirectedLink is a Link wrapper that contains the source Resource and destination Resource.
protected static class Models.IsCommunicationPredicate
          The IsCommunicationPredicate is a Predicate that returns true if the task implements the ICommunication interface.
protected static class Models.IsProcessPredicate
          The IsCommunicationPredicate is a Predicate that returns true if the task does not implement the ICommunication interface.
protected static class Models.OnlyCommunicationIterator
          The OnlyCommunicationIterator is an iterator for tasks that only considers communication tasks.
protected static class Models.OnlyProcessIterator
          The OnlyCommunicationIterator is an iterator for tasks that only considers process tasks.
 
Field Summary
protected static Models.IsCommunicationPredicate isCommunicationPredicate
          The instance of the IsCommunicationPredicate class.
protected static Models.IsProcessPredicate isProcessPredicate
          The instance of the IsProcessPredicate class.
 
Constructor Summary
Models()
           
 
Method Summary
static Specification clone(Specification specification)
           
static
<E extends Element>
E
copy(Element element)
           
static
<M extends Mapping<?,?>>
M
copy(Mapping<?,?> mapping)
           
static Specification copy(Specification specification)
           
static void filter(Specification specification, java.util.Collection<Function<Task,Dependency>> functions)
           
static void filterByFunctionName(Specification specification, java.util.Collection<java.lang.String> functions)
           
static void filterByFunctionName(Specification specification, java.lang.String... functions)
           
static void filterByResources(Specification specification, java.util.Collection<Resource> resources)
           
static java.lang.Iterable<Task> filterCommunications(java.lang.Iterable<Task> iterable)
          Filters an Iterable such that only communication tasks are considered.
static java.lang.Iterable<Task> filterProcesses(java.lang.Iterable<Task> iterable)
          Filters an Iterable such that only process tasks are considered.
static
<E extends Element>
java.lang.Iterable<E>
filterType(java.lang.Iterable<E> iterable, java.lang.String... types)
          Returns an Iterable which returns only those Elements from the given iterable which are of one of the given types.
static java.util.Set<Element> getElements(Specification specification)
          Returns all Element objects of a Specification.
static java.util.Map<java.lang.String,Element> getElementsMap(Specification specification)
          Returns a map of all pairs of ids and the corresponding Element objects.
static java.util.List<Models.DirectedLink> getInLinks(Architecture<Resource,Link> architecture, Resource r0)
          Returns the list of DirectedLink elements that have a given destination {code Resource}.
static java.util.List<Models.DirectedLink> getLinks(Architecture<Resource,Link> architecture)
          Returns all DirectedLink elements of an Architecture.
static java.util.List<Models.DirectedLink> getLinks(Architecture<Resource,Link> architecture, Link link)
          Returns all DirectedLink elements of an Architecture for given Link.
static java.util.List<Models.DirectedLink> getOutLinks(Architecture<Resource,Link> architecture, Resource r0)
          Returns the list of DirectedLink elements that have a given source {code Resource}.
static boolean isCommunication(Task task)
          Returns true if the task is a communication.
static boolean isProcess(Task task)
          Returns true if the task is a process.
static void setAttributes(IAttributes e, Attributes attributes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isCommunicationPredicate

protected static Models.IsCommunicationPredicate isCommunicationPredicate
The instance of the IsCommunicationPredicate class.


isProcessPredicate

protected static Models.IsProcessPredicate isProcessPredicate
The instance of the IsProcessPredicate class.

Constructor Detail

Models

public Models()
Method Detail

filterCommunications

public static java.lang.Iterable<Task> filterCommunications(java.lang.Iterable<Task> iterable)
Filters an Iterable such that only communication tasks are considered.

Parameters:
iterable - the iterable
Returns:
the filtered iterable

filterProcesses

public static java.lang.Iterable<Task> filterProcesses(java.lang.Iterable<Task> iterable)
Filters an Iterable such that only process tasks are considered.

Parameters:
iterable - the iterable
Returns:
the filtered iterable

isProcess

public static boolean isProcess(Task task)
Returns true if the task is a process.

Parameters:
task - the task
Returns:
true if the task is a process

isCommunication

public static boolean isCommunication(Task task)
Returns true if the task is a communication.

Parameters:
task - the task
Returns:
true if the task is a communication

getOutLinks

public static java.util.List<Models.DirectedLink> getOutLinks(Architecture<Resource,Link> architecture,
                                                              Resource r0)
Returns the list of DirectedLink elements that have a given source {code Resource}.

Parameters:
architecture - the architecture
r0 - the source
Returns:
all outgoing directed links

getInLinks

public static java.util.List<Models.DirectedLink> getInLinks(Architecture<Resource,Link> architecture,
                                                             Resource r0)
Returns the list of DirectedLink elements that have a given destination {code Resource}.

Parameters:
architecture - the architecture
r0 - the source
Returns:
all incoming directed links

getLinks

public static java.util.List<Models.DirectedLink> getLinks(Architecture<Resource,Link> architecture)
Returns all DirectedLink elements of an Architecture.

Parameters:
architecture - the architecture
Returns:
all directed links

getLinks

public static java.util.List<Models.DirectedLink> getLinks(Architecture<Resource,Link> architecture,
                                                           Link link)
Returns all DirectedLink elements of an Architecture for given Link.

Parameters:
architecture - the architecture
link - the link
Returns:
all directed links for a given link

getElementsMap

public static java.util.Map<java.lang.String,Element> getElementsMap(Specification specification)
Returns a map of all pairs of ids and the corresponding Element objects.

Parameters:
specification - the specification
Returns:
the map

getElements

public static java.util.Set<Element> getElements(Specification specification)
Returns all Element objects of a Specification.

Parameters:
specification - the specification
Returns:
all element objects

filterType

public static <E extends Element> java.lang.Iterable<E> filterType(java.lang.Iterable<E> iterable,
                                                                   java.lang.String... types)
Returns an Iterable which returns only those Elements from the given iterable which are of one of the given types.

Type Parameters:
E - the type of the element
Parameters:
iterable - the iterable over the source elements
types - the types to filter for
Returns:
the iterable over the elements which are of one of the types
See Also:
Element.getType()

copy

public static Specification copy(Specification specification)

copy

public static <E extends Element> E copy(Element element)

copy

public static <M extends Mapping<?,?>> M copy(Mapping<?,?> mapping)

setAttributes

public static void setAttributes(IAttributes e,
                                 Attributes attributes)

clone

public static Specification clone(Specification specification)

filterByResources

public static void filterByResources(Specification specification,
                                     java.util.Collection<Resource> resources)

filter

public static void filter(Specification specification,
                          java.util.Collection<Function<Task,Dependency>> functions)

filterByFunctionName

public static void filterByFunctionName(Specification specification,
                                        java.util.Collection<java.lang.String> functions)

filterByFunctionName

public static void filterByFunctionName(Specification specification,
                                        java.lang.String... functions)