com.thesett.aima.logic.fol.wam.debugger.monitor.RegisterSetMonitor Maven / Gradle / Ivy
The newest version!
/*
* Copyright The Sett Ltd, 2005 to 2014.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.thesett.aima.logic.fol.wam.debugger.monitor;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import com.thesett.common.util.doublemaps.DoubleKeyedMap;
import com.thesett.text.api.model.TextTableModel;
/**
* RegisterSetMonitor watches the register set of the machine, and updates a table model that contains the register
* values to those in the register set.
*
*
CRC Card
* Responsibilities Collaborations
* Create a table model to hold the register set values.
* Update a table model to the values in the register set.
*
*
* @author Rupert Smith
*/
public class RegisterSetMonitor implements PropertyChangeListener
{
/** Label for the column providing the register names. */
public static final String REG_NAME_COL = "regName";
/** Label for the column holding the register values. */
public static final String REG_VALUE_COL = "regValue";
/** The register names. */
private static final String[] REGISTER_NAMES =
new String[] { "ip", "hp", "hbp", "sp", "up", "ep", "bp", "b0", "trp" };
/** The register property names, used to label the table rows. */
private static final String[] REGISTER_LABELS =
new String[] { "IP", "HP", "HBP", "SP", "UP", "EP", "BP", "B0", "TRP" };
/** The table to store the registers in. */
private final TextTableModel table;
/** A labeled view onto the register table. */
private final DoubleKeyedMap