/**
* @ param rate4 the rate4 to set
*/
public void setRate4 ( int rate4) {
this . rate4=rate4;
}
/**
* @ param rate5 the rate5 to set
*/
public void setRate5 ( int rate5) {
this . rate5=rate5;
}
/* (non-Javadoc)
*see java. lang. Object # equals (java. Lang. Object)
*/
@ Override
public boolean equals (Object obj) {
if ( this == obj) {
return true ;
}
if (obj == null ) {
return false ;
}
if (! (obj instanceof Item)) {
return false ;
} other=(Item) obj;
if (rate1!=other. rate1) {
return false ;
}
if (rate2!=other. rate2) {
return false ;
}
if (rate3!=other. rate3) {
return false ;
}
if (rate4!=other. rate4) {
return false ;
}
if (rate5!=other. rate5) {
return false ;
}
if (volume!=other. volume) {
return false ;
}
if (Double. doubleToLongBits (weight)!=Double
. doubleToLongBits (other. weight)) {
return false ;
}
return true ;
}
@ Override
public Item clone () {clone= new Item ( id, volume, weight, rate1, rate2, rate3, rate4, rate5);
return clone;
}
/* (non-Javadoc)
*see java. lang. Object # toString ()
*/
@ Override
public String toString () {
return Об'єкт +
nID: + Id + , nОб'ём: + Volume + , nВес: + Weight
+ , nКр.1: + Rate1 + , nКр.2: + Rate2 + , nКр.3: + Rate3
+ , nКр.4: + Rate4 + , nКр.5 + Rate5 + , nID парного об'єкта: + Pair. id;
}
}. java
package core;
import java. util. ArrayList;
import java. util. Collection;
import java. util. List;
import java. util. Random;
import java. util. Set;
import java. util. SortedMap;
/**
* Пакувальник.
* @ author AtemB
*
*/
public class Packer {
/**
* Алгоритм упаковки.
* @ author AtemB
*
*/
public enum ALGORYTHM {
/** У...