public class

AbstractNode

extends Object
implements Node<A, S, N extends Node<A, S, N>>
java.lang.Object
   ↳ es.usc.citius.hipster.model.AbstractNode<A, S, N extends es.usc.citius.hipster.model.AbstractNode<A, S, N>>
Known Direct Subclasses

Class Overview

Basic implementation of the interface Node. All implementations of the interface may extend this class to reuse the implemented path() method and the getters.

Summary

Fields
protected A action
protected int pathSize
protected N extends AbstractNode<A, S, N> previousNode
protected S state
Public Constructors
AbstractNode(N previousNode, S state, A action)
Generic constructor of nodes.
Public Methods
A action()
Action of the node used to reach the state node
List<N> path()
Generates the ordered list of nodes with the path between the beginning state and the current node.
int pathSize()
Returns the length of the path from the start to the current node.
N previousNode()
Returns the previous node to the current.
S state()
State of the current node
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface es.usc.citius.hipster.model.Node

Fields

protected A action

protected int pathSize

protected N extends AbstractNode<A, S, N> previousNode

protected S state

Public Constructors

public AbstractNode (N previousNode, S state, A action)

Generic constructor of nodes.

Parameters
previousNode parent node
state current state
action action between the previous node and the current state

Public Methods

public A action ()

Action of the node used to reach the state node

public List<N> path ()

Generates the ordered list of nodes with the path between the beginning state and the current node.

Returns
  • ordered List the nodes of the path

public int pathSize ()

Returns the length of the path from the start to the current node. Note that pathSize() == path().size() but this method provides a fast way to obtain the length of the path without tracking back the nodes of the path.

Returns
  • length of the path from the initial node to this node.

public N previousNode ()

Returns the previous node to the current.

Returns

public S state ()

State of the current node

public String toString ()