home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _816308F9A5E643F1A1BBEF60D873377A < prev    next >
Encoding:
Text File  |  2003-03-24  |  6.4 KB  |  358 lines

  1. using System;
  2.  
  3. namespace Altova.Types
  4. {
  5.     public interface ISchemaType : IComparable, ICloneable
  6.     {
  7.     }
  8.  
  9.     public class SchemaBoolean : ISchemaType
  10.     {
  11.         public bool Value;
  12.  
  13.         public SchemaBoolean(SchemaBoolean obj)
  14.         {
  15.             Value = obj.Value;
  16.         }
  17.  
  18.         public SchemaBoolean(bool Value)
  19.         {
  20.             this.Value = Value;
  21.         }
  22.  
  23.         public SchemaBoolean(string Value)
  24.         {
  25.             this.Value = Value == "true" || Value == "1";
  26.         }
  27.  
  28.         public override string ToString()
  29.         {
  30.             return Value ? "true" : "false";
  31.         }
  32.  
  33.         public override int GetHashCode()
  34.         {
  35.             return Value ? 1231 : 1237;
  36.         }
  37.  
  38.         public override bool Equals(object obj)
  39.         {
  40.             if (obj == null)
  41.                 return false;
  42.             if (!(obj is SchemaBoolean))
  43.                 return false;
  44.             return Value == ((SchemaBoolean)obj).Value;
  45.         }
  46.  
  47.         public static bool operator==(SchemaBoolean obj1, SchemaBoolean obj2)
  48.         {
  49.             return obj1.Value == obj2.Value;
  50.         }
  51.  
  52.         public static bool operator!=(SchemaBoolean obj1, SchemaBoolean obj2)
  53.         {
  54.             return obj1.Value != obj2.Value;
  55.         }
  56.  
  57.         public int CompareTo(object obj)
  58.         {
  59.             return Value.CompareTo(((SchemaBoolean)obj).Value);
  60.         }
  61.  
  62.         public object Clone()
  63.         {
  64.             return new SchemaBoolean(Value);
  65.         }
  66.     }
  67.  
  68.     public class SchemaInt : ISchemaType
  69.     {
  70.         public int Value;
  71.  
  72.         public SchemaInt(SchemaInt obj)
  73.         {
  74.             Value = obj.Value;
  75.         }
  76.  
  77.         public SchemaInt(int Value)
  78.         {
  79.             this.Value = Value;
  80.         }
  81.  
  82.         public SchemaInt(string Value)
  83.         {
  84.             this.Value = Convert.ToInt32(Value);
  85.         }
  86.  
  87.         public override string ToString()
  88.         {
  89.             return Convert.ToString(Value);
  90.         }
  91.  
  92.         public override int GetHashCode()
  93.         {
  94.             return Value;
  95.         }
  96.  
  97.         public override bool Equals(object obj)
  98.         {
  99.             if (obj == null)
  100.                 return false;
  101.             if (!(obj is SchemaInt))
  102.                 return false;
  103.             return Value == ((SchemaInt)obj).Value;
  104.         }
  105.  
  106.         public static bool operator==(SchemaInt obj1, SchemaInt obj2)
  107.         {
  108.             return obj1.Value == obj2.Value;
  109.         }
  110.  
  111.         public static bool operator!=(SchemaInt obj1, SchemaInt obj2)
  112.         {
  113.             return obj1.Value != obj2.Value;
  114.         }
  115.  
  116.         public int CompareTo(object obj)
  117.         {
  118.             return Value.CompareTo(((SchemaInt)obj).Value);
  119.         }
  120.  
  121.         public object Clone()
  122.         {
  123.             return new SchemaInt(Value);
  124.         }
  125.     }
  126.  
  127.     public class SchemaLong : ISchemaType
  128.     {
  129.         public long Value;
  130.  
  131.         public SchemaLong(SchemaLong obj)
  132.         {
  133.             Value = obj.Value;
  134.         }
  135.  
  136.         public SchemaLong(long Value)
  137.         {
  138.             this.Value = Value;
  139.         }
  140.  
  141.         public SchemaLong(string Value)
  142.         {
  143.             this.Value = Convert.ToInt64(Value);
  144.         }
  145.  
  146.         public override string ToString()
  147.         {
  148.             return Convert.ToString(Value);
  149.         }
  150.  
  151.         public override int GetHashCode()
  152.         {
  153.             return (int)Value;
  154.         }
  155.  
  156.         public override bool Equals(object obj)
  157.         {
  158.             if (obj == null)
  159.                 return false;
  160.             if (!(obj is SchemaLong))
  161.                 return false;
  162.             return Value == ((SchemaLong)obj).Value;
  163.         }
  164.  
  165.         public static bool operator==(SchemaLong obj1, SchemaLong obj2)
  166.         {
  167.             return obj1.Value == obj2.Value;
  168.         }
  169.  
  170.         public static bool operator!=(SchemaLong obj1, SchemaLong obj2)
  171.         {
  172.             return obj1.Value != obj2.Value;
  173.         }
  174.  
  175.         public int CompareTo(object obj)
  176.         {
  177.             return Value.CompareTo(((SchemaLong)obj).Value);
  178.         }
  179.  
  180.         public object Clone()
  181.         {
  182.             return new SchemaLong(Value);
  183.         }
  184.     }
  185.  
  186.     public class SchemaDecimal : ISchemaType
  187.     {
  188.         public decimal Value;
  189.  
  190.         public SchemaDecimal(SchemaDecimal obj)
  191.         {
  192.             Value = obj.Value;
  193.         }
  194.  
  195.         public SchemaDecimal(decimal Value)
  196.         {
  197.             this.Value = Value;
  198.         }
  199.  
  200.         public SchemaDecimal(string Value)
  201.         {
  202.             this.Value = Convert.ToDecimal(Value);
  203.         }
  204.  
  205.         public override string ToString()
  206.         {
  207.             return Convert.ToString(Value);
  208.         }
  209.  
  210.         public override int GetHashCode()
  211.         {
  212.             return Value.GetHashCode();
  213.         }
  214.  
  215.         public override bool Equals(object obj)
  216.         {
  217.             if (obj == null)
  218.                 return false;
  219.             if (!(obj is SchemaDecimal))
  220.                 return false;
  221.             return Value == ((SchemaDecimal)obj).Value;
  222.         }
  223.  
  224.         public static bool operator==(SchemaDecimal obj1, SchemaDecimal obj2)
  225.         {
  226.             return obj1.Value == obj2.Value;
  227.         }
  228.  
  229.         public static bool operator!=(SchemaDecimal obj1, SchemaDecimal obj2)
  230.         {
  231.             return obj1.Value != obj2.Value;
  232.         }
  233.  
  234.         public int CompareTo(object obj)
  235.         {
  236.             return Value.CompareTo(((SchemaDecimal)obj).Value);
  237.         }
  238.  
  239.         public object Clone()
  240.         {
  241.             return new SchemaDecimal(Value);
  242.         }
  243.     }
  244.  
  245.     public class SchemaDateTime : ISchemaType
  246.     {
  247.         public DateTime Value;
  248.  
  249.         public SchemaDateTime(SchemaDateTime obj)
  250.         {
  251.             Value = obj.Value;
  252.         }
  253.  
  254.         public SchemaDateTime(DateTime Value)
  255.         {
  256.             this.Value = Value;
  257.         }
  258.  
  259.         public SchemaDateTime(string Value)
  260.         {
  261.             this.Value = Convert.ToDateTime(Value);
  262.         }
  263.  
  264.         public override string ToString()
  265.         {
  266.             return Value.GetDateTimeFormats('s')\[0\];
  267.         }
  268.  
  269.         public override int GetHashCode()
  270.         {
  271.             return Value.GetHashCode();
  272.         }
  273.  
  274.         public override bool Equals(object obj)
  275.         {
  276.             if (obj == null)
  277.                 return false;
  278.             if (!(obj is SchemaDateTime))
  279.                 return false;
  280.             return Value == ((SchemaDateTime)obj).Value;
  281.         }
  282.  
  283.         public static bool operator==(SchemaDateTime obj1, SchemaDateTime obj2)
  284.         {
  285.             return obj1.Value == obj2.Value;
  286.         }
  287.  
  288.         public static bool operator!=(SchemaDateTime obj1, SchemaDateTime obj2)
  289.         {
  290.             return obj1.Value != obj2.Value;
  291.         }
  292.  
  293.         public int CompareTo(object obj)
  294.         {
  295.             return Value.CompareTo(((SchemaDateTime)obj).Value);
  296.         }
  297.  
  298.         public object Clone()
  299.         {
  300.             return new SchemaDateTime(Value);
  301.         }
  302.     }
  303.  
  304.     public class SchemaString : ISchemaType
  305.     {
  306.         public string Value;
  307.  
  308.         public SchemaString(SchemaString obj)
  309.         {
  310.             Value = obj.Value;
  311.         }
  312.  
  313.         public SchemaString(string Value)
  314.         {
  315.             this.Value = Value;
  316.         }
  317.  
  318.         public override string ToString()
  319.         {
  320.             return Value;
  321.         }
  322.  
  323.         public override int GetHashCode()
  324.         {
  325.             return Value.GetHashCode();
  326.         }
  327.  
  328.         public override bool Equals(object obj)
  329.         {
  330.             if (obj == null)
  331.                 return false;
  332.             if (!(obj is SchemaString))
  333.                 return false;
  334.             return Value == ((SchemaString)obj).Value;
  335.         }
  336.  
  337.         public static bool operator==(SchemaString obj1, SchemaString obj2)
  338.         {
  339.             return obj1.Value == obj2.Value;
  340.         }
  341.  
  342.         public static bool operator!=(SchemaString obj1, SchemaString obj2)
  343.         {
  344.             return obj1.Value != obj2.Value;
  345.         }
  346.  
  347.         public int CompareTo(object obj)
  348.         {
  349.             return Value.CompareTo(((SchemaString)obj).Value);
  350.         }
  351.  
  352.         public object Clone()
  353.         {
  354.             return new SchemaString(Value);
  355.         }
  356.     }
  357. }
  358.