Skip to content

Commit

Permalink
update: spotless 2.43 & google-java-style 1.22
Browse files Browse the repository at this point in the history
  • Loading branch information
markusicu committed May 22, 2024
1 parent 614a388 commit e21a2d3
Show file tree
Hide file tree
Showing 107 changed files with 252 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ private int findIdentical(Comparable[][] sortedFlat, int rowIndex, int colIndex)
}
return sortedFlat.length - rowIndex;
}

// to-do: prevent overlap when it would cause information to be lost.
private BitSet breaksSpans = new BitSet();

Expand Down
17 changes: 17 additions & 0 deletions UnicodeJsps/src/main/java/org/unicode/jsp/Globe.java
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ private static void loadSourceMap(String sname) {
}
changeImage(frame);
}

/**
* @param frame
*/
Expand Down Expand Up @@ -704,12 +705,14 @@ public Shape getClip() {
}
return clip;
}

/**
* @return
*/
public boolean usesOrigin() {
return false;
}

// must set before use
Transform set(double srcW, double srcH, double dstW, double dstH) {
this.srcW = srcW;
Expand All @@ -724,6 +727,7 @@ Transform set(double srcW, double srcH, double dstW, double dstH) {
clip = null;
return this;
}

// Remember that the coordinate system is upside down so apply
// the transform as if the angle were negated.
// cos(-angle) = cos(angle)
Expand All @@ -750,6 +754,7 @@ public final boolean transform(double x, double y, DPoint retcoord) {
retcoord.y = lat_dstH.map(retcoord.y);
return retcoord.x >= 0.0 && retcoord.x <= dstW && retcoord.y >= 0 && retcoord.y <= dstH;
}

// Remember that the coordinate system is upside down so apply
// the transform as if the angle were negated. Since inverting
// the transform is also the same as negating the angle, itransform
Expand All @@ -774,18 +779,21 @@ public final boolean itransform(double x, double y, DPoint retcoord) {
retcoord.y = srcH_lat.back(retcoord.y);
return retcoord.x >= 0.0 && retcoord.x <= srcW && retcoord.y >= 0 && retcoord.y <= srcH;
}

/**
* @param input and output: latitude in y (radians from -pi/2 to pi/2) and longitude in x
* (radians from -pi to pi)
*/
protected abstract void _transform(DPoint retcoord);

/**
* @param input and output: latitude in y (radians from -pi/2 to pi/2) and longitude in x
* (radians from -pi to pi)
*/
protected abstract void _itransform(DPoint retcoord);

protected abstract Shape _getClip();

/**
* @param style
* @return
Expand Down Expand Up @@ -866,6 +874,7 @@ public void _transform(DPoint retcoord) {
public void _itransform(DPoint retcoord) {
// nothing
}

/* (non-Javadoc)
* @see Globe.Transform#_getClip()
*/
Expand Down Expand Up @@ -979,6 +988,7 @@ public static class TransformEqualAreaEllipse extends Transform {
debugTemp = false;
}
}

// Area of a spherical cap is 2 pi r^2 (1-sin(lat))
// Area of a circular segment is r^2 ( acos(p) - p sqrt(1-p^2)), where p = dist to chord/r
// Thus we get the itransform easily:
Expand Down Expand Up @@ -1016,6 +1026,7 @@ public void _itransform(DPoint retcoord) {
protected Shape _getClip() {
return new Ellipse2D.Double(0, 0, dstW, dstH);
}

/**
* @param in -1..1
* @return value in 0..PI
Expand Down Expand Up @@ -1573,6 +1584,7 @@ public void imageComplete(int status) {
consumer.imageComplete(status);
}
}

/*
public static double convertDegreesToDecimal(double degrees, double minutes, double seconds, boolean NorthOrEast) {
double result = (degrees + minutes / 60 + seconds / 3600);
Expand Down Expand Up @@ -1932,6 +1944,7 @@ void fixContents() {
lineContents[c.yStart].add(c);
}
}

/**
* @param c
* @return
Expand Down Expand Up @@ -2066,6 +2079,7 @@ private static void drawDegrees(
}

private static DPoint drawLineP1 = new DPoint();

/*
private static void drawLine(Graphics2D graphics2D, Transform trans, double x1, double y1, double x2, double y2) {
Expand Down Expand Up @@ -2111,6 +2125,7 @@ private static void drawLine2(Graphics2D graphics2D, Transform trans, double x,

abstract static class TTransform {
double x, y;

// t is 0..1
abstract void transform(double t);
}
Expand Down Expand Up @@ -2174,11 +2189,13 @@ static class LineDrawer {
transient double startX, startY, startT;
// transient double endX, endY, endT;
TTransform ttransform;

// int segments = 0;
LineDrawer(Graphics2D graphics2D, TTransform ttransform) {
this.graphics2D = graphics2D;
this.ttransform = ttransform;
}

// t is 0..1
void draw(double startT, double endT) {
this.startT = startT;
Expand Down
2 changes: 2 additions & 0 deletions UnicodeJsps/src/main/java/org/unicode/jsp/ScriptTester.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public enum ScriptSpecials {
public static final int EXTRA_COUNT = 16; // should be enough, hard working as UTC is!

public static final Map<String, Integer> extraScripts = new ConcurrentHashMap<>(EXTRA_COUNT);

/** Extended scripts; note that they do not have stable numbers, and should not be persisted. */
public static final int
// HANT = UScript.CODE_LIMIT,
Expand Down Expand Up @@ -551,6 +552,7 @@ public ScriptTester get() {
}
return new ScriptTester(character_scripts);
}

