Skip to content

Commit

Permalink
Apply auto-formatting, re #8
Browse files Browse the repository at this point in the history
  • Loading branch information
safris committed Feb 27, 2024
1 parent 7da4686 commit c643016
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 74 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/libj/console/Ansi.java
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ else if (color == null) {
}

/**
* Accepts a string that may contain ANSI escapes for colors and intensities, and returns an equivalent string with the same
* colors and intensities as HTML+CSS tags.
* Accepts a string that may contain ANSI escapes for colors and intensities, and returns an equivalent string with the same colors
* and intensities as HTML+CSS tags.
*
* @param str The string whose ANSI-escaped colors and/or intensities are to be transformed into HTML+CSS equivalents.
* @return The transformed string.
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/libj/console/Tables.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ public static String printTable(final boolean borders, final Align alignHeading,
}

/**
* Returns a string with a table layout of the provided array of columns of new-line-delimited rows, without borders, aligned to
* the left.
* Returns a string with a table layout of the provided array of columns of new-line-delimited rows, without borders, aligned to the
* left.
* <p>
* This is the equivalent of calling:
*
Expand All @@ -215,8 +215,8 @@ public static String printTable(final String ... columns) {
}

/**
* Returns a string with a table layout of the provided array of columns of new-line-delimited rows, without borders, aligned to
* the left.
* Returns a string with a table layout of the provided array of columns of new-line-delimited rows, without borders, aligned to the
* left.
* <p>
* This is the equivalent of calling:
*
Expand All @@ -237,8 +237,8 @@ public static String printTable(final int cells, final boolean firstColumnOneCel
}

/**
* Returns a string with a table layout of the provided array of columns of new-line-delimited rows, without borders, aligned to
* the left.
* Returns a string with a table layout of the provided array of columns of new-line-delimited rows, without borders, aligned to the
* left.
* <p>
* This is the equivalent of calling:
*
Expand All @@ -260,8 +260,8 @@ public static String printTable(final boolean borders, final Align alignHeading,
}

/**
* Returns a string with a table layout of the provided array of columns of new-line-delimited rows, without borders, aligned to
* the left.
* Returns a string with a table layout of the provided array of columns of new-line-delimited rows, without borders, aligned to the
* left.
* <p>
* This is the equivalent of calling:
*
Expand Down
38 changes: 19 additions & 19 deletions src/main/java/org/libj/console/drawille/BrailleMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ public BrailleMap() {
* can be expressed by a 4 by 2 dot matrix, these bounds are taken to be the upper bound respectively while negative numbers are
* taken as the lower bound.
*
* @param x Horizontal coordinate
* @param y Vertical coordinate
* @param x Horizontal coordinate.
* @param y Vertical coordinate.
*/
protected void checkRange(final int x, final int y) {
if (x < 0 || y < 0 || x > 1 || y > 3)
throw new DrawilleException(x, y);
}

