LinkArea.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Permission is hereby granted, free of charge, to any person obtaining
  2. // a copy of this software and associated documentation files (the
  3. // "Software"), to deal in the Software without restriction, including
  4. // without limitation the rights to use, copy, modify, merge, publish,
  5. // distribute, sublicense, and/or sell copies of the Software, and to
  6. // permit persons to whom the Software is furnished to do so, subject to
  7. // the following conditions:
  8. //
  9. // The above copyright notice and this permission notice shall be
  10. // included in all copies or substantial portions of the Software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  16. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  17. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  18. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19. //
  20. // Copyright (c) 2004 Novell, Inc.
  21. //
  22. // Authors:
  23. //
  24. // Dennis Hayes, [email protected]
  25. // Andreas Nahr, [email protected]
  26. // Jordi Mas i Hernandez, [email protected]
  27. //
  28. // COMPLETE
  29. namespace System.Windows.Forms
  30. {
  31. [Serializable]
  32. public struct LinkArea
  33. {
  34. private int start;
  35. private int length;
  36. public LinkArea (int start, int length)
  37. {
  38. this.start = start;
  39. this.length = length;
  40. }
  41. #region Public Properties
  42. public int Start {
  43. get { return start; }
  44. set { start = value; }
  45. }
  46. public int Length {
  47. get { return length; }
  48. set { length = value; }
  49. }
  50. public bool IsEmpty {
  51. get {
  52. if (start == 0 && length == 0)
  53. return true;
  54. else
  55. return false;
  56. }
  57. }
  58. #endregion //Public Properties
  59. #region Methods
  60. public override bool Equals (object o)
  61. {
  62. if (!(o is LinkArea))
  63. return false;
  64. LinkArea comp = (LinkArea) o;
  65. return (comp.Start == start && comp.Length == length);
  66. }
  67. public override int GetHashCode ()
  68. {
  69. return start << 4 | length;
  70. }
  71. #endregion //Methods
  72. }
  73. }