/**
* Add list of scripts that are acceptable in combination together.
*
Expand Down
1 change: 1 addition & 0 deletions UnicodeJsps/src/main/java/org/unicode/jsp/Typology.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class Typology {
public static Relation<String, String> labelToPaths =
new Relation(new TreeMap(), TreeSet.class);
public static Map<String, Map<String, UnicodeSet>> label_parent_uset = new TreeMap();

// public static Relation<String, String> pathToList = new Relation(new TreeMap(),
// TreeSet.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,7 @@ public static void getDifferences(
};

static Comparator<String> col = UnicodeSetUtilities.MAIN_COLLATOR;

// Collator.getInstance(ULocale.ROOT);
// static {
// ((RuleBasedCollator) col).setNumericCollation(true);
Expand Down Expand Up @@ -1958,6 +1959,7 @@ static Subheader getSubheader() {
static String removals =
new UnicodeSet("[\u1806[:di:]-[:cn:]]").complement().complement().toPattern(false);
static Matcher rem = Pattern.compile(removals).matcher("");

// TODO use UnicodeRegex

// static IdnaLabelTester getIdna2008Tester() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public void TestCollection() {
Set<Foo> w = Builder.with(EnumSet.noneOf(Foo.class)).add(Foo.foo1).freeze();
assertTrue("w", w.size() == 1 && w.contains(Foo.foo1));
}

/**
*
*
Expand Down
1 change: 1 addition & 0 deletions UnicodeJsps/src/test/java/org/unicode/jsptest/TestJsp.java
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ public void assertNoMatch(String message, String pattern, Object actual) {
false,
actual);
}

// return handleAssert(expected == actual, message, stringFor(expected),
// stringFor(actual), "==", false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ public void TestNFM() {
assertTrue("toNFM=a", actual2.contains("A"));
assertTrue("toNFM=a", !actual2.contains("B"));
}

// public void TestDefaultEncodingValue() {
// UnicodeProperty prop = factory.getProperty("enc_ISO-8859-2");
// assertTrue("Default for Å, enc_ISO-8859-2", prop.isDefault('Å'));
Expand Down
7 changes: 4 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<!-- Need to use an updated surefire plugin here. -->
<maven-surefire-plugin-version>3.0.0-M5</maven-surefire-plugin-version>

<spotless.version>2.22.5</spotless.version>
<spotless.version>2.43.0</spotless.version>
</properties>

<modules>
Expand Down Expand Up @@ -138,8 +138,9 @@
<!-- no need to specify files, inferred automatically, but you can if you want -->
<!-- apply a specific flavor of google-java-format and reflow long strings -->
<googleJavaFormat>
<!-- version of google-java-style -->
<version>1.15.0</version>
<!-- version of google-java-style, see
https://mvnrepository.com/artifact/com.google.googlejavaformat/google-java-format -->
<version>1.22.0</version>
<style>AOSP</style>
<reflowLongStrings>false</reflowLongStrings>
</googleJavaFormat>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ public boolean handleAssert(
System.err.println("UNICODETOOLS_VERBOSE=" + verbose);
System.err.println("UNICODETOOLS_RUN_BROKEN_TEST=" + runBroken);
}

/**
* set property: UNICODETOOLS_INCLUSION 0 = fewest tests, 5 is normal build (default), 10 is
* most tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package org.unicode.draft;

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
Expand Down
8 changes: 8 additions & 0 deletions unicodetools/src/main/java/org/unicode/draft/CldrUtility.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package org.unicode.draft;

/*
**********************************************************************
* Copyright (c) 2002-2004, International Business Machines
Expand Down Expand Up @@ -68,6 +69,7 @@ public static class VariableReplacer {
// simple implementation for now
private final Map<String, String> m =
new TreeMap<String, String>(Collections.reverseOrder());

/**
* Add a new variable
*
Expand All @@ -79,6 +81,7 @@ public VariableReplacer add(String variable, String value) {
m.put(variable, value);
return this;
}

/**
* Replace all of the variables in the source, recursively.
*
Expand Down Expand Up @@ -118,6 +121,7 @@ static String getPath(String path) {
}

static final boolean DEBUG_SHOW_BAT = false;

/**
* default working directory for Eclipse is . = ${workspace_loc:cldr}, which is
* <CLDR>/tools/java/
Expand All @@ -129,6 +133,7 @@ static String getPath(String path) {
CldrUtility.getProperty(
"CLDR_DIR",
null)); // new File(Utility.getProperty("CLDR_DIR", null)).getPath();

// // get up to <CLDR>

public static final String UTIL_DATA_DIR =
Expand All @@ -150,6 +155,7 @@ static String getPath(String path) {
*/
@Deprecated
public static final String SUPPLEMENTAL_DIRECTORY = getPath(COMMON_DIRECTORY, "supplemental/");

