net.sf.myra.framework
Class DefaultTrail

java.lang.Object
  extended by net.sf.myra.framework.Trail
      extended by net.sf.myra.framework.DefaultTrail
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class DefaultTrail
extends Trail

Default Trail implementation that contains no duplicate vertices.

Version:
$Revision$ $Date:: $
Author:
Fernando Esteban Barril Otero
See Also:
Serialized Form

Constructor Summary
DefaultTrail()
          Creates a new DefaultTrail instance.
 
Method Summary
 void add(Vertex<?> vertex)
          Adds a node to the trail.
 DefaultTrail clone()
          Creates and returns a copy of this trail instance.
 boolean equals(java.lang.Object o)
           
 Vertex<?> getLast()
          Returns the last added (visited) vertex.
 java.util.Collection<Vertex<?>> getVertices()
          Returns the vertices of this trail.
 boolean isEmpty()
          Checks if this trail is empty.
 void remove(Vertex<?> vertex)
          Removes the specified vertex.
 
Methods inherited from class net.sf.myra.framework.Trail
getCost, getIteration, getSize, setCost, setIteration, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultTrail

public DefaultTrail()
Creates a new DefaultTrail instance.

Method Detail

add

public void add(Vertex<?> vertex)
Description copied from class: Trail
Adds a node to the trail.

Specified by:
add in class Trail
Parameters:
vertex - the vertex to be added.

remove

public void remove(Vertex<?> vertex)
Description copied from class: Trail
Removes the specified vertex.

Specified by:
remove in class Trail
Parameters:
vertex - the vertex to remove.

getVertices

public java.util.Collection<Vertex<?>> getVertices()
Description copied from class: Trail
Returns the vertices of this trail.

Specified by:
getVertices in class Trail
Returns:
the vertices of this trail.

getLast

public Vertex<?> getLast()
Description copied from class: Trail
Returns the last added (visited) vertex. For partial trails, the last added vertex represents the current ant position.

Specified by:
getLast in class Trail
Returns:
the last added (visited) vertex.

isEmpty

public boolean isEmpty()
Description copied from class: Trail
Checks if this trail is empty.

Specified by:
isEmpty in class Trail
Returns:
true if this trail hasn't vertices associated; false otherwise.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

clone

public DefaultTrail clone()
Description copied from class: Trail
Creates and returns a copy of this trail instance.

Overrides:
clone in class Trail
Returns:
a copy of this trail instance.


Copyright © 2013. All Rights Reserved.