GoGraph
v1.0


gograph.algorithms.courses
Class GGPriorityQueue

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--gograph.algorithms.courses.GGPriorityQueue
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class GGPriorityQueue
extends javax.swing.table.AbstractTableModel

Priority queue based on a sorted set, used in course algorithms. Also used as data model for visualisation in GGTable.

See Also:
GoGraph, GGTable, Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
GGPriorityQueue()
          Creates a new instance of GGPriorityQueue.
 
Method Summary
 boolean add(java.lang.Object o)
          Add element to the sorted set.
 void clear()
          Empty sorted set.
 java.lang.Object first()
          Get top element in sorted set.
 java.lang.Class getColumnClass(int columnIndex)
          Always return DefaultGraphCell.class.
 int getColumnCount()
          Returns the number of columns in the model.
 java.lang.String getColumnName(int column)
          Always return null, so that no column name is added.
 int getRowCount()
          Returns the number of rows in the model.
 boolean getShowPriority()
          Get flag for elements priorities visualisation in the table.
 java.lang.Object getValueAt(int row, int column)
          Returns the value for the cell at column and row.
 boolean isCellEditable(int row, int column)
          Always return false to prevent table edition.
 boolean isEmpty()
          Test sorted set emptiness.
 java.lang.Object pop()
          Extract element from the top of the sorted set.
 void reset()
          Reorder sorted set after updating an element priority.
 void setShowPriority(boolean isShowPriority)
          Set flag for elements priorities visualisation in the table.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GGPriorityQueue

public GGPriorityQueue()
Creates a new instance of GGPriorityQueue.

Method Detail

add

public boolean add(java.lang.Object o)
Add element to the sorted set.

Updates table model.

Parameters:
o - Element to add.
Returns:
true if element successfully added, false otherwise.

pop

public java.lang.Object pop()
Extract element from the top of the sorted set.

Updates table model.

Returns:
Object extracted.

clear

public void clear()
Empty sorted set.

Updates table model.


reset

public void reset()
Reorder sorted set after updating an element priority.

Updates table model.


first

public java.lang.Object first()
Get top element in sorted set.

No modification.

Returns:
Top element in sorted set.

setShowPriority

public void setShowPriority(boolean isShowPriority)
Set flag for elements priorities visualisation in the table.

Parameters:
isShowPriority - Boolean to set flag with.

getShowPriority

public boolean getShowPriority()
Get flag for elements priorities visualisation in the table.

Returns:
Flag for elements priorities visualisation in the table.

isEmpty

public boolean isEmpty()
Test sorted set emptiness.

Returns:
true if sorted set is empty, false otherwise.

getColumnCount

public int getColumnCount()
Returns the number of columns in the model.

Returns:
Number of columns in the model.

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Always return DefaultGraphCell.class.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
columnIndex - Column being queried.
Returns:
Always DefaultGraphCell.class.

getColumnName

public java.lang.String getColumnName(int column)
Always return null, so that no column name is added.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
column - The column being queried.
Returns:
Always null.

getRowCount

public int getRowCount()
Returns the number of rows in the model.

Returns:
Number of rows in the model.

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Returns the value for the cell at column and row.

Parameters:
row - Row whose value is to be queried.
column - Column whose value is to be queried.
Returns:
Object at the specified cell.

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Always return false to prevent table edition.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row - Row whose value is to be queried.
column - Column whose value is to be queried.
Returns:
Always false.

GoGraph
v1.0


Copyright (C) 2003 Stewe Frei. All rights reserved.