/* * JFLAP - Formal Languages and Automata Package * * * Susan H. Rodger * Computer Science Department * Duke University * August 27, 2009 * Copyright (c) 2002-2009 * All rights reserved. * JFLAP is open source software. Please see the LICENSE for terms. * */ package gui.action; import javax.swing.Icon; import automata.Automaton; /** * The AutomatonAction is the general action that various * controllers for operators on automatons should subclass. The only real change * from the RestrictedAction is that by default the .isAcceptable * method now only returns true if the object is an instance of Automaton. * * @author Thomas Finley */ public abstract class AutomatonAction extends RestrictedAction { /** * Instantiates a new AutomatonAction. * * @param string * a string description * @param icon * the optional icon, or null if there is to be no * icon associated with this action */ public AutomatonAction(String string, Icon icon) { super(string, icon); } /** * Given an object, determine if this automaton action is able to be applied * to that object based on its class. By default, this method returns true * if this object is an instance of Automaton. * * @param object * the object to test for "applicability" * @return true if this action should be available to an * object of this type, false otherwise. */ public static boolean isApplicable(Object object) { return object instanceof Automaton; } }