Compare() abstract private method

abstract private Compare ( object value1, object value2 ) : int
value1 object
value2 object
return int
 internal override Exception CheckValueFacets(DateTime value, XmlSchemaDatatype datatype)
 {
     RestrictionFacets restriction = datatype.Restriction;
     RestrictionFlags flags = (restriction != null) ? restriction.Flags : ((RestrictionFlags) 0);
     if (((flags & RestrictionFlags.MaxInclusive) != 0) && (datatype.Compare(value, (DateTime) restriction.MaxInclusive) > 0))
     {
         return new XmlSchemaException("Sch_MaxInclusiveConstraintFailed", string.Empty);
     }
     if (((flags & RestrictionFlags.MaxExclusive) != 0) && (datatype.Compare(value, (DateTime) restriction.MaxExclusive) >= 0))
     {
         return new XmlSchemaException("Sch_MaxExclusiveConstraintFailed", string.Empty);
     }
     if (((flags & RestrictionFlags.MinInclusive) != 0) && (datatype.Compare(value, (DateTime) restriction.MinInclusive) < 0))
     {
         return new XmlSchemaException("Sch_MinInclusiveConstraintFailed", string.Empty);
     }
     if (((flags & RestrictionFlags.MinExclusive) != 0) && (datatype.Compare(value, (DateTime) restriction.MinExclusive) <= 0))
     {
         return new XmlSchemaException("Sch_MinExclusiveConstraintFailed", string.Empty);
     }
     if (((flags & RestrictionFlags.Enumeration) != 0) && !this.MatchEnumeration(value, restriction.Enumeration, datatype))
     {
         return new XmlSchemaException("Sch_EnumerationConstraintFailed", string.Empty);
     }
     return null;
 }
        internal override Exception CheckValueFacets(DateTime value, XmlSchemaDatatype datatype)
        {
            RestrictionFacets restriction = datatype.Restriction;
            RestrictionFlags  flags       = (restriction != null) ? restriction.Flags : ((RestrictionFlags)0);

            if (((flags & RestrictionFlags.MaxInclusive) != 0) && (datatype.Compare(value, (DateTime)restriction.MaxInclusive) > 0))
            {
                return(new XmlSchemaException("Sch_MaxInclusiveConstraintFailed", string.Empty));
            }
            if (((flags & RestrictionFlags.MaxExclusive) != 0) && (datatype.Compare(value, (DateTime)restriction.MaxExclusive) >= 0))
            {
                return(new XmlSchemaException("Sch_MaxExclusiveConstraintFailed", string.Empty));
            }
            if (((flags & RestrictionFlags.MinInclusive) != 0) && (datatype.Compare(value, (DateTime)restriction.MinInclusive) < 0))
            {
                return(new XmlSchemaException("Sch_MinInclusiveConstraintFailed", string.Empty));
            }
            if (((flags & RestrictionFlags.MinExclusive) != 0) && (datatype.Compare(value, (DateTime)restriction.MinExclusive) <= 0))
            {
                return(new XmlSchemaException("Sch_MinExclusiveConstraintFailed", string.Empty));
            }
            if (((flags & RestrictionFlags.Enumeration) != 0) && !this.MatchEnumeration(value, restriction.Enumeration, datatype))
            {
                return(new XmlSchemaException("Sch_EnumerationConstraintFailed", string.Empty));
            }
            return(null);
        }
Esempio n. 3
0
 internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype)
 {
     for (int i = 0; i < enumeration.Count; i++)
     {
         if (datatype.Compare(value, enumeration[i]) == 0)
         {
             return(true);
         }
     }
     return(false);
 }
 private bool MatchEnumeration(DateTime value, ArrayList enumeration, XmlSchemaDatatype datatype)
 {
     for (int i = 0; i < enumeration.Count; i++)
     {
         if (datatype.Compare(value, (DateTime) enumeration[i]) == 0)
         {
             return true;
         }
     }
     return false;
 }
 private bool MatchEnumeration(DateTime value, ArrayList enumeration, XmlSchemaDatatype datatype)
 {
     for (int i = 0; i < enumeration.Count; i++)
     {
         if (datatype.Compare(value, (DateTime)enumeration[i]) == 0)
         {
             return(true);
         }
     }
     return(false);
 }
 internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype)
 {
     for (int i = 0; i < enumeration.Count; i++)
     {
         if (datatype.Compare(value, enumeration[i]) == 0)
         {
             return true;
         }
     }
     return false;
 }
Esempio n. 7
0
 internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype) {
     for (int i = 0; i < enumeration.Count; ++i) {
         if (datatype.Compare(value, enumeration[i]) == 0) { //Compare on Datatype_union will compare two XsdSimpleValue
             return true;
         }
     }
     return false;
 }
 internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype) {
     foreach(object correctValue in enumeration) {
         if (datatype.Compare(value, correctValue) == 0) { //Compare on Datatype_union will compare two XsdSimpleValue
             return true;
         }
     }
     return false;
 }
 internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype) {
     foreach(object correctArray in enumeration) {
         if (datatype.Compare(value, correctArray) == 0) {
             return true;
         }
     }
     return false;
 }
 private bool MatchEnumeration(byte[] value, ArrayList enumeration, XmlSchemaDatatype datatype) {
     foreach(byte[] correctValue in enumeration) {
         if (datatype.Compare(value, correctValue) == 0) {
             return true;
         }
     }
     return false;
 }