/* * (non-Javadoc) * * @see fr.ifp.reservoir.model.geometry.ICoord#add(fr.ifp.reservoir.model.geometry.Coord) */ public Coord add(Coord add) throws ModelException { if (add instanceof Coord2D) { Coord2D a = (Coord2D) add; if (NoValues.containsNoValue(x, y) || NoValues.containsNoValue(a.x, a.y)) { return new Coord2D(NoValues.DOUBLE_NOVALUE, NoValues.DOUBLE_NOVALUE); } return new Coord2D(x + a.x, y + a.y); } Object[] msgParams = {ModelExceptionMessages.getString("msgAdd", null), "Coord2D"}; throw new ModelException( ModelExceptionMessages.getString("msgDataTypeOperationError", msgParams)); }
/* * (non-Javadoc) * * @see fr.ifp.reservoir.model.geometry.ICoord#substract(fr.ifp.reservoir.model.geometry.Coord) */ public Coord substract(Coord sub) throws ModelException { if (sub instanceof Coord2D) { Coord2D a = (Coord2D) sub; if (NoValues.containsNoValue(x, y) || NoValues.containsNoValue(a.x, a.y)) { return new Coord2D(NoValues.DOUBLE_NOVALUE, NoValues.DOUBLE_NOVALUE); } return new Coord2D(x - a.x, y - a.y); } Object[] msgParams = {ModelExceptionMessages.getString("msgSub", null), "Coord2D"}; throw new ModelException( ModelExceptionMessages.getString("msgDataTypeOperationError", msgParams)); }
void check_parameter(Object t1, String paramName) throws ModelException { if (t1 == null) { Object[] msgParams = {paramName}; throw new ModelException( getClass() + "#set", ModelExceptionMessages.getString("msgObjectNull", msgParams)); } }
/* * (non-Javadoc) * * @see fr.ifp.reservoir.model.geometry.ICoord#normalize() */ public void normalize() throws ModelException { double a = this.calculateNorm(); if (a > 0.0d) { x = x / a; y = y / a; } // If a == 0 we do nothing. // If negative => exception. else if (a < 0.0d) { throw new ModelException(ModelExceptionMessages.getString("msgInconsistent", null)); } }