AP&C API Reference
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
Apac.Logic.PredicateSet Class Reference

This class defines a structure for creating a set of predictate expressions, such as would be used when composing a 'where' clause in a database query or an XPath qualifier. It is basically a simplified List{PredicateExpression} implemenation that allows iteration and some special methods for adding expressions. More...

Inheritance diagram for Apac.Logic.PredicateSet:

Public Types

enum class  PredicateConnective { And , Or }
 The logic connective operators. More...
 

Public Member Functions

 PredicateSet ()
 Creates a new, empty PredicateSet. More...
 
 PredicateSet (PredicateExpression firstExpression)
 Creates a new PredicateSet with its first PredicateExpression . More...
 
void Add (PredicateConnective connective, PredicateExpression expression)
 Adds an expression to the set with a logical conjunctive operator. If called on a set with no expressions in it this method simply adds the expression without any logical operator. More...
 
void Remove (PredicateExpression expression)
 Removes a predicate expression and the connective just before it. More...
 
PredicateExpression Find (Predicate< PredicateExpression > match)
 Standard delegate-base Find method for lists. More...
 
List< PredicateExpressionFindAll (Predicate< PredicateExpression > match)
 Standard delegate-base FindAll method for lists. More...
 
void First (PredicateExpression expression)
 Sets the first expression in the set. If called on a set that already has an expression in it this will raise an InvalidOperationException. More...
 
void And (PredicateExpression expression)
 Adds an expression to the set with a logical AND operator. If called on a set with no expressions in it this method simply adds the expression without any logical operator. This is a helper for More...
 
void Or (PredicateExpression expression)
 Adds an expression to the set with a logical OR operator. If called on a set with no expressions in it this method simply adds the expression without any logical operator. This is a helper for More...
 
void BeginPrecedence (PredicateExpression expression)
 Adds the beginning of a logical precedence block, used for grouping expressions together to achieve the desired predicate meaning, and the starting expression of that block. More...
 
void BeginPrecedence (PredicateConnective connective, PredicateExpression expression)
 Adds the beginning of a logical precedence block after the conjunctive, used for grouping expressions together to achieve the desired predicate meaning, and adds expression inside the precedence. More...
 
void BeginPrecedence ()
 Increments the precedence level by addinging a precedence opener to the set. This is more efficiently done with the BeginPrecedence(PredicateConnective, PredicateExpression) overload, but may be useful for some logical requirements. More...
 
void EndPrecedence (PredicateConnective connective, PredicateExpression expression)
 Adds the expression and the ending of a logical precedence block, used for grouping expressions together to achieve the desired predicate meaning. More...
 
void EndPrecedence ()
 Decrements the precedence level by adding a precedence closure to the set. This is more efficiently done with the EndPrecedence(PredicateConnective, PredicateExpression) overload, but may be useful for some logical requirements. More...
 
void Clear ()
 Clears the expression set. More...
 
override string ToString ()
 Returns the set of expressions in a verticle list. More...
 
void Append (PredicateConnective connective, PredicateSet predicateSet)
 Appends each PredicateExpression from predicateSet on to the end of this instance. More...
 
IEnumerator< PredicateExpressionGetEnumerator ()
 Provides an enumerator for iterating the expression set. More...
 
System.Xml.Schema.XmlSchema GetSchema ()
 Returns null. More...
 
void ReadXml (System.Xml.XmlReader reader)
 Deserializes the expression from the XmlReader. More...
 
void WriteXml (System.Xml.XmlWriter writer)
 Serializes the expression into the XmlWriter. More...
 
void GetObjectData (SerializationInfo info, StreamingContext context)
 Serializes (binary) a predicate set. More...
 

Static Public Member Functions

static PredicateSet FromString (string predicate)
 Creates a PredicateSet from a predicate expression string. The string may use standard SQL predicate syntax or use PredicateOperators./> More...
 

Protected Member Functions

 PredicateSet (SerializationInfo info, StreamingContext context)
 Deserializes a predicate set. This deserialization uses the order of the serialization entries to rebuild the object from the serialized data. More...
 

Properties

