4 // Part of the Mono class libraries at
5 // mcs/class/System.Data.OracleClient/System.Data.OracleClient
7 // Assembly: System.Data.OracleClient.dll
8 // Namespace: System.Data.OracleClient
10 // Author: Tim Coleman <tim@timcoleman.com>
12 // Copyright (C) Tim Coleman, 2003
14 // Licensed under the MIT/X11 License.
18 using System.Data.SqlTypes;
20 namespace System.Data.OracleClient {
21 public struct OracleMonthSpan : IComparable, INullable
25 public static readonly OracleMonthSpan MaxValue = new OracleMonthSpan (176556);
26 public static readonly OracleMonthSpan MinValue = new OracleMonthSpan (-176556);
27 public static readonly OracleMonthSpan Null = new OracleMonthSpan ();
36 public OracleMonthSpan (int months)
42 public OracleMonthSpan (OracleMonthSpan from)
44 this.notNull = from.notNull;
45 this.value = from.value;
48 public OracleMonthSpan (int years, int months)
49 : this (years * 12 + months)
53 #endregion // Constructors
58 get { return !notNull; }
64 throw new Exception ("Data is null.");
70 #endregion // Properties
75 public int CompareTo (object obj)
77 throw new NotImplementedException ();
81 public override bool Equals (object value)
83 throw new NotImplementedException ();
86 public static OracleBoolean Equals (OracleMonthSpan x, OracleMonthSpan y)
88 if (x.IsNull || y.IsNull)
89 return OracleBoolean.Null;
90 return new OracleBoolean (x.Value == y.Value);
94 public override int GetHashCode ()
96 throw new NotImplementedException ();
99 public static OracleBoolean GreaterThan (OracleMonthSpan x, OracleMonthSpan y)
101 if (x.IsNull || y.IsNull)
102 return OracleBoolean.Null;
103 return (x.value > y.value);
106 public static OracleBoolean GreaterThanOrEqual (OracleMonthSpan x, OracleMonthSpan y)
108 if (x.IsNull || y.IsNull)
109 return OracleBoolean.Null;
110 return (x.value >= y.value);
113 public static OracleBoolean LessThan (OracleMonthSpan x, OracleMonthSpan y)
115 if (x.IsNull || y.IsNull)
116 return OracleBoolean.Null;
117 return (x.value < y.value);
120 public static OracleBoolean LessThanOrEqual (OracleMonthSpan x, OracleMonthSpan y)
122 if (x.IsNull || y.IsNull)
123 return OracleBoolean.Null;
124 return (x.value <= y.value);
127 public static OracleBoolean NotEquals (OracleMonthSpan x, OracleMonthSpan y)
129 if (x.IsNull || y.IsNull)
130 return OracleBoolean.Null;
131 return (x.value != y.value);
134 public static OracleMonthSpan Parse (string s)
136 return new OracleMonthSpan (Int32.Parse (s));
139 public override string ToString ()
143 return value.ToString ();
146 #endregion // Methods
148 #region Operators and Type Conversions
150 public static OracleBoolean operator == (OracleMonthSpan x, OracleMonthSpan y)
152 return Equals (x, y);
155 public static OracleBoolean operator > (OracleMonthSpan x, OracleMonthSpan y)
157 return GreaterThan (x, y);
160 public static OracleBoolean operator >= (OracleMonthSpan x, OracleMonthSpan y)
162 return GreaterThanOrEqual (x, y);
165 public static OracleBoolean operator != (OracleMonthSpan x, OracleMonthSpan y)
167 return NotEquals (x, y);
170 public static OracleBoolean operator < (OracleMonthSpan x, OracleMonthSpan y)
172 return LessThan (x, y);
175 public static OracleBoolean operator <= (OracleMonthSpan x, OracleMonthSpan y)
177 return LessThan (x, y);
180 public static explicit operator int (OracleMonthSpan x)
185 public static explicit operator OracleMonthSpan (string s)
190 #endregion // Operators and Type Conversions