提交 18536f38 authored 作者: thomasmueller's avatar thomasmueller

Formatting, Javadocs

上级 03e45626
...@@ -77,7 +77,7 @@ are no longer working (they can be removed, or fixed): ...@@ -77,7 +77,7 @@ are no longer working (they can be removed, or fixed):
The following can be skipped currently; benchmarks should probably be removed: The following can be skipped currently; benchmarks should probably be removed:
* To update benchmark data: use latest versions of other dbs, change version(s) in performance.html * To update benchmark data: use latest versions of other dbs, change version(s) in performance.html
## Build the release ## Build the Release
Change directory to src/installer Change directory to src/installer
Run ./buildRelease.sh (non-Windows) or buildRelease.bat (Windows) Run ./buildRelease.sh (non-Windows) or buildRelease.bat (Windows)
......
...@@ -39,6 +39,7 @@ public class ResultWithGeneratedKeys { ...@@ -39,6 +39,7 @@ public class ResultWithGeneratedKeys {
* *
* @param updateCount * @param updateCount
* update count * update count
* @return the result.
*/ */
public static ResultWithGeneratedKeys of(int updateCount) { public static ResultWithGeneratedKeys of(int updateCount) {
return new ResultWithGeneratedKeys(updateCount); return new ResultWithGeneratedKeys(updateCount);
......
...@@ -36,7 +36,30 @@ public class ToChar { ...@@ -36,7 +36,30 @@ public class ToChar {
private static final String[] ROMAN_NUMERALS = { "M", "CM", "D", "CD", "C", "XC", private static final String[] ROMAN_NUMERALS = { "M", "CM", "D", "CD", "C", "XC",
"L", "XL", "X", "IX", "V", "IV", "I" }; "L", "XL", "X", "IX", "V", "IV", "I" };
static final int MONTHS = 0, SHORT_MONTHS = 1, WEEKDAYS = 2, SHORT_WEEKDAYS = 3, AM_PM = 4; /**
* The month field.
*/
static final int MONTHS = 0;
/**
* The month field (short form).
*/
static final int SHORT_MONTHS = 1;
/**
* The weekday field.
*/
static final int WEEKDAYS = 2;
/**
* The weekday field (short form).
*/
static final int SHORT_WEEKDAYS = 3;
/**
* The AM / PM field.
*/
static final int AM_PM = 4;
private static volatile String[][] NAMES; private static volatile String[][] NAMES;
...@@ -454,7 +477,13 @@ public class ToChar { ...@@ -454,7 +477,13 @@ public class ToChar {
return hex; return hex;
} }
static String[] getNames(int names) { /**
* Get the date (month / weekday / ...) names.
*
* @param names the field
* @return the names
*/
static String[] getDateNames(int names) {
String[][] result = NAMES; String[][] result = NAMES;
if (result == null) { if (result == null) {
result = new String[5][]; result = new String[5][];
...@@ -688,8 +717,8 @@ public class ToChar { ...@@ -688,8 +717,8 @@ public class ToChar {
// Long/short date/time format // Long/short date/time format
} else if (containsAt(format, i, "DL") != null) { } else if (containsAt(format, i, "DL") != null) {
String day = getNames(WEEKDAYS)[DateTimeUtils.getSundayDayOfWeek(dateValue)]; String day = getDateNames(WEEKDAYS)[DateTimeUtils.getSundayDayOfWeek(dateValue)];
String month = getNames(MONTHS)[monthOfYear - 1]; String month = getDateNames(MONTHS)[monthOfYear - 1];
output.append(day).append(", ").append(month).append(' ').append(dayOfMonth).append(", "); output.append(day).append(", ").append(month).append(' ').append(dayOfMonth).append(", ");
StringUtils.appendZeroPadded(output, 4, posYear); StringUtils.appendZeroPadded(output, 4, posYear);
i += 2; i += 2;
...@@ -706,7 +735,7 @@ public class ToChar { ...@@ -706,7 +735,7 @@ public class ToChar {
output.append(':'); output.append(':');
StringUtils.appendZeroPadded(output, 2, second); StringUtils.appendZeroPadded(output, 2, second);
output.append(' '); output.append(' ');
output.append(getNames(AM_PM)[isAM ? 0 : 1]); output.append(getDateNames(AM_PM)[isAM ? 0 : 1]);
i += 2; i += 2;
// Day // Day
...@@ -718,11 +747,11 @@ public class ToChar { ...@@ -718,11 +747,11 @@ public class ToChar {
StringUtils.appendZeroPadded(output, 2, dayOfMonth); StringUtils.appendZeroPadded(output, 2, dayOfMonth);
i += 2; i += 2;
} else if ((cap = containsAt(format, i, "DY")) != null) { } else if ((cap = containsAt(format, i, "DY")) != null) {
String day = getNames(SHORT_WEEKDAYS)[DateTimeUtils.getSundayDayOfWeek(dateValue)]; String day = getDateNames(SHORT_WEEKDAYS)[DateTimeUtils.getSundayDayOfWeek(dateValue)];
output.append(cap.apply(day)); output.append(cap.apply(day));
i += 2; i += 2;
} else if ((cap = containsAt(format, i, "DAY")) != null) { } else if ((cap = containsAt(format, i, "DAY")) != null) {
String day = getNames(WEEKDAYS)[DateTimeUtils.getSundayDayOfWeek(dateValue)]; String day = getDateNames(WEEKDAYS)[DateTimeUtils.getSundayDayOfWeek(dateValue)];
if (fillMode) { if (fillMode) {
day = StringUtils.pad(day, "Wednesday".length(), " ", true); day = StringUtils.pad(day, "Wednesday".length(), " ", true);
} }
...@@ -834,14 +863,14 @@ public class ToChar { ...@@ -834,14 +863,14 @@ public class ToChar {
// Month / quarter // Month / quarter
} else if ((cap = containsAt(format, i, "MONTH")) != null) { } else if ((cap = containsAt(format, i, "MONTH")) != null) {
String month = getNames(MONTHS)[monthOfYear - 1]; String month = getDateNames(MONTHS)[monthOfYear - 1];
if (fillMode) { if (fillMode) {
month = StringUtils.pad(month, "September".length(), " ", true); month = StringUtils.pad(month, "September".length(), " ", true);
} }
output.append(cap.apply(month)); output.append(cap.apply(month));
i += 5; i += 5;
} else if ((cap = containsAt(format, i, "MON")) != null) { } else if ((cap = containsAt(format, i, "MON")) != null) {
String month = getNames(SHORT_MONTHS)[monthOfYear - 1]; String month = getDateNames(SHORT_MONTHS)[monthOfYear - 1];
output.append(cap.apply(month)); output.append(cap.apply(month));
i += 3; i += 3;
} else if (containsAt(format, i, "MM") != null) { } else if (containsAt(format, i, "MM") != null) {
......
...@@ -41,7 +41,8 @@ public class ToDateParser { ...@@ -41,7 +41,8 @@ public class ToDateParser {
private int hour, minute, second, nanos; private int hour, minute, second, nanos;
private int hour12; private int hour12;
boolean isAM = true;
private boolean isAM = true;
private TimeZone timeZone; private TimeZone timeZone;
......
...@@ -501,7 +501,7 @@ class ToDateTokenizer { ...@@ -501,7 +501,7 @@ class ToDateTokenizer {
static String setByName(ToDateParser params, int field) { static String setByName(ToDateParser params, int field) {
String inputFragmentStr = null; String inputFragmentStr = null;
String s = params.getInputStr(); String s = params.getInputStr();
String[] values = ToChar.getNames(field); String[] values = ToChar.getDateNames(field);
for (int i = 0; i < values.length; i++) { for (int i = 0; i < values.length; i++) {
String dayName = values[i]; String dayName = values[i];
if (dayName == null) { if (dayName == null) {
......
...@@ -283,12 +283,19 @@ public class ValueGeometry extends Value { ...@@ -283,12 +283,19 @@ public class ValueGeometry extends Value {
* A visitor that checks if there is a Z coordinate. * A visitor that checks if there is a Z coordinate.
*/ */
static class ZVisitor implements CoordinateSequenceFilter { static class ZVisitor implements CoordinateSequenceFilter {
boolean foundZ;
private boolean foundZ;
public boolean isFoundZ() { public boolean isFoundZ() {
return foundZ; return foundZ;
} }
/**
* Performs an operation on a coordinate in a CoordinateSequence.
*
* @param coordinateSequence the object to which the filter is applied
* @param i the index of the coordinate to apply the filter to
*/
@Override @Override
public void filter(CoordinateSequence coordinateSequence, int i) { public void filter(CoordinateSequence coordinateSequence, int i) {
if (!Double.isNaN(coordinateSequence.getOrdinate(i, 2))) { if (!Double.isNaN(coordinateSequence.getOrdinate(i, 2))) {
......
...@@ -1695,12 +1695,22 @@ public abstract class TestBase { ...@@ -1695,12 +1695,22 @@ public abstract class TestBase {
} }
/** /**
* Get the name of the test.
*
* @return the name of the test class * @return the name of the test class
*/ */
public String getTestName() { public String getTestName() {
return getClass().getSimpleName(); return getClass().getSimpleName();
} }
/**
* Build a child process.
*
* @param name the name
* @param childClass the class
* @param jvmArgs the argument list
* @return the process builder
*/
public ProcessBuilder buildChild(String name, Class<? extends TestBase> childClass, public ProcessBuilder buildChild(String name, Class<? extends TestBase> childClass,
String... jvmArgs) { String... jvmArgs) {
List<String> args = new ArrayList<>(16); List<String> args = new ArrayList<>(16);
...@@ -1720,8 +1730,7 @@ public abstract class TestBase { ...@@ -1720,8 +1730,7 @@ public abstract class TestBase {
return processBuilder; return processBuilder;
} }
public abstract static class Child extends TestBase public abstract static class Child extends TestBase {
{
private String url; private String url;
private String user; private String user;
private String password; private String password;
...@@ -1742,5 +1751,6 @@ public abstract class TestBase { ...@@ -1742,5 +1751,6 @@ public abstract class TestBase {
public Connection getConnection() throws SQLException { public Connection getConnection() throws SQLException {
return getConnection(url, user, password); return getConnection(url, user, password);
} }
} }
} }
...@@ -205,6 +205,12 @@ public class TestOutOfMemory extends TestBase { ...@@ -205,6 +205,12 @@ public class TestOutOfMemory extends TestBase {
public static final class MyChild extends TestBase.Child public static final class MyChild extends TestBase.Child
{ {
/**
* Run just this test.
*
* @param args the arguments
*/
public static void main(String... args) throws Exception { public static void main(String... args) throws Exception {
new MyChild(args).init().test(); new MyChild(args).init().test();
} }
......
...@@ -765,4 +765,4 @@ jacoco xdata invokes sourcefiles classfiles duplication crypto stacktraces prt d ...@@ -765,4 +765,4 @@ jacoco xdata invokes sourcefiles classfiles duplication crypto stacktraces prt d
interpolated thead interpolated thead
die weekdiff osx subprocess dow proleptic microsecond microseconds divisible cmp denormalized suppressed saturated mcs die weekdiff osx subprocess dow proleptic microsecond microseconds divisible cmp denormalized suppressed saturated mcs
london dfs weekdays intermittent looked msec tstz africa monrovia asia tokyo london dfs weekdays intermittent looked msec tstz africa monrovia asia tokyo weekday
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论