int PrecedenceLevel [get]
 Indicates the nested level of precedence. No precedence operators, or the proper number of matching open and close operators results in this property returning zero (0). A non-zero number is not good because it is likely to lead to faulting syntax in the component that translates this structure into a domain-specific language. More...
 
int Count [get]
 Returns the number of expressions in the set. More...
 
PredicateExpression this[int index] [get]
 Gets the JaguarSoftware.Logic.PredicateExpression at the specified index. More...
 

Detailed Description

This class defines a structure for creating a set of predictate expressions, such as would be used when composing a 'where' clause in a database query or an XPath qualifier. It is basically a simplified List{PredicateExpression} implemenation that allows iteration and some special methods for adding expressions.

Member Enumeration Documentation

◆ PredicateConnective

The logic connective operators.

Enumerator
And 

The logical conjunction operator.

Or 

The logical (inclusive) disjunction operator.

Constructor & Destructor Documentation

◆ PredicateSet() [1/3]

Apac.Logic.PredicateSet.PredicateSet ( SerializationInfo  info,
StreamingContext  context 
)
inlineprotected

Deserializes a predicate set. This deserialization uses the order of the serialization entries to rebuild the object from the serialized data.

Parameters
infoSee SerializationInfo.
contextSee StreamingContext.

◆ PredicateSet() [2/3]

Apac.Logic.PredicateSet.PredicateSet ( )
inline

Creates a new, empty PredicateSet.

◆ PredicateSet() [3/3]

Apac.Logic.PredicateSet.PredicateSet ( PredicateExpression  firstExpression)
inline

Creates a new PredicateSet with its first PredicateExpression .

Member Function Documentation

◆ Add()

void Apac.Logic.PredicateSet.Add ( PredicateConnective  connective,
PredicateExpression  expression 
)
inline

Adds an expression to the set with a logical conjunctive operator. If called on a set with no expressions in it this method simply adds the expression without any logical operator.

Parameters
connectiveThe logic conjunctive to with which the expression is added to the predicate.
expressionThe PredicateExpression to be added.

◆ And()

void Apac.Logic.PredicateSet.And ( PredicateExpression  expression)
inline

Adds an expression to the set with a logical AND operator. If called on a set with no expressions in it this method simply adds the expression without any logical operator. This is a helper for

Add(PredicateConjunctives.Add, expression ).

Parameters
expressionThe PredicateExpression to be added.

◆ Append()

void Apac.Logic.PredicateSet.Append ( PredicateConnective  connective,
PredicateSet  predicateSet 
)
inline

Appends each PredicateExpression from predicateSet on to the end of this instance.

Parameters
predicateSetThe PredicateSet to append.

◆ BeginPrecedence() [1/3]

void Apac.Logic.PredicateSet.BeginPrecedence ( )
inline

Increments the precedence level by addinging a precedence opener to the set. This is more efficiently done with the BeginPrecedence(PredicateConnective, PredicateExpression) overload, but may be useful for some logical requirements.

◆ BeginPrecedence() [2/3]

void Apac.Logic.PredicateSet.BeginPrecedence ( PredicateConnective  connective,
PredicateExpression  expression 
)
inline

Adds the beginning of a logical precedence block after the conjunctive, used for grouping expressions together to achieve the desired predicate meaning, and adds expression inside the precedence.

Parameters
connectiveThe logical conjunctive before beginning the precedence block.
expressionThe first expression inside the precedence block.

◆ BeginPrecedence() [3/3]

void Apac.Logic.PredicateSet.BeginPrecedence ( PredicateExpression  expression)
inline

Adds the beginning of a logical precedence block, used for grouping expressions together to achieve the desired predicate meaning, and the starting expression of that block.

Parameters
expressionThe first expression inside the precedence block.

◆ Clear()

void Apac.Logic.PredicateSet.Clear ( )
inline

Clears the expression set.

◆ EndPrecedence() [1/2]

void Apac.Logic.PredicateSet.EndPrecedence ( )
inline

Decrements the precedence level by adding a precedence closure to the set. This is more efficiently done with the EndPrecedence(PredicateConnective, PredicateExpression) overload, but may be useful for some logical requirements.

