org.kahina.core.breakpoint
Class KahinaBreakpoint

java.lang.Object
  extended by org.kahina.core.breakpoint.KahinaBreakpoint
All Implemented Interfaces:
Serializable

public class KahinaBreakpoint
extends Object
implements Serializable

A breakpoint based on a tree pattern as used by the Kahina breakpoint system.

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.

See Also:
Serialized Form

Constructor Summary
KahinaBreakpoint(int type)
          Class constructor specifying the breakpoint type as an integer constant.
 
Method Summary
 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.
 String exportXML(boolean asFile)
          Generates an XML representation of this breakpoint, optionally featuring an XML header.
 String getName()
          Gets the name of the breakpoint as used by various GUI components.
 TreePattern getPattern()
          Gets the tree pattern associated with this breakpoint.
 Color getSignalColor()
          Gets the signal color used for highlighting matches of this breakpoint.
 int getType()
          Gets the type of this breakpoint.
static KahinaBreakpoint importXML(Element breakpointNode)
          Constructs a breakpoint from an XML representation as produced by exportXML.
 boolean isActive()
          Checks whether this breakpoint is active.
 void setName(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(Color signalColor)
          Sets the signal color used for highlighting matches of this breakpoint.
 void setType(int type)
          Changes the type of this breakpoint.
 String toString()
          Returns the breakpoint's name, prefixed by '#' if it is inactive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KahinaBreakpoint

public KahinaBreakpoint(int type)
Class constructor specifying the breakpoint type as an integer constant.

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

Parameters:
type - one of the constant values in KahinaBreakpointType
Method Detail

compile

public TreeAutomaton compile()
Compiles this breakpoint into a tree automaton which is then returned.

Returns:
the compiled tree automaton, still referencing this breakpoint

getName

public String getName()
Gets the name of the breakpoint as used by various GUI components.

Returns:
the name of the breakpoint

setName

public void setName(String name)
Sets the name of the breakpoint that will be used by various GUI components.

Parameters:
name - a user-readable name for this breakpoint

isActive

public boolean isActive()
Checks whether this breakpoint is active. Used by tree automata to decide whether to inform Kahina about matches.

Returns:
true if this breakpoint is active, false if it is inactive

activate

public void activate()
Activates this breakpoint, causing the messaging system to announce its matches.


deactivate

public void deactivate()
Deactivates this breakpoint, preventing the messaging system from announcing its matches.


getSignalColor

public Color getSignalColor()
Gets the signal color used for highlighting matches of this breakpoint.

Returns:
the signal color associated with this breakpoint

setSignalColor

public void setSignalColor(Color signalColor)
Sets the signal color used for highlighting matches of this breakpoint.

Parameters:
signalColor - the signal color to be associated with this breakpoint

toString

public String toString()
Returns the breakpoint's name, prefixed by '#' if it is inactive.

Overrides:
toString in class Object

getPattern

public TreePattern getPattern()
Gets the tree pattern associated with this breakpoint.

Returns:
the tree pattern associated with this breakpoint

setPattern

public void setPattern(TreePattern pattern)
Associates this breakpoint with a new tree pattern.

Parameters:
pattern - the tree pattern to be associated with this breakpoint

getType

public int getType()
Gets the type of this breakpoint.

Returns:
an integer representing the breakpoint's type

setType

public void setType(int type)
Changes the type of this breakpoint.

Parameters:
type - one of the constant values in KahinaBreakpointType

exportXML

public String exportXML(boolean asFile)
Generates an XML representation of this breakpoint, optionally featuring an XML header.

Parameters:
asFile - determines whether the result features an XML header
Returns:
the XML representation of this breakpoint as a string

importXML

public static KahinaBreakpoint importXML(Element breakpointNode)
Constructs a breakpoint from an XML representation as produced by exportXML.

Parameters:
breakpointNode - an XML DOM element with name "breakpoint" as produced when parsing the result of exportXML
Returns:
a new breakpoint object corresponding to the XML representation contained in the DOM element