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

Public Member Functions

 PeerPageSyntaxNode (string name, int line)
 
- Public Member Functions inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< PeerPageConfiguration >
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 PeerPageConfiguration 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< PeerPageConfiguration >
 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< PeerPageConfiguration >
ConfigurationNode CompiledNode
 
IEnumerable< string > Errors
 
bool HasErrors
 
- Properties inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< PeerPageConfiguration >
int Line [get]
 
string Name [get]
 
List< ISyntaxNodeNodes [get]
 
bool RequirePath [get]
 
Symbol Symbol [get]
 

Detailed Description

Definition at line 32 of file PeerPageSyntaxNode.cs.

Constructor & Destructor Documentation

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

Definition at line 34 of file PeerPageSyntaxNode.cs.

References Ntp.Analyzer.Config.Table.KeywordPeerPage.

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

Member Function Documentation

override PeerPageConfiguration Ntp.Analyzer.Config.Syntax.PeerPageSyntaxNode.InternalCompile ( )
inlineprotectedvirtual

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

Definition at line 41 of file PeerPageSyntaxNode.cs.

42  {
43  var frequency = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordFrequency) as IntegerSettingNode;
44  var initialRun = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordInitialRun) as BooleanSettingNode;
45  var fixedRun = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordFixedRun) as BooleanSettingNode;
46  var title = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordTitle) as StringSettingNode ??
47  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPageTitle) as StringSettingNode;
48  var pageTemplate = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPageTemplate) as PageThemeNode;
49  var pageTime = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordPageTime) as TimeStampNode ??
50  Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordTimeStamp) as TimeStampNode;
51  var graphSets = Nodes.Where(n => n.Symbol == Symbol.KeywordGraphSet).Cast<GraphSetSyntaxNode>();
52  var dest = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordDestinations) as DirDestinationSyntaxNode;
53 
54  return new PeerPageConfiguration(
55  Name,
56  frequency?.Value,
57  initialRun?.Value,
58  fixedRun?.Value,
59  pageTime?.DateTimeKind,
60  pageTemplate?.PageTheme,
61  title?.Value,
62  graphSets.Select(g => g.Compile()),
63  dest?.Compile(),
64  location
65  );
66  }
override void Ntp.Analyzer.Config.Syntax.PeerPageSyntaxNode.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< PeerPageConfiguration >.

Definition at line 68 of file PeerPageSyntaxNode.cs.

69  {
70  CheckIsUnique(new List<Symbol>
71  {
72  Symbol.KeywordFrequency,
73  Symbol.KeywordInitialRun,
74  Symbol.KeywordFixedRun,
75  Symbol.KeywordTitle,
76  Symbol.KeywordPageTitle,
77  Symbol.KeywordLink,
78  Symbol.KeywordPageTemplate,
79  Symbol.KeywordPageTime,
80  Symbol.KeywordTimeStamp,
81  Symbol.KeywordDestinations
82  });
83 
84  CheckOnlyOneIsPresent(new List<Symbol>
85  {
86  Symbol.KeywordTitle,
87  Symbol.KeywordPageTitle
88  });
89 
90  CheckOnlyOneIsPresent(new List<Symbol>
91  {
92  Symbol.KeywordPageTime,
93  Symbol.KeywordTimeStamp
94  });
95 
96  CheckAllIsPresent(new List<Symbol> {Symbol.KeywordDestinations});
97  }
override void Ntp.Analyzer.Config.Syntax.PeerPageSyntaxNode.ValidateReferences ( SymbolTable  table)
inlineprotected

Definition at line 99 of file PeerPageSyntaxNode.cs.

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

100  {
101  var link = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordLink) as StringSettingNode;
102  if (link == null)
103  return;
104 
105  var keyword = Keyword.Find(Symbol.KeywordLink).Name;
106  location = CheckLink(link.Value, keyword);
107  }
static Keyword Find(Symbol symbol)
Definition: Keyword.cs:216

Here is the call graph for this function:

override void Ntp.Analyzer.Config.Syntax.PeerPageSyntaxNode.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< PeerPageConfiguration >.

Definition at line 109 of file PeerPageSyntaxNode.cs.

110  {
111  CheckTypeIs<IntegerSettingNode>(Symbol.KeywordFrequency);
112  CheckTypeIs<BooleanSettingNode>(Symbol.KeywordInitialRun);
113  CheckTypeIs<BooleanSettingNode>(Symbol.KeywordFixedRun);
114  CheckTypeIs<StringSettingNode>(Symbol.KeywordTitle);
115  CheckTypeIs<StringSettingNode>(Symbol.KeywordPageTitle);
116  CheckTypeIs<StringSettingNode>(Symbol.KeywordLink);
117  CheckTypeIs<PageThemeNode>(Symbol.KeywordPageTemplate);
118  CheckTypeIs<TimeStampNode>(Symbol.KeywordPageTime);
119  CheckTypeIs<TimeStampNode>(Symbol.KeywordTimeStamp);
120  }

Member Data Documentation

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

Definition at line 39 of file PeerPageSyntaxNode.cs.


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