Skip to content
Snippets Groups Projects
Select Git revision
  • 683ce4f3bc4fffb7ed626402387a605352400936
  • master default
  • goodpaths
  • movie-page
  • front-bilel
  • vieille-branche
  • octofront
  • branche-TP-de-Tom
8 results

.eslintrc.js

Blame
  • Command.java 1.36 KiB
    package Cli;
    
    import java.util.ArrayList;
    
    import Core.ActiveUserContext;
    import Core.MyFoodora;
    import Exception.ExceptionUnknownDishType;
    import Exception.ExceptionUnknownMealType;
    import Exception.ExceptionUnknownStartegyType;
    import Exception.ExceptionUnknownTypeOfUser;
    
    public abstract class Command {
    	private String commandName;
    	private Token [] listOfArgs;
    	
    	public Command(String _commandName, Token [] _listOfArgs){
    		commandName = _commandName;
    		listOfArgs = _listOfArgs;
    	}
    	
    	public boolean isOneWanted(String firstToken){
    		if(firstToken.toLowerCase().equals(commandName.toLowerCase()))
    			return true;
    		return false;
    	}
    	
    	public boolean isGoodArgument(ArrayList<String> arguments) throws errorWrongNumberOfParams,errorWrongFormatValue{
    		if(arguments.size() != listOfArgs.length){
    			throw new errorWrongNumberOfParams("Error : "+Integer.toString(arguments.size())+" parameter insteed of "+Integer.toString(listOfArgs.length));
    		}
    		int i = 0;
    		for (String arg : arguments) {
    			listOfArgs[i].isTockenCorrect(arg); // throw une erreur, faut la catch au dessus !
    			i++;
    		}
    		 // trow une erreur
    		return true;
    	}
    	
    	public abstract void execute(ArrayList<String> arguments, MyFoodora foodora, ActiveUserContext activeUser) throws ExceptionUnknownMealType, NumberFormatException, ExceptionUnknownDishType, ExceptionUnknownStartegyType, ExceptionUnknownTypeOfUser;
    	
    }