/*
* (C) 2003-2009 Spolecne s.r.o.
* Author: Tomas Straka
* www.spoledge.com
*
* Written permission must be obtained in advance from Spolecne s.r.o for any form of
* reproduction, use or distribution.
*/
package ants.models.thrakia;
import ants.models.thrakia.ZygothicGraph.Mediator;
import ants.World;
/**
* The chemical odour in the surrounding world. This is dual implementation of World.SLINT
* A nice place for refactoring. Two implementations left for backward compatability.
*/
public enum Odour {
STONE( Mediator.BLACK),
HOME( Mediator.RED ),
WATER( Mediator.CYAN ),
LEAVE( Mediator.ORANGE );
private Mediator correspondentMediator;
private Odour( Mediator correspondentMediator ) {
this.correspondentMediator = correspondentMediator;
}
/**
* The translation from Odour to the Mediator. Implementation of a tentacle
*/
public Mediator getCorrespondentMediator() {
return correspondentMediator;
}
/**
* The translation from Mediator to Odour. Implementation of an Output DBC.
* Is not a direct reverse conversion.
*/
public static Odour getCorrespondentOdour(Mediator m) {
if( m == null ) return null;
switch( m ) {
case ORANGE: return HOME; // Walking around makes path home
case RED: return HOME; // Walking on the paths strengthens the path
}
return null; // The ant is unable to product more Odours
}
}
|