SetDecimal() public method

public SetDecimal ( ) : void
return void
        public bool Equals(TypedObject other)
        {
            if (this.Dim != other.Dim)
            {
                return(false);
            }
            if (this.Type != other.Type)
            {
                if (!this.Type.IsComparable(other.Type))
                {
                    return(false);
                }
                other.SetDecimal();
                this.SetDecimal();
                if (this.IsDecimal && other.IsDecimal)
                {
                    return(this.ListDValueEquals(other));
                }
            }
            if (this.IsList)
            {
                if (other.IsList)
                {
                    return(this.Type.Compare(this.Value, other.Value) == 0);
                }
                Array            array      = this.Value as Array;
                XmlAtomicValue[] valueArray = array as XmlAtomicValue[];
                if (valueArray != null)
                {
                    return((valueArray.Length == 1) && valueArray.GetValue(0).Equals(other.Value));
                }
                return((array.Length == 1) && array.GetValue(0).Equals(other.Value));
            }
            if (!other.IsList)
            {
                return(this.Value.Equals(other.Value));
            }
            Array array2 = other.Value as Array;

            XmlAtomicValue[] valueArray2 = array2 as XmlAtomicValue[];
            if (valueArray2 != null)
            {
                return((valueArray2.Length == 1) && valueArray2.GetValue(0).Equals(this.Value));
            }
            return((array2.Length == 1) && array2.GetValue(0).Equals(this.Value));
        }
 public bool Equals(TypedObject other)
 {
     if (this.Dim != other.Dim)
     {
         return false;
     }
     if (this.Type != other.Type)
     {
         if (!this.Type.IsComparable(other.Type))
         {
             return false;
         }
         other.SetDecimal();
         this.SetDecimal();
         if (this.IsDecimal && other.IsDecimal)
         {
             return this.ListDValueEquals(other);
         }
     }
     if (this.IsList)
     {
         if (other.IsList)
         {
             return (this.Type.Compare(this.Value, other.Value) == 0);
         }
         Array array = this.Value as Array;
         XmlAtomicValue[] valueArray = array as XmlAtomicValue[];
         if (valueArray != null)
         {
             return ((valueArray.Length == 1) && valueArray.GetValue(0).Equals(other.Value));
         }
         return ((array.Length == 1) && array.GetValue(0).Equals(other.Value));
     }
     if (!other.IsList)
     {
         return this.Value.Equals(other.Value);
     }
     Array array2 = other.Value as Array;
     XmlAtomicValue[] valueArray2 = array2 as XmlAtomicValue[];
     if (valueArray2 != null)
     {
         return ((valueArray2.Length == 1) && valueArray2.GetValue(0).Equals(this.Value));
     }
     return ((array2.Length == 1) && array2.GetValue(0).Equals(this.Value));
 }
Ejemplo n.º 3
0
        public bool Equals(TypedObject other)
        {
            // ? one is list with one member, another is not list -- still might be equal
            if (this.Dim != other.Dim)
            {
                return(false);
            }

            if (this.Type != other.Type)
            {
                //Check if types are comparable
                if (!(this.Type.IsComparable(other.Type)))
                {
                    return(false);
                }
                other.SetDecimal(); // can't use cast and other.Type.IsEqual (value1, value2)
                this.SetDecimal();
                if (this.IsDecimal && other.IsDecimal)
                { //Both are decimal / derived types
                    return(this.ListDValueEquals(other));
                }
            }

            // not-Decimal derivation or type equal
            if (this.IsList)
            {
                if (other.IsList)
                { //Both are lists and values are XmlAtomicValue[] or clrvalue[]. So use Datatype_List.Compare
                    return(this.Type.Compare(this.Value !, other.Value !) == 0);
                }
                else
                { //this is a list and other is a single value
                    Array?arr1 = this.Value as System.Array;
                    XmlAtomicValue[]? atomicValues1 = arr1 as XmlAtomicValue[];
                    if (atomicValues1 != null)
                    { // this is a list of union
                        return(atomicValues1.Length == 1 && atomicValues1.GetValue(0) !.Equals(other.Value));
                    }
                    else
                    {
                        Debug.Assert(arr1 != null);
                        return(arr1.Length == 1 && arr1.GetValue(0) !.Equals(other.Value));
                    }
                }
            }
            else if (other.IsList)
            {
                Array?arr2 = other.Value as System.Array;
                XmlAtomicValue[]? atomicValues2 = arr2 as XmlAtomicValue[];
                if (atomicValues2 != null)
                { // other is a list of union
                    return(atomicValues2.Length == 1 && atomicValues2.GetValue(0) !.Equals(this.Value));
                }
                else
                {
                    Debug.Assert(arr2 != null);
                    return(arr2.Length == 1 && arr2.GetValue(0) !.Equals(this.Value));
                }
            }
            else
            { //Both are not lists
                return(this.Value !.Equals(other.Value));
            }
        }
        public bool Equals (TypedObject other) {
            // ? one is list with one member, another is not list -- still might be equal
            if (this.Dim != other.Dim) {
                return false;
            }

            if (this.Type != other.Type) {
                //Check if types are comparable
                if (! (this.Type.IsComparable(other.Type)) ) {       
                    return false;
                }
                other.SetDecimal(); // can't use cast and other.Type.IsEqual (value1, value2)
                this.SetDecimal();
                if (this.IsDecimal && other.IsDecimal) { //Both are decimal / derived types 
                    return this.ListDValueEquals(other);
                }
            }

            // not-Decimal derivation or type equal
            if (this.IsList) {
                if (other.IsList) { //Both are lists and values are XmlAtomicValue[] or clrvalue[]. So use Datatype_List.Compare
                    return this.Type.Compare(this.Value, other.Value) == 0;
                }
                else { //this is a list and other is a single value
                    Array arr1 = this.Value as System.Array;
                    XmlAtomicValue[] atomicValues1 = arr1 as XmlAtomicValue[];
                    if (atomicValues1 != null) { // this is a list of union
                        return atomicValues1.Length == 1 && atomicValues1.GetValue(0).Equals(other.Value);
                    }
                    else {
                        return arr1.Length == 1 && arr1.GetValue(0).Equals(other.Value);
                    }
                }
            }
            else if (other.IsList) {
                Array arr2 = other.Value as System.Array;
                XmlAtomicValue[] atomicValues2 = arr2 as XmlAtomicValue[];
                if (atomicValues2 != null) { // other is a list of union
                    return atomicValues2.Length == 1 && atomicValues2.GetValue(0).Equals(this.Value);
                }
                else {
                    return arr2.Length == 1 && arr2.GetValue(0).Equals(this.Value);
                }
            }
            else { //Both are not lists
                return this.Value.Equals(other.Value);
            }
        }
