Skip to content
Snippets Groups Projects
Commit 83fadb8a authored by Andrey Ruzhanskiy's avatar Andrey Ruzhanskiy
Browse files

Renamed Classes, fixed Typos

parent c9698943
No related branches found
No related tags found
1 merge request!8Feat/rasterizer 10
......@@ -28,7 +28,7 @@ public abstract class AbstractDocumentBuilder {
/**
* Interface for getting the final Document.
* @return DOcument to be printed
* @return Document to be printed
*/
public byte[] getDocument() {
return mDocument;
......
......@@ -11,7 +11,7 @@ package de.tudresden.inf.mci.brailleplot;
*/
@SuppressWarnings("checkstyle:MagicNumber")
public class AbstractIndexV4Printer extends AbstractDocumentBuilder {
public class AbstractIndexV4Builder extends AbstractDocumentBuilder {
......@@ -45,7 +45,6 @@ public class AbstractIndexV4Printer extends AbstractDocumentBuilder {
protected final byte[] mCharsPerLineName = new byte[] {0x43, 0x48};
/**
* Standard Value for Everest-V4 A4 Paper Size(30).If used, there must be also
* a corresponding Binding Margin. Possible Values are:
......@@ -112,7 +111,7 @@ public class AbstractIndexV4Printer extends AbstractDocumentBuilder {
* TODO find standard value!
*/
protected byte[] mFirstLineOffsetNameValue = null;
protected byte[] mFirstLineOffsetValue = null;
/**
* Standard VariableName for Graphic Dot Distance (GD).
......@@ -245,12 +244,19 @@ public class AbstractIndexV4Printer extends AbstractDocumentBuilder {
/**
* Separator for values (,).
*/
protected final byte[] mComa = new byte[] {0x2C};
protected final byte[] mComma = new byte[] {0x2C};
/**
* Colon Character.
*/
protected final byte[] mColon = new byte[] {0x3A};
/**
* End of Escape Sequence (;). Must be always at the end.
*/
protected final byte[] mEndTemporaryDoc = new byte[] {0x3B};
protected final byte[] mSemicolon = new byte[] {0x3B};
}
package de.tudresden.inf.mci.brailleplot;
import java.awt.print.PrinterJob;
import javax.print.*;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
......@@ -17,11 +16,10 @@ import java.io.ByteArrayOutputStream;
public class DirectPrint {
private PrintService[] printService;
private byte[] data;
public DirectPrint() {
this.printService = PrinterJob.lookupPrintServices();
}
@SuppressWarnings("checkstyle:MagicNumber")
......@@ -32,7 +30,7 @@ public class DirectPrint {
byte[] diagramData = ("' l\n' l .i\n' :r *a\n' l .i\n' ::r:: *a\n' l\n' :r\n' l\n' ::r: +::;\n' l l l\n' :r r::l\n' l l l\n' ::r: r::l +:::::;\n' l l l loooool g\n' :r r::l r:::::l\n' l l l loooool\n' ::r: r::l r:::::l g\n' l l l r:::::l\n' :r r::l r:::::l\n' l l l l l .iccce'\n' ::r: r::l r:::::l .i\n' l l l l l .i ; l\n' :r::r::r::r::r::r::r::r::r::r::r\n' b b b b b l\n' ' ' ' ' ' '").getBytes();
byte[] circleData = ("30.00:60.00\n31.90:59.90\n33.80:59.80\n35.60:59.50\n37.50:59.10\n39.30:58.50\n41.00:57.90\n42.80:57.10\n44.50:56.30\n46.10:55.30\n47.60:54.30\n49.10:53.10\n50.50:51.90\n51.90:50.50\n53.10:49.10\n54.30:47.60\n55.30:46.10\n56.30:44.50\n57.10:42.80\n57.90:41.00\n58.50:39.30\n59.10:37.50\n59.50:35.60\n59.80:33.80\n59.90:31.90\n60.00:30.00\n59.90:28.10\n59.80:26.20\n59.50:24.40\n59.10:22.50\n58.50:20.70\n57.90:19.00\n57.10:17.20\n56.30:15.50\n55.30:13.90\n54.30:12.40\n53.10:10.90\n51.90:9.50\n50.50:8.10\n49.10:6.90\n47.60:5.70\n46.10:4.70\n44.50:3.70\n42.80:2.90\n41.00:2.10\n39.30:1.50\n37.50:0.90\n35.60:0.50\n33.80:0.20\n31.90:0.10\n30.00:0.00\n28.10:0.10\n26.20:0.20\n24.40:0.50\n22.50:0.90\n20.70:1.50\n19.00:2.10\n17.20:2.90\n15.50:3.70\n13.90:4.70\n12.40:5.70\n10.90:6.90\n9.50:8.10\n8.10:9.50\n6.90:10.90\n5.70:12.40\n4.70:13.90\n3.70:15.50\n2.90:17.20\n2.10:19.00\n1.50:20.70\n0.90:22.50\n0.50:24.40\n0.20:26.20\n0.10:28.10\n0.00:30.00\n0.10:31.90\n0.20:33.80\n0.50:35.60\n0.90:37.50\n1.50:39.30\n2.10:41.00\n2.90:42.80\n3.70:44.50\n4.70:46.10\n5.70:47.60\n6.90:49.10\n8.10:50.50\n9.50:51.90\n10.90:53.10\n12.40:54.30\n13.90:55.30\n15.50:56.30\n17.20:57.10\n19.00:57.90\n20.70:58.50\n22.50:59.10\n24.40:59.50\n26.20:59.80\n28.10:59.90").getBytes();
FloatingDotArea fdaExample = new FloatingDotArea(circleData, 5, 3, 6, -1);
FloatingDotAreaBuilder fdaExample = new FloatingDotAreaBuilder(circleData, 5, 3, 6, -1);
byte[] betterData = fdaExample.getDocument();
//byte[] betterData = "I bims modern".getBytes();
......
......@@ -11,16 +11,12 @@ import java.io.IOException;
* @version 29.05.2019
*/
public class FloatingDotArea extends AbstractIndexV4Printer {
public class FloatingDotAreaBuilder extends AbstractIndexV4Builder {
private final byte[] mActivateDotArea = new byte[]{0x1B, 0x46};
private final byte[] mParameterOrigo = new byte[]{0x4F, 0x52};
private final byte[] mParameterWidth = new byte[]{0x57, 0x58};
private final byte[] mParameterHeight = new byte[]{0x48, 0x59};
private byte[] mDotList;
private final byte[] mSemicolon = new byte[] {0x3B};
private final byte[] mNewLine = new byte[] {0x0A};
private final byte mColon = 0x3A;
private final byte mComma = 0x2C;
private int mOrigoX = -1;
private int mOrigoY = -1;
private int mWidthX = -1;
......@@ -31,7 +27,7 @@ public class FloatingDotArea extends AbstractIndexV4Printer {
* @param data
* A sequence of bytes containing a newline separated line of colon separated values: xxx.xx:yy.yyy
*/
public FloatingDotArea(final byte[] data) {
public FloatingDotAreaBuilder(final byte[] data) {
mDocument = this.assemble(data);
}
......@@ -44,7 +40,7 @@ public class FloatingDotArea extends AbstractIndexV4Printer {
* @param origoY
* Origin y value in centimetres
*/
public FloatingDotArea(final byte[] data, final int origoX, final int origoY) {
public FloatingDotAreaBuilder(final byte[] data, final int origoX, final int origoY) {
this.mOrigoX = origoX;
this.mOrigoY = origoY;
mDocument = this.assemble(data);
......@@ -63,7 +59,7 @@ public class FloatingDotArea extends AbstractIndexV4Printer {
* @param heightY
* Area height in millimeters
*/
public FloatingDotArea(
public FloatingDotAreaBuilder(
final byte[] data,
final int origoX,
final int origoY,
......@@ -115,15 +111,5 @@ public class FloatingDotArea extends AbstractIndexV4Printer {
return mDocument;
}
private byte[] parseData(final byte[] data) {
for (byte b : data) {
if (Byte.compare(b, mColon) == 0) {
System.out.println("No Warning pls");
}
}
return null;
}
}
package de.tudresden.inf.mci.brailleplot;
public class FormatPrint extends AbstractIndexV4Printer {
/**
* Complex method for complex construction of an Document for the printer.
*
* @param data Raw Data to be printed without any escapesequences
* @return Fully build Document as byte[]
*/
@Override
public byte[] assemble(byte[] data) {
return super.assemble(data);
}
/**
* Interface for getting the final Document.
*
* @return DOcument to be printed
*/
@Override
public byte[] getDocument() {
return super.getDocument();
}
}
......@@ -5,16 +5,16 @@ import java.io.IOException;
/**
* Class representing the Graphic-Mode-Protocol from Braile Index Everest D4.
* Class representing the Graphic-Mode-Protocol from Braille Index Everest D4.
* @author Andrey Ruzhanskiy
*/
public class GraphicPrint extends AbstractIndexV4Printer {
public class GraphicPrintBuilder extends AbstractIndexV4Builder {
private final byte[] mEnterIMageMode = new byte[] {0x1B, 0x09};
private final byte[] mEnterImageMode = new byte[] {0x1B, 0x09};
private final byte[] mExitImageMode = new byte[] {0x1B, 0x0A};
private final byte[] mSetImageType = new byte[] {0x1B, 0x0B};
public GraphicPrint(final byte[] data) {
public GraphicPrintBuilder(final byte[] data) {
this.mDocument = this.assemble(data);
}
......@@ -23,10 +23,11 @@ public class GraphicPrint extends AbstractIndexV4Printer {
* @return
* The ready to print Document, as byte[]
*/
@Override
public byte[] assemble(final byte[] data) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
try {
stream.write(mEnterIMageMode);
stream.write(mEnterImageMode);
stream.write(mSetImageType);
//
......
......@@ -5,6 +5,6 @@ package de.tudresden.inf.mci.brailleplot;
* any Escapesequences.
* @author Andrey Ruzhanskiy
*/
public class NormalPrint extends AbstractDocumentBuilder {
public class NormalBuilder extends AbstractDocumentBuilder {
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment