* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.system.graph;
+import java.util.Arrays;
+
/**
*
* @author $author$
*/
public MyNode(String aName, String[] aPorts) {
super(aName);
- ports = aPorts;
+ ports = Arrays.copyOf(aPorts, aPorts.length);
}
public String[] getPorts() {
- return ports;
+ return Arrays.copyOf(ports, ports.length);
+ }
+
+ @Override
+ public boolean equals(Object aObj) {
+ if (!super.equals(aObj)) {
+ return false;
+ }
+ if (!(aObj instanceof MyNode)) {
+ return false;
+ }
+ return Arrays.equals(ports, ((MyNode) aObj).ports);
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
}
}