Mercurial > hg > semantic-sia
diff 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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/org/qmul/eecs/c4dm/sia/model/NDimensionalObject.java Sat Dec 29 17:41:06 2012 +0000 @@ -0,0 +1,38 @@ +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); + } + +} \ No newline at end of file