Class MappedSUL<AI,​AO,​CI,​CO>

  • All Implemented Interfaces:
    SUL<AI,​AO>

    public class MappedSUL<AI,​AO,​CI,​CO>
    extends Object
    implements SUL<AI,​AO>
    • Constructor Detail

      • MappedSUL

        public MappedSUL​(SULMapper<? super AI,​? extends AO,​? extends CI,​? super CO> mapper,
                         SUL<? super CI,​? extends CO> sul)
    • Method Detail

      • pre

        public void pre()
        Description copied from interface: SUL
        setup SUL.
        Specified by:
        pre in interface SUL<AI,​AO>
      • post

        public void post()
        Description copied from interface: SUL
        shut down SUL.
        Specified by:
        post in interface SUL<AI,​AO>
      • step

        public AO step​(AI in)
        Description copied from interface: SUL
        make one step on the SUL.
        Specified by:
        step in interface SUL<AI,​AO>
        Parameters:
        in - input to the SUL
        Returns:
        output of SUL
      • canFork

        public boolean canFork()
        Description copied from interface: SUL
        Returns whether this SUL is capable of forking.
        Specified by:
        canFork in interface SUL<AI,​AO>
        Returns:
        true if this SUL can be forked, false otherwise
        See Also:
        SUL.fork()
      • fork

        public MappedSUL<AI,​AO,​CI,​CO> fork()
        Description copied from interface: SUL
        Forks this SUL, if possible. The fork of a SUL is a copy which behaves exactly the same as this SUL. This method should always return a reseted SUL, regardless of whether this call is made between a call to SUL.pre() and SUL.post().

        If SUL.canFork() returns true, this method must return a non-null object, which should behave exactly like this SUL (in particular, it must be forkable as well). Otherwise, a UnsupportedOperationException must be thrown.

        Implementation note: if resetting a SUL changes the internal state of this object in a non-trivial way (e.g., incrementing a counter to ensure independent sessions), care must be taken that forks of this SUL manipulate the same internal state.

        Specified by:
        fork in interface SUL<AI,​AO>
        Returns:
        a fork of this SUL.