Class PaddedCell


  • public final class PaddedCell
    extends Object
    Models the result of applying a Formatter on a given File while characterizing various failure modes (slow convergence, cycles, and divergence). See check(Formatter, File) as the entry point to this class.
    • Method Detail

      • file

        public File file()
        Returns the file which was tested.
      • steps

        public List<String> steps()
        Returns the steps it takes to get to the result.
      • check

        public static PaddedCell check​(Formatter formatter,
                                       File file)
        Applies the given formatter to the given file, checking that F(F(input)) == F(input). If it meets this test, misbehaved() will return false. If it fails the test, misbehaved() will return true, and you can find out more about the misbehavior based on its PaddedCell.Type.
      • misbehaved

        public boolean misbehaved()
        Returns true iff the formatter misbehaved in any way (did not converge after a single iteration).
      • isResolvable

        public boolean isResolvable()
        Any result which doesn't diverge can be resolved.
      • canonical

        public String canonical()
        Returns the "canonical" form for this particular result (only possible if isResolvable).
      • userMessage

        public String userMessage()
        Returns a string which describes this result.
      • calculateDirtyState

        public static PaddedCell.DirtyState calculateDirtyState​(Formatter formatter,
                                                                File file)
                                                         throws IOException
        Calculates whether the given file is dirty according to a PaddedCell invocation of the given formatter. DirtyState includes the clean state of the file, as well as a warning if we were not able to apply the formatter due to diverging idempotence.
        Throws:
        IOException
      • isClean

        public static PaddedCell.DirtyState isClean()
        Returns the DirtyState which corresponds to isClean().