|
From: G?nther B. <br...@us...> - 2002-01-31 07:31:46
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions
In directory usw-pr-cvs1:/tmp/cvs-serv28027
Modified Files:
StoreDataTransition.java
Log Message:
DataObject included
Index: StoreDataTransition.java
===================================================================
RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/StoreDataTransition.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** StoreDataTransition.java 2002/01/29 10:43:16 1.1.1.1
--- StoreDataTransition.java 2002/01/31 07:31:43 1.2
***************
*** 1,97 ****
! /***********************************************************************
! * @(#)$RCSfile$ $Revision$ $Date$
! *
! * Copyright (c) 2001 IICM, Graz University of Technology
! * Schiesstattgasse 4a, A-8010 Graz, Austria.
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU Lesser General Public License (LGPL)
! * as published by the Free Software Foundation; either version 2.1 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.,
! * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! ***********************************************************************/
!
!
! package edu.iicm.xpg.transitions;
!
! import edu.iicm.xpg.statemachine.Transition;
! import edu.iicm.xpg.statemachine.State;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.XMLInput;
! import edu.iicm.xpg.statemachine.InitUserData;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @author Günther Brand
! * @version $Revision$
! */
!
! public class StoreDataTransition implements Transition
! {
! public static final int BEGINSTATE = 1;
! public static final int NEXTSTATE = 2;
! public static final int ELEMENT = 3;
! public static final int CLASSNAME = 4;
!
! private int data_type;
!
! public StoreDataTransition(int type)
! {
! data_type = type;
! }
!
! //----------------------------------------------------------------------
! /**
! * @param input the input that triggered this transition
! * @param from_state the start state for this transition
! * @param to_state the destination state for this transition
! * @param machine the state machine that this transition belongs to
! * @param data user defined data
! * @return
! * @exception Exception whatever an implementation can throw
! */
!
! public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,Object data)
! throws Exception
! {
! if (from_state != to_state)
! {
! System.out.println("StoreDataTransition: differentStates!");
! return(null);
! }
!
! switch (data_type)
! {
! case BEGINSTATE:
! ((InitUserData)data).beginstate = ((XMLInput)input).getValue();
! break;
! case NEXTSTATE:
! ((InitUserData)data).nextstate = ((XMLInput)input).getValue();
! break;
! case ELEMENT:
! ((InitUserData)data).element = ((XMLInput)input).getValue();
! ((InitUserData)data).default_transition = false;
! break;
! case CLASSNAME:
! ((InitUserData)data).classname = ((XMLInput)input).getValue();
! break;
! default: System.err.println("StoreDataTransition: illegal datatype!");
! }
!
! return(null);
! }
! }
!
!
--- 1,100 ----
! /***********************************************************************
! * @(#)$RCSfile$ $Revision$ $Date$
! *
! * Copyright (c) 2001 IICM, Graz University of Technology
! * Schiesstattgasse 4a, A-8010 Graz, Austria.
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU Lesser General Public License (LGPL)
! * as published by the Free Software Foundation; either version 2.1 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.,
! * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
! ***********************************************************************/
!
!
! package edu.iicm.xpg.transitions;
!
! import edu.iicm.xpg.statemachine.Transition;
! import edu.iicm.xpg.statemachine.State;
! import edu.iicm.xpg.statemachine.StateMachine;
! import edu.iicm.xpg.statemachine.Input;
! import edu.iicm.xpg.statemachine.XMLInput;
! import edu.iicm.xpg.statemachine.DataObject;
!
! //----------------------------------------------------------------------
! /**
! * @author Klaus Schmaranz
! * @author Günther Brand
! * @version $Revision$
! */
!
! public class StoreDataTransition implements Transition
! {
! public static final int BEGINSTATE = 1;
! public static final int NEXTSTATE = 2;
! public static final int ELEMENT = 3;
! public static final int CLASSNAME = 4;
!
! private int data_type_;
!
! public StoreDataTransition(int type)
! {
! data_type_ = type;
! }
!
! //----------------------------------------------------------------------
! /**
! * @param input the input that triggered this transition
! * @param from_state the start state for this transition
! * @param to_state the destination state for this transition
! * @param machine the state machine that this transition belongs to
! * @param data user defined data
! * @return
! * @exception Exception whatever an implementation can throw
! */
!
! public String transitionTriggered(Input input,State from_state,State to_state,
! StateMachine machine,Object data)
! throws Exception
! {
! if (from_state != to_state)
! {
! System.out.println("StoreDataTransition: differentStates!");
! return(null);
! }
!
! switch (data_type_)
! {
! case BEGINSTATE:
! ((DataObject)data).putObject("beginstate",
! ((XMLInput)input).getValue());
! break;
! case NEXTSTATE:
! ((DataObject)data).putObject("nextstate",
! ((XMLInput)input).getValue());
! break;
! case ELEMENT:
! ((DataObject)data).putObject("element",
! ((XMLInput)input).getValue());
! break;
! case CLASSNAME:
! ((DataObject)data).putObject("classname",
! ((XMLInput)input).getValue());
! break;
! default: System.err.println("StoreDataTransition: illegal datatype!");
! }
!
! return(null);
! }
! }
!
!
|