Mercurial > projects > dwt2
comparison org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/BindingStatus.d @ 85:6be48cf9f95c
Work on databinding
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 18 Apr 2009 13:54:50 +0200 |
parents | 0a55d2d5a946 |
children |
comparison
equal
deleted
inserted
replaced
84:fcf926c91ca4 | 85:6be48cf9f95c |
---|---|
70 */ | 70 */ |
71 public static BindingStatus ok() { | 71 public static BindingStatus ok() { |
72 return new BindingStatus(Policy.JFACE_DATABINDING, 0, "", null); //$NON-NLS-1$ | 72 return new BindingStatus(Policy.JFACE_DATABINDING, 0, "", null); //$NON-NLS-1$ |
73 } | 73 } |
74 | 74 |
75 private static int hashCode(Object[] array) { | 75 private static hash_t toHash(IStatus[] array) { |
76 final int prime = 31; | 76 final int prime = 31; |
77 if (array is null) | 77 if (array is null) |
78 return 0; | 78 return 0; |
79 int result = 1; | 79 int result = 1; |
80 for (int index = 0; index < array.length; index++) { | 80 for (int index = 0; index < array.length; index++) { |
81 auto obj = cast(Object)array[index]; | |
81 result = prime * result | 82 result = prime * result |
82 + (array[index] is null ? 0 : array[index].hashCode()); | 83 + (obj is null ? 0 : obj.toHash()); |
83 } | 84 } |
84 return result; | 85 return result; |
85 } | 86 } |
86 | 87 |
87 public int hashCode() { | 88 public hash_t toHash() { |
88 final int prime = 31; | 89 final int prime = 31; |
89 int result = 1; | 90 int result = 1; |
90 result = prime * result + BindingStatus.hashCode(getChildren()); | 91 result = prime * result + BindingStatus.toHash(getChildren()); |
91 return result; | 92 return result; |
92 } | 93 } |
93 | 94 |
94 public override bool opEquals(Object obj) { | 95 public override equals_t opEquals(Object obj) { |
95 if (this is obj) | 96 if (this is obj) |
96 return true; | 97 return true; |
97 if (obj is null) | 98 if (obj is null) |
98 return false; | 99 return false; |
99 if (getClass() !is obj.getClass()) | 100 if (this.classinfo !is obj.classinfo) |
100 return false; | 101 return false; |
101 final BindingStatus other = cast(BindingStatus) obj; | 102 final BindingStatus other = cast(BindingStatus) obj; |
102 if (!Arrays.equals(getChildren(), other.getChildren())) | 103 if (!Arrays.equals(getChildren(), other.getChildren())) |
103 return false; | 104 return false; |
104 return true; | 105 return true; |