package hero.entity;
/*
*
* NodeState.java -
* Copyright (C) 2002 Ecoo Team
* charoy@loria.fr
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
import hero.interfaces.BnNodeLocal;
public abstract class NodeState {
public static final int START=0;
public static final int TERMINATE=1;
public static final int SUSPEND=2;
public static final int RESUME=3;
public static final int EDGEINITIAL=4;
public static final int ANTACTIVE=5;
public static final int ACTIVE=6;
public static final int CANCEL=7;
public static NodeState make(int type,boolean anticipable) {
if (anticipable) {
if(type == hero.interfaces.Constants.Nd.AND_JOIN_NODE) {return new ActivityNodeState();}
if(type == hero.interfaces.Constants.Nd.OR_JOIN_NODE) {return new ActivityNodeState();}
if(type == hero.interfaces.Constants.Nd.AND_JOIN_AUTOMATIC_NODE) {return new AutomaticNodeState();}
if(type == hero.interfaces.Constants.Nd.OR_JOIN_AUTOMATIC_NODE) {return new AutomaticNodeState();}
if(type == hero.interfaces.Constants.Nd.SUB_PROCESS_NODE) {return new AutomaticSubNodeState();}
} else {
if(type == hero.interfaces.Constants.Nd.AND_JOIN_NODE) {return new TraditionalNodeState();}
if(type == hero.interfaces.Constants.Nd.OR_JOIN_NODE) {return new TraditionalNodeState();}
if(type == hero.interfaces.Constants.Nd.AND_JOIN_AUTOMATIC_NODE) {return new TraditionalAutomaticNodeState();}
if(type == hero.interfaces.Constants.Nd.OR_JOIN_AUTOMATIC_NODE) {return new TraditionalAutomaticNodeState();}
if(type == hero.interfaces.Constants.Nd.SUB_PROCESS_NODE) {return new AutomaticSubNodeState();}
}
return new ActivityNodeState();
}
public abstract int computeState(BnNodeLocal nd,int operation);
}
|