Back to index

wims  3.65+svn20090927
FormulaResourcesManager.java
Go to the documentation of this file.
00001 /*
00002 $Id: FormulaResourcesManager.java,v 1.3 2003/02/18 11:48:47 sander Exp $
00003 */
00004 
00005 
00006 /*
00007 Copyright (C) 2001-2002 Mainline Project (I3S - ESSI - CNRS -UNSA)
00008 
00009 This library is free software; you can redistribute it and/or
00010 modify it under the terms of the GNU Lesser General Public
00011 License as published by the Free Software Foundation; either
00012 version 2.1 of the License, or (at your option) any later version.
00013 
00014 This library is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public
00020 License along with this library; if not, write to the Free Software
00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00023 For further information on the GNU Lesser General Public License,
00024 see: http://www.gnu.org/copyleft/lesser.html
00025 For further information on this library, contact: mainline@essi.fr
00026 */
00027 
00028 
00029 package fr.ove.openmath.jome.model;
00030 
00031 import fr.ove.utils.CachingResourcesManager;
00032 
00039 public class FormulaResourcesManager extends CachingResourcesManager {
00046     public FormulaResourcesManager(String resourcesName) {
00047         super(resourcesName);
00048     }
00049     
00054     public String getClassName(String property) {
00055         return accessResource(property, 0);
00056     }
00057         
00062     public Integer getArity(String property) {
00063         String arity = accessResource(property, 2);
00064         Integer value = null; // On choisi un Integer putôt qu'un int pour des retours possibles de null
00065         
00066         if (arity != null) {
00067             try {
00068                 value = Integer.valueOf(arity);
00069             }
00070             catch (NumberFormatException fne) {
00071                 System.out.println("Wrong operator arity : " + property);
00072             }
00073         }
00074         
00075         return value;
00076     }
00077     
00078     public String getPrioritiesIdentifier(String property) {
00079         return accessResource(property, 1);
00080     }
00081     
00086     public int getAsOperatorPriority(String property) {
00087         String priority = accessResource(property, 0);
00088         int value = 0;
00089         
00090         try {
00091             value = Integer.valueOf(priority).intValue();
00092         }
00093         catch (NumberFormatException fne) {
00094             System.out.println("Wrong specification of as operator priority : " + priority);
00095         }
00096         
00097         return value;
00098     }
00099     
00104     public int getAsOperandPriority(String property) {
00105         String priority = accessResource(property, 1);
00106         int value = 0;
00107         
00108         try {
00109             value = Integer.valueOf(priority).intValue();
00110         }
00111         catch (NumberFormatException fne) {
00112             System.out.println("Wrong specification of as operand priority : " + priority);
00113         }
00114         
00115         return value;
00116     }
00117 }