Examples of Less


Examples of org.apache.imperius.spl.parser.expressions.impl.Less

        // Property1 < Property2 (20 < 5) = true   
        try {
            Vector v = new Vector();
            v.add(propertySensor2);
            v.add(propertySensor1);
            Expression expression1 = new Less(v,true);

            // Property1 < Property3 (20 < -20) = false   
            v.clear();
            v.add(propertySensor1);
            v.add(propertySensor3);
            Expression expression2 = new Less(v,true);

            v.clear();
            v.add(propertySensor1);
            v.add(new DoubleConstant(5));
            Expression expression3 = new Less(v,true);

            v.clear();
            v.add(new DoubleConstant(-20));
            v.add(new DoubleConstant(20));
            Expression expression4 = new Less(v,true);

            assertTrue(((Boolean) expression1.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression2.evaluate()).booleanValue());
            assertFalse(
                ((Boolean) expression3.evaluate()).booleanValue());
            assertTrue(((Boolean) expression4.evaluate()).booleanValue());
        } catch (SPLException e) {  
          logger.severe("Received evaluation exception " + e.getMessage());
            fail("Received evaluation exception " + e.getMessage());
        } catch (Exception e) {  
          logger.severe("Received evaluation exception " + e.getMessage());
View Full Code Here

Examples of org.apache.imperius.spl.parser.expressions.impl.Less

    case SPLTreeParserTokenTypes.EQUAL:
      returnExpr = new Equal(exprList, validateExpr);
      break;

    case SPLTreeParserTokenTypes.LT:
      returnExpr = new Less(exprList, validateExpr);
      break;

    case SPLTreeParserTokenTypes.GT:
      returnExpr = new Greater(exprList, validateExpr);
      break;
View Full Code Here

Examples of org.apache.ode.ql.tree.nodes.Less

        checkChildsNumber(node, 2);
        return new GE(createIdentifier(node, 0), createValue(node, 1));
    }
    private Less createLess(Node node) {
        checkChildsNumber(node, 2);
        return new Less(createIdentifier(node, 0), createValue(node, 1));
    }
View Full Code Here

Examples of org.apache.ode.ql.tree.nodes.Less

        checkChildsNumber(node, 2);
        return new GE(createIdentifier(node, 0), createValue(node, 1));
    }
    private Less createLess(Node node) {
        checkChildsNumber(node, 2);
        return new Less(createIdentifier(node, 0), createValue(node, 1));
    }
View Full Code Here

Examples of org.apache.ode.ql.tree.nodes.Less

        checkChildsNumber(node, 2);
        return new GE(createIdentifier(node, 0), createValue(node, 1));
    }
    private Less createLess(Node node) {
        checkChildsNumber(node, 2);
        return new Less(createIdentifier(node, 0), createValue(node, 1));
    }
View Full Code Here

