ListExpression

Overview

The ListExpression class is an implementation of ListExpression represents the collection of WhereExpression objects.

The ListExpression class is used to build specified expressions with multiple WhereExpression objects. For example, in the DataAbstract Dynamic Where sample, the ListExpression class is used to build specified binary expressions:

private WhereExpression PrepareWhereExpression(int aIndex)
{
...
lResult = new BinaryExpression(

              new BinaryExpression(
                  new BinaryExpression(
                      new FieldExpression("WorkerPosition"),
                      new ConstantExpression("Sales Representative", DataType.String),
                      BinaryOperator.Equal),
                  new BinaryExpression(
                      new FieldExpression("WorkerID"),
                      new ConstantExpression(120),
                      BinaryOperator.Equal),
                      BinaryOperator.Or),

                  new BinaryExpression(
                      new FieldExpression("WorkerCity"),
                      new ListExpression(
                      new WhereExpression[]{ new ConstantExpression("Walla Walla WA",DataType.String),
                                             new ConstantExpression("New York CA", DataType.String),
                                             new ConstantExpression("Portland OR", DataType.String) }),
                      BinaryOperator.In),

                  BinaryOperator.And);
...                  
}

Location

 

constructor

Creates a new instance of the ListExpression class.

 

constructor

 

ListExpression()

constructor (WhereExpression[])

Creates a new instance of the ListExpression class with the provided collection of WhereExpression items.

 

constructor(params anItems: array of WhereExpression)

 

ListExpression(WhereExpression[]... anItems)

Parameters:

  • anItems: The child expressions of the list expression.

add (Integer, WhereExpression)

Adds a new expression at the specified position to the current list of WhereExpression items.

 

method add(anIndex: Integer; anItem: WhereExpression)

 

void add(Integer anIndex, WhereExpression anItem)

Parameters:

  • anIndex: The position where the expression is to be added.
  • anItem: The expression to be added to the list.

Adds a new expression to the current list of WhereExpression items.

 

method add(anItem: WhereExpression)

 

void add(WhereExpression anItem)

Parameters:

  • anItem: The expression to be added to the list.

Creates a new BinaryExpression from the given aLeft and aRight operands using BinaryOperator.

 

class method combine(aLeft: WhereExpression; aRight: WhereExpression): WhereExpression

 

static WhereExpression combine(WhereExpression aLeft, WhereExpression aRight)

Parameters:

  • aLeft: The left operand to be combined.
  • aRight: The right operand to be combined.

Creates a new BinaryExpression from the given aLeft and aRight operands using the given operator.

 

class method combine(aLeft: WhereExpression; aRight: WhereExpression; anOperator: BinaryOperator): WhereExpression

 

static WhereExpression combine(WhereExpression aLeft, WhereExpression aRight, BinaryOperator anOperator)

Parameters:

  • aLeft: The left operand to be combined.
  • aRight: The right operand to be combined.
  • anOperator: The operator to be used in combining.

Count

 

property Count: Integer read;

 

Integer Count { __get; }

fromString    (declared in WhereExpression)

Creates a new WhereExpression from the specified string, which should contain XML node in the correct Dynamic Where XML Format.

 

class method fromString(anXml: String): WhereExpression

 

static WhereExpression fromString(String anXml)

Parameters:

  • anXml: The given XML string.

fromStringToSql    (declared in WhereExpression)

A helper method to convert a XML string into SQL string.

 

class method fromStringToSql(anXml: String): String

 

static String fromStringToSql(String anXml)

Parameters:

  • anXml: The XML string to be converted.

fromXmlNode    (declared in WhereExpression)

Creates a new WhereExpression from the given XML node, which should be in the correct Dynamic Where XML Format.

 

class method fromXmlNode(aNode: Node): WhereExpression

 

static WhereExpression fromXmlNode(Node aNode)

Parameters:

  • aNode: The XML node to be parsed.

Item

 

property Item[anIndex: Integer]: WhereExpression read write;

 

WhereExpression Item[Integer anIndex] { __get; __set; }

Kind

 

property Kind: WhereKind read;

 

WhereKind Kind { __get; }

parseExpression    (declared in WhereExpression)

 

class method parseExpression(node: Node): WhereExpression

 

