001/* 002 * Copyright (c) 2005 Peter Palotas, Fredrik Johansson, Einar Pehrson, 003 * Sebastian Kekkonen, Lars Magnus Lang, Malin Johansson and Sofia Nilsson 004 * 005 * This file is part of 006 * CleanSheets Extension for Assertions 007 * 008 * CleanSheets Extension for Assertions is free software; you can 009 * redistribute it and/or modify it under the terms of the GNU General Public 010 * License as published by the Free Software Foundation; either version 2 of 011 * the License, or (at your option) any later version. 012 * 013 * CleanSheets Extension for Assertions is distributed in the hope that 014 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 015 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 016 * See the GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with CleanSheets Extension for Assertions; if not, write to the 020 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 021 * Boston, MA 02111-1307 USA 022 */ 023package csheets.ext.assertion; 024 025import csheets.core.formula.Formula; 026 027/** Class representing a System Generated Assertion. 028 @author Peter Palotas */ 029public class SGAssertion extends Assertion { 030 031 /** The unique version identifier used for serialization */ 032 private static final long serialVersionUID = -5713386003093260622L; 033 034 /** Constructs a new System Generated Assertion (SGA) for the specified 035 Cell if possible. 036 @param cell the <code>Cell</code> on which to create an SGA. 037 @throws AssertionArithmeticException if the SGA could not be generated. */ 038 public SGAssertion(AssertableCell cell) throws AssertionArithmeticException, MathException { 039 Formula formula = cell.getFormula(); 040 if (formula == null) { 041 throw new AssertionArithmeticException("Cell " + cell.getAddress() + " does not contain a formula"); 042 } 043 044 intervals = new AssertionArithmeticVisitor().getResult(formula); 045 } 046}