Search in sources :

Example 91 with Formatter

use of java.util.Formatter in project weiui by kuaifan.

the class PDF417ScanningDecoder method toString.

public static String toString(BarcodeValue[][] barcodeMatrix) {
    try (Formatter formatter = new Formatter()) {
        for (int row = 0; row < barcodeMatrix.length; row++) {
            formatter.format("Row %2d: ", row);
            for (int column = 0; column < barcodeMatrix[row].length; column++) {
                BarcodeValue barcodeValue = barcodeMatrix[row][column];
                if (barcodeValue.getValue().length == 0) {
                    formatter.format("        ", (Object[]) null);
                } else {
                    formatter.format("%4d(%2d)", barcodeValue.getValue()[0], barcodeValue.getConfidence(barcodeValue.getValue()[0]));
                }
            }
            formatter.format("%n");
        }
        return formatter.toString();
    }
}
Also used : Formatter(java.util.Formatter) ResultPoint(vip.kuaifan.weiui.extend.integration.zxing.ResultPoint)

Example 92 with Formatter

use of java.util.Formatter in project mkgmap by openstreetmap.

the class StylePrinter method dumpToFile.

/**
 * Writes out this file to the given writer in the single file format. This
 * produces a valid style file, although it is mostly used for testing.
 */
public void dumpToFile(Writer out) {
    Formatter fmt = new Formatter(out);
    fmt.format("<<<version>>>\n0\n");
    dumpInfo(fmt);
    dumpOptions(fmt);
    if (relations != null)
        dumpRuleSet(fmt, "relations", relations);
    if (nodes != null)
        dumpRuleSet(fmt, "points", nodes);
    if (lines != null)
        dumpRuleSet(fmt, "lines", lines);
    if (polygons != null)
        dumpRuleSet(fmt, "polygons", polygons);
    fmt.flush();
}
Also used : Formatter(java.util.Formatter)

Example 93 with Formatter

use of java.util.Formatter in project mkgmap by openstreetmap.

the class StyleTester method roadToString.

/**
 * This is so we can run against versions of mkgmap that do not have
 * toString methods on MapLine and MapRoad.
 */
private static String roadToString(MapRoad el) {
    StringBuffer sb = new StringBuffer(lineToString(el));
    sb.delete(0, 4);
    sb.insert(0, "Road");
    Formatter fmt = new Formatter(sb);
    fmt.format(" road class=%d speed=%d", el.getRoadDef().getRoadClass(), getRoadSpeed(el.getRoadDef()));
    return fmt.toString();
}
Also used : Formatter(java.util.Formatter)

Example 94 with Formatter

use of java.util.Formatter in project mkgmap by openstreetmap.

the class StyleTester method lineToString.

/**
 * This is so we can run against versions of mkgmap that do not have
 * toString methods on MapLine and MapRoad.
 */
private static String lineToString(MapLine el) {
    Formatter fmt = new Formatter();
    fmt.format("Line 0x%x, labels=%s, res=%d-%d", el.getType(), Arrays.toString(el.getLabels()), el.getMinResolution(), el.getMaxResolution());
    if (el.isDirection())
        fmt.format(" oneway");
    fmt.format(" ");
    for (Coord co : el.getPoints()) fmt.format("(%s),", co);
    return fmt.toString();
}
Also used : Coord(uk.me.parabola.imgfmt.app.Coord) Formatter(java.util.Formatter)

Example 95 with Formatter

use of java.util.Formatter in project mkgmap by openstreetmap.

the class CollationRules method printExpansions.

private void printExpansions() {
    for (CharPosition cp : positionMap) {
        if (!cp.isExpansion())
            continue;
        Formatter fmt = new Formatter();
        // noinspection MalformedFormatString
        fmt.format("expand %c to", cp.getUnicode());
        boolean ok = true;
        for (CharPosition cp2 = cp; cp2 != null; cp2 = cp2.nextChar) {
            cp2.second = 0x50000;
            int top = (cp2.third >> 16) & 0xff;
            cp2.third = (top == 0x9e || top == 0xa2 || top == 0x2b) ? 0x9b0000 : 0;
            CharPosition floor = basePositionMap.ceiling(cp2);
            if (floor == null || floor.getUnicode() == 0xfffd) {
                fmt.format(" NF");
                ok = false;
            } else {
                fmt.format(" %s", fmtChar(floor.getUnicode()));
            }
        }
        System.out.println((ok ? "" : "# ") + fmt.toString());
        // Print comments to help find problems.
        for (CharPosition cp2 = cp; cp2 != null; cp2 = cp2.nextChar) {
            CharPosition floor = basePositionMap.ceiling(cp2);
            if (floor == null) {
                System.out.println("#FIX: NF ref=" + cp2);
            } else {
                System.out.println("#floor is " + fmtChar(toUnicode(floor.val)) + ", " + floor + ", ref is " + cp2);
            }
        }
    }
}
Also used : Formatter(java.util.Formatter)

Aggregations

Formatter (java.util.Formatter)558 ArrayList (java.util.ArrayList)26 File (java.io.File)25 IOException (java.io.IOException)25 Date (java.util.Date)22 Test (org.junit.Test)19 HashMap (java.util.HashMap)16 Map (java.util.Map)16 AlertDialog (android.app.AlertDialog)14 DialogInterface (android.content.DialogInterface)14 MessageDigest (java.security.MessageDigest)14 PrintWriter (java.io.PrintWriter)13 Justif (aQute.lib.justif.Justif)12 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)11 Locale (java.util.Locale)11 BigInteger (java.math.BigInteger)10 PrintStream (java.io.PrintStream)9 Calendar (java.util.Calendar)7 LayoutBuilder (android.text.StaticLayoutTest.LayoutBuilder)6 View (android.view.View)6