/**
* This method takes in a horizontal and vertical coordinates alongside a matrix entry value. It then sets said value into the
* pixel matrix based on the passed coordinates
* This method takes in a horizontal and vertical coordinates alongside a matrix entry value. It then sets said value into the pixel
* matrix based on the passed coordinates
*
* @param x Horizontal coordinate
* @param y Vertical coordinate
* @param color The color to set matrix entry to
* @param x Horizontal coordinate.
* @param y Vertical coordinate.
* @param color {@link org.libj.console.Ansi.Color Color} to set matrix entry to.
*/
public void change(final int x, final int y, final Ansi.Color color) {
checkRange(x, y);
Expand All @@ -73,21 +73,21 @@ public void change(final int x, final int y, final Ansi.Color color) {
* This method takes in a horizontal and vertical coordinates and it returns the value that is saved in the pixel matrix based on
* the passed coordinates.
*
* @param x Horizontal coordinate
* @param y Vertical coordinate
* @return Boolean Saved state based on coordinates
* @param x Horizontal coordinate.
* @param y Vertical coordinate.
* @return Boolean Saved state based on coordinates.
*/
public Ansi.Color get(final int x, final int y) {
checkRange(x, y);
return map[y * 2 + x];
}

/**
* This method takes in a horizontal and vertical coordinates, it then activates the value into the pixel matrix based on the
* passed coordinates.
* This method takes in a horizontal and vertical coordinates, it then activates the value into the pixel matrix based on the passed
* coordinates.
*
* @param x Horizontal coordinate
* @param y Vertical coordinate
* @param x Horizontal coordinate.
* @param y Vertical coordinate.
*/
public void set(final int x, final int y) {
set(x, y, Ansi.Color.DEFAULT);
Expand All @@ -101,8 +101,8 @@ public void set(final int x, final int y, final Ansi.Color color) {
* This method takes in a horizontal and vertical coordinates, it then deactivates the value into the pixel matrix based on the
* passed coordinates.
*
* @param x Horizontal coordinate
* @param y Vertical coordinate
* @param x Horizontal coordinate.
* @param y Vertical coordinate.
*/
public void unset(final int x, final int y) {
change(x, y, null);
Expand All @@ -117,10 +117,10 @@ public void reset() {
}

/**
* This method traverses through the pixel map matrix and transforms the matrix into a braille character. The resulting character
* is returned in string value.
* This method traverses through the pixel map matrix and transforms the matrix into a braille character. The resulting character is
* returned in string value.
*
* @return String Pixel matrix as braille character
* @return Pixel matrix as braille character.
*/
@Override
public String toString() {
Expand Down
58 changes: 29 additions & 29 deletions src/main/java/org/libj/console/drawille/Canvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public class Canvas {
* This constructor takes in a width and height and initializes a flattened matrix of BrailleMap objects. These objects serve as
* sub-matrices and extend the 'pixel' definition that can be displayed on a screen.
*
* @param width The desired width of the canvas
* @param height The desired height of the canvas
* @param width The desired width of the canvas.
* @param height The desired height of the canvas.
* @param border Border color.
*/
public Canvas(final int width, final int height, final Ansi.Color border) {
Expand Down Expand Up @@ -78,9 +78,9 @@ public Canvas(final int width, final int height) {
}

/**
* This method takes in a horizontal and vertical component and checks to see if it is in range of the screen matrix. Since
* braille can be expressed by a 3 by 2 dot matrix, these bounds are taken to be the upper bound respectively while negative
* numbers are taken as the lower bound. These values are taken into effect by the getWidth and getHeight methods.
* This method takes in a horizontal and vertical component and checks to see if it is in range of the screen matrix. Since braille
* can be expressed by a 3 by 2 dot matrix, these bounds are taken to be the upper bound respectively while negative numbers are
* taken as the lower bound. These values are taken into effect by the getWidth and getHeight methods.
*
* @param x Horizontal coordinate
* @param y Vertical coordinate
Expand All @@ -94,17 +94,17 @@ protected void checkRange(final int x, final int y) {
* This method returns the screen width in the true pixel definition. The user supplied width is multiplied by 2 because a braille
* dot matrix has 2 columns.
*
* @return Integer True pixel width
* @return Integer True pixel width.
*/
public int getWidth() {
return pixelWidth;
}

/**
* This method returns the screen height in the true pixel definition. The user supplied height is multiplied by 4 because a
* braille dot matrix has 4 rows.
* This method returns the screen height in the true pixel definition. The user supplied height is multiplied by 4 because a braille
* dot matrix has 4 rows.
*
* @return Integer True pixel width
* @return Integer True pixel width.
*/
public int getHeight() {
return pixelHeight;
Expand All @@ -114,9 +114,9 @@ public int getHeight() {
* This method takes in a horizontal and vertical coordinate and returns the value of the activation of said pixel. If true, the
* pixel is turned on, otherwise it is off.
*
* @param x Horizontal coordinate of pixel
* @param y Vertical coordinate of pixel
* @return Boolean The activation value of the pixel
* @param x Horizontal coordinate of pixel.
* @param y Vertical coordinate of pixel.
* @return The activation value of the pixel.
*/
public Ansi.Color get(final int x, final int y) {
checkRange(x, y);
Expand All @@ -125,12 +125,12 @@ public Ansi.Color get(final int x, final int y) {
}

/**
* This method takes in a horizontal and vertical coordinate as well as an activation state. It then applies that activation to
* said pixel that lives in the passed coordinates.
* This method takes in a horizontal and vertical coordinate as well as an activation state. It then applies that activation to said
* pixel that lives in the passed coordinates.
*
* @param x Horizontal coordinate of pixel
* @param y Vertical coordinate of pixel
* @param color Color to set on pixel
* @param x Horizontal coordinate of pixel.
* @param y Vertical coordinate of pixel.
* @param color {@link org.libj.console.Ansi.Color Color} to set on pixel
*/
public void change(final int x, final int y, final Ansi.Color color) {
checkRange(x, y);
Expand All @@ -141,8 +141,8 @@ public void change(final int x, final int y, final Ansi.Color color) {
/**
* This method takes in a horizontal and vertical coordinate, it then activates said pixel by setting it's value to true.
*
* @param x Horizontal coordinate of pixel
* @param y Vertical coordinate of pixel
* @param x Horizontal coordinate of pixel.
* @param y Vertical coordinate of pixel.
*/
public void set(final int x, final int y) {
set(x, y, Ansi.Color.DEFAULT);
Expand All @@ -155,8 +155,8 @@ public void set(final int x, final int y, final Ansi.Color color) {
/**
* This method takes in a horizontal and vertical coordinate, it then deactivates said pixel by setting it's value to false.
*
* @param x Horizontal coordinate of pixel
* @param y Vertical coordinate of pixel
* @param x Horizontal coordinate of pixel.
* @param y Vertical coordinate of pixel.
*/
public void unset(final int x, final int y) {
change(x, y, null);
Expand All @@ -173,8 +173,8 @@ public void clear() {
}

/**
* This method traverses through all the BrailleMap objects and renders out the sub-matrices by asking for the object's string
* value with the getString method. It then prints them all out to the screen by using the overloaded corresponding render method.
* This method traverses through all the BrailleMap objects and renders out the sub-matrices by asking for the object's string value
* with the getString method. It then prints them all out to the screen by using the overloaded corresponding render method.
*/
public void render() {
try {
Expand All @@ -186,13 +186,13 @@ public void render() {
}

/**
* This method traverses through all the BrailleMap objects and renders out the sub-matrices by asking for the object's string
* value with the getString method. It then writes said output to the specified ByteArrayOutputStream. This stream is then
* returned back to caller for method chaining.
* This method traverses through all the BrailleMap objects and renders out the sub-matrices by asking for the object's string value
* with the getString method. It then writes said output to the specified ByteArrayOutputStream. This stream is then returned back
* to caller for method chaining.
*
* @param out Stream to write to
* @return Same stream that was passed in
* @throws IOException ByteArrayOutputStream throws exception
* @param out Stream to write to.
* @return Same stream that was passed in.
* @throws IOException If an I/O error has occurred.
*/
public OutputStream render(final OutputStream out) throws IOException {
for (int i = 0; i < area; ++i) { // [N]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public class DrawilleException extends RuntimeException {
* This constructor takes in an (x,y) value pair and displays those pairs to the user. These values are defined to be out of range
* by the caller, therefore the caller will be alerted.
*
* @param x The passed horizontal coordinate
* @param y The passed vertical coordinate
* @param x The passed horizontal coordinate.
* @param y The passed vertical coordinate.
*/
public DrawilleException(int x, int y) {
public DrawilleException(final int x, final int y) {
super(String.format("Out of range {x:%d,y:%d}", x, y));
}
}
24 changes: 12 additions & 12 deletions src/main/java/org/libj/console/drawille/Turtle.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public class Turtle extends Canvas {
/**
* This constructor simply calls the super constructor and passes the desired dimensions.
*
* @param width Desired width of canvas
* @param height Desired height of canvas
* @param width Desired width of canvas.
* @param height Desired height of canvas.
*/
public Turtle(final int width, final int height) {
super(width, height);
Expand All @@ -48,7 +48,7 @@ public Turtle(final int width, final int height) {
/**
* This method simply returns the horizontal component of the position of the pen.
*
* @return double Horizontal position of pen
* @return double Horizontal position of pen.
*/
public double getX() {
return x;
Expand All @@ -57,7 +57,7 @@ public double getX() {
/**
* This method simply returns the vertical component of the position of the pen.
*
* @return double Vertical position of pen
* @return double Vertical position of pen.
*/
public double getY() {
return y;
Expand Down Expand Up @@ -89,7 +89,7 @@ public void up() {
/**
* This method takes in the angle to add to the right and adds it to the pen angle.
*
* @param angle Angle to move right
* @param angle Angle to move right.
*/
public void right(final double angle) {
a += angle;
Expand All @@ -98,17 +98,17 @@ public void right(final double angle) {
/**
* This method takes in the angle to add to the left and subtracts it from pen angle.
*
* @param angle Angle to move right
* @param angle Angle to move right.
*/
public void left(final double angle) {
a -= angle;
}

/**
* This method takes in the length and expects us to move backwards with the pen based on the current pen angle. The forward
* method is used to implement this method by simply passing in the same scalar value of length but in the opposite direction.
* This method takes in the length and expects us to move backwards with the pen based on the current pen angle. The forward method
* is used to implement this method by simply passing in the same scalar value of length but in the opposite direction.
*
* @param length Length to move back
* @param length Length to move back.
*/
public void backward(final double length) {
forward(length * -1);
Expand All @@ -117,7 +117,7 @@ public void backward(final double length) {
/**
* This method takes in the length and expects us to move forwards with the pen based on the current pen angle.
*
* @param length Length to move forward
* @param length Length to move forward.
*/
public void forward(double length) {
final double theta = a / 180.0 * Math.PI;
Expand All @@ -128,8 +128,8 @@ public void forward(double length) {
* This method takes in a new horizontal and vertical coordinate and based on the current coordinates, it draws a line to connect
* them. If the state of isDrawing is false, then we do not draw and instead just move the pen to those coordinates.
*
* @param x Horizontal coordinate
* @param y Vertical coordinate
* @param x Horizontal coordinate.
* @param y Vertical coordinate.
*/
public void move(final double x, final double y) {
if (isDrawing) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/libj/console/drawille/CanvasTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void testRenderOverload() {
canvas.set(1, 1);
canvas.set(1, 2);
String result = canvas.render(output).toString().replace("\n", "");
// assertTrue(result.equals("\u2830\u2800"));
// assertTrue(result.equals("\u2830\u2800"));
}
catch (final Exception e) {
assertTrue(false);
Expand Down

0 comments on commit c643016

Please sign in to comment.