C# Class ABB.Swum.Nodes.PhraseNode

Represents a phrase, consisting of one or more words.
Inheritance: Node
显示文件 Open project: abb-iss/Swum.NET Class Usage Examples

Public Methods

Method Description
Add ( PhraseNode phrase ) : void

Concatenates the supplied phrase to the end of the current phrase.

Add ( WordNode word ) : void

Adds the given word to the end of the phrase.

FirstWord ( ) : WordNode

Returns the first word in the phrase.

GetNewEmpty ( ) : PhraseNode

Creates a new empty node of the same type.

GetParse ( ) : PhraseNode

Returns a PhraseNode containing the node's parsed name, i.e. returns itself.

GetPhrase ( ) : Collection

Returns a list of the words in the phrase.

GetWord ( int wordIndex ) : WordNode

Returns the word within the phrase at the given index.

IsEmpty ( ) : bool

Reports whether there are any words in the phrase.

LastWord ( ) : WordNode

Returns the last word in the phrase.

Parse ( string source ) : PhraseNode

Creates a PhraseNode by parsing the given string representation.

PhraseNode ( ) : System

Creates a new empty PhraseNode.

PhraseNode ( IEnumerable words, Location location, bool containsPreposition ) : System

Creates a new PhraseNode that contains the given words.

PhraseNode ( IEnumerable words ) : System

Creates a new PhraseNode, containing the given words.

PhraseNode ( string id, IdSplitter splitter ) : System

Creates a new PhraseNode that contains the words resulting from splitting the given identifier.

RemoveWord ( int wordIndex ) : void

Removes the word from the phrase at the given index.

SetLocation ( Location location ) : void

Sets the program location of the node.

Size ( ) : int

Returns the number of words in the phrase.

ToPlainString ( ) : string

Return a string representation of the PhraseNode without any added SWUM markup.

ToString ( ) : string

Creates a string representation of the PhraseNode, containing a string version of each word.

this ( int wordIndex ) : WordNode

Returns the word within the phrase at the given index.

Protected Methods

Method Description
InitWords ( IEnumerable words ) : void

Initializes the list of WordNodes by creating a new node for each word string.

Method Details

Add() public method

Concatenates the supplied phrase to the end of the current phrase.
public Add ( PhraseNode phrase ) : void
phrase PhraseNode The phrase to add.
return void

Add() public method

Adds the given word to the end of the phrase.
public Add ( WordNode word ) : void
word WordNode The word to add.
return void

FirstWord() public method

Returns the first word in the phrase.
public FirstWord ( ) : WordNode
return WordNode

GetNewEmpty() public method

Creates a new empty node of the same type.
public GetNewEmpty ( ) : PhraseNode
return PhraseNode

GetParse() public method

Returns a PhraseNode containing the node's parsed name, i.e. returns itself.
public GetParse ( ) : PhraseNode
return PhraseNode

GetPhrase() public method

Returns a list of the words in the phrase.
public GetPhrase ( ) : Collection
return Collection

GetWord() public method

Returns the word within the phrase at the given index.
public GetWord ( int wordIndex ) : WordNode
wordIndex int The index of the word to get.
return WordNode

InitWords() protected method

Initializes the list of WordNodes by creating a new node for each word string.
protected InitWords ( IEnumerable words ) : void
words IEnumerable String versions of the words in the phrase.
return void

IsEmpty() public method

Reports whether there are any words in the phrase.
public IsEmpty ( ) : bool
return bool

LastWord() public method

Returns the last word in the phrase.
public LastWord ( ) : WordNode
return WordNode

Parse() public static method

Creates a PhraseNode by parsing the given string representation.
public static Parse ( string source ) : PhraseNode
source string The string to parse the PhraseNode from.
return PhraseNode

PhraseNode() public method

Creates a new empty PhraseNode.
public PhraseNode ( ) : System
return System

PhraseNode() public method

Creates a new PhraseNode that contains the given words.
public PhraseNode ( IEnumerable words, Location location, bool containsPreposition ) : System
words IEnumerable A list of the words in the phrase.
location Location The program location of the phrase.
containsPreposition bool Whether the phrase contains any prepositions or not.
return System

PhraseNode() public method

Creates a new PhraseNode, containing the given words.
public PhraseNode ( IEnumerable words ) : System
words IEnumerable The words in the phrase.
return System

PhraseNode() public method

Creates a new PhraseNode that contains the words resulting from splitting the given identifier.
public PhraseNode ( string id, IdSplitter splitter ) : System
id string A program identifier.
splitter ABB.Swum.IdSplitter An IdSplitter to split the given identifier into words.
return System

RemoveWord() public method

Removes the word from the phrase at the given index.
public RemoveWord ( int wordIndex ) : void
wordIndex int The index of the word to remove.
return void

SetLocation() public method

Sets the program location of the node.
public SetLocation ( Location location ) : void
location Location The location of the node.
return void

Size() public method

Returns the number of words in the phrase.
public Size ( ) : int
return int

ToPlainString() public method

Return a string representation of the PhraseNode without any added SWUM markup.
public ToPlainString ( ) : string
return string

ToString() public method

Creates a string representation of the PhraseNode, containing a string version of each word.
public ToString ( ) : string
return string

this() public method

Returns the word within the phrase at the given index.
public this ( int wordIndex ) : WordNode
wordIndex int The index of the word to get.
return WordNode