Package uk.ac.cranfield.thesis.shared.exception

Examples of uk.ac.cranfield.thesis.shared.exception.IncorrectODEEquationException


    {
        input = input.replace(" ", "").toLowerCase();
        String[] parts = input.split(",");
       
        if (parts.length < 2)
            throw new IncorrectODEEquationException("lack of initial values");
       
        Equation equation = new Equation(parts[0]);
        equation.setOrder(longestRun(parts[0], '\'', 1));
       
        List<String> init = new ArrayList<String>(parts.length - 1);
        for (int i = 1; i < parts.length; i++)
            init.add(parts[i]);
       
        equation.setInitValues(parseInitialValues(init));
        equation.setFunctionVariable(parseFunctionVariable(parts[0]));
        equation.setIndependentVariable(parseIndependentVariable(parts[0], equation.getFunctionVariable()));
       
        if (equation.getFunctionVariable() != parts[1].charAt(0))
            throw new IncorrectODEEquationException("Incorrect initial variable");
       
        return equation;
    }
View Full Code Here


            String[] parts = input.split(",");
           
            Equation equation = new Equation(parts[0]);
            equation.setOrder(longestRun(parts[0], '\'', 1));
            if (equation.getOrder() < parts.length - 1)
                throw new IncorrectODEEquationException("lack of initial values");
           
            List<String> init = new ArrayList<String>(parts.length - 1);
            for (int i = 1; i < parts.length; i++)
                init.add(parts[i]);
           
View Full Code Here

            if (m.find())
            {
                if (result == 0)
                    result = ch;
                else
                    throw new IncorrectODEEquationException(input);
            }
        }
       
        return result;
    }
View Full Code Here

            }
        }
       
        if (valid.size() > 1)
        {
            throw new IncorrectODEEquationException("Too many independent variables in equation");
        }
       
        for (Character ch : valid)
        {
            return ch;
View Full Code Here

        }
       
       
        if (result.size() > 1)
        {
            throw new IncorrectODEEquationException("Too many variables in equation");
        }
       
        for (Character ch : result)
        {
            if (ch != null)
View Full Code Here

       
        for (String s : data)
        {
            String[] values = s.split("=");
            if (values.length < 2)
                throw new IncorrectODEEquationException("Wrong input of initial values");
           
            int i = longestRun(values[0], '\'', 1);
            result.set(i, Double.valueOf(values[1]));
        }
       
View Full Code Here

    private String parseFunctionEquation(Equation equation) throws IncorrectODEEquationException
    {
        String[] eq = equation.getEquation().split("=");
       
        if (eq.length < 2)
            throw new IncorrectODEEquationException("Given equation has incorrect form , lack of assignment sign ( = )");
       
        int i = 0;
        String result = "";
        while (i < eq[1].length())
        {
View Full Code Here

        String[] parts = input.split(",");
       
        Equation equation = new Equation(parts[0]);
        equation.setOrder(longestRun(parts[0], '\'', 1));
        if (equation.getOrder() < parts.length - 1)
            throw new IncorrectODEEquationException("lack of initial values");
       
        List<String> init = new ArrayList<String>(parts.length - 1);
        for (int i = 1; i < parts.length; i++)
            init.add(parts[i]);
       
View Full Code Here

            if (m.find())
            {
                if (result == 0)
                    result = ch;
                else
                    throw new IncorrectODEEquationException(input);
            }
        }
       
        return result;
    }
View Full Code Here

            if (m.find() && ch != functionalVariable)
            {
                if (result == 0)
                    result = ch;
                else
                    throw new IncorrectODEEquationException(input);
            }
        }
       
        return result;
    }
View Full Code Here

TOP

Related Classes of uk.ac.cranfield.thesis.shared.exception.IncorrectODEEquationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.