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.
| Modifier and Type | Class and Description |
|---|---|
static class |
PaddedCell.Type
The kind of result.
|
| Modifier and Type | Method and Description |
|---|---|
String |
canonical()
Returns the “canonical” form for this particular result (only possible if isResolvable).
|
static PaddedCell |
check(Formatter formatter,
File file)
Applies the given formatter to the given file, checking that F(F(input)) == F(input).
|
static PaddedCell |
check(Formatter formatter,
File file,
String originalUnix) |
File |
file()
Returns the file which was tested.
|
boolean |
isResolvable()
Any result which doesn’t diverge can be resolved.
|
boolean |
misbehaved()
Returns true iff the formatter misbehaved in any way (did not converge after a single iteration).
|
List<String> |
steps()
Returns the steps it takes to get to the result.
|
PaddedCell.Type |
type()
Returns the type of the result (either
PaddedCell.Type.CONVERGE, PaddedCell.Type.CYCLE, or PaddedCell.Type.DIVERGE). |
String |
userMessage()
Returns a string which describes this result.
|
public File file()
Returns the file which was tested.
public PaddedCell.Type type()
Returns the type of the result (either PaddedCell.Type.CONVERGE, PaddedCell.Type.CYCLE, or PaddedCell.Type.DIVERGE).
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.
public static PaddedCell check(Formatter formatter, File file, String originalUnix)
public boolean misbehaved()
Returns true iff the formatter misbehaved in any way (did not converge after a single iteration).
public boolean isResolvable()
Any result which doesn’t diverge can be resolved.
public String canonical()
Returns the “canonical” form for this particular result (only possible if isResolvable).
public String userMessage()
Returns a string which describes this result.