/** Only the default, if no other directory is specified. */
public static final String DEFAULT_SUPPLEMENTAL_DIRECTORY =
getPath(COMMON_DIRECTORY, "supplemental/");
Expand All @@ -171,6 +177,7 @@ static String getPath(String path) {

public interface LineComparer {
static final int LINES_DIFFERENT = -1, LINES_SAME = 0, SKIP_FIRST = 1, SKIP_SECOND = 2;

/**
* Returns LINES_DIFFERENT, LINES_SAME, or if one of the lines is ignorable, SKIP_FIRST or
* SKIP_SECOND
Expand Down Expand Up @@ -399,6 +406,7 @@ boolean matches(StringIterator other) {
}
}
}

/**
* @return Returns the position.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2426,6 +2426,7 @@ public static UnicodeSet flatten(UnicodeSet exemplar1) {
+ "-[:script=katakana:]"
+ "-[〇]"
+ "]"); // we'll alter

// below to remove
// iicore

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package org.unicode.draft;

/*
**********************************************************************
* Copyright (c) 2004-2009, International Business Machines
Expand Down Expand Up @@ -839,6 +840,7 @@ public Format[] getFormatsByArgumentIndex() {
}
return resultArray;
}

// TODO: provide method public Map getFormatsByArgumentName().
// Where Map is: String argumentName --> Format format.

Expand Down
7 changes: 7 additions & 0 deletions unicodetools/src/main/java/org/unicode/draft/OldPunycode.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package org.unicode.draft;

/*
*******************************************************************************
* Copyright (C) 2003-2008, International Business Machines Corporation and *
Expand Down Expand Up @@ -45,6 +46,7 @@ public final class OldPunycode {
private static final int CAPITAL_A = 0x41;
private static final int CAPITAL_Z = 0x5a;
private static final int MAX_CP_COUNT = 200;

// private static final int UINT_MAGIC = 0x80000000;
// private static final long ULONG_MAGIC = 0x8000000000000000L;

Expand Down Expand Up @@ -101,6 +103,7 @@ private static char asciiCaseMap(char b, boolean uppercase) {
}
return b;
}

/// CLOVER:ON
/**
* digitToBasic() returns the basic code point whose value (when used for representing integers)
Expand All @@ -120,6 +123,7 @@ private static char digitToBasic(int digit, boolean uppercase) {
return (char) ((ZERO - 26) + digit);
}
}

/**
* Converts Unicode to Punycode. The input string must not contain single, unpaired surrogates.
* The output will be represented as an array of ASCII code points.
Expand Down Expand Up @@ -296,14 +300,17 @@ public static StringBuffer encode(StringBuffer src, boolean[] caseFlags)
private static boolean isBasic(int ch) {
return (ch < INITIAL_N);
}

/// CLOVER:OFF
private static boolean isBasicUpperCase(int ch) {
return (CAPITAL_A <= ch && ch >= CAPITAL_Z);
}

/// CLOVER:ON
private static boolean isSurrogate(int ch) {
return (((ch) & 0xfffff800) == 0xd800);
}

/**
* Converts Punycode to Unicode. The Unicode string will be at most as long as the Punycode
* string.
Expand Down
2 changes: 2 additions & 0 deletions unicodetools/src/main/java/org/unicode/draft/Punycode.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package org.unicode.draft;

/*
*******************************************************************************
* Copyright (C) 2003-2008, International Business Machines Corporation and *
Expand Down Expand Up @@ -38,6 +39,7 @@ public final class Punycode {
private final char DELIMITER;

private static final int MAX_CP_COUNT = 200;

// private static final int UINT_MAGIC = 0x80000000;
// private static final long ULONG_MAGIC = 0x8000000000000000L;

Expand Down
Loading

0 comments on commit e21a2d3

Please sign in to comment.