Module jamal.core

Class Import

  • All Implemented Interfaces:
    Macro, Stackable

    public class Import
    extends java.lang.Object
    implements Stackable
    Imports the macros from the file.

    The file name is followed by the macro keyword import. If the file was already imported on the actual level or some higher level then the file will not be imported again. This is to ensure that the same macro file will not be imported uselessly more than once. Also if the macro file was imported on a level only that is deeper than the current level then the macros are not available at the current position (except those that were exported) and therefore will be imported again.

    The output generated from the file is ignored and is thrown away.

    The class implements Stackable. This will signal the processor to invoke push() and pop()

    when the macro context opens and closes one level. That way the macro can keep track of the level of already imported files in it's own stack.

    • Constructor Summary

      Constructors 
      Constructor Description
      Import()
      The constructor of this class is not implicit because it has to initialize the stack of Set that keeps tract of already imported files (one element of the set for the corresponding level of the stack).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String evaluate​(Input input, Processor processor)  
      void pop()  
      void push()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax0.jamal.api.Macro

        getId
    • Constructor Detail

      • Import

        public Import()
        The constructor of this class is not implicit because it has to initialize the stack of Set that keeps tract of already imported files (one element of the set for the corresponding level of the stack). When the application starts the stack (implemented as an ArrayList) has to have one (empty set) element already.