1 /*****************************************************************************
2 * Virtual Mockup for Machine Vision
3 * Copyright (C) 2001-2003 Fabio R. de Miranda, João E. Kogler Jr.,
4 * Carlos S. Santos.
5 * Virtual Mockup for Machine Vision Project funded by SENAC-SP
6 *
7 * Permission is granted to redistribute and/or modify this
8 * software under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License (http://www.gnu.org/copyleft/lesser.html)
16 * for more details.
17 *
18 *****************************************************************************/
19
20 package camera3d.action;
21
22
23 import camera3d.GUIControl;
24
25 /***
26 * Abstract superclass to all VirtualCamera actions.
27 *
28 * @author Fábio Roberto de Miranda
29 * @version 1.0
30 */
31 public abstract class VcAction {
32 /*** Constant for signaling that an action affects one single object. */
33 public static final int SINGLE_OBJECT_ACTION = 0;
34 /*** Constant for signaling that an action affects more than one object. */
35 public static final int MULTIPLE_OBJECT_ACTION = 1;
36
37 boolean debugflag = true;
38
39 private int multiplicityType = SINGLE_OBJECT_ACTION;
40
41 public VcAction() {
42 }
43
44 /***
45 * Returns a flag indicating whether this action is applied to a single object or
46 * to a collection of them.
47 */
48 public int getMultiplicityType(){
49 return this.multiplicityType;
50 }
51
52 /***
53 * Sets multiplicity flag for this action.
54 */
55 public void setMultiplicityType(int i){
56 this.multiplicityType = i;
57 }
58
59 /***
60 * Performs the action.
61 * @param executor provides any resource necessary for the action execution, such
62 * as references to other objects.
63 */
64 public abstract void doAction(ActionExecutor executor);
65
66 /***
67 * Undoes the action.
68 * @param executor provides any resource necessary for the action execution, such
69 * as references to other objects.
70 */
71 public void undoAction(ActionExecutor executor){
72 }
73
74 /***
75 * Returns a flag indicating whether the action can be undone. It is used by ActionExecutor
76 * in order to select which actions should be pushed into the output queue. Currently, this
77 * method always returns true. In the future it should be turned into a abstract method,
78 * implemented by subclasses.
79 */
80 public boolean isUndoable(){
81 return true;
82 }
83
84 /***
85 * Prints a debug message. Its execution is controlled by debugflag and GUIControl.debugflag.
86 */
87 public void debugln(String s){
88 if ((debugflag)&&(GUIControl.debugflag)) {
89 //if (debugflag) {
90 System.out.println(s);
91 }
92 }
93
94 }
This page was automatically generated by Maven