home *** CD-ROM | disk | FTP | other *** search
- using System;
-
- namespace Altova.Types
- {
- public interface ISchemaType : IComparable, ICloneable
- {
- }
-
- public class SchemaBoolean : ISchemaType
- {
- public bool Value;
-
- public SchemaBoolean(SchemaBoolean obj)
- {
- Value = obj.Value;
- }
-
- public SchemaBoolean(bool Value)
- {
- this.Value = Value;
- }
-
- public SchemaBoolean(string Value)
- {
- this.Value = Value == "true" || Value == "1";
- }
-
- public override string ToString()
- {
- return Value ? "true" : "false";
- }
-
- public override int GetHashCode()
- {
- return Value ? 1231 : 1237;
- }
-
- public override bool Equals(object obj)
- {
- if (obj == null)
- return false;
- if (!(obj is SchemaBoolean))
- return false;
- return Value == ((SchemaBoolean)obj).Value;
- }
-
- public static bool operator==(SchemaBoolean obj1, SchemaBoolean obj2)
- {
- return obj1.Value == obj2.Value;
- }
-
- public static bool operator!=(SchemaBoolean obj1, SchemaBoolean obj2)
- {
- return obj1.Value != obj2.Value;
- }
-
- public int CompareTo(object obj)
- {
- return Value.CompareTo(((SchemaBoolean)obj).Value);
- }
-
- public object Clone()
- {
- return new SchemaBoolean(Value);
- }
- }
-
- public class SchemaInt : ISchemaType
- {
- public int Value;
-
- public SchemaInt(SchemaInt obj)
- {
- Value = obj.Value;
- }
-
- public SchemaInt(int Value)
- {
- this.Value = Value;
- }
-
- public SchemaInt(string Value)
- {
- this.Value = Convert.ToInt32(Value);
- }
-
- public override string ToString()
- {
- return Convert.ToString(Value);
- }
-
- public override int GetHashCode()
- {
- return Value;
- }
-
- public override bool Equals(object obj)
- {
- if (obj == null)
- return false;
- if (!(obj is SchemaInt))
- return false;
- return Value == ((SchemaInt)obj).Value;
- }
-
- public static bool operator==(SchemaInt obj1, SchemaInt obj2)
- {
- return obj1.Value == obj2.Value;
- }
-
- public static bool operator!=(SchemaInt obj1, SchemaInt obj2)
- {
- return obj1.Value != obj2.Value;
- }
-
- public int CompareTo(object obj)
- {
- return Value.CompareTo(((SchemaInt)obj).Value);
- }
-
- public object Clone()
- {
- return new SchemaInt(Value);
- }
- }
-
- public class SchemaLong : ISchemaType
- {
- public long Value;
-
- public SchemaLong(SchemaLong obj)
- {
- Value = obj.Value;
- }
-
- public SchemaLong(long Value)
- {
- this.Value = Value;
- }
-
- public SchemaLong(string Value)
- {
- this.Value = Convert.ToInt64(Value);
- }
-
- public override string ToString()
- {
- return Convert.ToString(Value);
- }
-
- public override int GetHashCode()
- {
- return (int)Value;
- }
-
- public override bool Equals(object obj)
- {
- if (obj == null)
- return false;
- if (!(obj is SchemaLong))
- return false;
- return Value == ((SchemaLong)obj).Value;
- }
-
- public static bool operator==(SchemaLong obj1, SchemaLong obj2)
- {
- return obj1.Value == obj2.Value;
- }
-
- public static bool operator!=(SchemaLong obj1, SchemaLong obj2)
- {
- return obj1.Value != obj2.Value;
- }
-
- public int CompareTo(object obj)
- {
- return Value.CompareTo(((SchemaLong)obj).Value);
- }
-
- public object Clone()
- {
- return new SchemaLong(Value);
- }
- }
-
- public class SchemaDecimal : ISchemaType
- {
- public decimal Value;
-
- public SchemaDecimal(SchemaDecimal obj)
- {
- Value = obj.Value;
- }
-
- public SchemaDecimal(decimal Value)
- {
- this.Value = Value;
- }
-
- public SchemaDecimal(string Value)
- {
- this.Value = Convert.ToDecimal(Value);
- }
-
- public override string ToString()
- {
- return Convert.ToString(Value);
- }
-
- public override int GetHashCode()
- {
- return Value.GetHashCode();
- }
-
- public override bool Equals(object obj)
- {
- if (obj == null)
- return false;
- if (!(obj is SchemaDecimal))
- return false;
- return Value == ((SchemaDecimal)obj).Value;
- }
-
- public static bool operator==(SchemaDecimal obj1, SchemaDecimal obj2)
- {
- return obj1.Value == obj2.Value;
- }
-
- public static bool operator!=(SchemaDecimal obj1, SchemaDecimal obj2)
- {
- return obj1.Value != obj2.Value;
- }
-
- public int CompareTo(object obj)
- {
- return Value.CompareTo(((SchemaDecimal)obj).Value);
- }
-
- public object Clone()
- {
- return new SchemaDecimal(Value);
- }
- }
-
- public class SchemaDateTime : ISchemaType
- {
- public DateTime Value;
-
- public SchemaDateTime(SchemaDateTime obj)
- {
- Value = obj.Value;
- }
-
- public SchemaDateTime(DateTime Value)
- {
- this.Value = Value;
- }
-
- public SchemaDateTime(string Value)
- {
- this.Value = Convert.ToDateTime(Value);
- }
-
- public override string ToString()
- {
- return Value.GetDateTimeFormats('s')\[0\];
- }
-
- public override int GetHashCode()
- {
- return Value.GetHashCode();
- }
-
- public override bool Equals(object obj)
- {
- if (obj == null)
- return false;
- if (!(obj is SchemaDateTime))
- return false;
- return Value == ((SchemaDateTime)obj).Value;
- }
-
- public static bool operator==(SchemaDateTime obj1, SchemaDateTime obj2)
- {
- return obj1.Value == obj2.Value;
- }
-
- public static bool operator!=(SchemaDateTime obj1, SchemaDateTime obj2)
- {
- return obj1.Value != obj2.Value;
- }
-
- public int CompareTo(object obj)
- {
- return Value.CompareTo(((SchemaDateTime)obj).Value);
- }
-
- public object Clone()
- {
- return new SchemaDateTime(Value);
- }
- }
-
- public class SchemaString : ISchemaType
- {
- public string Value;
-
- public SchemaString(SchemaString obj)
- {
- Value = obj.Value;
- }
-
- public SchemaString(string Value)
- {
- this.Value = Value;
- }
-
- public override string ToString()
- {
- return Value;
- }
-
- public override int GetHashCode()
- {
- return Value.GetHashCode();
- }
-
- public override bool Equals(object obj)
- {
- if (obj == null)
- return false;
- if (!(obj is SchemaString))
- return false;
- return Value == ((SchemaString)obj).Value;
- }
-
- public static bool operator==(SchemaString obj1, SchemaString obj2)
- {
- return obj1.Value == obj2.Value;
- }
-
- public static bool operator!=(SchemaString obj1, SchemaString obj2)
- {
- return obj1.Value != obj2.Value;
- }
-
- public int CompareTo(object obj)
- {
- return Value.CompareTo(((SchemaString)obj).Value);
- }
-
- public object Clone()
- {
- return new SchemaString(Value);
- }
- }
- }
-