logist.plan
Class PlanVerifier

java.lang.Object
  extended by logist.plan.PlanVerifier
All Implemented Interfaces:
ActionHandler<java.lang.String[]>

public class PlanVerifier
extends java.lang.Object
implements ActionHandler<java.lang.String[]>

A verifier that can check various constraints on Plans.

The set of constraints that are actually checked depends on the exercise (i.e. type of agent).

Author:
Robin Steiger

Constructor Summary
PlanVerifier(Topology topology, TaskSet availableTasks)
          Creates a plan verifier for a given topology and task set.
 
Method Summary
 java.lang.String[] deliver(Task task)
          A delivery pattern
 java.lang.String[] moveTo(Topology.City targetCity)
          A move pattern
 java.lang.String[] pickup(Task task)
          A pickup pattern
 void verifyDelivery()
          Verifies that the plan delivers all tasks that were picked up.
 void verifyPickup()
          Verifies that the plan picks up all available tasks.
 void verifyPlan(Vehicle vehicle, Plan plan)
          Verifies that a sequence of actions is valid for a vehicle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlanVerifier

public PlanVerifier(Topology topology,
                    TaskSet availableTasks)
Creates a plan verifier for a given topology and task set.

Parameters:
topology - The topology
availableTasks - The set of tasks available for pickup
Method Detail

verifyPlan

public void verifyPlan(Vehicle vehicle,
                       Plan plan)
Verifies that a sequence of actions is valid for a vehicle.

Parameters:
vehicle - The vehicle executing the plan
plan - The plan

verifyPickup

public void verifyPickup()
Verifies that the plan picks up all available tasks.

Throws:
IllegalPlanException - If this constraint is violated

verifyDelivery

public void verifyDelivery()
Verifies that the plan delivers all tasks that were picked up.

Throws:
IllegalPlanException - If this constraint is violated

moveTo

public java.lang.String[] moveTo(Topology.City targetCity)
Description copied from interface: ActionHandler
A move pattern

Specified by:
moveTo in interface ActionHandler<java.lang.String[]>
Parameters:
targetCity - The target city

pickup

public java.lang.String[] pickup(Task task)
Description copied from interface: ActionHandler
A pickup pattern

Specified by:
pickup in interface ActionHandler<java.lang.String[]>
Parameters:
task - The task being picked up

deliver

public java.lang.String[] deliver(Task task)
Description copied from interface: ActionHandler
A delivery pattern

Specified by:
deliver in interface ActionHandler<java.lang.String[]>
Parameters:
task - The task being delivered