static WhereExpression parseExpression(Node node)

Parameters:

  • node:

readFromXml

Initializes the current ListExpression from the given XML node.

 

method readFromXml(aNode: Node)

 

void readFromXml(Node aNode)

Parameters:

  • aNode: The node that contains the serialized expression.

remove (Integer)

Removes the expression at the specified position from the current list .

 

method remove(anIndex: Integer)

 

void remove(Integer anIndex)

Parameters:

  • anIndex: The position of the expression that is to be removed.

remove (WhereExpression)

Removes the provided expression from the current list.

 

method remove(anItem: WhereExpression)

 

void remove(WhereExpression anItem)

Parameters:

  • anItem: The expression to be removed.

toSqlString    (declared in WhereExpression)

A helper method that wraps the similar one with the string builder and returns a SQL string.

 

method toSqlString: String

 

String toSqlString()

toSqlString (StringBuilder)

Creates an SQL representation of macro expression and appends it to the provided StringBuilder. The resulting SQL string will have the following format: [WhereExpression1.ToSQLString,...,WhereExpressionN.ToSQLString].

 

method toSqlString(aDestination: StringBuilder)

 

void toSqlString(StringBuilder aDestination)

Parameters:

  • aDestination: The destination string builder that will contain the string representation of the list.

toString    (declared in WhereExpression)

Returns a SQL string representation of the current expression.

 

method toString: String

 

String toString()

toXmlNode    (declared in WhereExpression)

Creates a query node (in the Dynamic Where XML Format) from the current expression.

 

method toXmlNode: Node

 

Node toXmlNode()

toXmlString    (declared in WhereExpression)

Creates the query node (in the Dynamic Where XML Format) from current expression and returns it in the string format.

 

method toXmlString: String

 

String toXmlString()

validate    (declared in WhereExpression)

Validates the current expression with the WhereValidator and returns TRUE if it contains no errors. The main purpose of the validation is to scan all objects of WhereExpession tree and make sure that they contain correct field names.

 

method validate: Boolean

 

Boolean validate()

validate (WhereExpression): Boolean    (declared in WhereExpression)

Validates the provided WhereExpression with the WhereValidator and returns TRUE if it contains no errors. The main purpose of the validation is to scan all objects of WhereExpession tree and make sure that it contains correct field names.

 

class method validate(anExpression: WhereExpression): Boolean

 

static Boolean validate(WhereExpression anExpression)

Parameters:

  • anExpression: The expression to be validated.

writeToXml

Creates Xml node (in the Dynamic Where XML Format) from the current ListExpression and appends it to the given parent node.

 

method writeToXml(aNode: Node)

 

void writeToXml(Node aNode)

Parameters:

  • aNode: The parent XML node.

 

Count

 

property Count: Integer read;

 

Integer Count { __get; }

Item

 

property Item[anIndex: Integer]: WhereExpression read write;

 

WhereExpression Item[Integer anIndex] { __get; __set; }

Kind

 

property Kind: WhereKind read;

 

WhereKind Kind { __get; }

 

Creates a new BinaryExpression from the given aLeft and aRight operands using BinaryOperator.

 

class method combine(aLeft: WhereExpression; aRight: WhereExpression): WhereExpression

 

static WhereExpression combine(WhereExpression aLeft, WhereExpression aRight)

Parameters:

  • aLeft: The left operand to be combined.
  • aRight: The right operand to be combined.

Creates a new BinaryExpression from the given aLeft and aRight operands using the given operator.

 

class method combine(aLeft: WhereExpression; aRight: WhereExpression; anOperator: BinaryOperator): WhereExpression

 

static WhereExpression combine(WhereExpression aLeft, WhereExpression aRight, BinaryOperator anOperator)

Parameters:

  • aLeft: The left operand to be combined.
  • aRight: The right operand to be combined.
  • anOperator: The operator to be used in combining.

fromString    (declared in WhereExpression)

Creates a new WhereExpression from the specified string, which should contain XML node in the correct Dynamic Where XML Format.

 

class method fromString(anXml: String): WhereExpression

 

static WhereExpression fromString(String anXml)

Parameters:

  • anXml: The given XML string.

fromStringToSql    (declared in WhereExpression)

