Class ReducerFactory

java.lang.Object
eu.bandm.tools.ramus.ogma.Factory
eu.bandm.tools.ramus.ogma.ReducerFactory

public class ReducerFactory extends Factory
Factory with configurable operations for AST construction.
  • Method Details

    • derive

      Creates a new variant of this factory with a modified configuration.
      Parameters:
      evolution - the modification to apply to the configuration
      Returns:
      a new factory with a modified configuration
      Throws:
      NullPointerException - if evolution is null
    • getReadingFactory

      public final ReadingFactory getReadingFactory()
      Returns the reading factory used by this factory.
      Returns:
      the reading factory used by this factory
    • getParserFactory

      public final ParserFactory getParserFactory()
      Returns the parser factory used by this factory.
      Returns:
      the parser factory used by this factory
    • getDefault

      public static ReducerFactory getDefault()
      Returns a factory with default configuration (factory settings).
      Returns:
      a factory with default configuration
      See Also:
    • reduce

      public final <D, T, A1, R> Reading<D,T,R> reduce(ReducerFactory.Constructor1<D,A1,? extends R> cons, Reading<D,T,? extends A1> arg1)
      Creates a compound reading for AST nodes with one parsed argument.

      The argument is parsed in a location-tracking context. Then the given constructor is invoked to create an AST node.

      Type Parameters:
      D - the type of source document identifiers
      T - the type of token types
      A1 - the type of the (first) parsed argument value
      R - the type of resulting AST nodes
      Parameters:
      cons - the AST node constructor
      arg1 - the reading for the (first) parsed argument
      Returns:
      a compound reading using the AST node constructor for its root
    • reduce

      public final <D, T, A1, A2, R> Reading<D,T,R> reduce(ReducerFactory.Constructor2<D,A1,A2,R> cons, Reading<D,T,? extends A1> arg1, Reading<D,T,? extends A2> arg2)
      Creates a compound reading for AST nodes with two parsed arguments.

      The arguments are parsed sequentially in a location-tracking context. Then the given constructor is invoked to create an AST node.

      Type Parameters:
      D - the type of source document identifiers
      T - the type of token types
      A1 - the type of the first parsed argument value
      A2 - the type of the second parsed argument value
      R - the type of resulting AST nodes
      Parameters:
      cons - the AST node constructor
      arg1 - the reading for the first parsed argument
      arg2 - the reading for the second parsed argument
      Returns:
      a compound reading using the AST node constructor for its root
    • reduce

      public final <D, T, A1, A2, A3, R> Reading<D,T,R> reduce(ReducerFactory.Constructor3<D,A1,A2,A3,R> cons, Reading<D,T,? extends A1> arg1, Reading<D,T,? extends A2> arg2, Reading<D,T,? extends A3> arg3)
      Creates a compound reading for AST nodes with three parsed arguments.

      The arguments are parsed sequentially in a location-tracking context. Then the given constructor is invoked to create an AST node.

      Type Parameters:
      D - the type of source document identifiers
      T - the type of token types
      A1 - the type of the first parsed argument value
      A2 - the type of the second parsed argument value
      A3 - the type of the third parsed argument value
      R - the type of resulting AST nodes
      Parameters:
      cons - the AST node constructor
      arg1 - the reading for the first parsed argument
      arg2 - the reading for the second parsed argument
      arg3 - the reading for the third parsed argument
      Returns:
      a compound reading using the AST node constructor for its root
    • reduce

      public final <D, T, A1, A2, A3, A4, R> Reading<D,T,R> reduce(ReducerFactory.Constructor4<D,A1,A2,A3,A4,R> cons, Reading<D,T,? extends A1> arg1, Reading<D,T,? extends A2> arg2, Reading<D,T,? extends A3> arg3, Reading<D,T,? extends A4> arg4)
      Creates a compound reading for AST nodes with four parsed arguments.

      The arguments are parsed sequentially in a location-tracking context. Then the given constructor is invoked to create an AST node.

      Type Parameters:
      D - the type of source document identifiers
      T - the type of token types
      A1 - the type of the first parsed argument value
      A2 - the type of the second parsed argument value
      A3 - the type of the third parsed argument value
      A4 - the type of the fourth parsed argument value
      R - the type of resulting AST nodes
      Parameters:
      cons - the AST node constructor
      arg1 - the reading for the first parsed argument
      arg2 - the reading for the second parsed argument
      arg3 - the reading for the third parsed argument
      arg4 - the reading for the fourth parsed argument
      Returns:
      a compound reading using the AST node constructor for its root
    • reduce

      public final <D, T, A1, A2, A3, A4, A5, R> Reading<D,T,R> reduce(ReducerFactory.Constructor5<D,A1,A2,A3,A4,A5,R> cons, Reading<D,T,? extends A1> arg1, Reading<D,T,? extends A2> arg2, Reading<D,T,? extends A3> arg3, Reading<D,T,? extends A4> arg4, Reading<D,T,? extends A5> arg5)
      Creates a compound reading for AST nodes with five parsed arguments.

      The arguments are parsed sequentially in a location-tracking context. Then the given constructor is invoked to create an AST node.

      Type Parameters:
      D - the type of source document identifiers
      T - the type of token types
      A1 - the type of the first parsed argument value
      A2 - the type of the second parsed argument value
      A3 - the type of the third parsed argument value
      A4 - the type of the fourth parsed argument value
      A5 - the type of the fifth parsed argument value
      R - the type of resulting AST nodes
      Parameters:
      cons - the AST node constructor
      arg1 - the reading for the first parsed argument
      arg2 - the reading for the second parsed argument
      arg3 - the reading for the third parsed argument
      arg4 - the reading for the fourth parsed argument
      arg5 - the reading for the fifth parsed argument
      Returns:
      a compound reading using the AST node constructor for its root
    • reduce

      public final <D, T, A1, A2, A3, A4, A5, A6, R> Reading<D,T,R> reduce(ReducerFactory.Constructor6<D,A1,A2,A3,A4,A5,A6,R> cons, Reading<D,T,? extends A1> arg1, Reading<D,T,? extends A2> arg2, Reading<D,T,? extends A3> arg3, Reading<D,T,? extends A4> arg4, Reading<D,T,? extends A5> arg5, Reading<D,T,? extends A6> arg6)
      Creates a compound reading for AST nodes with six parsed arguments.

      The arguments are parsed sequentially in a location-tracking context. Then the given constructor is invoked to create an AST node.

      Type Parameters:
      D - the type of source document identifiers
      T - the type of token types
      A1 - the type of the first parsed argument value
      A2 - the type of the second parsed argument value
      A3 - the type of the third parsed argument value
      A4 - the type of the fourth parsed argument value
      A5 - the type of the fifth parsed argument value
      A6 - the type of the sixth parsed argument value
      R - the type of resulting AST nodes
      Parameters:
      cons - the AST node constructor
      arg1 - the reading for the first parsed argument
      arg2 - the reading for the second parsed argument
      arg3 - the reading for the third parsed argument
      arg4 - the reading for the fourth parsed argument
      arg5 - the reading for the fifth parsed argument
      arg6 - the reading for the sixth parsed argument
      Returns:
      a compound reading using the AST node constructor for its root
    • reduce

      public final <D, T, A1, A2, A3, A4, A5, A6, A7, R> Reading<D,T,R> reduce(ReducerFactory.Constructor7<D,A1,A2,A3,A4,A5,A6,A7,R> cons, Reading<D,T,? extends A1> arg1, Reading<D,T,? extends A2> arg2, Reading<D,T,? extends A3> arg3, Reading<D,T,? extends A4> arg4, Reading<D,T,? extends A5> arg5, Reading<D,T,? extends A6> arg6, Reading<D,T,? extends A7> arg7)
      Creates a compound reading for AST nodes with seven parsed arguments.

      The arguments are parsed sequentially in a location-tracking context. Then the given constructor is invoked to create an AST node.

      Type Parameters:
      D - the type of source document identifiers
      T - the type of token types
      A1 - the type of the first parsed argument value
      A2 - the type of the second parsed argument value
      A3 - the type of the third parsed argument value
      A4 - the type of the fourth parsed argument value
      A5 - the type of the fifth parsed argument value
      A6 - the type of the sixth parsed argument value
      A7 - the type of the seventh parsed argument value
      R - the type of resulting AST nodes
      Parameters:
      cons - the AST node constructor
      arg1 - the reading for the first parsed argument
      arg2 - the reading for the second parsed argument
      arg3 - the reading for the third parsed argument
      arg4 - the reading for the fourth parsed argument
      arg5 - the reading for the fifth parsed argument
      arg6 - the reading for the sixth parsed argument
      arg7 - the reading for the seventh parsed argument
      Returns:
      a compound reading using the AST node constructor for its root