Module org.snmp4j.agent
Package org.snmp4j.agent.mo
Class DefaultMOMutableTableModel<R extends MOTableRow>
- java.lang.Object
-
- org.snmp4j.agent.mo.DefaultMOTableModel<R>
-
- org.snmp4j.agent.mo.DefaultMOMutableTableModel<R>
-
- All Implemented Interfaces:
MOMutableTableModel<R>,MOTableModel<R>,MOTableRowFactory<R>
- Direct Known Subclasses:
UsmMIB.UsmTableModel
public class DefaultMOMutableTableModel<R extends MOTableRow> extends DefaultMOTableModel<R> implements MOMutableTableModel<R>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classDefaultMOMutableTableModel.FilteredRowIterator
-
Field Summary
Fields Modifier and Type Field Description protected MOTableRowFactory<R>rowFactory-
Fields inherited from class org.snmp4j.agent.mo.DefaultMOTableModel
columnCount, rows
-
-
Constructor Summary
Constructors Constructor Description DefaultMOMutableTableModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMOTableModelListener(MOTableModelListener l)RaddRow(R row)Adds a row to the table.voidclear()Removes all rows.List<R>clear(MOTableRowFilter<R> filter)Remove all rows that do not match the given filter criteria from the model.RcreateRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] values)Create a new row and return it.protected voidfireTableModelChanged(MOTableModelEvent event)voidfreeRow(R row)Frees resources associated with the supplied row which is to be deleted.MOTableRowFactory<R>getRowFactory()Gets the factory instance used for creating rows for this model.List<MOTableRow>getRows(org.snmp4j.smi.OID lowerBound, org.snmp4j.smi.OID upperBoundEx)Returns a lexicographic ordered list of the rows in the specified index range.List<R>getRows(org.snmp4j.smi.OID lowerBound, org.snmp4j.smi.OID upperBoundEx, MOTableRowFilter<R> filter)Returns a lexicographic ordered list of the rows in the specified index range that match the supplied filter.Iterator<R>iterator(MOTableRowFilter<R> filter)Returns an iterator over all rows in this table that pass the given filter.voidremoveMOTableModelListener(MOTableModelListener l)RremoveRow(org.snmp4j.smi.OID index)Removes the row with the specified index from the table and returns it.voidremoveRows(org.snmp4j.smi.OID lowerBoundIncl, org.snmp4j.smi.OID upperBoundExcl)voidsetColumnCount(int columnCount)voidsetRowFactory(MOTableRowFactory<R> rowFactory)Sets the factory instance to be used for creating rows for this model.-
Methods inherited from class org.snmp4j.agent.mo.DefaultMOTableModel
containsRow, dump, firstIndex, firstRow, getColumnCount, getRow, getRowCount, isEmpty, iterator, lastIndex, lastRow, tailIterator
-
Methods inherited from interface org.snmp4j.agent.mo.MOTableModel
containsRow, firstIndex, firstRow, getColumnCount, getRow, getRowCount, isEmpty, iterator, lastIndex, lastRow, tailIterator
-
-
-
-
Field Detail
-
rowFactory
protected MOTableRowFactory<R extends MOTableRow> rowFactory
-
-
Method Detail
-
getRowFactory
public MOTableRowFactory<R> getRowFactory()
Description copied from interface:MOMutableTableModelGets the factory instance used for creating rows for this model.- Specified by:
getRowFactoryin interfaceMOMutableTableModel<R extends MOTableRow>- Returns:
- the row factory used for creating rows or
nullif row creation is not possible due to a missing factory.
-
getRows
public List<MOTableRow> getRows(org.snmp4j.smi.OID lowerBound, org.snmp4j.smi.OID upperBoundEx)
Returns a lexicographic ordered list of the rows in the specified index range.- Parameters:
lowerBound- the lower bound index (inclusive) for the rows in the returned list.upperBoundEx- the upper bound index (exclusive) for the rows in the returned list.- Returns:
- the possibly empty lexicographically ordered
Listof rows of this table model in the specified index range. Modifications to the list will not affect the underlying table model, although modifications to the row elements will.
-
getRows
public List<R> getRows(org.snmp4j.smi.OID lowerBound, org.snmp4j.smi.OID upperBoundEx, MOTableRowFilter<R> filter)
Returns a lexicographic ordered list of the rows in the specified index range that match the supplied filter.- Parameters:
lowerBound- the lower bound index (inclusive) for the rows in the returned list.upperBoundEx- the upper bound index (exclusive) for the rows in the returned list.filter- the filter to exclude rows in the range from the returned- Returns:
- the possibly empty lexicographically ordered
Listof rows of this table model in the specified index range. Modifications to the list will not affect the underlying table model, although modifications to the row elements will.
-
removeRow
public R removeRow(org.snmp4j.smi.OID index)
Description copied from interface:MOMutableTableModelRemoves the row with the specified index from the table and returns it.- Specified by:
removeRowin interfaceMOMutableTableModel<R extends MOTableRow>- Parameters:
index- the row index of the row to remove.- Returns:
- the removed row or
nullif the table did not contain such a row.
-
removeRows
public void removeRows(org.snmp4j.smi.OID lowerBoundIncl, org.snmp4j.smi.OID upperBoundExcl)
-
clear
public void clear()
Description copied from interface:MOMutableTableModelRemoves all rows.- Specified by:
clearin interfaceMOMutableTableModel<R extends MOTableRow>
-
clear
public List<R> clear(MOTableRowFilter<R> filter)
Remove all rows that do not match the given filter criteria from the model.- Specified by:
clearin interfaceMOMutableTableModel<R extends MOTableRow>- Parameters:
filter- theMOTableRowFilterthat filters out the rows to delete.- Returns:
- the number of removed rows.
-
iterator
public Iterator<R> iterator(MOTableRowFilter<R> filter)
Returns an iterator over all rows in this table that pass the given filter. If the table might be modified while the iterator is used, it is recommended to synchronize on this model while iterating.- Parameters:
filter- a MOTableRowFilter instance that defines the rows to return.- Returns:
- an Iterator.
-
createRow
public R createRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] values) throws UnsupportedOperationException
Create a new row and return it. The new row will not be added to the table. To add it to the model use theaddRow(R)method. If this mutable table does not support row creation, it should throw anUnsupportedOperationException.- Specified by:
createRowin interfaceMOTableRowFactory<R extends MOTableRow>- Parameters:
index- the index OID for the new row.values- the values to be contained in the new row.- Returns:
- the created
MOTableRow. - Throws:
UnsupportedOperationException- if the specified row cannot be created.
-
setRowFactory
public void setRowFactory(MOTableRowFactory<R> rowFactory)
Description copied from interface:MOMutableTableModelSets the factory instance to be used for creating rows for this model.- Specified by:
setRowFactoryin interfaceMOMutableTableModel<R extends MOTableRow>- Parameters:
rowFactory- aMOTableRowFactoryinstance ornullto disable row creation.
-
setColumnCount
public void setColumnCount(int columnCount)
-
freeRow
public void freeRow(R row)
Description copied from interface:MOTableRowFactoryFrees resources associated with the supplied row which is to be deleted.- Specified by:
freeRowin interfaceMOTableRowFactory<R extends MOTableRow>- Parameters:
row- a MOTableRow that has been created using this factory and is now to be deleted (removed from the associated table).
-
addMOTableModelListener
public void addMOTableModelListener(MOTableModelListener l)
-
removeMOTableModelListener
public void removeMOTableModelListener(MOTableModelListener l)
-
fireTableModelChanged
protected void fireTableModelChanged(MOTableModelEvent event)
-
addRow
public R addRow(R row)
Description copied from interface:MOMutableTableModelAdds a row to the table. If a row with the same index already exists it will be replaced and returned.- Specified by:
addRowin interfaceMOMutableTableModel<R extends MOTableRow>- Overrides:
addRowin classDefaultMOTableModel<R extends MOTableRow>- Parameters:
row- theMOTableRowinstance to add.- Returns:
- the previous row with the specified index or
nullif it did not have one.
-
-