[29] | 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 | /* |
---|
| 18 | * TreeDisplayEvent.java |
---|
| 19 | * Copyright (C) 1999 University of Waikato, Hamilton, New Zealand |
---|
| 20 | * |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | package weka.gui.treevisualizer; |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | /** |
---|
| 27 | * An event containing the user selection from the tree display |
---|
| 28 | * |
---|
| 29 | * @author Malcolm Ware (mfw4@cs.waikato.ac.nz) |
---|
| 30 | * @version $Revision: 1.4 $ |
---|
| 31 | */ |
---|
| 32 | public class TreeDisplayEvent { |
---|
| 33 | public static final int NO_COMMAND = 0; |
---|
| 34 | public static final int ADD_CHILDREN = 1; |
---|
| 35 | public static final int REMOVE_CHILDREN = 2; |
---|
| 36 | |
---|
| 37 | /** States that the user has accepted the tree. */ |
---|
| 38 | public static final int ACCEPT = 3; |
---|
| 39 | |
---|
| 40 | /** Asks for another learning scheme to classify this node. */ |
---|
| 41 | public static final int CLASSIFY_CHILD = 4; |
---|
| 42 | |
---|
| 43 | /** Command to remove instances from this node and send them to the |
---|
| 44 | * VisualizePanel. */ |
---|
| 45 | public static final int SEND_INSTANCES = 5; |
---|
| 46 | |
---|
| 47 | /** The int representing the action. */ |
---|
| 48 | private int m_command; |
---|
| 49 | |
---|
| 50 | /** The id string for the node to alter. */ |
---|
| 51 | private String m_nodeId; |
---|
| 52 | |
---|
| 53 | /** |
---|
| 54 | * Constructs an event with the specified command |
---|
| 55 | * and what the command is applied to. |
---|
| 56 | * @param ar The event type. |
---|
| 57 | * @param id The id string for the node to perform the action on. |
---|
| 58 | */ |
---|
| 59 | public TreeDisplayEvent(int ar, String id) { |
---|
| 60 | m_command = 0; |
---|
| 61 | if (ar == 1 || ar == 2 || ar == 3 || ar == 4 || ar == 5) { |
---|
| 62 | //then command is good |
---|
| 63 | m_command = ar; |
---|
| 64 | } |
---|
| 65 | m_nodeId = id; |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | /** |
---|
| 69 | * @return The command. |
---|
| 70 | */ |
---|
| 71 | public int getCommand() { |
---|
| 72 | return m_command; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | /** |
---|
| 76 | * @return The id of the node. |
---|
| 77 | */ |
---|
| 78 | public String getID() { |
---|
| 79 | return m_nodeId; |
---|
| 80 | } |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | |
---|