A helper method to convert a XML string into SQL string.

 

class method fromStringToSql(anXml: String): String

 

static String fromStringToSql(String anXml)

Parameters:

  • anXml: The XML string to be converted.

fromXmlNode    (declared in WhereExpression)

Creates a new WhereExpression from the given XML node, which should be in the correct Dynamic Where XML Format.

 

class method fromXmlNode(aNode: Node): WhereExpression

 

static WhereExpression fromXmlNode(Node aNode)

Parameters:

  • aNode: The XML node to be parsed.

parseExpression    (declared in WhereExpression)

 

class method parseExpression(node: Node): WhereExpression

 

static WhereExpression parseExpression(Node node)

Parameters:

  • node:

validate (WhereExpression): Boolean    (declared in WhereExpression)

Validates the provided WhereExpression with the WhereValidator and returns TRUE if it contains no errors. The main purpose of the validation is to scan all objects of WhereExpession tree and make sure that it contains correct field names.

 

class method validate(anExpression: WhereExpression): Boolean

 

static Boolean validate(WhereExpression anExpression)

Parameters:

  • anExpression: The expression to be validated.

 

constructor

Creates a new instance of the ListExpression class.

 

constructor

 

ListExpression()

constructor (WhereExpression[])

Creates a new instance of the ListExpression class with the provided collection of WhereExpression items.

 

constructor(params anItems: array of WhereExpression)

 

ListExpression(WhereExpression[]... anItems)

Parameters:

  • anItems: The child expressions of the list expression.

add (Integer, WhereExpression)

Adds a new expression at the specified position to the current list of WhereExpression items.

 

method add(anIndex: Integer; anItem: WhereExpression)

 

void add(Integer anIndex, WhereExpression anItem)

Parameters:

  • anIndex: The position where the expression is to be added.
  • anItem: The expression to be added to the list.

Adds a new expression to the current list of WhereExpression items.

 

method add(anItem: WhereExpression)

 

void add(WhereExpression anItem)

Parameters:

  • anItem: The expression to be added to the list.

readFromXml

Initializes the current ListExpression from the given XML node.

 

method readFromXml(aNode: Node)

 

void readFromXml(Node aNode)

Parameters:

  • aNode: The node that contains the serialized expression.

remove (Integer)

Removes the expression at the specified position from the current list .

 

method remove(anIndex: Integer)

 

void remove(Integer anIndex)

Parameters:

  • anIndex: The position of the expression that is to be removed.

remove (WhereExpression)

Removes the provided expression from the current list.

 

method remove(anItem: WhereExpression)

 

void remove(WhereExpression anItem)

Parameters:

  • anItem: The expression to be removed.

toSqlString    (declared in WhereExpression)

A helper method that wraps the similar one with the string builder and returns a SQL string.

 

method toSqlString: String

 

String toSqlString()

toSqlString (StringBuilder)

Creates an SQL representation of macro expression and appends it to the provided StringBuilder. The resulting SQL string will have the following format: [WhereExpression1.ToSQLString,...,WhereExpressionN.ToSQLString].

 

method toSqlString(aDestination: StringBuilder)

 

void toSqlString(StringBuilder aDestination)

Parameters:

  • aDestination: The destination string builder that will contain the string representation of the list.

toString    (declared in WhereExpression)

Returns a SQL string representation of the current expression.

 

method toString: String

 

String toString()

toXmlNode    (declared in WhereExpression)

Creates a query node (in the Dynamic Where XML Format) from the current expression.

 

method toXmlNode: Node

 

Node toXmlNode()

toXmlString    (declared in WhereExpression)

Creates the query node (in the Dynamic Where XML Format) from current expression and returns it in the string format.

 

method toXmlString: String

 

String toXmlString()

validate    (declared in WhereExpression)

Validates the current expression with the WhereValidator and returns TRUE if it contains no errors. The main purpose of the validation is to scan all objects of WhereExpession tree and make sure that they contain correct field names.

 

method validate: Boolean

 

Boolean validate()

writeToXml

Creates Xml node (in the Dynamic Where XML Format) from the current ListExpression and appends it to the given parent node.

 

method writeToXml(aNode: Node)

 

void writeToXml(Node aNode)

Parameters:

  • aNode: The parent XML node.