NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Config.Syntax.GraphSetSyntaxNode Class Reference
Inheritance diagram for Ntp.Analyzer.Config.Syntax.GraphSetSyntaxNode:
Collaboration diagram for Ntp.Analyzer.Config.Syntax.GraphSetSyntaxNode:

Public Member Functions

 GraphSetSyntaxNode (string name, Symbol owner, int line)
 
- Public Member Functions inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< GraphSetConfiguration >
void Add (ISyntaxNode node)
 
void Assemble (ISyntaxNode node)
 
Compile ()
 
void CompileNode ()
 
IEnumerator< ISyntaxNodeGetEnumerator ()
 
void Resolve (SymbolTable table)
 
void Validate (SymbolTable table)
 

Protected Member Functions

override GraphSetConfiguration InternalCompile ()
 
override void InternalResolve (SymbolTable table)
 
override void ValidateMandatories ()
 Override to validates the mandatory types in this syntax node. More...
 
override void ValidateReferences (SymbolTable table)
 
override void ValidateTypes ()
 Override to validates the types in this syntax node. More...
 
- Protected Member Functions inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< GraphSetConfiguration >
 SyntaxNode (Symbol symbol, string name, int line, bool requirePath=false)
 
void AddError (string message)
 
void AddReferenceNameError (ISyntaxNode node, string keyword, string name)
 
void AddReferenceTypeError (ISyntaxNode node, string keyword, string section, string name)
 
void CheckAllIsPresent (IEnumerable< Symbol > list)
 
void CheckIsUnique (IEnumerable< Symbol > list)
 
Uri CheckLink (string link, string keyword)
 
void CheckOneIsPresent (IEnumerable< Symbol > list)
 
void CheckOnlyOneIsPresent (IEnumerable< Symbol > list)
 
void CheckTypeIs< TU > (Symbol symbol)
 
void CheckTypeIs< TU, TV > (Symbol symbol)
 
virtual void InternalResolve (SymbolTable table)
 Override to resolve references to other syntax nodes from this syntax node. More...
 
virtual void ValidateReferences (SymbolTable table)
 Override to validates the references in this syntax node. More...
 

Private Attributes

readonly List< ISyntaxNodegraphs
 
readonly Symbol owner
 

Additional Inherited Members

- Public Attributes inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< GraphSetConfiguration >
ConfigurationNode CompiledNode
 
IEnumerable< string > Errors
 
bool HasErrors
 
- Properties inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< GraphSetConfiguration >
int Line [get]
 
string Name [get]
 
List< ISyntaxNodeNodes [get]
 
bool RequirePath [get]
 
Symbol Symbol [get]
 

Detailed Description

Definition at line 31 of file GraphSetSyntaxNode.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Config.Syntax.GraphSetSyntaxNode.GraphSetSyntaxNode ( string  name,
Symbol  owner,
int  line 
)
inline

Definition at line 33 of file GraphSetSyntaxNode.cs.

References Ntp.Analyzer.Config.Table.KeywordGraphSet.

34  : base(Symbol.KeywordGraphSet, name, line)
35  {
36  graphs = new List<ISyntaxNode>();
37  this.owner = owner;
38  }

Member Function Documentation

override GraphSetConfiguration Ntp.Analyzer.Config.Syntax.GraphSetSyntaxNode.InternalCompile ( )
inlineprotectedvirtual

Implements Ntp.Analyzer.Config.Syntax.SyntaxNode< GraphSetConfiguration >.

Definition at line 43 of file GraphSetSyntaxNode.cs.

References Ntp.Analyzer.Config.Syntax.SyntaxNode< T >.Add().

44  {
45  var title = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordTitle) as StringSettingNode;
46  var linkIndex = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordLinkIndex) as IntegerSettingNode;
47 
48  var list = new List<GraphBaseConfiguration>();
49  foreach (var graph in graphs)
50  {
51  if (graph is HostGraphSyntaxNode)
52  {
53  list.Add((graph as HostGraphSyntaxNode).Compile());
54  }
55  else if (graph is TrafficGraphSyntaxNode)
56  {
57  list.Add((graph as TrafficGraphSyntaxNode).Compile());
58  }
59  else if (graph is PeerGraphSyntaxNode)
60  {
61  list.Add((graph as PeerGraphSyntaxNode).Compile());
62  }
63  else
64  {
65  AddError("Internal error in configuration compiler: GraphSetConfiguration");
66  }
67  }
68 
69  return new GraphSetConfiguration(
70  Name,
71  title?.Value,
72  linkIndex?.Value,
73  list
74  );
75  }
void Add(ISyntaxNode node)
Definition: SyntaxNode.cs:66

