Class Edge

All Implemented Interfaces:
Builder<Edge.RuntimeEdge>

public class Edge extends CachedBuilder<Edge,Edge.RuntimeEdge>

Edge

The Edge holds the information for a transition in a model.

The edge represents an action performed by a test, which takes the system under test, from a state to another. The edge has a source and target vertex. If the vertices are identical, the edge is a self loop. The source vertex is not mandatory, but in a model, there should be only one such instance. Also, the target vertex is not mandatory, but again, in a model, there should be only one such instance.
Author:
Nils Olsson
  • Constructor Details

    • Edge

      public Edge()
  • Method Details

    • setSourceVertex

      public Edge setSourceVertex(Vertex vertex)
      Sets the source vertex of the edge.
      Parameters:
      vertex - The source vertex.
      Returns:
      The edge.
    • getSourceVertex

      public Vertex getSourceVertex()
      Gets the source vertex.
      Returns:
      The source vertex.
      See Also:
    • setTargetVertex

      public Edge setTargetVertex(Vertex vertex)
      Sets the target vertex of the edge.
      Parameters:
      vertex - The target vertex.
      Returns:
      The edge.
    • getTargetVertex

      public Vertex getTargetVertex()
      Gets the target vertex of the edge.
      Returns:
      The vertex.
      See Also:
    • setGuard

      public Edge setGuard(Guard guard)
      Sets the guard of the edge. The code in the guard is by default interpreted as javascript. The guard works like an 'if-statement'. It controls the accessibility of the edge. During execution, the guard evaluates to a boolean expression. If true, the edge is accessible, else it's not.
      Parameters:
      guard - The guard.
      Returns:
      The edge.
    • getGuard

      public Guard getGuard()
      Gets the guard of the edge.
      Returns:
      The guard.
      See Also:
    • addAction

      public Edge addAction(Action action)
      Adds an action to the edge, which represents a piece of code that will be executed each time the edge is being traversed. The code is by default interpreted as javascript.
      Parameters:
      action - The action.
      Returns:
      The edge.
    • addActions

      public Edge addActions(Action... actions)
    • addActions

      public Edge addActions(List<Action> actions)
    • setActions

      public Edge setActions(List<Action> actions)
      Adds a list of actions to the edge, which represents a pieces of code that will be executed each time the edge is being traversed. The code snippets is by default interpreted as javascript.
      Parameters:
      actions - The actions.
      Returns:
      The edge.
      See Also:
    • getActions

      public List<Action> getActions()
      Gets the lists of actions of the edge.
      Returns:
      The actions
      See Also:
    • getWeight

      public Double getWeight()
      Gets the weight of the edge.
      Returns:
      The weight as double.
      See Also:
    • setWeight

      public Edge setWeight(Double weight)
      The weight is used as probability when using the WeightedRandomPath. Weight means the probability for the edge to be selected.
      Parameters:
      weight - a double between 0 and 1
      Returns:
      The edge
    • createCache

      protected Edge.RuntimeEdge createCache()
      Creates an immutable edge from this edge.
      Specified by:
      createCache in class CachedBuilder<Edge,Edge.RuntimeEdge>
      Returns:
      An immutable edge as a RuntimeEdge
    • getDependency

      public Integer getDependency()
      Gets the dependency of the edge.
      Returns:
      The dependency as double.
      See Also:
    • setDependency

      public Edge setDependency(Integer dependency)
      The dependency shows how much targetVertex depends on sourceVertex. One way to obtain the dependency is by using process mining to generate a model out of log files.
      Parameters:
      dependency - a double between 0 and 1
      Returns:
      The edge