public EnumNode( Action <ActionNode, IToken, IResultAccumulator> action, INodeFamily family, string name) : base(action, family, name) { }
protected TextNodeBase( IEnumerable <ITextClass> textClasses, Action <ActionNode, IToken, IResultAccumulator> action, INodeFamily family, string name) : base(action, family, name) { if (textClasses == null) { throw new ArgumentNullException(nameof(textClasses)); } var textClassesList = textClasses.ToList(); // to avoid multiple enumerating. if (textClassesList.Count == 0) { throw new ArgumentException($"'{nameof(textClasses)}' cannot be empty."); } if (textClassesList.Any(x => x == null)) { throw new ArgumentException($"'{nameof(textClasses)}' cannot contain nulls."); } this.TextClassesImpl = new HashSet <ITextClass>(textClassesList); this.TextClasses = this.TextClassesImpl.ToList(); }
public ExactTextNode( string exactText, IEnumerable <ITextClass> textClasses, bool isCaseSensitive, Action <ActionNode, IToken, IResultAccumulator> action, INodeFamily family, string name) : base( textClasses, action, family, name) { if (exactText == null) { throw new ArgumentNullException(nameof(exactText)); } if (!isCaseSensitive) { exactText = exactText.ToLowerInvariant(); } this.ExactText = exactText; if (textClasses == null) { throw new ArgumentNullException(nameof(textClasses)); } this.IsCaseSensitive = isCaseSensitive; }
public FallbackNode( Func <FallbackNode, IToken, IResultAccumulator, bool> fallbackPredicate, INodeFamily family, string name) : base(family, name) { this.FallbackPredicate = fallbackPredicate ?? throw new ArgumentNullException(nameof(fallbackPredicate)); }
protected ActionNode( Action <ActionNode, IToken, IResultAccumulator> action, INodeFamily family, string name) : base(family, name) { this.Action = action; // can be null }
public CustomCliHost(string name) { this.Name = name; _output = TextWriter.Null; _input = TextReader.Null; _nodeFamily = new NodeFamily($"Node family for empty host '{this.Name}'"); }
public CustomActionNode( Action <ActionNode, IToken, IResultAccumulator> action, Func <IToken, IResultAccumulator, bool> tokenAcceptPredicate, INodeFamily family, string name) : base(action, family, name) { this.TokenAcceptPredicate = tokenAcceptPredicate; }
public ExactEnumNode( TEnum value, Action<ActionNode, IToken, IResultAccumulator> action, INodeFamily family, string name) : base(action, family, name) { this.Value = value; }
protected NodeImpl(INodeFamily family, string name) { this.Family = family; this.Name = name; family?.RegisterNode(this); _establishedLinks = new HashSet <INode>(); _claimedLinkNames = new HashSet <string>(); _properties = new Dictionary <string, string>(); }
protected TextNodeBase( ITextClass textClass, Action <ActionNode, IToken, IResultAccumulator> action, INodeFamily family, string name) : this( new[] { textClass }, action, family, name) { }
public TextNode( IEnumerable <ITextClass> textClasses, Action <ActionNode, IToken, IResultAccumulator> action, INodeFamily family, string name) : base( textClasses, action, family, name) { }
public ExactPunctuationNode( char c, Action <ActionNode, IToken, IResultAccumulator> action, INodeFamily family, string name) : base(action, family, name) { if (!LexingHelper.IsStandardPunctuationChar(c)) { throw new ArgumentOutOfRangeException(nameof(c)); } this.Value = c; }
public virtual void StartSystem() { Entities = Engine.FamilyManager.Get(this.RequiredTypes()).Entities; NodeFamily = Engine.FamilyManager.GetNodeFamily <T>(); Entities.ItemAdded += (o, e) => { var entity = (Entity)e; OnNodeAdded(entity, NodeFamily.NodeForEntity(entity)); }; Entities.ItemRemoved += (o, e) => { var entity = (Entity)e; OnNodeRemoved(entity, NodeFamily.NodeForEntity(entity)); }; }
public MultiTextNode( IEnumerable <string> texts, ITextClass textClass, bool isCaseSensitive, Action <ActionNode, IToken, IResultAccumulator> action, INodeFamily family, string name) : this( texts, new[] { textClass }, isCaseSensitive, action, family, name) { }
public ExactTextNode( string exactText, ITextClass textClass, bool isCaseSensitive, Action <ActionNode, IToken, IResultAccumulator> action, INodeFamily family, string name) : this( exactText, new[] { textClass }, isCaseSensitive, action, family, name) { }
protected CliHostBase( string name, string version, bool supportsHelp) : base(name, version, supportsHelp) { if (name == null) { throw new ArgumentNullException(nameof(name)); // host cannot be nameless. } _nodeFamily = new NodeFamily($"Node family for host '{this.Name}'"); _addInRecords = new Dictionary <string, AddInRecord>(); _output = TextWriter.Null; _input = TextReader.Null; }
protected CliAddInBase(string name, string version, bool supportsHelp) : base(name, version, supportsHelp) { if (name == null) { if (version != null) { throw new ArgumentException("Nameless add-in cannot have version.", nameof(version)); } //if (supportsHelp) //{ // throw new ArgumentException("Nameless add-in cannot support help.", nameof(supportsHelp)); //} } _nodeFamily = new NodeFamily($"Add-in node family: {this.Name ?? string.Empty}. Add-in type is '{this.GetType().FullName}'."); _executors = new List <ICliExecutor>(); }
public MultiTextNode( IEnumerable <string> texts, IEnumerable <ITextClass> textClasses, bool isCaseSensitive, Action <ActionNode, IToken, IResultAccumulator> action, INodeFamily family, string name) : base( textClasses, action, family, name) { if (texts == null) { throw new ArgumentNullException(nameof(texts)); } var textList = texts.ToList(); if (textList.Count == 0) { throw new ArgumentException($"'{nameof(texts)}' cannot be empty.", nameof(texts)); } if (textList.Any(x => x == null)) { throw new ArgumentException($"'{nameof(texts)}' cannot contain nulls.", nameof(texts)); } if (!isCaseSensitive) { textList = textList.Select(x => x.ToLowerInvariant()).ToList(); } _texts = new HashSet <string>(textList); this.IsCaseSensitive = isCaseSensitive; this.Texts = _texts.ToList(); }
public IdleNode(INodeFamily family, string name) : base(family, name) { }