| 1 | /** |
| 2 | * |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.probfunction.math.impl; |
| 5 | |
| 6 | import de.uka.ipd.sdq.probfunction.math.IUnit; |
| 7 | |
| 8 | /** |
| 9 | * @author Ihssane |
| 10 | * |
| 11 | */ |
| 12 | public class UnitImpl implements IUnit { |
| 13 | |
| 14 | private String unitName; |
| 15 | |
| 16 | protected UnitImpl(String unitName) { |
| 17 | this.unitName = unitName; |
| 18 | } |
| 19 | |
| 20 | /* (non-Javadoc) |
| 21 | * @see de.uka.ipd.sdq.math.probfunction.impl.IUnit#getUnit() |
| 22 | */ |
| 23 | public String getUnitName() { |
| 24 | return unitName; |
| 25 | } |
| 26 | |
| 27 | /* (non-Javadoc) |
| 28 | * @see de.uka.ipd.sdq.math.probfunction.impl.IUnit#setUnit(java.lang.String) |
| 29 | */ |
| 30 | public void setUnitName(String unitName) { |
| 31 | this.unitName = unitName; |
| 32 | } |
| 33 | |
| 34 | @Override |
| 35 | public boolean equals(Object obj) { |
| 36 | boolean result = false; |
| 37 | if (obj instanceof IUnit) { |
| 38 | IUnit other = (IUnit)obj; |
| 39 | result = unitName.equals(other.getUnitName()); |
| 40 | } |
| 41 | return result; |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | public int hashCode() { |
| 46 | return unitName.hashCode(); |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public String toString() { |
| 51 | return unitName; |
| 52 | } |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | } |