org.millscript.millscript.datatypes
Class Binding

java.lang.Object
  extended by org.millscript.commons.util.list.AbstractIList<V>
      extended by org.millscript.commons.util.list.IArrayList<java.lang.String>
          extended by org.millscript.millscript.datatypes.Binding
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, org.millscript.commons.util.IList<java.lang.String>, org.millscript.commons.util.IMap<java.lang.Integer,java.lang.String>

public final class Binding
extends org.millscript.commons.util.list.IArrayList<java.lang.String>
implements java.io.Serializable

This class represents a MillScript Binding, which itself reprsents the set of match variables for a given regular expression and string.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.millscript.commons.util.list.AbstractIList
org.millscript.commons.util.list.AbstractIList.ListMapletIterator<V>, org.millscript.commons.util.list.AbstractIList.ListMapletList<V>
 
Method Summary
 java.lang.String getMatchedString()
          Returns the section of the original string matched by the regular expression used to make this binding.
 java.lang.Integer getMatchedStringEnd()
          Returns the index in the original string of the last character of the matched section.
 java.lang.Integer getMatchedStringStart()
          Returns the index in the original string of the first character of the matched section.
 java.lang.String getMatchVar(int n)
          Returns the binding for the specified match variable.
 java.lang.Integer getMatchVarEnd(int n)
          Returns the index in the original string of the last character of the specified match variable.
 java.lang.Integer getMatchVarStart(int n)
          Returns the index in the original string of the first character of the specified match variable.
 java.lang.String getOriginalString()
          Returns the original string the regex was matched against.
 java.util.regex.Pattern getPattern()
          Returns the pattern used to make this binding.
static Binding newBinding(java.lang.String s, java.util.regex.Matcher m)
          Returns a new binding for the specified matcher.
 void validateMatchVarReference(int n)
          Validates the specified integer as a match variable reference, generating an alert if the refernce is not valid.
 
Methods inherited from class org.millscript.commons.util.list.IArrayList
clone, doGet, doSlice, indexOf, iterator, size, toArray
 
Methods inherited from class org.millscript.commons.util.list.AbstractIList
allButFirst, allButLast, allFirst, allLast, contains, contains, contains, contains0, contains0, contains0, containsAll, containsKey, containsKey, containsKey0, containsKey0, containsSlice, containsSlice0, containsValue, decorate, equals, first, get, get, get0, get0, getDefault, hashCode, indexOf0, isEmtpy, keyList, last, mapletList, setDefault, setDefault, sharedMapletList, sharedValueList, slice, slice0, toArray, toString, valueList
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

newBinding

public static final Binding newBinding(java.lang.String s,
                                       java.util.regex.Matcher m)
Returns a new binding for the specified matcher.

Parameters:
s - the original string that was matched against
m - the matcher to make a binding from

getMatchedString

public java.lang.String getMatchedString()
Returns the section of the original string matched by the regular expression used to make this binding.

Returns:
a String which is this bindings section of the original string

getMatchedStringEnd

public java.lang.Integer getMatchedStringEnd()
Returns the index in the original string of the last character of the matched section. Note the index is 1 based, not 0.

Returns:
the index in the original string of the last character of the matched section

getMatchedStringStart

public java.lang.Integer getMatchedStringStart()
Returns the index in the original string of the first character of the matched section. Note the index is 1 based, not 0.

Returns:
the index in the original string of the first character of the matched section

getMatchVar

public java.lang.String getMatchVar(int n)
Returns the binding for the specified match variable.

Parameters:
n - the match variable to get
Returns:
a String holding the binding for the specified match variable

getMatchVarEnd

public java.lang.Integer getMatchVarEnd(int n)
Returns the index in the original string of the last character of the specified match variable. Note the index is 1 based, not 0.

Returns:
the index in the original string of the last character of the specified match variable

getMatchVarStart

public java.lang.Integer getMatchVarStart(int n)
Returns the index in the original string of the first character of the specified match variable. Note the index is 1 based, not 0.

Returns:
the index in the original string of the first character of the specified match variable

getOriginalString

public java.lang.String getOriginalString()
Returns the original string the regex was matched against.

Returns:
the original String the regex was matched against

getPattern

public java.util.regex.Pattern getPattern()
Returns the pattern used to make this binding.

Returns:
the Pattern used to make this binding.

validateMatchVarReference

public void validateMatchVarReference(int n)
Validates the specified integer as a match variable reference, generating an alert if the refernce is not valid. A valid refernce is a non-zero positive integer that is less than or equal to the number of match variables in this binding.

Parameters:
n - the match variable reference to validate


Copyright © 2001-2007 Open World Ltd. All Rights Reserved.