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

Public Member Functions

 HostPageSyntaxNode (string name, int line)
 
- Public Member Functions inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< HostPageConfiguration >
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 HostPageConfiguration 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< HostPageConfiguration >
 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
 
PeerPageSyntaxNode peerPagesNode
 

Additional Inherited Members

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

Detailed Description

Definition at line 32 of file HostPageSyntaxNode.cs.

Constructor & Destructor Documentation

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

Definition at line 34 of file HostPageSyntaxNode.cs.

References Ntp.Analyzer.Config.Table.KeywordHostPage.

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

Member Function Documentation

override HostPageConfiguration Ntp.Analyzer.Config.Syntax.HostPageSyntaxNode.InternalCompile ( )
inlineprotectedvirtual

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

Definition at line 42 of file HostPageSyntaxNode.cs.

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

43  {
44  var frequency = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordFrequency) as IntegerSettingNode;
45  var initialRun = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordInitialRun) as BooleanSettingNode;
46  var fixedRun = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordFixedRun) as BooleanSettingNode;
47  var title = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordTitle) as StringSettingNode ??
48  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPageTitle) as StringSettingNode;
49  var poolMember = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPoolMember) as BooleanSettingNode;
50  var queryDirect = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordQueryDirect) as BooleanSettingNode;
51  var pageTemplate = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPageTemplate) as PageThemeNode;
52  var pageTime = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPageTime) as TimeStampNode ??
53  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordTimeStamp) as TimeStampNode;
54  var dest = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordDestinations) as FileDestinationSyntaxNode;
55  var summaries = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordSummaries) as SummariesSyntaxNode;
56  var graphSets = Nodes.Where(n => n.Symbol == Symbol.KeywordGraphSet).Cast<GraphSetSyntaxNode>();
57 
58  return new HostPageConfiguration(
59  Name,
60  frequency?.Value,
61  initialRun?.Value,
62  fixedRun?.Value,
63  pageTime?.DateTimeKind,
64  pageTemplate?.PageTheme,
65  title?.Value,
66  poolMember?.Value,
67  queryDirect?.Value,
68  location,
70  graphSets.Select(g => g.Compile()),
71  summaries?.Compile(),
72  dest?.Compile()
73  );
74  }
Configuration for a HTML page showing status and graphs for a hosted NTP server.

Here is the call graph for this function:

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

Definition at line 76 of file HostPageSyntaxNode.cs.

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

77  {
78  var page = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPeerPage) as StringSettingNode;
79  if (page != null)
80  peerPagesNode = table.Lookup(page.Value) as PeerPageSyntaxNode;
81  }
ISyntaxNode Lookup(string name)
Definition: SymbolTable.cs:41

Here is the call graph for this function:

override void Ntp.Analyzer.Config.Syntax.HostPageSyntaxNode.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< HostPageConfiguration >.

Definition at line 83 of file HostPageSyntaxNode.cs.

84  {
85  CheckIsUnique(new List<Symbol>
86  {
87  Symbol.KeywordFrequency,
88  Symbol.KeywordInitialRun,
89  Symbol.KeywordFixedRun,
90  Symbol.KeywordTitle,
91  Symbol.KeywordPageTitle,
92  Symbol.KeywordPoolMember,
93  Symbol.KeywordQueryDirect,
94  Symbol.KeywordPageTemplate,
95  Symbol.KeywordPageTime,
96  Symbol.KeywordTimeStamp,
97  Symbol.KeywordPeerPage,
98  Symbol.KeywordLink
99  });
100 
101  CheckOnlyOneIsPresent(new List<Symbol>
102  {
103  Symbol.KeywordTitle,
104  Symbol.KeywordPageTitle
105  });
106 
107  CheckOnlyOneIsPresent(new List<Symbol>
108  {
109  Symbol.KeywordPageTime,
110  Symbol.KeywordTimeStamp
111  });
112 
113  CheckAllIsPresent(new List<Symbol> {Symbol.KeywordDestinations});
114  }
override void Ntp.Analyzer.Config.Syntax.HostPageSyntaxNode.ValidateReferences ( SymbolTable  table)
inlineprotected

Definition at line 116 of file HostPageSyntaxNode.cs.

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

117  {
118  var pageName = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPeerPage) as StringSettingNode;
119  if (pageName != null)
120  {
121  string keyword = Keyword.Find(Symbol.KeywordPeerPage).Name;
122  var reference = table.Lookup(pageName.Value);
123  if (reference == null)
124  AddReferenceNameError(pageName, keyword, pageName.Value);
125  else if (!(reference is PeerPageSyntaxNode))
126  AddReferenceTypeError(pageName, keyword, keyword, pageName.Value);
127  }
128 
129  var link = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordLink) as StringSettingNode;
130  if (link == null)
131  return;
132 
133  var linkKeyword = Keyword.Find(Symbol.KeywordLink).Name;
134  location = CheckLink(link.Value, linkKeyword);
135  }
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.HostPageSyntaxNode.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< HostPageConfiguration >.

Definition at line 137 of file HostPageSyntaxNode.cs.

138  {
139  CheckTypeIs<IntegerSettingNode>(Symbol.KeywordFrequency);
140  CheckTypeIs<BooleanSettingNode>(Symbol.KeywordInitialRun);
141  CheckTypeIs<BooleanSettingNode>(Symbol.KeywordFixedRun);
142  CheckTypeIs<StringSettingNode>(Symbol.KeywordTitle);
143  CheckTypeIs<StringSettingNode>(Symbol.KeywordPageTitle);
144  CheckTypeIs<StringSettingNode>(Symbol.KeywordPeerPage);
145  CheckTypeIs<StringSettingNode>(Symbol.KeywordLink);
146  CheckTypeIs<BooleanSettingNode>(Symbol.KeywordPoolMember);
147  CheckTypeIs<BooleanSettingNode>(Symbol.KeywordQueryDirect);
148  CheckTypeIs<PageThemeNode>(Symbol.KeywordPageTemplate);
149  CheckTypeIs<TimeStampNode>(Symbol.KeywordPageTime);
150  CheckTypeIs<TimeStampNode>(Symbol.KeywordTimeStamp);
151  }

Member Data Documentation

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

Definition at line 39 of file HostPageSyntaxNode.cs.

PeerPageSyntaxNode Ntp.Analyzer.Config.Syntax.HostPageSyntaxNode.peerPagesNode
private

Definition at line 40 of file HostPageSyntaxNode.cs.


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