Examples of org.jboss.aesh.extensions.less.Less

        PrintWriter out = new PrintWriter(System.out);

        final Man man = new Man(exampleConsole);
        //man.addPage(new File("/tmp/README.md"), "test");

        final Less less = new Less(exampleConsole);
        final More more = new More(exampleConsole);

        List<MultipleChoice> choices = new ArrayList<MultipleChoice>();
        choices.add(new MultipleChoice(1,"Do you want foo?"));
        choices.add(new MultipleChoice(2,"Do you want bar?"));

        final MultipleChoiceCommand choice =
                new MultipleChoiceCommand(exampleConsole, "choice", choices);

        Completion completer = new Completion() {
            @Override
            public void complete(CompleteOperation co) {
                // very simple completor
                List<String> commands = new ArrayList<String>();
                if(co.getBuffer().equals("fo") || co.getBuffer().equals("foo")) {
                    commands.add("foo");
                    commands.add("foobaa");
                    commands.add("foobar");
                    commands.add("foobaxxxxxx");
                    commands.add("foobbx");
                    commands.add("foobcx");
                    commands.add("foobdx");
                }
                else if(co.getBuffer().equals("fooba")) {
                    commands.add("foobaa");
                    commands.add("foobar");
                    commands.add("foobaxxxxxx");
                }
                else if(co.getBuffer().equals("foobar")) {
                    commands.add("foobar");
                }
                else if(co.getBuffer().equals("bar")) {
                    commands.add("bar/");
                }
                else if(co.getBuffer().equals("h")) {
                    commands.add("help.history");
                    commands.add("help");
                }
                else if(co.getBuffer().equals("help")) {
                    commands.add("help.history");
                    commands.add("help");
                }
                else if(co.getBuffer().equals("help.")) {
                    commands.add("help.history");
                }
                else if(co.getBuffer().equals("deploy")) {
                    commands.add("deploy /home/blabla/foo/bar/alkdfe/en/to/tre");
                }
                 co.setCompletionCandidates(commands);
            }
        };

        exampleConsole.addCompletion(completer);
        exampleConsole.addCompletion(man);
        exampleConsole.addCompletion(less);
        exampleConsole.addCompletion(more);

        exampleConsole.setPrompt(new Prompt("[test@foo]~> "));
        //exampleConsole.pushToConsole(ANSI.greenText());
        //while ((consoleOutput = exampleConsole.read("[test@foo.bar]~> ")) != null) {
        exampleConsole.setConsoleCallback(new ConsoleCallback() {
            @Override
            public int readConsoleOutput(ConsoleOutput consoleOutput) throws IOException {

                String line = consoleOutput.getBuffer();
                exampleConsole.pushToStdOut("======>\"" + line + "\"\n");

                if (line.equalsIgnoreCase("quit") || line.equalsIgnoreCase("exit") ||
                        line.equalsIgnoreCase("reset")) {
                    exampleConsole.stop();
                }
                if(line.equals("clear"))
                    exampleConsole.clear();
                if(line.startsWith("man")) {
                    //exampleConsole.attachProcess(test);
                    //man.setCurrentManPage("test");
                    try {
                    man.setFile("/tmp/test.txt.gz");
                    man.attach(consoleOutput);
                    }
                    catch (IllegalArgumentException iae) {
                        exampleConsole.pushToStdOut(iae.getMessage());
                    }
                }
                if(line.startsWith("choice")) {
                    choice.attach(consoleOutput);
                }
                if(line.trim().startsWith("less")) {
                    //is it getting input from pipe
                    if(consoleOutput.getStdOut() != null &&
                            consoleOutput.getStdOut().length() > 0) {
                        less.setInput(consoleOutput.getStdOut());
                        less.attach(consoleOutput);

                    }
                    else if(line.length() > "less".length()) {
                        File f = new File(Parser.switchEscapedSpacesToSpacesInWord(line.substring("less ".length())).trim());
                        if(f.isFile()) {
                            //less.setPage(f);
                            less.setFile(f);
                            less.attach(consoleOutput);
                        }
                        else if(f.isDirectory()) {
                            exampleConsole.pushToStdOut(f.getAbsolutePath()+": is a directory"+
                                    Config.getLineSeparator());
                        }
View Full Code Here

Examples of org.jboss.aesh.extensions.less.Less

            file = new File(Config.getHomeDir() + file.getAbsolutePath().substring(
                     file.getAbsolutePath().indexOf("~/") + 1));
         }
         if (file.isFile())
         {
            Less less = new Less(console);
            less.setFile(file);
            less.attach(((ShellContext) context).getConsoleOutput());
            return Results.success();
         }
         else if (file.isDirectory())
         {
            return Results.fail(file.getAbsolutePath() + " is a directory");
View Full Code Here

Examples of org.jboss.aesh.extensions.less.Less

            file = new File(Config.getHomeDir() + file.getAbsolutePath().substring(
                     file.getAbsolutePath().indexOf("~/") + 1));
         }
         if (file.isFile())
         {
            Less less = new Less(console);
            less.setFile(file);
            less.attach(((ShellContext) context).getConsoleOutput());
            return Results.success();
         }
         else if (file.isDirectory())
         {
            return Results.fail(file.getAbsolutePath() + " is a directory");
View Full Code Here

Examples of org.jboss.aesh.extensions.less.Less

            if(file.getAbsolutePath().contains("~/")) {
                file = new File(Config.getHomeDir()+file.getAbsolutePath().substring(
                        file.getAbsolutePath().indexOf("~/")+1));
            }
            if(file.isFile()) {
                Less less = new Less(console);
                less.setFile(file);
                less.attach(((ShellContext) context).getConsoleOutput());
                return Results.success();
            }
            else if(file.isDirectory()) {
                return Results.fail(file.getAbsolutePath() + " is a directory");
            }
View Full Code Here

Examples of org.jboss.aesh.extensions.less.Less

        final Man man = new Man(exampleConsole);
        //man.addPage(new File("/tmp/README.md"), "test");

        final Harlem harlem = new Harlem(exampleConsole);

        final Less less = new Less(exampleConsole);
        final More more = new More(exampleConsole);

        List<MultipleChoice> choices = new ArrayList<MultipleChoice>();
        choices.add(new MultipleChoice(1,"Do you want foo?"));
        choices.add(new MultipleChoice(2,"Do you want bar?"));

        final MultipleChoiceCommand choice =
                new MultipleChoiceCommand(exampleConsole, "choice", choices);

        Completion completer = new Completion() {
            @Override
            public void complete(CompleteOperation co) {
                // very simple completor
                List<String> commands = new ArrayList<String>();
                if(co.getBuffer().equals("fo") || co.getBuffer().equals("foo")) {
                    commands.add("foo");
                    commands.add("foobaa");
                    commands.add("foobar");
                    commands.add("foobaxxxxxx");
                    commands.add("foobbx");
                    commands.add("foobcx");
                    commands.add("foobdx");
                }
                else if(co.getBuffer().equals("fooba")) {
                    commands.add("foobaa");
                    commands.add("foobar");
                    commands.add("foobaxxxxxx");
                }
                else if(co.getBuffer().equals("foobar")) {
                    commands.add("foobar");
                }
                else if(co.getBuffer().equals("bar")) {
                    commands.add("bar/");
                }
                else if(co.getBuffer().equals("h")) {
                    commands.add("help.history");
                    commands.add("help");
                }
                else if(co.getBuffer().equals("help")) {
                    commands.add("help.history");
                    commands.add("help");
                }
                else if(co.getBuffer().equals("help.")) {
                    commands.add("help.history");
                }
                else if(co.getBuffer().equals("deploy")) {
                    commands.add("deploy /home/blabla/foo/bar/alkdfe/en/to/tre");
                }
                 co.setCompletionCandidates(commands);
            }
        };

        exampleConsole.addCompletion(completer);
        exampleConsole.addCompletion(man);
        exampleConsole.addCompletion(less);
        exampleConsole.addCompletion(more);
        exampleConsole.addCompletion(harlem);

        exampleConsole.setPrompt(new Prompt("[test@foo]~> "));
        //exampleConsole.pushToConsole(ANSI.greenText());
        //while ((consoleOutput = exampleConsole.read("[test@foo.bar]~> ")) != null) {
        exampleConsole.setConsoleCallback(new ConsoleCallback() {
            @Override
            public int readConsoleOutput(ConsoleOutput consoleOutput) throws IOException {

                String line = consoleOutput.getBuffer();
                exampleConsole.pushToStdOut("======>\"" + line + "\"\n");

                if (line.equalsIgnoreCase("quit") || line.equalsIgnoreCase("exit") ||
                        line.equalsIgnoreCase("reset")) {
                    exampleConsole.stop();
                }
                if(line.equals("clear"))
                    exampleConsole.clear();
                if(line.startsWith("man")) {
                    //exampleConsole.attachProcess(test);
                    //man.setCurrentManPage("test");
                    try {
                    man.setFile("/tmp/test.txt.gz");
                    man.attach(consoleOutput);
                    }
                    catch (IllegalArgumentException iae) {
                        exampleConsole.pushToStdOut(iae.getMessage());
                    }
                }
                if(line.startsWith("choice")) {
                    choice.attach(consoleOutput);
                }
                if(line.startsWith("harlem")) {
                    harlem.attach(consoleOutput);
                }
                if(line.trim().startsWith("less")) {
                    //is it getting input from pipe
                    if(consoleOutput.getStdOut() != null &&
                            consoleOutput.getStdOut().length() > 0) {
                        less.setInput(consoleOutput.getStdOut());
                        less.attach(consoleOutput);

                    }
                    else if(line.length() > "less".length()) {
                        File f = new File(Parser.switchEscapedSpacesToSpacesInWord(line.substring("less ".length())).trim());
                        if(f.isFile()) {
                            //less.setPage(f);
                            less.setFile(f);
                            less.attach(consoleOutput);
                        }
                        else if(f.isDirectory()) {
                            exampleConsole.pushToStdOut(f.getAbsolutePath()+": is a directory"+
                                    Config.getLineSeparator());
                        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.