All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xf.xfvrp.opt.evaluation.Amount Maven / Gradle / Ivy

There is a newer version: 11.4.6-RELEASE
Show newest version
package xf.xfvrp.opt.evaluation;

public class Amount {

	private float[] amounts;
	
	public Amount() {
	}

	public void add(float[] otherAmount) {
		init(otherAmount);
		
		for (int i = 0; i < amounts.length; i++) {
			amounts[i] += otherAmount[i];
		}
	}
	
	public float getAmount(int idx) {
		return (amounts != null && idx < amounts.length) ? amounts[idx] : 0;
	}

	public float[] getAmounts() {
		return amounts;
	}

	public void setAmounts(float[] amounts) {
		this.amounts = amounts;
	}
	
	private void init(float[] otherAmount) {
		if(amounts == null)
			amounts = new float[otherAmount.length];
	}

	public boolean hasAmount() {
		return (amounts != null);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy