Examples of ReplacementProvider


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

Examples of com.elega9t.commons.util.ReplacementProvider

            }
        } 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

Examples of com.elega9t.commons.util.ReplacementProvider

        });
        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
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.