net.sf.myra.framework
Class Trail

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

public abstract class Trail
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

This class represents an ant tour in the problem construction graph.

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

Constructor Summary
Trail()
          Default constructor.
 
Method Summary
abstract  void add(Vertex<?> vertex)
          Adds a node to the trail.
 Trail clone()
          Creates and returns a copy of this trail instance.
 Cost getCost()
          Returns the trail cost.
 int getIteration()
          Returns the iteration number that created this trail.
abstract  Vertex<?> getLast()
          Returns the last added (visited) vertex.
 int getSize()
          Returns the trail size (number of vertices).
abstract  java.util.Collection<Vertex<?>> getVertices()
          Returns the vertices of this trail.
abstract  boolean isEmpty()
          Checks if this trail is empty.
abstract  void remove(Vertex<?> vertex)
          Removes the specified vertex.
 void setCost(Cost cost)
          Sets the trail cost.
 void setIteration(int iteration)
          Sets the iteration that created this trail.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Trail

public Trail()
Default constructor.

Method Detail

add

public abstract void add(Vertex<?> vertex)
Adds a node to the trail.

Parameters:
vertex - the vertex to be added.

remove

public abstract void remove(Vertex<?> vertex)
Removes the specified vertex.

Parameters:
vertex - the vertex to remove.

isEmpty

public abstract boolean isEmpty()
Checks if this trail is empty.

Returns:
true if this trail hasn't vertices associated; false otherwise.

getCost

public Cost getCost()
Returns the trail cost.

Returns:
the cost.

setCost

public void setCost(Cost cost)
Sets the trail cost.

Parameters:
cost - the cost to set.

getIteration

public int getIteration()
Returns the iteration number that created this trail.

Returns:
the iteration number that created this trail.

setIteration

public void setIteration(int iteration)
Sets the iteration that created this trail.

Parameters:
iteration - the iteration number to set.

getVertices

public abstract java.util.Collection<Vertex<?>> getVertices()
Returns the vertices of this trail.

Returns:
the vertices of this trail.

getLast

public abstract Vertex<?> getLast()
Returns the last added (visited) vertex. For partial trails, the last added vertex represents the current ant position.

Returns:
the last added (visited) vertex.

getSize

public int getSize()
Returns the trail size (number of vertices).

Returns:
the trail size (number of vertices).

clone

public Trail clone()
Creates and returns a copy of this trail instance.

Overrides:
clone in class java.lang.Object
Returns:
a copy of this trail instance.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2013. All Rights Reserved.