Esempio n. 1
0
 public override Goal <Type> ResolveType(Var type)
 {
     return(Goal.Disj(
                Goal.Conj(Goal.Pred <Type>(type, _ => IntValue.CompareTo(System.Int32.MaxValue) <= 0),
                          Goal.Unify <Type>(type, Builtins.SystemInt32.Instance)),
                Goal.Unify <Type>(type, Builtins.SystemNumericsBigInteger.Instance)
                ));
 }
Esempio n. 2
0
        /// <inheritdoc/>
        public Int32 CompareTo(LinkAttribute other)
        {
            Int32 ret = _name.CompareTo(other.Name);

            if (ret == 0)
            {
                if (_value is String)
                {
                    return(StringValue.CompareTo(other.StringValue));
                }
                else if (_value is Int32)
                {
                    return(IntValue.CompareTo(other.IntValue));
                }
            }
            return(ret);
        }
Esempio n. 3
0
 /// <summary>
 /// Compares to other object.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns></returns>
 public int CompareTo(Object other)
 {
     if (other is LispVariant)
     {
         var otherVariant = (LispVariant)other;
         if (IsNumber && otherVariant.IsNumber)
         {
             if (IsDouble || otherVariant.IsDouble)
             {
                 return(ToDouble().CompareTo(otherVariant.ToDouble()));
             }
             return(IntValue.CompareTo(otherVariant.IntValue));
         }
         // all other types will be compared like a string
         return(string.Compare(StringValue, otherVariant.StringValue, StringComparison.Ordinal));
     }
     return(CompareTo(new LispVariant(other)));
 }
        public int CompareTo(object obj)
        {
            var typedObj = (AllSupportedPropertyTypesObject)obj;
            int result   = string.Compare(StringValue, typedObj.StringValue);

            if (result == 0)
            {
                result = IntValue.CompareTo(typedObj.IntValue);
            }
            if (result == 0)
            {
                result = Nullable.Compare(NullableIntValue, typedObj.NullableIntValue);
            }

            if (result == 0)
            {
                result = DoubleValue.CompareTo(typedObj.DoubleValue);
            }

            if (result == 0)
            {
                result = Nullable.Compare(NullableDoubleValue, typedObj.NullableDoubleValue);
            }

            if (result == 0)
            {
                result = DateTimeValue.CompareTo(typedObj.DoubleValue);
            }

            if (result == 0)
            {
                result = Nullable.Compare(NullableDateTimeValue, typedObj.NullableDateTimeValue);
            }

            if (result == 0)
            {
                // TODO: this is more correctly done by using SequenceCompareTo()
                //       method but this is only available from Standard 2.1 onwards.
                //       Use basic custom implementation for backward compatibility.
                //result =  ByteArrayValue.SequenceEqual(typedObj.ByteArrayValue);
            }

            return(result);
        }
            public int CompareTo(object obj)
            {
                FooValue temp = (FooValue)obj;

                return(IntValue.CompareTo(temp.IntValue));
            }
Esempio n. 6
0
 public int CompareTo(ComparableElement1 other)
 {
     return(IntValue.CompareTo(other.IntValue));
 }