/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.ow2.choreos.nodes.datamodel;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement
public class ResourceImpact implements Serializable {
private static final long serialVersionUID = 3562796485617767731L;
private MemoryType memory;
private String cpu;
private String storage;
private String network;
public MemoryType getMemory() {
return memory;
}
public void setMemory(MemoryType memory) {
this.memory = memory;
}
public String getCpu() {
return cpu;
}
public void setCpu(String cpu) {
this.cpu = cpu;
}
public String getStorage() {
return storage;
}
public void setStorage(String storage) {
this.storage = storage;
}
public String getNetwork() {
return network;
}
public void setNetwork(String network) {
this.network = network;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((cpu == null) ? 0 : cpu.hashCode());
result = prime * result + ((storage == null) ? 0 : storage.hashCode());
result = prime * result + ((memory == null) ? 0 : memory.hashCode());
result = prime * result + ((network == null) ? 0 : network.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;
ResourceImpact other = (ResourceImpact) obj;
if (cpu == null) {
if (other.cpu != null)
return false;
} else if (!cpu.equals(other.cpu))
return false;
if (storage == null) {
if (other.storage != null)
return false;
} else if (!storage.equals(other.storage))
return false;
if (memory != other.memory)
return false;
if (network == null) {
if (other.network != null)
return false;
} else if (!network.equals(other.network))
return false;
return true;
}
@Override
public String toString() {
return "ResourceImpact [memory=" + memory + ", cpu=" + cpu + ", io=" + storage + ", network=" + network + "]";
}
}