c979f3ddcab3911914e519b71075d4023fe0507a
4 private int defaultWeight
= 72;
22 public int getDefaultWeight() {
26 public int getWeight() {
30 public void setWeight(int weight
) {
31 if (validateWeight(weight
)) {
34 throw new IllegalArgumentException("Weight must be between " + this.getMin() + " and " + this.getMax());
38 private boolean validateWeight(int weight
) {
39 return (weight
>= getMin() && weight
<= getMax());
42 public Integer
[] getValuesArray() {
43 int arrayLength
= this.getMax() - this.getMin() + 1;
44 Integer
[] intArray
= new Integer
[arrayLength
];
45 for (int i
= 0; i
< intArray
.length
; i
++) {
46 intArray
[i
] = this.getMin() + i
;
51 public int distanceTo(Weight weight
) {
52 int distance
= weight
.getWeight() - this.getWeight();
53 return Math
.abs(distance
);