View Source Renewex.Hierarchy (renewex v0.10.0)

The grammar for parsing a Renew *.rnw file is defined by the object oriented class hierarchy of java classes in the original Java Renew implementation.

In order to parse all Renew *.rnw files correctly, this hierarchical model has to be reproduced as desribed in the Renewex.Grammar module.

This module provides utility functions to query the hierarchy of a given Renewex.Grammar. For example you can query if Java class of a given name is defined inside the hierarchy or if some class a sub class of another class.

Summary

Functions

Get a list of all classes defined in the grammars hierarchy.

Get the name of the super class of the given class inside the given hierarchy.

The the list of all classes that are defined to implement a given interface inside the hierarchy of the grammar.

Get the list of all interfaces that a given class is defined to implement by the hierarchy of the given grammar.

Check if a class of a given name is defined inside the hierarchy of the given grammar.

Check if subtype is an implementation of given interface_or_class or if subtype is identical to the given interface_or_class.

Check if one class is a subtype of another class or interface.

Get a list of all classes in the grammars hierarchy that have no super class. Check if one class is a subtype of another class or interface.

Get a list of all supetypes of one or many given supertypes defined in the grammar hierarchy.

Functions

Get a list of all classes defined in the grammars hierarchy.

Parameters

  • grammar: The grammar that contains the definition of the rules to work with

Returns

A list of all rules defined in the given grammar as fully qualified java class names.

Link to this function

get_super(grammar, name)

View Source

Get the name of the super class of the given class inside the given hierarchy.

Parameters

  • grammar: The grammar that contains the definition of the rules to work with
  • name: The fully qualified name of a Java class

Returns

The name of the super class, if it is defined. nil if the class of the given name is defined but has no super class. :undefined if the class of the given name is not defined in the given grammar.

Link to this function

implementors_of(grammar, interface)

View Source

The the list of all classes that are defined to implement a given interface inside the hierarchy of the grammar.

Parameters

  • grammar: The grammar that contains the definition of the rules to work with
  • interface: A single fully qualified name of a Java interface

Returns

A list of all class names that are implement the given interface according to the grammar definition.

Link to this function

interfaces_of(grammar, name)

View Source

Get the list of all interfaces that a given class is defined to implement by the hierarchy of the given grammar.

Parameters

  • grammar: The grammar that contains the definition of the rules to work with
  • name: The fully qualified name of a Java class

Returns

If the given class is defined inside the grammar: A list of all interfaces that the given class implements according to the grammar definition. Otherwise returns :undefined. Returns an empty list if nil is given as name.

Link to this function

is_defined(grammar, name)

View Source

Check if a class of a given name is defined inside the hierarchy of the given grammar.

Parameters

  • grammar: The grammar that contains the definition of the rules to work with
  • name: The fully qualified name of a Java class

Returns

true if the class of the given name is defined inside the grammar, false otherwise.

Link to this function

is_implementation_of(grammar, subtype, interface_or_class)

View Source

Check if subtype is an implementation of given interface_or_class or if subtype is identical to the given interface_or_class.

Parameters

  • grammar: The grammar that contains the definition of the rules to work with
  • interface_or_class: The fully qualified name of a Java class or interface

Returns

true if the given subtype is defined in the given grammar and is either a subclass of the given super class or an implementation of the given interface. false if the given subtype is defined in the grammar but is neither a subclass nor an implementation of interface_or_class. :undefined if the subtype is not even defined inside the given grammar

Link to this function

is_subtype_of(grammar, subtype, supertype)

View Source

Check if one class is a subtype of another class or interface.

Parameters

  • grammar: The grammar that contains the definition of the rules to work with
  • subtype: The fully qualified name of a Java class
  • supertype: The fully qualified name of a Java class

Returns

true if the class subtype is defined as a subtype of the class supertype in the given grammar.

Get a list of all classes in the grammars hierarchy that have no super class. Check if one class is a subtype of another class or interface.

Parameters

  • grammar: The grammar that contains the definition of the rules to work with

Returns

A list of fully qualified Java class names that have no super classes according to the given grammar.

Link to this function

subtypes_of(grammar, supertypes)

View Source

Get a list of all supetypes of one or many given supertypes defined in the grammar hierarchy.

Parameters

  • grammar: The grammar that contains the definition of the rules to work with
  • supetypes: Either a single fully qualified Java class name as string or a list of class names.

Returns

A list of all class names that are subtypes of the given class according to the given grammar definition.