◆ EndPrecedence() [2/2]

void Apac.Logic.PredicateSet.EndPrecedence ( PredicateConnective  connective,
PredicateExpression  expression 
)
inline

Adds the expression and the ending of a logical precedence block, used for grouping expressions together to achieve the desired predicate meaning.

Parameters
connectiveThe logical conjunctive applied to expression .
expressionThe last expression inside the precedence block.

◆ Find()

PredicateExpression Apac.Logic.PredicateSet.Find ( Predicate< PredicateExpression match)
inline

Standard delegate-base Find method for lists.

Parameters
matchThe Predicate<PredicateExpression> used to indicate a match.
Returns
Returns the matching object or null.

◆ FindAll()

List<PredicateExpression> Apac.Logic.PredicateSet.FindAll ( Predicate< PredicateExpression match)
inline

Standard delegate-base FindAll method for lists.

Parameters
matchThe Predicate<PredicateExpression> used to indicate a match.
Returns
Returns the List{PredicateExpression} containing any matching objects.

◆ First()

void Apac.Logic.PredicateSet.First ( PredicateExpression  expression)
inline

Sets the first expression in the set. If called on a set that already has an expression in it this will raise an InvalidOperationException.

Parameters
expressionThe PredicateExpression to be added.

◆ FromString()

static PredicateSet Apac.Logic.PredicateSet.FromString ( string  predicate)
inlinestatic

Creates a PredicateSet from a predicate expression string. The string may use standard SQL predicate syntax or use PredicateOperators./>

Parameters
predicateThe predicate set to transform into an object.
Returns
Returns a PredicateSet representing the logic give by predicate .

◆ GetEnumerator()

IEnumerator<PredicateExpression> Apac.Logic.PredicateSet.GetEnumerator ( )
inline

Provides an enumerator for iterating the expression set.

Returns

◆ GetObjectData()

void Apac.Logic.PredicateSet.GetObjectData ( SerializationInfo  info,
StreamingContext  context 
)
inline

Serializes (binary) a predicate set.

Parameters
infoSee SerializationInfo.
contextSee StreamingContext.

◆ GetSchema()

System.Xml.Schema.XmlSchema Apac.Logic.PredicateSet.GetSchema ( )
inline

Returns null.

Returns
Returns null.

◆ Or()

void Apac.Logic.PredicateSet.Or ( PredicateExpression  expression)
inline

Adds an expression to the set with a logical OR operator. If called on a set with no expressions in it this method simply adds the expression without any logical operator. This is a helper for

Add(PredicateConjunctives.Or, expression ).

Parameters
expressionThe PredicateExpression to be added.

◆ ReadXml()

void Apac.Logic.PredicateSet.ReadXml ( System.Xml.XmlReader  reader)
inline

Deserializes the expression from the XmlReader.

Parameters
readerThe reader from which the data is read.

◆ Remove()

void Apac.Logic.PredicateSet.Remove ( PredicateExpression  expression)
inline

Removes a predicate expression and the connective just before it.

Parameters
expressionThe expression to be removed.

◆ ToString()

override string Apac.Logic.PredicateSet.ToString ( )
inline

Returns the set of expressions in a verticle list.

Returns
Returns a string representation of the set.

◆ WriteXml()

void Apac.Logic.PredicateSet.WriteXml ( System.Xml.XmlWriter  writer)
inline

Serializes the expression into the XmlWriter.

Parameters
writerThe writer into which the data will be serialized.

Property Documentation

◆ Count

int Apac.Logic.PredicateSet.Count
get

Returns the number of expressions in the set.

◆ PrecedenceLevel

int Apac.Logic.PredicateSet.PrecedenceLevel
get

Indicates the nested level of precedence. No precedence operators, or the proper number of matching open and close operators results in this property returning zero (0). A non-zero number is not good because it is likely to lead to faulting syntax in the component that translates this structure into a domain-specific language.

◆ this[int index]

PredicateExpression Apac.Logic.PredicateSet.this[int index]
get

Gets the JaguarSoftware.Logic.PredicateExpression at the specified index.

Returns the JaguarSoftware.Logic.PredicateExpression at the specified index.


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