public abstract class SimpleLinkedListView extends AnimatingLinkedView<PresentationView.Settings,SimpleLinkedListView.LLNodeLoc,SimpleLinkedListView.LLStructData>
Modifier and Type | Class and Description |
---|---|
protected class |
SimpleLinkedListView.LLNodeLoc
Linked list node location.
|
protected static class |
SimpleLinkedListView.LLStructData
Structure data from an update.
|
AnimatingLinkedView.State
PresentationView.MainRoot, PresentationView.Settings, PresentationView.SizeLimitDialog
Modifier and Type | Field and Description |
---|---|
static int |
DOUBLY_LINKED
Constructor flag indicating that the list is doubly linked.
|
static int |
HEADER
Constructor flag indicating that the list has a header node.
|
static int |
LABELS_NONE
Node index labels flag indicating no labels.
|
static int |
LABELS_ZERO_INDEX_BRACKETED
Node index labels flag indicating <0>, <1>, <2>
...
|
static int |
LABELS_ZERO_INDEXED
Node index labels flag indicating 0, 1, 2 ....
|
static int |
LABELS_ZERO_INDEXED_WITH_DUMMY
Node index labels flag indicating -, 0, 1, 2 ....
|
static int |
LINK_END_TO_START
Constructor flag indicating that the back link from the first node
should point to the last node.
|
static int |
LINK_START_TO_END
Constructor flag indicating that the forward link from the last node
should point to the first node.
|
ANIMATE, CCW, REVERSIBLE, ROUND, VERTICAL
Constructor and Description |
---|
SimpleLinkedListView(ViewerCreateData vcd,
int flags,
int labelsIn,
int numValuesPerNode)
Creates a new PresentationListView.
|
Modifier and Type | Method and Description |
---|---|
void |
build(ViewerInitData vid,
Element initDataIn)
Builds the viewer non-gui internals.
|
void |
changeSizeLimit()
Changes a structure size limit imposed by the PresentationView subclass.
|
void |
configure(boolean update,
JPanel paintPanel,
AnimatingLinkedView.State s)
Configures the viewer based on the current state.
|
PresentationView.Settings |
createGlobalSettings()
Creates a global settings object for the viewer.
|
int |
getExpectedLength(Value list,
DebugContext context)
Gets the expected item count.
|
abstract Value |
getFirst(Value value,
DebugContext context)
Gets the first node for the structure.
|
String |
getFirstNodeField()
Gets the name of the field that contains the first node, if there is
one.
|
protected Rectangle |
getLabelBounds(int row,
Rectangle2D textBounds,
AnimatingLinkedView.State s)
Gets the bounds rectangle for a row label.
|
static String |
getLabelTypeLabel(int index)
Gets a label for a node label type constant.
|
abstract Value |
getLast(Value list,
DebugContext context)
Gets the last node for the structure.
|
abstract String |
getLastLabel()
Gets the name of the last node field, if any.
|
Point2D.Double |
getLinkTarget(int sourceRow,
NodeData<SimpleLinkedListView.LLNodeLoc> nd,
AnimatingLinkedView.State s,
double edgeAdjust) |
Point2D.Double |
getLVLinkSource(int row,
AnimatingLinkedView.State s) |
Dimension |
getMainSize()
Gets the default size for the main panel when on the canvas, if this
needs to be different from the preferred size.
|
abstract Value |
getNext(Value list,
Value node,
DebugContext context)
Gets the next node for a specified node.
|
Rectangle |
getNodeRect(NodeData<SimpleLinkedListView.LLNodeLoc> nd,
AnimatingLinkedView.State s)
Gets the display rectangle for a node.
|
abstract Value |
getNodeValue(Value list,
Value node,
int valIndex,
DebugContext context)
Gets one of the values contained in a node.
|
String |
getNodeValueText(Value list,
Value node,
Value value,
int valIndex,
DebugContext context)
Gets the display text for a node value.
|
static int |
getNumLabelTypes()
Gets the number of label type constants.
|
PresentationElement |
getPe(NodeData<SimpleLinkedListView.LLNodeLoc> nd)
Gets the presentation element corresponding to a node.
|
Value |
getPrevious(Value list,
Value node,
DebugContext context)
Gets the previous node for a specified node, for doubly-linked lists.
|
int |
getPriority(ViewerPriorityData vpd)
Gets the viewer priority.
|
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
Gets the unit increment when there is a scrollable main without a single
scrollable child.
|
PresentationView.Settings |
getSettingsCopy(PresentationView.Settings settingsIn)
Creates a copy of settings.
|
int |
getSizeLimit()
Gets the node size limit.
|
String |
getViewName()
Gets the display name of the viewer.
|
protected NodeData<SimpleLinkedListView.LLNodeLoc> |
nodeLocationToData(SimpleLinkedListView.LLNodeLoc location,
SimpleLinkedListView.LLStructData currentData)
Gets the node data at a specified node location.
|
void |
paintMainView(Graphics graphics,
JPanel paintPanel,
AnimatingLinkedView.State s)
Paints the view.
|
void |
setCollectionState(SimpleLinkedListView.LLStructData data,
boolean enableCollection)
Protects the recorded structure from garbage collection, or removes that
protection.
|
SimpleLinkedListView.LLStructData |
update(Value value,
ViewerUpdateData data,
DebugContext context)
Gets the structure data.
|
configure, createGui, destroy, getBlendComposite, getDisplayFields, getNodeColor, getNodeType, getNumValuesPerNode, horizontalRows, matchesLocal, paintArray, paintHashArrayElement, paintLabels, paintNodes, rightLabels, setSubViewValue, update, updateGui
addToolBarButton, animate, getAnimateDelay, getCurrentSettings, getElementChars, getElementWidth, getNewSizeLimit, getPerClassSettings, getRefSettings, init, isEmbedded, isReversed, isRound, isSimple, isVertical, isViewerTransparent, noSimpleForPrimitives, scaleFont, setError, setLabelLocation, setSelectionViewValue, setSizeLabelText, setValuesAreObjects, showEmbedded, showReversed, showRound, showSimple, showVertical, sizeLimitExceeded, toXML, valuesAreObjects
public static final int LABELS_NONE
public static final int LABELS_ZERO_INDEXED
public static final int LABELS_ZERO_INDEXED_WITH_DUMMY
public static final int LABELS_ZERO_INDEX_BRACKETED
public static final int DOUBLY_LINKED
public static final int HEADER
public static final int LINK_END_TO_START
public static final int LINK_START_TO_END
public SimpleLinkedListView(ViewerCreateData vcd, int flags, int labelsIn, int numValuesPerNode)
vcd
- creation data.flags
- constructor flags. A combination of DOUBLY_LINKED
,
LINK_END_TO_START
, and LINK_START_TO_END
.labelsIn
- node index labels type. One of LABELS_NONE
,
LABELS_ZERO_INDEXED
, and
LABELS_ZERO_INDEXED_WITH_DUMMY
, or
LABELS_ZERO_INDEX_BRACKETED
.numValuesPerNode
- the number of values to be displayed for each
node.public static String getLabelTypeLabel(int index)
index
- the constant. One of LABELS_NONE
,
LABELS_ZERO_INDEXED
, LABELS_ZERO_INDEXED_WITH_DUMMY
,
and LABELS_ZERO_INDEX_BRACKETED
. Alternately, a value from zero
to getNumLabelTypes()
- 1.public static int getNumLabelTypes()
public void build(ViewerInitData vid, Element initDataIn)
build
in interface Viewer
build
in class AnimatingLinkedView<PresentationView.Settings,SimpleLinkedListView.LLNodeLoc,SimpleLinkedListView.LLStructData>
vid
- initialization and control element for the viewer.initDataIn
- XML initialization data for the viewer.public void changeSizeLimit()
sizeLimitExceeded()
is called, this
method must be overridden.changeSizeLimit
in class PresentationView<PresentationView.Settings>
public void configure(boolean update, JPanel paintPanel, AnimatingLinkedView.State s)
configure
in class AnimatingLinkedView<PresentationView.Settings,SimpleLinkedListView.LLNodeLoc,SimpleLinkedListView.LLStructData>
update
- true if the viewer panel should be resized (if necessary)
and repainted, false if it should not.paintPanel
- the panel on which the view will be displayed.s
- the current viewer state.public PresentationView.Settings createGlobalSettings()
createGlobalSettings
in class PresentationView<PresentationView.Settings>
public int getExpectedLength(Value list, DebugContext context) throws ViewerException
list
- the current list being viewed.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public abstract Value getFirst(Value value, DebugContext context) throws ViewerException
value
- the current value being viewed.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public String getFirstNodeField()
public abstract Value getLast(Value list, DebugContext context) throws ViewerException
list
- the current value being viewed.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public abstract String getLastLabel()
public Point2D.Double getLinkTarget(int sourceRow, NodeData<SimpleLinkedListView.LLNodeLoc> nd, AnimatingLinkedView.State s, double edgeAdjust)
public Point2D.Double getLVLinkSource(int row, AnimatingLinkedView.State s)
public Dimension getMainSize()
Overridden to supply a main size that doesn't include the local variables label.
getMainSize
in class AnimatingLinkedView<PresentationView.Settings,SimpleLinkedListView.LLNodeLoc,SimpleLinkedListView.LLStructData>
public abstract Value getNext(Value list, Value node, DebugContext context) throws ViewerException
list
- the current list. This will be a null value for local
variable nodes. If a list is required to follow the link and it can not
be obtained from the node, then return a null Value and local nodes will
show up without linked nodes.node
- the node of interest.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public Rectangle getNodeRect(NodeData<SimpleLinkedListView.LLNodeLoc> nd, AnimatingLinkedView.State s)
getNodeRect
in class AnimatingLinkedView<PresentationView.Settings,SimpleLinkedListView.LLNodeLoc,SimpleLinkedListView.LLStructData>
nd
- the node data.s
- the structure state.public abstract Value getNodeValue(Value list, Value node, int valIndex, DebugContext context) throws ViewerException
list
- the list object. This will be a null value for local variable
nodes. If a list is required to follow the link and it can not be
obtained from the node, then return a null Value and selecting local
variable nodes will not display the actual value.node
- the node of interest.valIndex
- index of the value of interest.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public String getNodeValueText(Value list, Value node, Value value, int valIndex, DebugContext context) throws ViewerException
list
- the list object. This will be a null value for local variable
nodes. If a list is required to follow the link and it can not be
obtained from the node, then return any arbitrary value ("?" suggested)
for local variable nodes to display.node
- the node of interest.value
- the value of interest.valIndex
- index of the value of interest.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public PresentationElement getPe(NodeData<SimpleLinkedListView.LLNodeLoc> nd)
getPe
in class AnimatingLinkedView<PresentationView.Settings,SimpleLinkedListView.LLNodeLoc,SimpleLinkedListView.LLStructData>
nd
- node data for the node, or null if the presentation element for
field nodes should be returned.nd
, or if nd
is null, the
presentation element used to layout and paint field nodes.public Value getPrevious(Value list, Value node, DebugContext context) throws ViewerException
list
- the current list. This will be a null value for local
variable nodes. If a list is required to follow the link and it can not
be obtained from the node, then return a null Value and local nodes will
show up without linked nodes.node
- the node of interest.context
- the current debugger context.ViewerException
- if any exceptions are occur and are not caught
while using jgrdi.public int getPriority(ViewerPriorityData vpd)
vpd
- data about how the viewer will be used.Integer.MIN_VALUE
indicates that the viewer
dialog or canvas should change viewers.public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in class PresentationView<PresentationView.Settings>
visibleRect
- the main panel visible rect.orientation
- the scroll direction, one of
SwingConstants.VERTICAL
and SwingConstants.HORIZONTAL
.direction
- negative for a left or up scroll, positive for a right
or down scroll.public PresentationView.Settings getSettingsCopy(PresentationView.Settings settingsIn)
getSettingsCopy
in class PresentationView<PresentationView.Settings>
settingsIn
- the settings to be copied.public int getSizeLimit()
getSizeLimit
in class AnimatingLinkedView<PresentationView.Settings,SimpleLinkedListView.LLNodeLoc,SimpleLinkedListView.LLStructData>
public String getViewName()
public void paintMainView(Graphics graphics, JPanel paintPanel, AnimatingLinkedView.State s)
paintMainView
in class AnimatingLinkedView<PresentationView.Settings,SimpleLinkedListView.LLNodeLoc,SimpleLinkedListView.LLStructData>
graphics
- the graphics to which the view will be rendered.paintPanel
- the panel on which the view will be rendered.s
- the current viewer state.public void setCollectionState(SimpleLinkedListView.LLStructData data, boolean enableCollection)
setCollectionState
in class AnimatingLinkedView<PresentationView.Settings,SimpleLinkedListView.LLNodeLoc,SimpleLinkedListView.LLStructData>
data
- the structure data to be protected or freed.enableCollection
- if true, garbage collection protection will be
removed, if false it will be enabled.public SimpleLinkedListView.LLStructData update(Value value, ViewerUpdateData data, DebugContext context) throws ViewerException
update
in class AnimatingLinkedView<PresentationView.Settings,SimpleLinkedListView.LLNodeLoc,SimpleLinkedListView.LLStructData>
value
- the current structure value.data
- viewer update data.context
- the current debugger context.ViewerException
- if an error occurs while updating the viewer.protected Rectangle getLabelBounds(int row, Rectangle2D textBounds, AnimatingLinkedView.State s)
getLabelBounds
in class AnimatingLinkedView<PresentationView.Settings,SimpleLinkedListView.LLNodeLoc,SimpleLinkedListView.LLStructData>
row
- the row.textBounds
- bounds (size) of the label text.s
- the structure state.protected NodeData<SimpleLinkedListView.LLNodeLoc> nodeLocationToData(SimpleLinkedListView.LLNodeLoc location, SimpleLinkedListView.LLStructData currentData)
nodeLocationToData
in class AnimatingLinkedView<PresentationView.Settings,SimpleLinkedListView.LLNodeLoc,SimpleLinkedListView.LLStructData>
location
- the node location of interest.currentData
- current structure data.