001 /** 002 * ========================================= 003 * LibFormula : a free Java formula library 004 * ========================================= 005 * 006 * Project Info: http://reporting.pentaho.org/libformula/ 007 * 008 * (C) Copyright 2006-2007, by Pentaho Corporation and Contributors. 009 * 010 * This library is free software; you can redistribute it and/or modify it under the terms 011 * of the GNU Lesser General Public License as published by the Free Software Foundation; 012 * either version 2.1 of the License, or (at your option) any later version. 013 * 014 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 015 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 016 * See the GNU Lesser General Public License for more details. 017 * 018 * You should have received a copy of the GNU Lesser General Public License along with this 019 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, 020 * Boston, MA 02111-1307, USA. 021 * 022 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 023 * in the United States and other countries.] 024 * 025 * 026 * ------------ 027 * $Id: LibFormulaErrorValue.java 3521 2007-10-16 10:55:14Z tmorgner $ 028 * ------------ 029 * (C) Copyright 2006-2007, by Pentaho Corporation. 030 */ 031 package org.jfree.formula; 032 033 import java.util.Locale; 034 035 /** 036 * Creation-Date: 31.10.2006, 13:07:37 037 * 038 * @author Thomas Morgner 039 */ 040 public class LibFormulaErrorValue implements ErrorValue 041 { 042 public static final int ERROR_REFERENCE_NOT_RESOLVABLE = 499; 043 044 /** A parse error */ 045 public static final int ERROR_INVALID_CHARACTER = 501; 046 /** Function name is invalid error code */ 047 public static final int ERROR_INVALID_FUNCTION = 505; 048 /** Function name is invalid error */ 049 public static final LibFormulaErrorValue ERROR_INVALID_FUNCTION_VALUE = new LibFormulaErrorValue(ERROR_INVALID_FUNCTION); 050 /** Parameter types are invalid error code */ 051 public static final int ERROR_INVALID_ARGUMENT = 502; 052 /** Parameter types are invalid error */ 053 public static final LibFormulaErrorValue ERROR_INVALID_ARGUMENT_VALUE = new LibFormulaErrorValue(ERROR_INVALID_ARGUMENT); 054 /** Parameter types are invalid error code */ 055 public static final int ERROR_INVALID_AUTO_ARGUMENT = 666; 056 /** Parameter types are invalid error */ 057 public static final LibFormulaErrorValue ERROR_INVALID_AUTO_ARGUMENT_VALUE = new LibFormulaErrorValue(ERROR_INVALID_AUTO_ARGUMENT); 058 059 public static final int ERROR_ILLEGAL_ARRAY = 667; 060 061 public static final LibFormulaErrorValue ERROR_ILLEGAL_ARRAY_VALUE = new LibFormulaErrorValue(ERROR_ILLEGAL_ARRAY); 062 /** Number arithmetic error code */ 063 public static final int ERROR_ARITHMETIC = 503; 064 /** Number arithmetic error */ 065 public static final LibFormulaErrorValue ERROR_ARITHMETIC_VALUE = new LibFormulaErrorValue(ERROR_ARITHMETIC); 066 /** Invalid number of arguments error code*/ 067 public static final int ERROR_ARGUMENTS = 1; 068 /** Invalid number of arguments error */ 069 public static final LibFormulaErrorValue ERROR_ARGUMENTS_VALUE = new LibFormulaErrorValue(ERROR_ARGUMENTS); 070 /** Occurence not found error code */ 071 public static final int ERROR_NOT_FOUND = 504; 072 /** Occurence not found error */ 073 public static final LibFormulaErrorValue ERROR_NOT_FOUND_VALUE = new LibFormulaErrorValue(ERROR_NOT_FOUND); 074 /** NA error code*/ 075 public static final int ERROR_NA = 522; 076 /** NA error*/ 077 public static final LibFormulaErrorValue ERROR_NA_VALUE = new LibFormulaErrorValue(ERROR_NA); 078 /** Unexpected error code */ 079 public static final int ERROR_UNEXPECTED = 0; 080 /** Unexpected error */ 081 public static final LibFormulaErrorValue ERROR_UNEXPECTED_VALUE = new LibFormulaErrorValue(ERROR_UNEXPECTED); 082 083 private int errorCode; 084 085 public LibFormulaErrorValue(final int errorCode) 086 { 087 this.errorCode = errorCode; 088 } 089 090 public String getNamespace() 091 { 092 return "http://jfreereport.sourceforge.net/libformula"; 093 } 094 095 public int getErrorCode() 096 { 097 return errorCode; 098 } 099 100 public String getErrorMessage(final Locale locale) 101 { 102 return "TODO"; 103 } 104 105 public boolean equals(final Object obj) 106 { 107 if(obj instanceof LibFormulaErrorValue) 108 { 109 final LibFormulaErrorValue error = (LibFormulaErrorValue)obj; 110 return this.errorCode == error.getErrorCode(); 111 } 112 113 return false; 114 } 115 116 public String toString() 117 { 118 return "LibFormulaErrorValue{" + 119 "errorCode=" + errorCode + 120 '}'; 121 } 122 }