TreeDisplayEvent.java
Upload User: rhdiban
Upload Date: 2013-08-09
Package Size: 15085k
Code Size: 2k
Category:

Windows Develop

Development Platform:

Java

  1. /*
  2.  *    This program is free software; you can redistribute it and/or modify
  3.  *    it under the terms of the GNU General Public License as published by
  4.  *    the Free Software Foundation; either version 2 of the License, or
  5.  *    (at your option) any later version.
  6.  *
  7.  *    This program is distributed in the hope that it will be useful,
  8.  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
  9.  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10.  *    GNU General Public License for more details.
  11.  *
  12.  *    You should have received a copy of the GNU General Public License
  13.  *    along with this program; if not, write to the Free Software
  14.  *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15.  */
  16. /*
  17.  *    TreeDisplayEvent.java
  18.  *    Copyright (C) 1999 Malcolm Ware
  19.  *
  20.  */
  21. package weka.gui.treevisualizer;
  22. /**
  23.  * An event containing the user selection from the tree display
  24.  *
  25.  * @author Malcolm Ware (mfw4@cs.waikato.ac.nz)
  26.  * @version $Revision: 1.3 $
  27.  */
  28. public class TreeDisplayEvent {
  29.   public static final int NO_COMMAND = 0;
  30.   public static final int ADD_CHILDREN = 1;
  31.   public static final int REMOVE_CHILDREN = 2;
  32.   /** States that the user has accepted the tree. */
  33.   public static final int ACCEPT = 3;
  34.   /** Asks for another learning scheme to classify this node. */
  35.   public static final int CLASSIFY_CHILD = 4;
  36.   /** Command to remove instances from this node and send them to the 
  37.    * VisualizePanel. */
  38.   public static final int SEND_INSTANCES = 5;
  39.   /** The int representing the action. */
  40.   private int m_command;
  41.   /** The id string for the node to alter. */
  42.   private String m_nodeId;
  43.   /**
  44.    * Constructs an event with the specified command
  45.    * and what the command is applied to.
  46.    * @param ar The event type.
  47.    * @param id The id string for the node to perform the action on.
  48.    */
  49.   public TreeDisplayEvent(int ar, String id) {
  50.     m_command = 0;
  51.     if (ar == 1 || ar == 2 || ar == 3 || ar == 4 || ar == 5) {
  52.       //then command is good
  53.       m_command = ar;
  54.     }
  55.     m_nodeId = id;
  56.   }
  57.   /**
  58.    * @return The command.
  59.    */
  60.   public int getCommand() {
  61.     return m_command;
  62.   }
  63.   
  64.   /**
  65.    * @return The id of the node.
  66.    */
  67.   public String getID() {
  68.     return m_nodeId;
  69.   }
  70. }