- Timestamp:
- 06/28/18 11:13:37 (6 years ago)
- Location:
- branches/2522_RefactorPluginInfrastructure
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2522_RefactorPluginInfrastructure
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Common/3.3/Point2D.cs
r12012 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 namespace HeuristicLab.Common { 27 27 [Serializable] 28 public struct Point2D<T> where T : struct {28 public struct Point2D<T> where T : struct, IEquatable<T> { 29 29 public static readonly Point2D<T> Empty = new Point2D<T>(); 30 30 … … 38 38 } 39 39 40 private object tag; 41 public object Tag { 42 get { return tag; } 43 } 44 40 45 [Browsable(false)] 41 46 public bool IsEmpty { … … 43 48 } 44 49 45 public Point2D(T x, T y ) {50 public Point2D(T x, T y, object tag = null) { 46 51 this.x = x; 47 52 this.y = y; 53 this.tag = tag; 54 } 55 56 public static Point2D<T> Create(T x, T y, object tag = null) { 57 return new Point2D<T>(x, y, tag); 48 58 } 49 59 50 60 public static bool operator ==(Point2D<T> left, Point2D<T> right) { 51 return left.x.Equals(right.x) && left.y.Equals(right.y) ;61 return left.x.Equals(right.x) && left.y.Equals(right.y) && left.tag == right.tag; 52 62 } 53 63 public static bool operator !=(Point2D<T> left, Point2D<T> right) { … … 59 69 return false; 60 70 Point2D<T> point = (Point2D<T>)obj; 61 return x.Equals(point.x) && y.Equals(point.y) && GetType().Equals(point.GetType()); 71 return GetType() == point.GetType() && x.Equals(point.x) && y.Equals(point.y) && 72 ((tag != null && tag.Equals(point.tag)) || tag == point.tag); 62 73 } 63 74 public override int GetHashCode() {
Note: See TracChangeset
for help on using the changeset viewer.