import java.util.*; public abstract class Operateur implements IOperateur { private static Map ops = new HashMap(); private String nom; private int arite; public Operateur(String nom, int arite) throws OperateurExistantException { IOperateur op = (IOperateur) ops.get(nom); if (op != null) { throw new OperateurExistantException(op); } this.nom = nom; this.arite = arite; ops.put(nom, this); } public String nom() { return nom; } public static IOperateur operateur(String nom) throws OperateurInexistantException { IOperateur op = (IOperateur) ops.get(nom); if (op == null) { throw new OperateurInexistantException(nom); } return op; } static void substituerOperateur(String nom, IOperateur op) throws OperateurInexistantException { IOperateur op2 = (IOperateur) ops.get(nom); if (op2 == null) { throw new OperateurInexistantException(nom); } ops.put(nom, op); } public int arite() { return arite; } public abstract int evaluer(int [] operandes); }