1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-22 04:55:10 +00:00

Merge pull request #871 from soloturn/gradle

valueOf instead of new
This commit is contained in:
PlantUML 2022-01-27 09:41:45 +01:00 committed by GitHub
commit 6fe22da334
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 375 additions and 372 deletions

View File

@ -5,9 +5,13 @@ root = true
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
indent_style = tab
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false
[pom.xml, *.yml]
indent_style = space

View File

@ -53,7 +53,7 @@ public class MapDataReader {
fData = new ArrayList();
for (Iterator it = lines.iterator(); it.hasNext(); ) {
String lLine = (String) it.next();
if (lLine.indexOf("/*") != -1) {
if (lLine.contains("/*")) {
// Filter out comments.
continue;
}
@ -61,7 +61,7 @@ public class MapDataReader {
StringTokenizer lST = new StringTokenizer(lLine, ", ");
while (lST.hasMoreTokens()) {
String lToken = lST.nextToken();
final Integer lValue = new Integer(lToken);
final Integer lValue = Integer.valueOf(lToken);
fData.add(lValue);
}
}

View File

@ -119,7 +119,7 @@ class ScanBuf
// Record the x value for every line (y).
for(int lLineNo = lYFrom; lLineNo <= lYTo; lLineNo++)
{
fScanbuf[lLineNo].add(new Double(lX));
fScanbuf[lLineNo].add(Double.valueOf(lX));
lX += lDx;
}
fScanBufsAdded = true;
@ -152,10 +152,10 @@ class ScanBuf
{
// Round lLineFrom (but .5 is handled oddly)
// 1.5001 - 2.5 -> 1.0001 - 2.0 -> 2
int lXLo = (int)Math.ceil(lScanLine[n].doubleValue() - 0.5);
int lXLo = (int)Math.ceil(lScanLine[n] - 0.5);
// Round lLineTo, substract 1
// 1.5 - 2.4999 -> 1.0 - 1.9999 -> 1
int lXHi = (int)Math.floor(lScanLine[n + 1].doubleValue() - 0.5);
int lXHi = (int)Math.floor(lScanLine[n + 1] - 0.5);
// Limit low and high x to image dimensions
if(lXLo < 0)

View File

@ -67,13 +67,13 @@ public final class CharacterSetECI extends ECI {
private static void addCharacterSet(int value, String encodingName) {
CharacterSetECI eci = new CharacterSetECI(value, encodingName);
VALUE_TO_ECI.put(new Integer(value), eci); // can't use valueOf
VALUE_TO_ECI.put(value, eci); // can't use valueOf
NAME_TO_ECI.put(encodingName, eci);
}
private static void addCharacterSet(int value, String[] encodingNames) {
CharacterSetECI eci = new CharacterSetECI(value, encodingNames[0]);
VALUE_TO_ECI.put(new Integer(value), eci); // can't use valueOf
VALUE_TO_ECI.put(value, eci); // can't use valueOf
for (int i = 0; i < encodingNames.length; i++) {
NAME_TO_ECI.put(encodingNames[i], eci);
}
@ -92,7 +92,7 @@ public final class CharacterSetECI extends ECI {
if (value < 0 || value >= 900) {
throw new IllegalArgumentException("Bad ECI value: " + value);
}
return (CharacterSetECI) VALUE_TO_ECI.get(new Integer(value));
return (CharacterSetECI) VALUE_TO_ECI.get(value);
}
/**

View File

@ -291,23 +291,23 @@ public class Plot implements DataListener {
* </table>
*/
public void dataChanged(DataEvent event) {
Integer index = new Integer(0);
int index = 0;
PlotEventType type = PlotEventType.DATA_PLOT_CHANGED;
synchronized (_curves) {
int numberOfCurves = _curves.size();
if (event.getContainer() instanceof DataCurve
&& numberOfCurves == _dataPlot.getNumberOfElements()) {
DataCurve curve = (DataCurve) event.getContainer();
index = new Integer(curve.getContainer().getIndexOf(curve));
index = curve.getContainer().getIndexOf(curve);
type = PlotEventType.DATA_CURVE_CHANGED;
fillCurve(index.intValue(), curve);
if (index.intValue() < numberOfCurves - 1) {
fillCurve(index, curve);
if (index < numberOfCurves - 1) {
Vector curveHints
= (Vector) _nextCurveHints.elementAt(index.intValue());
= (Vector) _nextCurveHints.elementAt(index);
for (int i = 0, n = curveHints.size(); i < n; i++) {
if (curveHints.elementAt(i) != null) {
type = PlotEventType.DATA_PLOT_CHANGED;
for (int j = index.intValue()+1; j < numberOfCurves; j++) {
for (int j = index +1; j < numberOfCurves; j++) {
fillCurve(j, (DataCurve) _dataPlot.getElement(j));
}
break;

View File

@ -73,7 +73,7 @@ public class TicLabelMap implements TicLabelFormat {
item = item.substring(0, index).trim();
index = item.indexOf(':');
if (index < 0) {
_min = new Double(item).doubleValue();
_min = Double.parseDouble(item);
_max = _min == 0 ? Double.MIN_VALUE : _min * 1.000001d;
_min = _min * 0.999999d;
if (_min > _max) {
@ -82,8 +82,8 @@ public class TicLabelMap implements TicLabelFormat {
_max = z;
}
} else {
_min = new Double(item.substring(0, index)).doubleValue();
_max = new Double(item.substring(index + 1)).doubleValue();
_min = Double.parseDouble(item.substring(0, index));
_max = Double.parseDouble(item.substring(index + 1));
}
}
}

View File

@ -209,7 +209,7 @@ public class ConfigParameters {
private double parseDouble(String value, String key) {
try {
return new Double(value).doubleValue();
return Double.parseDouble(value);
} catch (NumberFormatException e) {
throw createNumberFormatException("number", value, key);
}
@ -251,7 +251,7 @@ public class ConfigParameters {
StringTokenizer tokenizer = new StringTokenizer(value);
double[] result = new double[tokenizer.countTokens()];
for (int i = 0; i < result.length; i++) {
result[i] = new Double(tokenizer.nextToken()).doubleValue();
result[i] = Double.parseDouble(tokenizer.nextToken());
}
return result;
} catch (NumberFormatException e) {

View File

@ -61,7 +61,7 @@ class ColorAndSizeChange implements FontChange {
}
final Matcher2 matcherSize = sizePattern.matcher(s);
if (matcherSize.find()) {
size = new Integer(matcherSize.group(1));
size = Integer.valueOf(matcherSize.group(1));
} else {
size = null;
}

View File

@ -50,7 +50,7 @@ class SizeChange implements FontChange {
if (matcherSize.find() == false) {
throw new IllegalArgumentException();
}
size = new Integer(matcherSize.group(1));
size = Integer.valueOf(matcherSize.group(1));
}
Integer getSize() {

View File

@ -45,29 +45,29 @@ class LogoScanner {
private int i;
public LogoScanner() {
keywordTable.put("forward", new Integer(LogoToken.FORWARD));
keywordTable.put("fd", new Integer(LogoToken.FORWARD));
keywordTable.put("back", new Integer(LogoToken.BACK));
keywordTable.put("bk", new Integer(LogoToken.BACK));
keywordTable.put("right", new Integer(LogoToken.RIGHT));
keywordTable.put("rt", new Integer(LogoToken.RIGHT));
keywordTable.put("left", new Integer(LogoToken.LEFT));
keywordTable.put("lt", new Integer(LogoToken.LEFT));
keywordTable.put("penup", new Integer(LogoToken.PENUP));
keywordTable.put("pu", new Integer(LogoToken.PENUP));
keywordTable.put("pendown", new Integer(LogoToken.PENDOWN));
keywordTable.put("pd", new Integer(LogoToken.PENDOWN));
keywordTable.put("hideturtle", new Integer(LogoToken.HIDETURTLE));
keywordTable.put("ht", new Integer(LogoToken.HIDETURTLE));
keywordTable.put("showturtle", new Integer(LogoToken.SHOWTURTLE));
keywordTable.put("st", new Integer(LogoToken.SHOWTURTLE));
keywordTable.put("clearscreen", new Integer(LogoToken.CLEARSCREEN));
keywordTable.put("cs", new Integer(LogoToken.CLEARSCREEN));
keywordTable.put("repeat", new Integer(LogoToken.REPEAT));
keywordTable.put("rep", new Integer(LogoToken.REPEAT));
keywordTable.put("to", new Integer(LogoToken.TO));
keywordTable.put("setpc", new Integer(LogoToken.SETPC));
keywordTable.put("pc", new Integer(LogoToken.SETPC));
keywordTable.put("forward", LogoToken.FORWARD);
keywordTable.put("fd", LogoToken.FORWARD);
keywordTable.put("back", LogoToken.BACK);
keywordTable.put("bk", LogoToken.BACK);
keywordTable.put("right", LogoToken.RIGHT);
keywordTable.put("rt", LogoToken.RIGHT);
keywordTable.put("left", LogoToken.LEFT);
keywordTable.put("lt", LogoToken.LEFT);
keywordTable.put("penup", LogoToken.PENUP);
keywordTable.put("pu", LogoToken.PENUP);
keywordTable.put("pendown", LogoToken.PENDOWN);
keywordTable.put("pd", LogoToken.PENDOWN);
keywordTable.put("hideturtle", LogoToken.HIDETURTLE);
keywordTable.put("ht", LogoToken.HIDETURTLE);
keywordTable.put("showturtle", LogoToken.SHOWTURTLE);
keywordTable.put("st", LogoToken.SHOWTURTLE);
keywordTable.put("clearscreen", LogoToken.CLEARSCREEN);
keywordTable.put("cs", LogoToken.CLEARSCREEN);
keywordTable.put("repeat", LogoToken.REPEAT);
keywordTable.put("rep", LogoToken.REPEAT);
keywordTable.put("to", LogoToken.TO);
keywordTable.put("setpc", LogoToken.SETPC);
keywordTable.put("pc", LogoToken.SETPC);
}
public int getPosition() {
@ -134,7 +134,7 @@ class LogoScanner {
token.kind = LogoToken.IDENTIFIER;
final Integer keyword = keywordTable.get(token.lexeme);
if (keyword != null) {
token.kind = keyword.intValue();
token.kind = keyword;
}
} else if (c >= '0' && c <= '9') {
do {
@ -151,12 +151,12 @@ class LogoScanner {
}
i--;
token.lexeme = lexeme.toString();
token.value = Float.valueOf(token.lexeme).floatValue();
token.value = Float.parseFloat(token.lexeme);
if (hasDecimalPart) {
token.kind = LogoToken.FLOAT;
} else {
token.kind = LogoToken.INTEGER;
token.intValue = Integer.valueOf(token.lexeme).intValue();
token.intValue = Integer.parseInt(token.lexeme);
}
} else if (c == 0) {
i--;

View File

@ -68,7 +68,7 @@ public class Instant implements Comparable<Instant>, Value {
}
private Long toLong() {
return new Long(ms);
return Long.valueOf(ms);
}
@Override

View File

@ -62,7 +62,7 @@ public class Segment {
@Override
public int hashCode() {
return new Double(pos1).hashCode() + new Double(pos2).hashCode();
return Double.valueOf(pos1).hashCode() + Double.valueOf(pos2).hashCode();
}
final public boolean contains(double y) {
@ -113,7 +113,6 @@ public class Segment {
return Collections.unmodifiableCollection(result2);
}
if (this.contains(pause)) {
if (pendingStart < pause.pos1)
result2.add(new Segment(pendingStart, pause.pos1));
pendingStart = pause.pos2;
}

View File

@ -736,8 +736,8 @@ public class Diagram {
int index = filledSets.indexOf(largest);
if(gridLargest.equals(gridOfSmalls)
&& !toBeRemovedIndices.contains(new Integer(index))) {
toBeRemovedIndices.add(new Integer(index));
&& !toBeRemovedIndices.contains(index)) {
toBeRemovedIndices.add(index);
if (DEBUG){
System.out.println("Decided to remove set:");
largest.printAsGrid();

View File

@ -232,7 +232,7 @@ public class TextGrid {
+StringUtils.repeatString("0123456789", (int) Math.floor(getWidth()/10)+1));
while(it.hasNext()){
String row = it.next().toString();
String index = new Integer(i).toString();
String index = Integer.valueOf(i).toString();
if(i < 10) index = " "+index;
System.out.println(index+" ("+row+")");
i++;
@ -248,7 +248,7 @@ public class TextGrid {
+StringUtils.repeatString("0123456789", (int) Math.floor(getWidth()/10)+1)+"\n");
while(it.hasNext()){
String row = it.next().toString();
String index = new Integer(i).toString();
String index = Integer.valueOf(i).toString();
if(i < 10) index = " "+index;
row = row.replaceAll("\n", "\\\\n");
row = row.replaceAll("\r", "\\\\r");
@ -632,9 +632,9 @@ public class TextGrid {
char cR = s.charAt(1);
char cG = s.charAt(2);
char cB = s.charAt(3);
int r = Integer.valueOf(String.valueOf(cR), 16).intValue() * 17;
int g = Integer.valueOf(String.valueOf(cG), 16).intValue() * 17;
int b = Integer.valueOf(String.valueOf(cB), 16).intValue() * 17;
int r = Integer.valueOf(String.valueOf(cR), 16) * 17;
int g = Integer.valueOf(String.valueOf(cG), 16) * 17;
int b = Integer.valueOf(String.valueOf(cB), 16) * 17;
result.add(new CellColorPair(cell, new Color(r, g, b)));
}
}