Record Class ControlBreak
java.lang.Object
java.lang.Record
org.matwoess.jsourceprofiler.tool.model.ControlBreak
- Record Components:
kind- the kind of control break (one ofControlBreak.Kind)label- the target label of the control break, if any
- All Implemented Interfaces:
Serializable
public record ControlBreak(ControlBreak.Kind kind, String label)
extends Record
implements Serializable
This class is used to represent a control flow break.
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionControlBreak(ControlBreak.Kind kind, String label) Creates an instance of aControlBreakrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static ControlBreakCreate a new control flow break from a keyword token value.static ControlBreakfromTokenWithLabel(String tokenValue, String label) Create a new control flow break from a keyword token value and a label.final inthashCode()Returns a hash code value for this object.kind()Returns the value of thekindrecord component.label()Returns the value of thelabelrecord component.booleanstopPropagationAt(Block block) Decide when to stop propagating a control break at a given parent block.toString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
stopPropagationAt
Decide when to stop propagating a control break at a given parent block.- Parameters:
block- the block to check- Returns:
- true if this kind of control flow break should be propagated only until the given block
-
fromToken
Create a new control flow break from a keyword token value.- Parameters:
tokenValue- the keyword string of the control break- Returns:
- a new control break instance with a kind matching the token string
-
fromTokenWithLabel
Create a new control flow break from a keyword token value and a label.- Parameters:
tokenValue- the keyword of the control breaklabel- the target label of the control break- Returns:
- a new control break instance with the given label
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
label
Returns the value of thelabelrecord component.- Returns:
- the value of the
labelrecord component
-