Class Navigate

java.lang.Object
eu.bandm.tools.d2d2.base.Navigate

public final class Navigate extends Object
Auxiliary static methods for model navigation and inquiry.
  • Field Details

    • isPublicRegExp

      public static final Predicate<Definition> isPublicRegExp
      Returns whether a definition is of reg exp type (tags or chars) and has been defined as "public".
    • locnull

      public static final Location<XMLDocumentIdentifier> locnull
      A null value of the given type.
    • makeRef

      protected static final Function<String,Reference> makeRef
      Delivers an unresolved reference expression which contains the given name.
  • Method Details

    • PP

      public static final void PP(String text, Object... args)
      Shortcut formatting a String with arguemnts.
    • getModule

      public static Module getModule(SourceItem si)
      Find the module which contains a given definition, or the argument itself, if it is a module.
      Returns:
      the module a definition or import item is contained in, or the argument itself, in case it is a module itself.

      (Must be public for "../postproc".)

    • getTopmostModule

      public static Module getTopmostModule(SourceItem si)
      Returns:
      the top-most static (source text level) module, a definition or import item is contained in, or the argument itself, in case it is a top-level module itself.
    • getAllModules

      public static List<Module> getAllModules(SourceItem si)
      Delivers the ascending list of containing modules.
    • isLocalModule

      public static boolean isLocalModule(Module mod)
      Returns:
      whether the module has been defined in the prefix of a text input file as a local module.
    • qname

      public static String qname(SourceItem si)
      Return the qualified name which represents nesting of local definitions up to (and excluding) the module level.
    • expandModulePath

      public static String expandModulePath(ImportItem item)
      Deliver the absolute path name for a module which is given by a reference to a module name from some nested scope. "childs" and "siblings" of the referring module are considered first. If none is found, the name is considered to be absolute.

      Returns:
      the expanded module name = path from top level module to module. This is additionally stored in the field "absolutePath" of the argument.
    • findImplicit

      @Opt public static @Opt Reference findImplicit(TagsRegExp def)
      Find the reference marked as #implicit, iff it is the first in a sequence (possibly length 1) on the top of the content model of the given regexp.
    • isEmptyXRegExp

      public static boolean isEmptyXRegExp(Definition def)
      Returns whether a definition is of reg exp type (tags or chars) and has empty contents.
    • extractSuffix

      public static String extractSuffix(String s)
      Returns:
      The part after the last Chars.STRING_NAMING_LEVEL_SEPARATOR = ".", or the whole String if none is contained.
    • findInDefinitions

      @Opt public static @Opt Definition findInDefinitions(Module mod, String name)
      Look for a definition in a module, including local defs.
    • findInDefinitions

      @Opt public static @Opt Definition findInDefinitions(Module mod, String[] names)
      Look for a definition in a module, including local defs.
    • reJoin

      public static String reJoin(String[] names)
      Recompose a compound identifier by joining it with Chars.STRING_NAMING_LEVEL_SEPARATOR = ".",
      Parameters:
      names - a non-empty array of identifiers (in the sense of the grammar).
    • allXRegExp

      public static Set<XRegExp> allXRegExp(Module mod)
      Delivers all definitons in the given module which are of reg exp type.
    • allPublicXRegExp

      public static Set<XRegExp> allPublicXRegExp(Module mod)
      Delivers all definitons in the given module which are of reg exp type and and have been defined as "public".
    • co_resolve

      public static Reference co_resolve(Definition def)
      Delivers a resolved reference expression which points to the given definition.
    • insertedExpression

      public static Expression insertedExpression(Insertion ins)
      Delivers the expression which is meant to be inserted by an insertion expression which contains only one single (resolved) reference expression. All insertions in a ResolvedModule are of this type (synthetic).
    • resolveInsertion

      public static Expression resolveInsertion(Expression exp)
      Resturns the argument if it is not an insertson, otherwise the XRegExp referred to by its only content, a resolved reference. All insertions in a ResolvedModule are of this type (synthetic).
    • printUdom

      public static void printUdom(Udom u)
      Dump the internal text parsing result object for debugging.
    • printUdom

      public static void printUdom(PrintStream p, Udom u)
      Dump the internal text parsing result object for debugging.
    • collectAttributes

      public static void collectAttributes(XRegExp host)
      Every XRegExp has a local cache with definitions which are realized as attributes. It caches additionally their optionality. This function updates this cache, if necessary.