Class PolicyBuilder


  • public final class PolicyBuilder
    extends java.lang.Object
    A builder for policies.
    • Constructor Detail

      • PolicyBuilder

        public PolicyBuilder()
        Default constructor.
    • Method Detail

      • registerCompileTimePass

        public PolicyBuilder registerCompileTimePass​(CompileTimePass compileTimePass)
        Register a compile time pass.
        Parameters:
        compileTimePass - the compile time pass to register.
        Returns:
        the PolicyBuilder which registers the compileTimePass.
      • registerCompileTimePass

        public PolicyBuilder registerCompileTimePass​(CompileTimePass compileTimePass,
                                                     java.util.function.Predicate<IRDAG> condition)
        Register compile time pass with its condition under which to run the pass.
        Parameters:
        compileTimePass - the compile time pass to register.
        condition - condition under which to run the pass.
        Returns:
        the PolicyBuilder which registers the compileTimePass.
      • registerRunTimePass

        public PolicyBuilder registerRunTimePass​(RunTimePass<?> runTimePass,
                                                 CompileTimePass runTimePassRegisterer)
        Register a run time pass.
        Parameters:
        runTimePass - the runtime pass to register.
        runTimePassRegisterer - the compile time pass that triggers the runtime pass.
        Returns:
        the PolicyBuilder which registers the runTimePass and the runTimePassRegisterer.
      • registerRunTimePass

        public PolicyBuilder registerRunTimePass​(RunTimePass<?> runTimePass,
                                                 CompileTimePass runTimePassRegisterer,
                                                 java.util.function.Predicate<IRDAG> condition)
        Register a run time pass.
        Parameters:
        runTimePass - the runtime pass to register.
        runTimePassRegisterer - the compile time pass that triggers the runtime pass.
        condition - condition under which to run the pass.
        Returns:
        the PolicyBuilder which registers the runTimePass and the runTimePassRegisterer.
      • getCompileTimePasses

        public java.util.List<CompileTimePass> getCompileTimePasses()
        Getter for compile time passes.
        Returns:
        the list of compile time passes.
      • getRunTimePasses

        public java.util.Set<RunTimePass<?>> getRunTimePasses()
        Getter for run time passes.
        Returns:
        the list of run time passes.
      • build

        public Policy build()
        Build a policy using compileTimePasses and runTimePasses in this object.
        Returns:
        the built Policy.