Grammatica
Public Member Functions | Properties | List of all members
PerCederberg.Grammatica.Runtime.ProductionPatternElement Class Reference

A production pattern element. More...

Public Member Functions

 ProductionPatternElement (bool isToken, int id, int min, int max)
 Creates a new element. More...
 
int GetId ()
 Returns the node identity. More...
 
int GetMinCount ()
 Returns the minimum occurence count. More...
 
int GetMaxCount ()
 Returns the maximum occurence count. More...
 
bool IsToken ()
 Returns true if this element represents a token. More...
 
bool IsProduction ()
 Returns true if this element represents a production. More...
 
bool IsMatch (Token token)
 Checks if a specific token matches this element. More...
 
override bool Equals (object obj)
 Checks if this object is equal to another. More...
 
override int GetHashCode ()
 Returns a hash code for this object. More...
 
override string ToString ()
 Returns a string representation of this object. More...
 

Properties

int Id [get]
 The node identity property (read-only). More...
 
int MinCount [get]
 The minimum occurence count property (read-only). More...
 
int MaxCount [get]
 The maximum occurence count property (read-only). More...
 

Detailed Description

A production pattern element.

This class represents a reference to either a token or a production. Each element also contains minimum and maximum occurence counters, controlling the number of repetitions allowed. A production pattern element is always contained within a production pattern rule.

Author
Per Cederberg
Version
1.5

Constructor & Destructor Documentation

PerCederberg.Grammatica.Runtime.ProductionPatternElement.ProductionPatternElement ( bool  isToken,
int  id,
int  min,
int  max 
)
inline

Creates a new element.

If the maximum value if zero (0) or negative, it will be set to Int32.MaxValue.

Parameters
isTokenthe token flag
idthe node identity
minthe minimum number of occurancies
maxthe maximum number of occurancies, or negative for infinite

Member Function Documentation

override bool PerCederberg.Grammatica.Runtime.ProductionPatternElement.Equals ( object  obj)
inline

Checks if this object is equal to another.

This method only returns true for another identical production pattern element.

Parameters
objthe object to compare with
Returns
true if the object is identical to this one, or false otherwise
override int PerCederberg.Grammatica.Runtime.ProductionPatternElement.GetHashCode ( )
inline

Returns a hash code for this object.

Returns
a hash code for this object
int PerCederberg.Grammatica.Runtime.ProductionPatternElement.GetId ( )
inline

Returns the node identity.

Returns
the node identity
See also
Id
Deprecated:
Use the Id property instead.
int PerCederberg.Grammatica.Runtime.ProductionPatternElement.GetMaxCount ( )
inline

Returns the maximum occurence count.

Returns
the maximum occurence count
See also
MaxCount
Deprecated:
Use the MaxCount property instead.
int PerCederberg.Grammatica.Runtime.ProductionPatternElement.GetMinCount ( )
inline

Returns the minimum occurence count.

Returns
the minimum occurence count
See also
MinCount
Deprecated:
Use the MinCount property instead.
bool PerCederberg.Grammatica.Runtime.ProductionPatternElement.IsMatch ( Token  token)
inline

Checks if a specific token matches this element.

This method will only return true if this element is a token element, and the token has the same id and this element.

Parameters
tokenthe token to check
Returns
true if the token matches this element, or false otherwise
bool PerCederberg.Grammatica.Runtime.ProductionPatternElement.IsProduction ( )
inline

Returns true if this element represents a production.

Returns
true if the element is a production, or false otherwise
bool PerCederberg.Grammatica.Runtime.ProductionPatternElement.IsToken ( )
inline

Returns true if this element represents a token.

Returns
true if the element is a token, or false otherwise
override string PerCederberg.Grammatica.Runtime.ProductionPatternElement.ToString ( )
inline

Returns a string representation of this object.

Returns
a string representation of this object

Property Documentation

int PerCederberg.Grammatica.Runtime.ProductionPatternElement.Id
get

The node identity property (read-only).

Since
1.5
int PerCederberg.Grammatica.Runtime.ProductionPatternElement.MaxCount
get

The maximum occurence count property (read-only).

Since
1.5
int PerCederberg.Grammatica.Runtime.ProductionPatternElement.MinCount
get

The minimum occurence count property (read-only).

Since
1.5

The documentation for this class was generated from the following file: