Package com.elega9t.commons.util

Examples of com.elega9t.commons.util.ReplacementProvider


import com.elega9t.commons.shell.intrprtr.Context;

public class Environment extends Context<String> {

    public String resolve(String str) {
        return StringUtilities.replace("\\$([a-zA-Z0-9._\\-\\?]+)", str, new ReplacementProvider() {
            @Override
            public String getReplacement(String match) {
                return getValue(match);
            }
        });
View Full Code Here


            }
        } while(interpreter != null);
    }

    public static String handleSpecialCommand(final Shell shell, String str) {
        str = StringUtilities.replace("(!!)", str, new ReplacementProvider() {
            @Override
            public String getReplacement(String match) {
                return shell.getLastFromHistory();
            }
        });
        str = StringUtilities.replace("!(\\d+)", str, new ReplacementProvider() {
            @Override
            public String getReplacement(String match) {
                int index = Integer.parseInt(match);
                return shell.getFromHistory(index);
            }
View Full Code Here

        });
        return str;
    }

    public String resolve(String str) {
        str = StringUtilities.replace("\\$\\(([. ]+)", str, new ReplacementProvider() {
            @Override
            public String getReplacement(String match) {
                return "Hi";
            }
        });
View Full Code Here

TOP

Related Classes of com.elega9t.commons.util.ReplacementProvider

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.