public override IEnumerable <(string filedName, string value)> GetStringFields() { yield return("Arity", Arity.ToString()); yield return("ReturnTypeStr", ReturnTypeStr); yield return("ExplicitInterfaceSpecifierStr", ExplicitInterfaceSpecifierStr); yield return("IdentifierStr", IdentifierStr); yield return("TypeParameterListStr", TypeParameterListStr); yield return("ConstraintClausesStr", ConstraintClausesStr); yield return("AttributeListsStr", AttributeListsStr); yield return("ModifiersStr", ModifiersStr); yield return("ParameterListStr", ParameterListStr); yield return("BodyStr", BodyStr); yield return("ExpressionBodyStr", ExpressionBodyStr); yield return("SemicolonTokenStr", SemicolonTokenStr); }
public override IEnumerable <(string filedName, string value)> GetStringFields() { yield return("Arity", Arity.ToString()); yield return("KeywordStr", KeywordStr); yield return("TypeParameterListStr", TypeParameterListStr); yield return("ConstraintClausesStr", ConstraintClausesStr); yield return("MembersStr", MembersStr); yield return("AttributeListsStr", AttributeListsStr); yield return("ModifiersStr", ModifiersStr); yield return("IdentifierStr", IdentifierStr); yield return("BaseListStr", BaseListStr); yield return("OpenBraceTokenStr", OpenBraceTokenStr); yield return("CloseBraceTokenStr", CloseBraceTokenStr); yield return("SemicolonTokenStr", SemicolonTokenStr); }
public Op(string op, int precedence, Assoc assoc, Arity arity) { this.op = op; this.prec = precedence; this.assoc = assoc; this.arity = arity; }
/// <summary> /// A command may be created by a primary name, which may have 1 or more characters. /// If it has only 1 character, it will be invoked with '-c' switch, where 'c' is that character. /// If it has more characters, it will be invoked with '--name'. /// In addition to the primary name, a command may have a short name, which is always 1 character, /// and serves as an alias to the main command. /// Optional parameter isImportant is ued when displaying help, where /// only switches marked important will be shown. /// </summary> /// <exception cref="ArgumentException"></exception> public CommandSwitch(string primaryName, char shortName = '\0', bool isImportant = true) { if (primaryName == null || primaryName.Length == 0) { throw new ArgumentException("Invalid primary name"); } if (primaryName.Length == 1 && shortName != '\0') { throw new ArgumentException("Primary name length cannot be 1, when the short name is present."); } if (primaryName.Length == 1) { _longName = null; _shortName = primaryName[0]; } else { _longName = primaryName; _shortName = shortName; } _isImportant = isImportant; _arity = Arity.None; }
public Operator(int id, string sym, int prio, Associaivity assoc, Arity ari = Arity.Binary) { ID = id; Symbol = sym; Priority = prio; Associativity = assoc; Arity = ari; }
private Operator(string name, int precedence, Side associativity, Func <Operand, Operand> func) { Name = name; Precedence = precedence; Asssoc = associativity; UnaryFunc = func; Arity = Arity.Unary; }
public override IEnumerable <(string filedName, string value)> GetStringFields() { yield return("IdentifierStr", IdentifierStr); yield return("Arity", Arity.ToString()); yield return("IsVar", IsVar.ToString()); }
/// <summary> /// Adds a parameter for the switch. /// When switches are parsed, NoneOrOne type of switches /// must have the argument present in format '=value', /// following the switch without spaces. /// Help shows to users correctly how to do this. /// One and Many types of switches get their arguments /// separated by spaces. /// </summary> /// <exception cref="ArgumentException"></exception> public void AddParameter(Arity arity, string name) { if (arity == Arity.None) { throw new ArgumentException("Can't explicitly set switch arity to none."); } _arity = arity; _parameterName = name; }
public bool IsUniqueByArity(string denotation, Arity arity) { if (string.IsNullOrWhiteSpace(denotation)) { throw new ArgumentNullException(); } return(Operators.Count(x => x.Denotations.Contains(denotation) && x.Arity == arity) == 1); }
/// <inheritdoc /> public override int GetHashCode() { unchecked { var hash = base.GetHashCode(); hash ^= Arity.GetHashCode(); return(hash); } }
void AddSemanticOperator(Section kind, Arity arity, int precedence, Associativity lr, string token, string [] semanticOperatorNames, bool hasNodes = true, string baseClass = null) { // this will fail if there's a duplicate, and that's the idea. _syntacticTokens.Add(new Tuple <Section, string> (kind, token)); // just ensuring uniqueness here _operatorNames.Add((kind == UnaryState ? "Unary" : "Binary") + token); _semanticOperators.Add(new SemanticOperator(kind, arity, precedence, lr, token, semanticOperatorNames, hasNodes, baseClass)); }
public SemanticOperator(Section section, Arity arity, int precedence, Associativity lr, string token, string [] names, bool hasTreeNodes, string baseClass) { Section = section; Arity = arity; Precedence = precedence; Lr = lr; Token = token; Names = names; HasTreeNodes = hasTreeNodes; BaseClass = baseClass; }
protected BaseOption(IImmutableList <string> aliases, Arity arity, string description, bool hidden) { if (aliases.Count == 0) { throw new ArgProcessProgrammerException($"Option of type '{GetType().Name}' must have at least one alias."); } Aliases = aliases; Arity = arity; Description = description; Hidden = hidden; }
public int CompareTo(PredicateDescr pd) { int result = Functor.CompareTo(pd.Functor); if (result == 0) { return(Arity.CompareTo(pd.Arity)); } return(result); }
public override IEnumerable <(string filedName, string value)> GetStringFields() { yield return("IsUnboundGenericName", IsUnboundGenericName.ToString()); yield return("TypeArgumentListStr", TypeArgumentListStr); yield return("IdentifierStr", IdentifierStr); yield return("Arity", Arity.ToString()); yield return("IsVar", IsVar.ToString()); }
public override IEnumerable <(string filedName, string value)> GetStringFields() { yield return("LeftStr", LeftStr); yield return("DotTokenStr", DotTokenStr); yield return("RightStr", RightStr); yield return("Arity", Arity.ToString()); yield return("IsVar", IsVar.ToString()); }
public override IEnumerable <(string filedName, string value)> GetStringFields() { yield return("AliasStr", AliasStr); yield return("ColonColonTokenStr", ColonColonTokenStr); yield return("NameStr", NameStr); yield return("Arity", Arity.ToString()); yield return("IsVar", IsVar.ToString()); }
public XElement ToXElement() { if (IsOperator) { return(new XElement(ElementName, new XElement("Name", Name), new XElement("Arity", Arity.ToString(CultureInfo.InvariantCulture)), new XElement("IsOperator", IsOperator.ToString()))); } return(new XElement(ElementName, new XElement("Name", Name), new XElement("Arity", Arity.ToString(CultureInfo.InvariantCulture)))); }
public Operator(Arity arity, Associativity associativity, OperatorType operatorType, Fixity fixity, params string[] denotations) : base(operatorType, -1) // priority will be calculated in runtime based on operators declaration in config files // otherwise it will be hard to maintain it properly { Arity = arity; Associativity = associativity; Denotations = denotations; Fixity = fixity; }
public XElement ToXElement() { if (IsOperator) { return(new XElement(ElementName, new XElement("Name", Name), new XElement("Arity", Arity.ToString()), new XElement("IsOperator", IsOperator.ToString()))); } else { return(new XElement(ElementName, new XElement("Name", Name), new XElement("Arity", Arity.ToString()))); } }
public Arity Merge(Arity other) { var min = Minimum; if (other.Minimum < min) { min = other.Minimum; } var max = Maximum; if (other.Maximum > max) { max = other.Maximum; } return(new Arity(min, max)); }
public override int GetHashCode() { int hashCode = -1018114159; hashCode = hashCode * -1521134295 + EqualityComparer <OtpErlangPid> .Default.GetHashCode(Pid); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Module); hashCode = hashCode * -1521134295 + Index.GetHashCode(); hashCode = hashCode * -1521134295 + OldIndex.GetHashCode(); hashCode = hashCode * -1521134295 + Uniq.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <IOtpErlangObject[]> .Default.GetHashCode(FreeVars); hashCode = hashCode * -1521134295 + Arity.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <byte[]> .Default.GetHashCode(Md5); return(hashCode); }
/// <inheritdoc /> public override int GetHashCode() { unchecked { var hash = DefiningType.GetHashCode() * 397; hash ^= StringComparer.Ordinal.GetHashCode(Name); hash ^= Arity.GetHashCode(); foreach (var parameter in Parameters) { hash ^= parameter.GetHashCode(); } if (ReturnType != null) { hash ^= ReturnType.GetHashCode(); } return(hash); } }
public override IEnumerable <(string filedName, string value)> GetStringFields() { yield return("Arity", Arity.ToString()); yield return("AttributeListsStr", AttributeListsStr); yield return("ModifiersStr", ModifiersStr); yield return("DelegateKeywordStr", DelegateKeywordStr); yield return("ReturnTypeStr", ReturnTypeStr); yield return("IdentifierStr", IdentifierStr); yield return("TypeParameterListStr", TypeParameterListStr); yield return("ParameterListStr", ParameterListStr); yield return("ConstraintClausesStr", ConstraintClausesStr); yield return("SemicolonTokenStr", SemicolonTokenStr); }
public int CompareTo(OtpErlangFun other) { if (other is null) { return(1); } int res = Pid.CompareTo(other.Pid); if (res == 0) { res = Module.CompareTo(other.Module); } if (res == 0) { res = Arity.CompareTo(other.Arity); } if (res == 0) { res = Md5.CompareTo(other.Md5); } if (res == 0) { res = Index.CompareTo(other.Index); } if (res == 0) { res = OldIndex.CompareTo(other.OldIndex); } if (res == 0) { res = Uniq.CompareTo(other.Uniq); } if (res == 0) { res = FreeVars.CompareTo(other.FreeVars); } return(res); }
public bool Equals(Arity other) => other?.Minimum == Minimum && other.Maximum == Maximum;
public ArgumentsAttribute(Arity arity) { arguments = (int)arity; }
public Operator(string id, int precidence, Arity arity) { this.id = id; this.precidence = precidence; this.arity = arity; }
public static Dictionary<Color, Shape> RecognizeObjectsAsShapes(this Color[,] image, Arity arity, Shape shape) { Dictionary<Color, double> circularities = image.Circularity(); Dictionary<Color, double> rectangularities = image.ObjectRectangularity(); Tuple<double,double>[] circularityRanges = ThresholdValues.Circularities; Tuple<double,double>[] rectangularityRanges = ThresholdValues.Rectangularities; Dictionary<Color, Shape> result = new Dictionary<Color, Shape>(); foreach ( Color key in circularities.Keys ) { double c = circularities[key]; double r = rectangularities[key]; List<int> inRangeOf = new List<int>(); for ( int i = 0; i < circularityRanges.Length; i++ ) { double low = circularityRanges[i].Item1; double high = circularityRanges[i].Item2; if ( c >= low && c <= high ) { inRangeOf.Add(i); } } foreach ( int j in inRangeOf ) { double low = rectangularityRanges[j].Item1; double high = rectangularityRanges[j].Item2; if ( r >= low && r <= high ) result.Add(key, (Shape)j); } } return result; }
internal OperatorExpression(Token token) : this() { this.identifier = token; operationType = Arity.binary; }
public int Precedence(string op, Arity arity) { return(GetOp(op, arity).prec); }
// 0 for left assoc, else 1 for right public Assoc Associativity(string op, Arity arity) { return(GetOp(op, arity).assoc); }
public override int GetHashCode() { return(Name.GetHashCode() ^ Arity.GetHashCode()); }