Author: adietish
Date: 2010-11-09 11:04:02 -0500 (Tue, 09 Nov 2010)
New Revision: 26380
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Image.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java
Log:
[JBIDE-7513] added equals and hascode methods to be able to match new instances to old
ones (so that I can keep the selection in the cloud viewer)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-11-09 15:59:32
UTC (rev 26379)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-11-09 16:04:02
UTC (rev 26380)
@@ -1,5 +1,15 @@
2010-11-09 André Dietisheim <adietish(a)redhat.com>
+ * src/org/jboss/tools/deltacloud/core/client/Instance.java
+ (hashCode):
+ (equals):
+ [JBIDE-7513] added equals and hascode methods to be able to match new instances to old
ones
+ (so that I can keep the selection in the cloud viewer)
+ * src/org/jboss/tools/deltacloud/core/client/Image.java
+ (hashCode):
+ (equals):
+ [JBIDE-7513] added equals and hascode methods to be able to match new instances to old
ones
+ (so that I can keep the selection in the cloud viewer)
* src/org/jboss/tools/deltacloud/core/ImageFilter.java (setRules):
* src/org/jboss/tools/deltacloud/core/InstanceFilter.java
(setRules):
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java 2010-11-09
15:59:32 UTC (rev 26379)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java 2010-11-09
16:04:02 UTC (rev 26380)
@@ -36,4 +36,29 @@
public String getId() {
return image.getId();
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((image == null) ? 0 : image.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DeltaCloudImage other = (DeltaCloudImage) obj;
+ if (image == null) {
+ if (other.image != null)
+ return false;
+ } else if (!image.equals(other.image))
+ return false;
+ return true;
+ }
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-11-09
15:59:32 UTC (rev 26379)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-11-09
16:04:02 UTC (rev 26380)
@@ -100,4 +100,35 @@
}
return client.performInstanceAction(action);
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((givenName == null) ? 0 : givenName.hashCode());
+ result = prime * result + ((instance == null) ? 0 : instance.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DeltaCloudInstance other = (DeltaCloudInstance) obj;
+ if (givenName == null) {
+ if (other.givenName != null)
+ return false;
+ } else if (!givenName.equals(other.givenName))
+ return false;
+ if (instance == null) {
+ if (other.instance != null)
+ return false;
+ } else if (!instance.equals(other.instance))
+ return false;
+ return true;
+ }
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Image.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Image.java 2010-11-09
15:59:32 UTC (rev 26379)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Image.java 2010-11-09
16:04:02 UTC (rev 26380)
@@ -87,4 +87,49 @@
s += "Arch:\t\t" + getArchitecture() + "\n";
return s;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((architecture == null) ? 0 : architecture.hashCode());
+ result = prime * result + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Image other = (Image) obj;
+ if (architecture == null) {
+ if (other.architecture != null)
+ return false;
+ } else if (!architecture.equals(other.architecture))
+ return false;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (ownerId == null) {
+ if (other.ownerId != null)
+ return false;
+ } else if (!ownerId.equals(other.ownerId))
+ return false;
+ return true;
+ }
+
+
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java 2010-11-09
15:59:32 UTC (rev 26379)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java 2010-11-09
16:04:02 UTC (rev 26380)
@@ -250,4 +250,77 @@
return s;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((cpu == null) ? 0 : cpu.hashCode());
+ result = prime * result + ((imageId == null) ? 0 : imageId.hashCode());
+ result = prime * result + ((keyname == null) ? 0 : keyname.hashCode());
+ result = prime * result + ((memory == null) ? 0 : memory.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode());
+ result = prime * result + ((profileId == null) ? 0 : profileId.hashCode());
+ result = prime * result + ((realmId == null) ? 0 : realmId.hashCode());
+ result = prime * result + ((storage == null) ? 0 : storage.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Instance other = (Instance) obj;
+ if (cpu == null) {
+ if (other.cpu != null)
+ return false;
+ } else if (!cpu.equals(other.cpu))
+ return false;
+ if (imageId == null) {
+ if (other.imageId != null)
+ return false;
+ } else if (!imageId.equals(other.imageId))
+ return false;
+ if (keyname == null) {
+ if (other.keyname != null)
+ return false;
+ } else if (!keyname.equals(other.keyname))
+ return false;
+ if (memory == null) {
+ if (other.memory != null)
+ return false;
+ } else if (!memory.equals(other.memory))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (ownerId == null) {
+ if (other.ownerId != null)
+ return false;
+ } else if (!ownerId.equals(other.ownerId))
+ return false;
+ if (profileId == null) {
+ if (other.profileId != null)
+ return false;
+ } else if (!profileId.equals(other.profileId))
+ return false;
+ if (realmId == null) {
+ if (other.realmId != null)
+ return false;
+ } else if (!realmId.equals(other.realmId))
+ return false;
+ if (storage == null) {
+ if (other.storage != null)
+ return false;
+ } else if (!storage.equals(other.storage))
+ return false;
+ return true;
+ }
}