Here is the call graph for this function:

override void Ntp.Analyzer.Config.Syntax.GraphSetSyntaxNode.InternalResolve ( SymbolTable  table)
inlineprotected

Definition at line 77 of file GraphSetSyntaxNode.cs.

References Ntp.Analyzer.Config.Table.SymbolTable.Lookup().

78  {
79  graphs.AddRange(
80  Nodes.
81  Where(n => n.Symbol == Symbol.KeywordGraph).
82  Cast<StringSettingNode>().
83  Select(graph => table.Lookup(graph.Value))
84  );
85  }
ISyntaxNode Lookup(string name)
Definition: SymbolTable.cs:41

Here is the call graph for this function:

override void Ntp.Analyzer.Config.Syntax.GraphSetSyntaxNode.ValidateMandatories ( )
inlineprotectedvirtual

Override to validates the mandatory types in this syntax node.

When overriding this method do not call the base method.

Reimplemented from Ntp.Analyzer.Config.Syntax.SyntaxNode< GraphSetConfiguration >.

Definition at line 87 of file GraphSetSyntaxNode.cs.

88  {
89  CheckIsUnique(new List<Symbol>
90  {
91  Symbol.KeywordLinkIndex,
92  Symbol.KeywordTitle
93  });
94 
95  CheckAllIsPresent(new List<Symbol> {Symbol.KeywordGraph});
96  }
override void Ntp.Analyzer.Config.Syntax.GraphSetSyntaxNode.ValidateReferences ( SymbolTable  table)
inlineprotected

Definition at line 98 of file GraphSetSyntaxNode.cs.

References Ntp.Analyzer.Config.Table.Keyword.Find(), and Ntp.Analyzer.Config.Table.Keyword.Name.

99  {
100  string keyword = Keyword.Find(Symbol.KeywordGraph).Name;
101  string peerGraphWord = Keyword.Find(Symbol.KeywordPeerGraph).Name;
102  var graphNames = Nodes.Where(n => n.Symbol == Symbol.KeywordGraph).Cast<StringSettingNode>();
103 
104  foreach (var graph in graphNames)
105  {
106  var reference = table.Lookup(graph.Value);
107  if (reference == null)
108  {
109  AddReferenceNameError(graph, keyword, graph.Value);
110  }
111  else if (owner == Symbol.KeywordHostPage &&
112  !(reference is HostGraphSyntaxNode || reference is TrafficGraphSyntaxNode))
113  {
114  AddReferenceTypeError(graph, keyword, keyword, graph.Value);
115  }
116  else if (owner == Symbol.KeywordPeerPage && !(reference is PeerGraphSyntaxNode))
117  {
118  AddReferenceTypeError(graph, keyword, peerGraphWord, graph.Value);
119  }
120  }
121  }
void AddReferenceTypeError(ISyntaxNode node, string keyword, string section, string name)
Definition: SyntaxNode.cs:441
static Keyword Find(Symbol symbol)
Definition: Keyword.cs:216
void AddReferenceNameError(ISyntaxNode node, string keyword, string name)
Definition: SyntaxNode.cs:428
ISyntaxNode Lookup(string name)
Definition: SymbolTable.cs:41

Here is the call graph for this function:

override void Ntp.Analyzer.Config.Syntax.GraphSetSyntaxNode.ValidateTypes ( )
inlineprotectedvirtual

Override to validates the types in this syntax node.

When overriding this method do not call the base method.

Reimplemented from Ntp.Analyzer.Config.Syntax.SyntaxNode< GraphSetConfiguration >.

Definition at line 123 of file GraphSetSyntaxNode.cs.

124  {
125  CheckTypeIs<IntegerSettingNode>(Symbol.KeywordLinkIndex);
126  CheckTypeIs<StringSettingNode>(Symbol.KeywordTitle);
127  CheckTypeIs<StringSettingNode>(Symbol.KeywordGraph);
128  }

Member Data Documentation

readonly List<ISyntaxNode> Ntp.Analyzer.Config.Syntax.GraphSetSyntaxNode.graphs
private

Definition at line 40 of file GraphSetSyntaxNode.cs.

readonly Symbol Ntp.Analyzer.Config.Syntax.GraphSetSyntaxNode.owner
private

Definition at line 41 of file GraphSetSyntaxNode.cs.


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