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
patternis set, thenminandmaxshould be null, and vice-versa - Only one LayerMatch in a
Matrixhastarget== true.
-
-
Constructor Summary
Constructors Constructor Description LayerMatch()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LayerMatchensurePatternAnchored()Ensures that the pattern includes anchoring to the beginning (^) and end ($) of input.BooleangetAnchorEnd()Getter foranchorEnd: Whether this condition is anchored to the end of the word token.BooleangetAnchorStart()Getter foranchorStart: Whether this condition is anchored to the start of the word token.BooleangetCaseSensitive()Getter forcaseSensitive: Whether thepatternis to matched in a case-sensitive manner.StringgetId()Getter forid: The Layer ID to match.DoublegetMax()Getter formax: The maximum value for the label.DoublegetMin()Getter formin: The minimum value for the label.BooleangetNot()Getter fornot: Whether thepatternis being negated (i.e.StringgetPattern()Getter forpattern: The regular expression to match the label against.BooleangetTarget()Getter fortarget: Whether this matrix cell is the target of the search.static booleanHasCondition(LayerMatch layer)Determines whether the given LayerMatch actually specifies apattern,min, ormax.static booleanIsTarget(LayerMatch layer)Determines whether the given LayerMatch actually specifies apattern,min, ormax.LayerMatchsetAnchorEnd(Boolean newAnchorEnd)Setter foranchorEnd: Whether this condition is anchored to the end of the word token.LayerMatchsetAnchorStart(Boolean newAnchorStart)Setter foranchorStart: Whether this condition is anchored to the start of the word token.LayerMatchsetCaseSensitive(Boolean newCaseSensitive)Setter forcaseSensitive: Whether thepatternis to matched in a case-sensitive manner.LayerMatchsetId(String newId)Setter forid: The Layer ID to match.LayerMatchsetMax(Double newMax)Setter formax: The maximum value for the label.LayerMatchsetMaxString(String newMax)Setter formax.LayerMatchsetMin(Double newMin)Setter formin: The minimum value for the label.LayerMatchsetMinString(String newMin)Setter formin.LayerMatchsetNot(Boolean newNot)Setter fornot: Whether thepatternis being negated (i.e.LayerMatchsetNullBooleans()Ensures that Boolean attributes (target,not,caseSensitive,anchorStart,anchorEnd) have non-null values.LayerMatchsetPattern(String newPattern)Setter forpattern: The regular expression to match the label against.LayerMatchsetTarget(Boolean newTarget)Setter fortarget: Whether this matrix cell is the target of the search.StringtoString()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 thepatternis being negated (i.e. selecting tokens that don't match) or not.- Returns:
- Whether the
patternis being negated (i.e. selecting tokens that don't match) or not.
-
setNot
public LayerMatch setNot(Boolean newNot)
Setter fornot: Whether thepatternis being negated (i.e. selecting tokens that don't match) or not.- Parameters:
newNot- Whether thepatternis being negated (i.e. selecting tokens that don't match) or not.
-
getCaseSensitive
@ClonedProperty public Boolean getCaseSensitive()
Getter forcaseSensitive: Whether thepatternis to matched in a case-sensitive manner.- Returns:
- Whether the
patternis to matched in a case-sensitive manner.
-
setCaseSensitive
public LayerMatch setCaseSensitive(Boolean newCaseSensitive)
Setter forcaseSensitive: Whether thepatternis to matched in a case-sensitive manner.- Parameters:
newCaseSensitive- Whether thepatternis to matched in a case-sensitive manner.
-
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,caseSensitive,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.
-
-