コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: Evaluator.cs プロジェクト: ChrisLomont/CLAsmTool
 public Op(string op, int precedence, Assoc assoc, Arity arity)
 {
     this.op    = op;
     this.prec  = precedence;
     this.assoc = assoc;
     this.arity = arity;
 }
コード例 #4
0
        /// <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;
        }
コード例 #5
0
 public Operator(int id, string sym, int prio, Associaivity assoc, Arity ari = Arity.Binary)
 {
     ID            = id;
     Symbol        = sym;
     Priority      = prio;
     Associativity = assoc;
     Arity         = ari;
 }
コード例 #6
0
ファイル: Operator.cs プロジェクト: corylanza/Outlet-Lang
 private Operator(string name, int precedence, Side associativity, Func <Operand, Operand> func)
 {
     Name       = name;
     Precedence = precedence;
     Asssoc     = associativity;
     UnaryFunc  = func;
     Arity      = Arity.Unary;
 }
コード例 #7
0
        public override IEnumerable <(string filedName, string value)> GetStringFields()
        {
            yield return("IdentifierStr", IdentifierStr);

            yield return("Arity", Arity.ToString());

            yield return("IsVar", IsVar.ToString());
        }
コード例 #8
0
 /// <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;
 }
コード例 #9
0
        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);
        }
コード例 #10
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = base.GetHashCode();
         hash ^= Arity.GetHashCode();
         return(hash);
     }
 }
コード例 #11
0
ファイル: Program.cs プロジェクト: erikeidt/Draconum
        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));
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: erikeidt/Draconum
 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;
 }
コード例 #13
0
 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;
 }
コード例 #14
0
            public int CompareTo(PredicateDescr pd)
            {
                int result = Functor.CompareTo(pd.Functor);

                if (result == 0)
                {
                    return(Arity.CompareTo(pd.Arity));
                }

                return(result);
            }
コード例 #15
0
        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());
        }
コード例 #16
0
        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());
        }
コード例 #17
0
        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());
        }
コード例 #18
0
ファイル: CodeFunctor.cs プロジェクト: russlank/Prolog.NET
 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))));
 }
コード例 #19
0
        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;
        }
コード例 #20
0
 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())));
     }
 }
コード例 #21
0
ファイル: Arity.cs プロジェクト: SilverPhoenix99/mintcs
        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));
        }
コード例 #22
0
        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);
        }
コード例 #23
0
        /// <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);
            }
        }
コード例 #24
0
        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);
        }
コード例 #25
0
        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);
        }
コード例 #26
0
ファイル: Arity.cs プロジェクト: SilverPhoenix99/mintcs
 public bool Equals(Arity other) => other?.Minimum == Minimum && other.Maximum == Maximum;
コード例 #27
0
ファイル: ArgumentsAttribute.cs プロジェクト: jdruin/F5Eagle
 public ArgumentsAttribute(Arity arity)
 {
     arguments = (int)arity;
 }
コード例 #28
0
ファイル: Variable.cs プロジェクト: Bassie-c/Kerbulator
 public Operator(string id, int precidence, Arity arity)
 {
     this.id = id;
     this.precidence = precidence;
     this.arity = arity;
 }
コード例 #29
0
ファイル: Operators.cs プロジェクト: kutagh/IBV
        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;
        }
コード例 #30
0
 internal OperatorExpression(Token token)
     : this()
 {
     this.identifier = token;
     operationType = Arity.binary;
 }
コード例 #31
0
ファイル: Evaluator.cs プロジェクト: ChrisLomont/CLAsmTool
 public int Precedence(string op, Arity arity)
 {
     return(GetOp(op, arity).prec);
 }
コード例 #32
0
ファイル: Evaluator.cs プロジェクト: ChrisLomont/CLAsmTool
 // 0 for left assoc, else 1 for right
 public Assoc Associativity(string op, Arity arity)
 {
     return(GetOp(op, arity).assoc);
 }
コード例 #33
0
ファイル: Functor.cs プロジェクト: richardy2012/Prolog.NET
 public override int GetHashCode()
 {
     return(Name.GetHashCode()
            ^ Arity.GetHashCode());
 }