view src/org/qmul/eecs/c4dm/sia/model/NDimensionalObject.java @ 0:08675ab08e7f

New
author Steven Hargreaves <steve.harg@gmail.com>
date Sat, 29 Dec 2012 17:41:06 +0000
parents
children ffd47645ca13
line wrap: on
line source
package org.qmul.eecs.c4dm.sia.model;

import java.util.Vector;

import org.qmul.eecs.c4dm.sia.exceptions.DimensionException;

public class NDimensionalObject {

	private Vector<DimensionValue> dimensionValues;

	public NDimensionalObject() {
		super();
	}

	/**
	 * @return the dimensionValue
	 */
	public Vector<DimensionValue> getDimensionValues() {
		return dimensionValues;
	}

	/**
	 * @param dimensionValue the dimensionValue to set
	 */
	public void setDimensionValues(Vector<DimensionValue> dimensionValues) {
		this.dimensionValues = dimensionValues;
	}

	public double getDimensionValue(int dimension) throws DimensionException {
		for (DimensionValue dv : this.getDimensionValues())
		{
			if (dv.getDimension() == dimension)
				return dv.getValue();
		}
		throw new DimensionException("No value for dimension " + dimension);
	}

}