Package org.apache.oodt.cas.pushpull.exceptions

Examples of org.apache.oodt.cas.pushpull.exceptions.MethodException


            while (!stack.empty())
                output.addLast(stack.pop());

            return output;
        } catch (Exception e) {
            throw new MethodException("Failed to convert infix to postfix : "
                    + e.getMessage());
        }
    }
View Full Code Here


                            Integer value = new Integer(((Integer) second
                                    .getValue()).intValue()
                                    + ((Integer) first.getValue()).intValue());
                            stack.push(new Variable(null, value));
                        } else {
                            throw new MethodException(
                                    "Invalid Concatination/Addition types. . .must be String or Integer");
                        }
                        break;
                    case '-':
                        if (((Variable) first).isInteger()
                                && ((Variable) second).isInteger()) {
                            Integer value = new Integer(((Integer) second
                                    .getValue()).intValue()
                                    - ((Integer) first.getValue()).intValue());
                            stack.push(new Variable(null, value));
                        } else {
                            throw new MethodException(
                                    "Invalid Subtraction types. . .must be Integer");
                        }
                        break;
                    case '*':
                        if (((Variable) first).isInteger()
                                && ((Variable) second).isInteger()) {
                            Integer value = new Integer(((Integer) second
                                    .getValue()).intValue()
                                    * ((Integer) first.getValue()).intValue());
                            stack.push(new Variable(null, value));
                        } else {
                            throw new MethodException(
                                    "Invalid Multiplication types. . .must be Integer");
                        }
                        break;
                    case '/':
                        if (((Variable) first).isInteger()
                                && ((Variable) second).isInteger()
                                && ((Integer) ((Variable) first).getValue())
                                        .intValue() > 0) {
                            Integer value = new Integer(((Integer) second
                                    .getValue()).intValue()
                                    / ((Integer) first.getValue()).intValue());
                            stack.push(new Variable(null, value));
                        } else {
                            throw new MethodException(
                                    "Invalid Division types. . .must be Integer and denominator must be greater than 0");
                        }
                        break;
                    }
                }
            }
            return stack.pop().getValue();
        } catch (Exception e) {
            throw new MethodException("Failed to execute method " + name
                    + " : " + e.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.pushpull.exceptions.MethodException

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.