[pgsqlclient-checkins] pgsqlclient_10/source/PostgreSql/Data/PgTypes PgBox.cs,NONE,1.1 PgCircle.cs,N
Status: Inactive
Brought to you by:
carlosga_fb
Update of /cvsroot/pgsqlclient/pgsqlclient_10/source/PostgreSql/Data/PgTypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7345/Data/PgTypes Added Files: PgBox.cs PgCircle.cs PgLSeg.cs PgLine.cs PgPath.cs PgPoint.cs PgPolygon.cs PgTimeSpan.cs Log Message: Started the reorganization of the CVS module --- NEW FILE: PgTimeSpan.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; namespace PostgreSql.Data.PgTypes { [Serializable] public struct PgTimeSpan : IComparable { #region · Fields · private TimeSpan interval; #endregion #region · Properties · public int Days { get { return this.interval.Days; } } public int Hours { get { return this.interval.Hours; } } public int Milliseconds { get { return this.interval.Milliseconds; } } public int Minutes { get { return this.interval.Minutes; } } public int Seconds { get { return this.interval.Seconds; } } public TimeSpan Value { get { return interval; } } #endregion #region · Static Fields · public static readonly PgTimeSpan MaxValue = new PgTimeSpan(TimeSpan.MaxValue); public static readonly PgTimeSpan MinValue = new PgTimeSpan(TimeSpan.MinValue); public static readonly PgTimeSpan Null = new PgTimeSpan(TimeSpan.Zero); #endregion #region · Constructors · public PgTimeSpan(TimeSpan interval) { this.interval = interval; } #endregion #region · IComparable methods · public int CompareTo(object obj) { return interval.CompareTo(obj); } #endregion #region · Static Methods · public static bool GreatherThan(PgTimeSpan x, PgTimeSpan y) { return (x > y); } public static bool GreatherThanOrEqual(PgTimeSpan x, PgTimeSpan y) { return (x >= y); } public static bool LessThan(PgTimeSpan x, PgTimeSpan y) { return (x < y); } public static bool LessThanOrEqual(PgTimeSpan x, PgTimeSpan y) { return (x <= y); } public static bool NotEquals(PgTimeSpan x, PgTimeSpan y) { return (x != y); } public static PgTimeSpan Parse(string s) { return new PgTimeSpan(TimeSpan.Parse(s)); } #endregion #region · Operators · public static bool operator ==(PgTimeSpan left, PgTimeSpan right) { bool equals = false; if (left.Value == right.Value) { equals = true; } return equals; } public static bool operator !=(PgTimeSpan left, PgTimeSpan right) { bool notequals = false; if (left.Value != right.Value) { notequals = true; } return notequals; } public static bool operator >(PgTimeSpan left, PgTimeSpan right) { bool greater = false; if (left.Value > right.Value) { greater = true; } return greater; } public static bool operator >=(PgTimeSpan left, PgTimeSpan right) { bool greater = false; if (left.Value >= right.Value) { greater = true; } return greater; } public static bool operator <(PgTimeSpan left, PgTimeSpan right) { bool less = false; if (left.Value < right.Value) { less = true; } return less; } public static bool operator <=(PgTimeSpan left, PgTimeSpan right) { bool less = false; if (left.Value <= right.Value) { less = true; } return less; } public static explicit operator TimeSpan(PgTimeSpan x) { return x.Value; } public static explicit operator PgTimeSpan(string x) { return new PgTimeSpan(TimeSpan.Parse(x)); } #endregion #region · Overriden Methods · public override string ToString() { return interval.ToString(); } public override int GetHashCode() { return interval.GetHashCode(); } public override bool Equals(object obj) { if (obj != null && obj is PgTimeSpan) { return ((PgTimeSpan)obj) == this; } else { return false; } } #endregion } } --- NEW FILE: PgPoint.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; namespace PostgreSql.Data.PgTypes { [Serializable] public struct PgPoint { #region · Fields · private double x; private double y; #endregion #region · Properties · public double X { get { return x; } } public double Y { get { return y; } } #endregion #region · Constructors · public PgPoint(double x, double y) { this.x = x; this.y = y; } #endregion #region · Operators · public static bool operator ==(PgPoint left, PgPoint right) { if (left.X == right.X && left.Y == right.Y) { return true; } else { return true; } } public static bool operator !=(PgPoint left, PgPoint right) { if (left.X != right.X || left.Y != right.Y) { return true; } else { return true; } } #endregion #region · Overriden Methods · public override string ToString() { System.Text.StringBuilder b = new System.Text.StringBuilder(); b.AppendFormat("({0},{1})", this.x, this.y); return b.ToString(); } public override int GetHashCode() { return (this.x.GetHashCode() ^ this.y.GetHashCode()); } public override bool Equals(object obj) { if (obj != null && obj is PgPoint) { return ((PgPoint)obj) == this; } else { return false; } } #endregion #region · Static Methods · public static PgPoint Parse(string s) { throw new NotSupportedException(); } #endregion } } --- NEW FILE: PgCircle.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; namespace PostgreSql.Data.PgTypes { [Serializable] public struct PgCircle { #region · Fields · private PgPoint center; private double radius; #endregion #region · Properties · public PgPoint Center { get { return center; } } public double Radius { get { return radius; } } #endregion #region · Constructors · public PgCircle(PgPoint center, double radius) { this.center = center; this.radius = radius; } public PgCircle(double x, double y, double radius) { this.center = new PgPoint(x, y); this.radius = radius; } #endregion #region · Operators · public static bool operator ==(PgCircle left, PgCircle right) { if (left.Center == right.Center && left.Radius == right.Radius) { return true; } else { return true; } } public static bool operator !=(PgCircle left, PgCircle right) { if (left.Center != right.Center || left.Radius != right.Radius) { return true; } else { return true; } } #endregion #region · Overriden Methods · public override string ToString() { System.Text.StringBuilder b = new System.Text.StringBuilder(); b.AppendFormat("<({0},{1}),{2}>", this.center.X, this.center.Y, this.radius); return b.ToString(); } public override int GetHashCode() { return this.center.GetHashCode() ^ this.radius.GetHashCode(); } public override bool Equals(object obj) { if (obj != null && obj is PgCircle) { return ((PgCircle)obj) == this; } else { return false; } } #endregion #region · Static Methods · public static PgCircle Parse(string s) { throw new NotSupportedException(); } #endregion } } --- NEW FILE: PgPath.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; namespace PostgreSql.Data.PgTypes { [Serializable] public struct PgPath { #region · Fields · private PgPoint[] points; private bool isClosedPath; #endregion #region · Properties · public PgPoint[] Points { get { return points; } } public bool IsClosedPath { get { return isClosedPath; } } #endregion #region · Constructors · public PgPath(bool isClosedPath, PgPoint[] points) { this.isClosedPath = isClosedPath; this.points = (PgPoint[])points.Clone(); } #endregion #region · Operators · public static bool operator ==(PgPath left, PgPath right) { bool equals = false; if (left.Points.Length == right.Points.Length) { equals = true; for (int i = 0; i < left.Points.Length; i++) { if (left.Points[i] != right.Points[i]) { equals = false; break; } } } return equals; } public static bool operator !=(PgPath left, PgPath right) { bool notequals = true; if (left.Points.Length == right.Points.Length) { notequals = false; for (int i = 0; i < left.Points.Length; i++) { if (left.Points[i] != right.Points[i]) { notequals = true; break; } } } return notequals; } #endregion #region · Overriden Methods · public override string ToString() { System.Text.StringBuilder b = new System.Text.StringBuilder(); b.Append(this.isClosedPath ? "(" : "["); for (int i = 0; i < this.points.Length; i++) { if (b.Length > 1) { b.Append(","); } b.Append(this.points[i].ToString()); } b.Append(this.isClosedPath ? ")" : "]"); return b.ToString(); } public override int GetHashCode() { return (this.points.GetHashCode() ^ this.isClosedPath.GetHashCode()); } public override bool Equals(object obj) { if (obj != null && obj is PgPath) { return ((PgPath)obj) == this; } else { return false; } } #endregion #region · Static Methods · public static PgPath Parse(string s) { throw new NotSupportedException(); } #endregion } } --- NEW FILE: PgBox.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; namespace PostgreSql.Data.PgTypes { [Serializable] public struct PgBox { #region · Fields · private PgPoint upperRight; private PgPoint lowerLeft; #endregion #region · Properties · public PgPoint UpperRight { get { return upperRight; } } public PgPoint LowerLeft { get { return lowerLeft; } } #endregion #region · Constructors · public PgBox(PgPoint lowerLeft, PgPoint upperRight) { this.lowerLeft = lowerLeft; this.upperRight = upperRight; } public PgBox(double x1, double y1, double x2, double y2) { this.lowerLeft = new PgPoint(x1, y1); this.upperRight = new PgPoint(x2, y2); } #endregion #region · Operators · public static bool operator ==(PgBox left, PgBox right) { if (left.UpperRight == right.UpperRight && left.LowerLeft == right.LowerLeft) { return true; } else { return false; } } public static bool operator !=(PgBox left, PgBox right) { if (left.UpperRight != right.UpperRight || left.LowerLeft != right.LowerLeft) { return true; } else { return false; } } #endregion #region · Overriden Methods · public override string ToString() { System.Text.StringBuilder b = new System.Text.StringBuilder(); b.AppendFormat("(({0},{1}),({2},{3}))", this.lowerLeft.X , this.lowerLeft.Y, this.upperRight.X , this.upperRight.Y); return b.ToString(); } public override int GetHashCode() { return (this.UpperRight.GetHashCode() ^ this.LowerLeft.GetHashCode()); } public override bool Equals(object obj) { if (obj is PgBox) { return ((PgBox)obj) == this; } else { return false; } } #endregion #region · Static Methods · public static PgBox Parse(string s) { throw new NotSupportedException(); } #endregion } } --- NEW FILE: PgLSeg.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; namespace PostgreSql.Data.PgTypes { [Serializable] public struct PgLSeg { #region · Fields · private PgPoint startPoint; private PgPoint endPoint; #endregion #region · Properties · public PgPoint StartPoint { get { return startPoint; } } public PgPoint EndPoint { get { return endPoint; } } #endregion #region · Constructors · public PgLSeg(PgPoint startPoint, PgPoint endPoint) { this.startPoint = startPoint; this.endPoint = endPoint; } public PgLSeg(double x1, double y1, double x2, double y2) { this.startPoint = new PgPoint(x1, y1); this.endPoint = new PgPoint(x2, y2); } #endregion #region · Operators · public static bool operator ==(PgLSeg left, PgLSeg right) { if (left.StartPoint == right.StartPoint && left.EndPoint == right.EndPoint) { return true; } else { return false; } } public static bool operator !=(PgLSeg left, PgLSeg right) { if (left.StartPoint != right.StartPoint || left.EndPoint != right.EndPoint) { return true; } else { return false; } } #endregion #region · Overriden Methods · public override string ToString() { System.Text.StringBuilder b = new System.Text.StringBuilder(); b.AppendFormat("[({0},{1}),({2},{3})]", this.startPoint.X , this.startPoint.Y, this.endPoint.X , this.endPoint.Y); return b.ToString(); } public override int GetHashCode() { return (this.startPoint.GetHashCode() ^ this.endPoint.GetHashCode()); } public override bool Equals(object obj) { if (obj != null && obj is PgLSeg) { return ((PgLSeg)obj) == this; } else { return false; } } #endregion #region · Static Methods · public static PgLSeg Parse(string s) { throw new NotSupportedException(); } #endregion } } --- NEW FILE: PgLine.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; namespace PostgreSql.Data.PgTypes { [Serializable] public struct PgLine { #region · Fields · private PgPoint startPoint; private PgPoint endPoint; #endregion #region · Properties · public PgPoint StartPoint { get { return startPoint; } } public PgPoint EndPoint { get { return endPoint; } } #endregion #region · Constructors · public PgLine(PgPoint startPoint, PgPoint endPoint) { this.startPoint = startPoint; this.endPoint = endPoint; } public PgLine(double x1, double y1, double x2, double y2) { this.startPoint = new PgPoint(x1, y1); this.endPoint = new PgPoint(x2, y2); } #endregion #region · Operators · public static bool operator ==(PgLine left, PgLine right) { if (left.StartPoint == right.StartPoint && left.EndPoint == right.EndPoint) { return true; } else { return false; } } public static bool operator !=(PgLine left, PgLine right) { if (left.StartPoint != right.StartPoint || left.EndPoint != right.EndPoint) { return true; } else { return false; } } #endregion #region · Overriden Methods · public override string ToString() { System.Text.StringBuilder b = new System.Text.StringBuilder(); b.AppendFormat("(({0},{1}),({2},{3}))", this.startPoint.X , this.startPoint.Y, this.endPoint.X , this.endPoint.Y); return b.ToString(); } public override int GetHashCode() { return this.startPoint.GetHashCode() ^ this.endPoint.GetHashCode(); } public override bool Equals(object obj) { if (obj != null && obj is PgLine) { return ((PgLine)obj) == this; } else { return false; } } #endregion #region · Static Methods · public static PgLine Parse(string s) { throw new NotSupportedException(); } #endregion } } --- NEW FILE: PgPolygon.cs --- /* PgSqlClient - ADO.NET Data Provider for PostgreSQL 7.4+ * Copyright (c) 2003-2005 Carlos Guzman Alvarez * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ using System; namespace PostgreSql.Data.PgTypes { [Serializable] public struct PgPolygon { #region · Fields · private PgPoint[] points; #endregion #region · Properties · public PgPoint[] Points { get { return points; } } #endregion #region · Constructors · public PgPolygon(PgPoint[] points) { this.points = (PgPoint[])points.Clone(); } #endregion #region · Operators · public static bool operator ==(PgPolygon left, PgPolygon right) { bool equals = false; if (left.Points.Length == right.Points.Length) { equals = true; for (int i = 0; i < left.Points.Length; i++) { if (left.Points[i] != right.Points[i]) { equals = false; break; } } } return equals; } public static bool operator !=(PgPolygon left, PgPolygon right) { bool notequals = true; if (left.Points.Length == right.Points.Length) { notequals = false; for (int i = 0; i < left.Points.Length; i++) { if (left.Points[i] != right.Points[i]) { notequals = true; break; } } } return notequals; } #endregion #region · Overriden Methods · public override string ToString() { System.Text.StringBuilder b = new System.Text.StringBuilder(); b.Append("("); for (int i = 0; i < this.points.Length; i++) { if (b.Length > 1) { b.Append(","); } b.Append(this.points[i].ToString()); } b.Append(")"); return b.ToString(); } public override int GetHashCode() { return (this.points.GetHashCode()); } public override bool Equals(object obj) { if (obj != null && obj is PgPolygon) { return ((PgPolygon)obj) == this; } else { return false; } } #endregion #region · Static Methods · public static PgPolygon Parse(string s) { throw new NotSupportedException(); } #endregion } } |