Class AccessTableModel

All Implemented Interfaces:
PopupActivationListener, Serializable, Comparable, EventListener, ListSelectionListener, TableModel

public class AccessTableModel extends AttributeStore
This class encapsulates the timing constraints table. Timing constraints specify the time periods when the scheduler may or may not make changes to the schedule.

Timing constraints are associated with blocks using a relational join based on a common column. Use the setKey(java.lang.String) method to change the join key.

Changes to the values can be made using the setValueAt(java.lang.Object, int, int, int) method. This table is flat in that it does not have any periods. Instead, period data are stored in columns named "PERIOD1", "PERIOD2", etc. To change a value use code like the following:

   /*
    * This changes the value for the row with unit value "LRU"
    * to a value of unavailable.
    *\/
   AccessTableModel atm = control.getAccessTable();
   int row = atm.lookupRow("LRU", 0); 
   int col = atm.findColumn("PERIOD1");
   atm.setValueAt(new Integer(atm.UNAVAILABLE), row, col);
 

Changes will not take effect until the apply() method has been invoked.

See Also:
Serialized Form
  • Field Details

    • AVAILABLE

      public static final int AVAILABLE
      The code for an available timing. Scheduling is allowed and existing treatments are allowed to remain.
      See Also:
      Constant Field Values
    • MANUAL

      public static final int MANUAL
      The code for an available timing. No scheduleing is allowed, but existing treatments will allowed to remain.
      See Also:
      Constant Field Values
    • UNAVAILABLE

      public static final int UNAVAILABLE
      The code for an unavailable timing. No scheduleing is allowed, and when applied all existing treatments will be removed.
      See Also:
      Constant Field Values
  • Method Details

    • getRowCount

      public int getRowCount()
      Description copied from class: AttributeStore
      Get the number of rows in this store
      Specified by:
      getRowCount in interface TableModel
      Specified by:
      getRowCount in class AttributeStore
      Returns:
      the number of rows in this store
    • getPeriodCount

      public int getPeriodCount()
      Description copied from class: AttributeStore
      Get the total number of periods that this store supports
      Specified by:
      getPeriodCount in class AttributeStore
      Returns:
      The number of periods in this store
    • getYearForPeriod

      public int getYearForPeriod(int period)
      Description copied from class: AttributeStore
      Get the ending year for a given period.
      Specified by:
      getYearForPeriod in class AttributeStore
      Parameters:
      period - The period of interest
      Returns:
      the year for a given period
    • getValueAt

      public Object getValueAt(int row, int column, int period)
      Description copied from class: AttributeStore
      Get a cell value
      Specified by:
      getValueAt in class AttributeStore
      Parameters:
      row - The row containing the cell
      column - The column containing the cell
      period - The period of interest
      Returns:
      An object containing the cell value.
    • setValueAt

      public void setValueAt(Object o, int row, int column, int period)
      Description copied from class: AttributeStore
      Set the value in a cell and notify listeners that the value has changed.

      Implementing classes that override must call this method to ensure that joins are properly maintained.

      Overrides:
      setValueAt in class AttributeStore
      Parameters:
      o - The value to be set.
      row - The row containing the cell
      column - The column containing the cell
      period - The period of interest
    • setKey

      public void setKey(String key)
      Set the join key for the timing constraints table.
    • setKey

      public void setKey(String key, SimpleProgress3 sp, boolean notifyListeners)
      Set the join key in the timing constraints table.
      Parameters:
      key - the join key expression
      sp - a progress bar that will be updated
      notifyListeners - if true then notify any listeners when the key changes
    • apply

      public void apply()
      Apply any changes to the timing constraints.
    • apply

      public void apply(SimpleProgress3 sp)
      Apply any changes to the timing constraints. This version will display a custom progress bar. This intereacts with Swing, and must be done on the EDT.
    • load

      public void load(String filename)
      Load a set of timing constraints from a file
    • load

      public void load(File file)
      Load a set of timing constraints from a file
    • setZoneForUnit

      public void setZoneForUnit(String unit, String zone)
    • setEligForZone

      public void setEligForZone(String zone, int[] codes)
    • save

      public void save(String filename)
      Save the current timing constraints to a file
    • save

      public void save(File file)
      Save the current timing constraints to a file
    • getKeys

      public Vector<String> getKeys()
      Get a list of all keys in this table
    • getKey

      public String getKey()
      Get the name of the join key field
    • getStore

      public AttributeStore getStore()
      Get the name of the base table in the relation
    • isAltered

      public boolean isAltered()
      Test of the table has been altered but the changes not yet applied.
    • addKeyListener

      public void addKeyListener(AccessKeyListener akl)
    • removeKeyListener

      public void removeKeyListener(AccessKeyListener akl)