Package nzilbb.labbcat.server.search
Class LayerMatch
- java.lang.Object
-
- nzilbb.labbcat.server.search.LayerMatch
-
- All Implemented Interfaces:
nzilbb.util.CloneableBean
public class LayerMatch extends Object implements nzilbb.util.CloneableBean
One cell in a search matrix, containing a pattern to match on one layer.General principles, which are not enforced by these classes, are:
- If
pattern
is set, thenmin
andmax
should be null, and vice-versa - Only one LayerMatch in a
Matrix
hastarget
== true.
-
-
Constructor Summary
Constructors Constructor Description LayerMatch()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LayerMatch
ensurePatternAnchored()
Ensures that the pattern includes anchoring to the beginning (^) and end ($) of input.Boolean
getAnchorEnd()
Getter foranchorEnd
: Whether this condition is anchored to the end of the word token.Boolean
getAnchorStart()
Getter foranchorStart
: Whether this condition is anchored to the start of the word token.String
getId()
Getter forid
: The Layer ID to match.Double
getMax()
Getter formax
: The maximum value for the label.Double
getMin()
Getter formin
: The minimum value for the label.Boolean
getNot()
Getter fornot
: Whether the #pattern is being negated (i.e.String
getPattern()
Getter forpattern
: The regular expression to match the label against.Boolean
getTarget()
Getter fortarget
: Whether this matrix cell is the target of the search.static boolean
HasCondition(LayerMatch layer)
Determines whether the given LayerMatch actually specifies apattern
,min
, ormax
.static boolean
IsTarget(LayerMatch layer)
Determines whether the given LayerMatch actually specifies apattern
,min
, ormax
.LayerMatch
setAnchorEnd(Boolean newAnchorEnd)
Setter foranchorEnd
: Whether this condition is anchored to the end of the word token.LayerMatch
setAnchorStart(Boolean newAnchorStart)
Setter foranchorStart
: Whether this condition is anchored to the start of the word token.LayerMatch
setId(String newId)
Setter forid
: The Layer ID to match.LayerMatch
setMax(Double newMax)
Setter formax
: The maximum value for the label.LayerMatch
setMaxString(String newMax)
Setter formax
.LayerMatch
setMin(Double newMin)
Setter formin
: The minimum value for the label.LayerMatch
setMinString(String newMin)
Setter formin
.LayerMatch
setNot(Boolean newNot)
Setter fornot
: Whether the #pattern is being negated (i.e.LayerMatch
setNullBooleans()
Ensures that Boolean attributes (target
,not
,anchorStart
,anchorEnd
) have non-null values.LayerMatch
setPattern(String newPattern)
Setter forpattern
: The regular expression to match the label against.LayerMatch
setTarget(Boolean newTarget)
Setter fortarget
: Whether this matrix cell is the target of the search.String
toString()
Returns the JSON serialization of this layer.
-
-
-
Method Detail
-
getId
@ClonedProperty public String getId()
Getter forid
: The Layer ID to match.- Returns:
- The Layer ID to match.
-
setId
public LayerMatch setId(String newId)
Setter forid
: The Layer ID to match.- Parameters:
newId
- The Layer ID to match.
-
getPattern
@ClonedProperty public String getPattern()
Getter forpattern
: The regular expression to match the label against.- Returns:
- The regular expression to match the label against.
-
setPattern
public LayerMatch setPattern(String newPattern)
Setter forpattern
: The regular expression to match the label against.- Parameters:
newPattern
- The regular expression to match the label against. An empty string results in null being assigned.
-
getNot
@ClonedProperty public Boolean getNot()
Getter fornot
: Whether the #pattern is being negated (i.e. selecting tokens that don't match) or not.- Returns:
- Whether the #pattern is being negated (i.e. selecting tokens that don't match) or not.
-
setNot
public LayerMatch setNot(Boolean newNot)
Setter fornot
: Whether the #pattern is being negated (i.e. selecting tokens that don't match) or not.- Parameters:
newNot
- Whether the #pattern is being negated (i.e. selecting tokens that don't match) or not.
-
getMin
@ClonedProperty public Double getMin()
Getter formin
: The minimum value for the label.- Returns:
- The minimum value for the label.
-
setMin
public LayerMatch setMin(Double newMin)
Setter formin
: The minimum value for the label.- Parameters:
newMin
- The minimum value for the label.
-
setMinString
public LayerMatch setMinString(String newMin)
Setter formin
.- Parameters:
newMin
- A string representing the minimum value for the label. An empty string results in null being assigned.
-
getMax
@ClonedProperty public Double getMax()
Getter formax
: The maximum value for the label.- Returns:
- The maximum value for the label.
-
setMax
public LayerMatch setMax(Double newMax)
Setter formax
: The maximum value for the label.- Parameters:
newMax
- The maximum value for the label.
-
setMaxString
public LayerMatch setMaxString(String newMax)
Setter formax
.- Parameters:
newMax
- A string representing the maximum value for the label.
-
getTarget
@ClonedProperty public Boolean getTarget()
Getter fortarget
: Whether this matrix cell is the target of the search.- Returns:
- Whether this matrix cell is the target of the search.
-
setTarget
public LayerMatch setTarget(Boolean newTarget)
Setter fortarget
: Whether this matrix cell is the target of the search.- Parameters:
newTarget
- Whether this matrix cell is the target of the search.
-
getAnchorStart
@ClonedProperty public Boolean getAnchorStart()
Getter foranchorStart
: Whether this condition is anchored to the start of the word token.- Returns:
- Whether this condition is anchored to the start of the word token.
-
setAnchorStart
public LayerMatch setAnchorStart(Boolean newAnchorStart)
Setter foranchorStart
: Whether this condition is anchored to the start of the word token.- Parameters:
newAnchorStart
- Whether this condition is anchored to the start of the word token.
-
getAnchorEnd
@ClonedProperty public Boolean getAnchorEnd()
Getter foranchorEnd
: Whether this condition is anchored to the end of the word token.- Returns:
- Whether this condition is anchored to the end of the word token.
-
setAnchorEnd
public LayerMatch setAnchorEnd(Boolean newAnchorEnd)
Setter foranchorEnd
: Whether this condition is anchored to the end of the word token.- Parameters:
newAnchorEnd
- Whether this condition is anchored to the end of the word token.
-
setNullBooleans
public LayerMatch setNullBooleans()
Ensures that Boolean attributes (target
,not
,anchorStart
,anchorEnd
) have non-null values. Any with null values are assumed to be false.
-
ensurePatternAnchored
public LayerMatch ensurePatternAnchored()
Ensures that the pattern includes anchoring to the beginning (^) and end ($) of input.After this method is called,
pattern
will instead be^(pattern)$
-
toString
public String toString()
Returns the JSON serialization of this layer.
-
HasCondition
public static boolean HasCondition(LayerMatch layer)
Determines whether the given LayerMatch actually specifies apattern
,min
, ormax
.- Parameters:
layer
- The layer match to check.- Returns:
- true if the given LayerMatch specifies a
pattern
,min
, ormax
, false otherwise.
-
IsTarget
public static boolean IsTarget(LayerMatch layer)
Determines whether the given LayerMatch actually specifies apattern
,min
, ormax
.- Parameters:
layer
- The layer match to check.- Returns:
- true if the given LayerMatch specifies a
pattern
,min
, ormax
, false otherwise.
-
-