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

Public Member Functions

 HostSyntaxNode (string name, int line)
 
- Public Member Functions inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< HostConfiguration >
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 HostConfiguration InternalCompile ()
 
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< HostConfiguration >
 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

Uri location
 

Additional Inherited Members

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

Detailed Description

Definition at line 32 of file HostSyntaxNode.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Config.Syntax.HostSyntaxNode.HostSyntaxNode ( string  name,
int  line 
)
inline

Definition at line 34 of file HostSyntaxNode.cs.

References Ntp.Analyzer.Config.Table.KeywordHost.

35  : base(Symbol.KeywordHost, name, line)
36  {
37  }

Member Function Documentation

override HostConfiguration Ntp.Analyzer.Config.Syntax.HostSyntaxNode.InternalCompile ( )
inlineprotectedvirtual

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

Definition at line 41 of file HostSyntaxNode.cs.

References c.

42  {
43  var hostId = Nodes.Single(n => n.Symbol == Symbol.KeywordHostId) as IntegerSettingNode;
44  var hostName = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordIp) as StringSettingNode ??
45  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordAddress) as StringSettingNode ??
46  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordHostAddress) as StringSettingNode;
47  var hostType = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordHostType) as HostTypeNode;
48  var filePath = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordFilePath) as StringSettingNode;
49  var menu = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordMenu) as MenuSyntaxNode;
50  var aboutPage = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordAboutPage) as AboutPageSyntaxNode;
51  var page1 = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordHostGraphPage) as HostGraphPageSyntaxNode;
52  var page2 = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPeerGraphPage) as PeerGraphPageSyntaxNode;
53  var hostStats = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordHostStats) as StatSyntaxNode;
54  var hostIoStats = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordHostIoStats) as StatSyntaxNode;
55  var peerStats = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPeerStats) as StatSyntaxNode;
56  var driftStats = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordDriftStats) as StatSyntaxNode;
57  var hostGraphs = Nodes.Where(n => n.Symbol == Symbol.KeywordHostGraph).Cast<HostGraphSyntaxNode>();
58  var hostPages = Nodes.Where(n => n.Symbol == Symbol.KeywordHostPage).Cast<HostPageSyntaxNode>();
59  var peerGraphs = Nodes.Where(n => n.Symbol == Symbol.KeywordPeerGraph).Cast<PeerGraphSyntaxNode>();
60  var peerPages = Nodes.Where(n => n.Symbol == Symbol.KeywordPeerPage).Cast<PeerPageSyntaxNode>();
61  var trafficGraphs = Nodes.Where(n => n.Symbol == Symbol.KeywordTrafficGraph).Cast<TrafficGraphSyntaxNode>();
62  var summery = Nodes.Where(n => n.Symbol == Symbol.KeywordPeerSummaryPage).Cast<PeerSummaryPageSyntaxNode>();
63 
64  if (hostId == null)
65  {
66  throw new InvalidOperationException(@"Internal compiler error: HostSyntaxNode");
67  }
68 
69  return new HostConfiguration(
70  Name,
71  hostId.Value,
72  hostName?.Value,
73  hostType?.HostType,
74  filePath?.Value,
75  location,
76  aboutPage?.Compile(),
77  page1?.Compile(),
78  hostIoStats?.Compile(),
79  hostStats?.Compile(),
80  menu?.Compile(),
81  page2?.Compile(),
82  peerStats?.Compile(),
83  (DriftStatConfiguration) driftStats?.Compile(),
84  hostGraphs.Select(c => c.Compile()),
85  hostPages.Select(c => c.Compile()),
86  peerGraphs.Select(c => c.Compile()),
87  peerPages.Select(c => c.Compile()),
88  summery.Select(c => c.Compile()),
89  trafficGraphs.Select(c => c.Compile())
90  );
91  }
var c
Definition: bootstrap.min.js:6
override void Ntp.Analyzer.Config.Syntax.HostSyntaxNode.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< HostConfiguration >.

Definition at line 93 of file HostSyntaxNode.cs.

94  {
95  CheckIsUnique(new List<Symbol>
96  {
97  Symbol.KeywordHostId,
98  Symbol.KeywordFilePath,
99  Symbol.KeywordWebPath,
100  Symbol.KeywordHostType,
101  Symbol.KeywordTimeStamp,
102  Symbol.KeywordAboutPage,
103  Symbol.KeywordHostGraphPage,
104  Symbol.KeywordPeerGraphPage,
105  Symbol.KeywordMenu,
106  Symbol.KeywordHostStats,
107  Symbol.KeywordHostIoStats,
108  Symbol.KeywordPeerStats,
109  Symbol.KeywordDriftStats
110  });
111 
112  CheckAllIsPresent(new List<Symbol> {Symbol.KeywordHostId});
113 
114  if (Nodes.Count(n => n.RequirePath) != 0)
115  CheckAllIsPresent(new List<Symbol> {Symbol.KeywordFilePath});
116  }
override void Ntp.Analyzer.Config.Syntax.HostSyntaxNode.ValidateReferences ( SymbolTable  table)
inlineprotected

Definition at line 118 of file HostSyntaxNode.cs.

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

119  {
120  var webPath = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordWebPath) as StringSettingNode;
121  if (webPath == null)
122  return;
123 
124  var keyword = Keyword.Find(Symbol.KeywordLink).Name;
125  location = CheckLink(webPath.Value, keyword);
126  }
static Keyword Find(Symbol symbol)
Definition: Keyword.cs:216

Here is the call graph for this function:

override void Ntp.Analyzer.Config.Syntax.HostSyntaxNode.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< HostConfiguration >.

Definition at line 128 of file HostSyntaxNode.cs.

129  {
130  CheckTypeIs<IntegerSettingNode>(Symbol.KeywordHostId);
131  CheckTypeIs<StringSettingNode>(Symbol.KeywordFilePath);
132  CheckTypeIs<StringSettingNode>(Symbol.KeywordWebPath);
133  CheckTypeIs<HostTypeNode>(Symbol.KeywordHostType);
134  CheckTypeIs<TimeStampNode>(Symbol.KeywordTimeStamp);
135  }

Member Data Documentation

Uri Ntp.Analyzer.Config.Syntax.HostSyntaxNode.location
private

Definition at line 39 of file HostSyntaxNode.cs.


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