Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package jason.asSyntax.directives;
This class maintains the set of directives and is used by the parser to process them. All available directives must be registered in this class using the addDirective method.

public class DirectiveProcessor {
    static Logger logger = Logger.getLogger(DirectiveProcessor.class.getName());
    private static Map<String,Directivedirectives = new HashMap<String,Directive>();
    public static void addDirective(String idDirective d) {
    public static Directive getDirective(String id) {
        return .get(id);
    public static Directive removeDirective(String id) {
        return .remove(id);
    // add known directives
    static {
        addDirective("include"new Include());
        addDirective("register_function"new FunctionRegister());
        addDirective("dg"new DG());
        addDirective("bdg"new BDG());
        addDirective("ebdg"new EBDG());
        addDirective("bc"new BC());
        addDirective("smc"new SMC());
        addDirective("rc"new RC());
        addDirective("omc"new OMC());
        addDirective("mg"new MG());
        addDirective("sga"new SGA());
    public static Agent process(Pred directiveAgent outerAgAgent innerAg) {
        try {
            .fine("Processing directive "+directive);
            Directive d = .get(directive.getFunctor());
            if (d != null) {
                return d.process(directiveouterAginnerAg);
            } else {
                .log(."Unknown directive "+directive);
        } catch (Exception e) {
            .log(."Error processing directive "+directive,e);
        return null;
New to GrepCode? Check out our FAQ X