|
| 1 | +package testSuite.classes.imagewrite_correct; |
| 2 | + |
| 3 | +import java.util.Locale; |
| 4 | + |
| 5 | +import javax.imageio.ImageWriteParam; |
| 6 | + |
| 7 | +import liquidjava.specification.ExternalRefinementsFor; |
| 8 | +import liquidjava.specification.Refinement; |
| 9 | +import liquidjava.specification.StateRefinement; |
| 10 | +import liquidjava.specification.StateSet; |
| 11 | + |
| 12 | +/** |
| 13 | + * External typestate specification for {@code javax.imageio.ImageWriteParam}. |
| 14 | + * |
| 15 | + * <p> |
| 16 | + * The class is modelled as two independent ghost-state dimensions — tiling and compression — so a configuration error |
| 17 | + * in one dimension does not mask the other. The conditional {@code setTilingMode} / {@code setCompressionMode} |
| 18 | + * transitions only reach the {@code *Explicit} state when called with {@code MODE_EXPLICIT}; any other mode leaves the |
| 19 | + * param in its {@code start*} state, which the dimension-specific setters reject. |
| 20 | + */ |
| 21 | +@StateSet({ "startTiling", "tilingExplicit", "tilingSet" }) |
| 22 | +@StateSet({ "startCompression", "compressionExplicit", "compressionSet" }) |
| 23 | +@ExternalRefinementsFor("javax.imageio.ImageWriteParam") |
| 24 | +public interface ImageWriteParamsRefinements { |
| 25 | + |
| 26 | + // Constructor |
| 27 | + @StateRefinement(to = "startTiling(this) && startCompression(this)") |
| 28 | + void ImageWriteParam(Locale locale); |
| 29 | + |
| 30 | + // Tiling related methods |
| 31 | + |
| 32 | + @StateRefinement(to = "(mode == ImageWriteParam.MODE_EXPLICIT)? tilingExplicit(this) : startTiling(this)") |
| 33 | + void setTilingMode(int mode); |
| 34 | + |
| 35 | + @StateRefinement(from = "tilingExplicit(this)", to = "tilingSet(this)") |
| 36 | + @StateRefinement(from = "tilingSet(this)", to = "tilingSet(this)") |
| 37 | + void setTiling(@Refinement("_ > 0") int tileWidth, @Refinement("_ > 0") int tileHeight, int tileGridXOffset, |
| 38 | + int tileGridYOffset); |
| 39 | + |
| 40 | + @StateRefinement(from = "tilingSet(this)") |
| 41 | + int getTileGridXOffset(); |
| 42 | + |
| 43 | + @StateRefinement(from = "tilingSet(this)") |
| 44 | + int getTileGridYOffset(); |
| 45 | + |
| 46 | + @StateRefinement(from = "tilingSet(this)") |
| 47 | + int getTileHeight(); |
| 48 | + |
| 49 | + @StateRefinement(from = "tilingSet(this)") |
| 50 | + int getTileWidth(); |
| 51 | + |
| 52 | + @StateRefinement(from = "tilingExplicit(this)") |
| 53 | + @StateRefinement(from = "tilingSet(this)", to = "tilingExplicit(this)") |
| 54 | + void unsetTiling(); |
| 55 | + |
| 56 | + void setProgressiveMode(@Refinement("ImageWriteParam.MODE_DISABLED == mode || mode == ImageWriteParam.MODE_DEFAULT || mode == ImageWriteParam.MODE_COPY_FROM_METADATA") int mode); |
| 57 | + |
| 58 | + // Compression related methods |
| 59 | + |
| 60 | + @StateRefinement(to = "mode == ImageWriteParam.MODE_EXPLICIT? compressionExplicit(this) : startCompression(this)") |
| 61 | + void setCompressionMode(int mode); |
| 62 | + |
| 63 | + @StateRefinement(from = "compressionExplicit(this)") |
| 64 | + @StateRefinement(from = "compressionSet(this)") |
| 65 | + void setCompressionQuality(@Refinement("_ >= 0.0 && _ <= 1.0") float quality); |
| 66 | + |
| 67 | + @StateRefinement(from = "compressionExplicit(this)") |
| 68 | + @StateRefinement(from = "compressionSet(this)") |
| 69 | + String getCompressionType(); |
| 70 | + |
| 71 | + @StateRefinement(from = "compressionExplicit(this)", to = "compressionSet(this)") |
| 72 | + void setCompressionType(String compressionType); |
| 73 | + |
| 74 | + @StateRefinement(from = "compressionExplicit(this)") |
| 75 | + @StateRefinement(from = "compressionSet(this)", to = "compressionExplicit(this)") |
| 76 | + void unsetCompression(); |
| 77 | + |
| 78 | + @StateRefinement(from = "compressionSet(this)") |
| 79 | + String getLocalizedCompressionTypeName(); |
| 80 | + |
| 81 | + @StateRefinement(from = "compressionExplicit(this)") |
| 82 | + @StateRefinement(from = "compressionSet(this)") |
| 83 | + boolean isCompressionLossless(); |
| 84 | + |
| 85 | + @StateRefinement(from = "compressionExplicit(this)") |
| 86 | + @StateRefinement(from = "compressionSet(this)") |
| 87 | + float getCompressionQuality(); |
| 88 | +} |
0 commit comments