Ejemplo n.º 5
0
        public bool Equals(TypedObject other)
        {
            // ? one is list with one member, another is not list -- still might be equal
            if (this.Dim != other.Dim)
            {
                return(false);
            }

            if (this.Type != other.Type)
            {
                bool thisfromother = this.Type.IsDerivedFrom(other.Type);
                bool otherfromthis = other.Type.IsDerivedFrom(this.Type);

                if (!(thisfromother || otherfromthis))          // second normal case
                {
                    return(false);
                }

                if (thisfromother)
                {
                    // can't use cast and other.Type.IsEqual (value1, value2)
                    other.SetDecimal();
                    if (other.IsDecimal)
                    {
                        this.SetDecimal();
                        return(this.ListDValueEquals(other));
                    }
                    // deal else (not decimal) in the end
                }
                else
                {
                    this.SetDecimal();
                    if (this.IsDecimal)
                    {
                        other.SetDecimal();
                        return(this.ListDValueEquals(other));
                    }
                    // deal else (not decimal) in the end
                }
            }

            // not-Decimal derivation or type equal
            if ((!this.IsList) && (!other.IsList))          // normal case
            {
                return(this.Value.Equals(other.Value));
            }
            else if ((this.IsList) && (other.IsList))       // second normal case
            {
                for (int i = 0; i < this.Dim; i++)
                {
                    if (!((Array)this.Value).GetValue(i).Equals(((Array)other.Value).GetValue(i)))
                    {
                        return(false);
                    }
                }
                return(true);
            }
            else if (((this.IsList) && (((Array)this.Value).GetValue(0).Equals(other.Value))) ||
                     ((other.IsList) && (((Array)other.Value).GetValue(0).Equals(this.Value)))) // any possibility?
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 6
0
        public bool Equals (TypedObject other) {
            // ? one is list with one member, another is not list -- still might be equal
            if (this.Dim != other.Dim) {
                return false;
            }

            if (this.Type != other.Type) {              
                bool thisfromother = this.Type.IsDerivedFrom (other.Type); 
                bool otherfromthis = other.Type.IsDerivedFrom (this.Type);

                if (! (thisfromother || otherfromthis)) {       // second normal case
                    return false;
                }

                if (thisfromother) {
                    // can't use cast and other.Type.IsEqual (value1, value2)
                    other.SetDecimal();
                    if (other.IsDecimal) {
                        this.SetDecimal();
			   return this.ListDValueEquals(other);                    
		      }
                    // deal else (not decimal) in the end 
                }
                else {
                    this.SetDecimal();
                    if (this.IsDecimal) {
                        other.SetDecimal();
                        return this.ListDValueEquals(other);
                    }
                    // deal else (not decimal) in the end 
                }
            }

            // not-Decimal derivation or type equal
            if ((! this.IsList) && (! other.IsList)) {      // normal case
                return this.Value.Equals (other.Value);
            }
            else if ((this.IsList) && (other.IsList)){      // second normal case
                for (int i = 0; i < this.Dim; i ++) {
                    if (! ((Array)this.Value).GetValue(i).Equals(((Array)other.Value).GetValue(i))) {
                        return false;
                    }
                }
                return true;
            }
            else if (((this.IsList) && (((Array)this.Value).GetValue(0).Equals(other.Value)))
                || ((other.IsList) && (((Array)other.Value).GetValue(0).Equals(this.Value)))) { // any possibility?
                return true;
            }

            return false;
        }