public class KahinaBreakpoint extends KahinaObject implements java.io.Serializable
The main purpose of this class is to combine a TreePattern
with meta information such as a type, a signal color, a name and an activation status.
It constitutes the form in which breakpoints are most transparent and accessible to the user.
The breakpoint editor as well as import and export formats build on breakpoints in this form.
Within the breakpoint system, a KahinaBreakpoint
is compiled into a TreeAutomaton
which is then used for pattern matching.
The resulting TreeAutomaton
will however still contain a reference to this object for meta data access.
needsUpdate
Constructor and Description |
---|
KahinaBreakpoint(int type)
Class constructor specifying the breakpoint type as an integer constant.
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates this breakpoint, causing the messaging system to announce its matches.
|
TreeAutomaton |
compile()
Compiles this breakpoint into a tree automaton which is then returned.
|
void |
deactivate()
Deactivates this breakpoint, preventing the messaging system from announcing its matches.
|
java.lang.String |
exportXML(boolean asFile)
Generates an XML representation of this breakpoint, optionally featuring an XML header.
|
org.w3c.dom.Element |
exportXML(org.w3c.dom.Document dom) |
java.lang.String |
getName()
Gets the name of the breakpoint as used by various GUI components.
|
TreePattern |
getPattern()
Gets the tree pattern associated with this breakpoint.
|
java.awt.Color |
getSignalColor()
Gets the signal color used for highlighting matches of this breakpoint.
|
int |
getType()
Gets the type of this breakpoint.
|
static KahinaBreakpoint |
importXML(org.w3c.dom.Element breakpointNode)
Constructs a breakpoint from an XML representation as produced by
exportXML . |
boolean |
isActive()
Checks whether this breakpoint is active.
|
void |
setName(java.lang.String name)
Sets the name of the breakpoint that will be used by various GUI components.
|
void |
setPattern(TreePattern pattern)
Associates this breakpoint with a new tree pattern.
|
void |
setSignalColor(java.awt.Color signalColor)
Sets the signal color used for highlighting matches of this breakpoint.
|
void |
setType(int type)
Changes the type of this breakpoint.
|
java.lang.String |
toString()
Returns the breakpoint's name, prefixed by '#' if it is inactive.
|
needsUpdate, requireUpdate
public KahinaBreakpoint(int type)
The breakpoint starts out with the following default values:
name
- "Breakpoint " + a number
signalColor
- a random RGB color
active
- true (= activated)
pattern
- the empty pattern
type
- one of the constant values in KahinaBreakpointType
public TreeAutomaton compile()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- a user-readable name for this breakpointpublic boolean isActive()
public void activate()
public void deactivate()
public java.awt.Color getSignalColor()
public void setSignalColor(java.awt.Color signalColor)
signalColor
- the signal color to be associated with this breakpointpublic java.lang.String toString()
toString
in class java.lang.Object
public TreePattern getPattern()
public void setPattern(TreePattern pattern)
pattern
- the tree pattern to be associated with this breakpointpublic int getType()
public void setType(int type)
type
- one of the constant values in KahinaBreakpointType
public java.lang.String exportXML(boolean asFile)
asFile
- determines whether the result features an XML headerpublic org.w3c.dom.Element exportXML(org.w3c.dom.Document dom)
public static KahinaBreakpoint importXML(org.w3c.dom.Element breakpointNode)
exportXML
.breakpointNode
- an XML DOM element with name "breakpoint" as produced when parsing the result of exportXML