提交 e9f6a718 authored 作者: thomasmueller's avatar thomasmueller

Javadocs, formatting

上级 43e768fc
git pull # Checklist for a release
./build.sh spellcheck
./build.sh javadocImpl ## Formatting, Spellchecking, Javadocs
./build.sh docs
./build.sh jarMVStore (should be about 200 KB) git pull
Do this until there are no errors.
Fix typos, add new words to dictionary.txt:
./build.sh spellcheck
Add documentation for all public methods. Make methods private if possible:
./build.sh javadocImpl
Ensure lines are not overly long:
./build.sh docs
## Jar File Size Verification
To ensure the MVStore jar file is not too large
(does not reference the database code by accident).
The file size should be about 200 KB:
./build.sh jarMVStore
## Changing Version Numbers
Update Constants.java - change version and build number Update Constants.java - change version and build number
Update changelog.html - add new version, remove oldest Update changelog.html - add new version, remove oldest
Update newsfeed.sql - add new version, remove oldest Update newsfeed.sql - add new version, remove oldest
......
...@@ -137,6 +137,11 @@ public class Merge extends Prepared { ...@@ -137,6 +137,11 @@ public class Merge extends Prepared {
return count; return count;
} }
/**
* Merge the given row.
*
* @param row the row
*/
protected void merge(Row row) { protected void merge(Row row) {
ArrayList<Parameter> k = update.getParameters(); ArrayList<Parameter> k = update.getParameters();
for (int i = 0; i < columns.length; i++) { for (int i = 0; i < columns.length; i++) {
......
...@@ -195,6 +195,11 @@ public class MergeUsing extends Prepared { ...@@ -195,6 +195,11 @@ public class MergeUsing extends Prepared {
Right.SELECT); Right.SELECT);
} }
/**
* Merge the given row.
*
* @param row the row
*/
protected void merge(Row sourceRow) { protected void merge(Row sourceRow) {
// put the column values into the table filter // put the column values into the table filter
sourceTableFilter.set(sourceRow); sourceTableFilter.set(sourceRow);
......
...@@ -17,6 +17,7 @@ import java.util.Arrays; ...@@ -17,6 +17,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.h2.engine.Constants; import org.h2.engine.Constants;
/** /**
...@@ -1087,4 +1088,26 @@ public final class DataUtils { ...@@ -1087,4 +1088,26 @@ public final class DataUtils {
} }
/**
* Get the configuration parameter value, or default.
*
* @param config the configuration
* @param key the key
* @param defaultValue the default
* @return the configured value or default
*/
public static int getConfigParam(Map<String, ?> config, String key, int defaultValue) {
Object o = config.get(key);
if (o instanceof Number) {
return ((Number) o).intValue();
} else if (o != null) {
try {
return Integer.decode(o.toString());
} catch (NumberFormatException e) {
// ignore
}
}
return defaultValue;
}
} }
...@@ -27,7 +27,6 @@ import org.h2.mvstore.cache.CacheLongKeyLIRS; ...@@ -27,7 +27,6 @@ import org.h2.mvstore.cache.CacheLongKeyLIRS;
import org.h2.mvstore.type.StringDataType; import org.h2.mvstore.type.StringDataType;
import org.h2.util.MathUtils; import org.h2.util.MathUtils;
import org.h2.util.New; import org.h2.util.New;
import org.h2.util.Utils;
/* /*
...@@ -295,7 +294,7 @@ public final class MVStore { ...@@ -295,7 +294,7 @@ public final class MVStore {
* @throws IllegalArgumentException if the directory does not exist * @throws IllegalArgumentException if the directory does not exist
*/ */
MVStore(Map<String, Object> config) { MVStore(Map<String, Object> config) {
this.compressionLevel = Utils.getConfigParam(config, "compress", 0); this.compressionLevel = DataUtils.getConfigParam(config, "compress", 0);
String fileName = (String) config.get("fileName"); String fileName = (String) config.get("fileName");
FileStore fileStore = (FileStore) config.get("fileStore"); FileStore fileStore = (FileStore) config.get("fileStore");
fileStoreIsProvided = fileStore != null; fileStoreIsProvided = fileStore != null;
...@@ -307,7 +306,7 @@ public final class MVStore { ...@@ -307,7 +306,7 @@ public final class MVStore {
int pgSplitSize = 48; // for "mem:" case it is # of keys int pgSplitSize = 48; // for "mem:" case it is # of keys
CacheLongKeyLIRS.Config cc = null; CacheLongKeyLIRS.Config cc = null;
if (this.fileStore != null) { if (this.fileStore != null) {
int mb = Utils.getConfigParam(config, "cacheSize", 16); int mb = DataUtils.getConfigParam(config, "cacheSize", 16);
if (mb > 0) { if (mb > 0) {
cc = new CacheLongKeyLIRS.Config(); cc = new CacheLongKeyLIRS.Config();
cc.maxMemory = mb * 1024L * 1024L; cc.maxMemory = mb * 1024L * 1024L;
...@@ -327,7 +326,7 @@ public final class MVStore { ...@@ -327,7 +326,7 @@ public final class MVStore {
cacheChunkRef = null; cacheChunkRef = null;
} }
pgSplitSize = Utils.getConfigParam(config, "pageSplitSize", pgSplitSize); pgSplitSize = DataUtils.getConfigParam(config, "pageSplitSize", pgSplitSize);
// Make sure pages will fit into cache // Make sure pages will fit into cache
if (cache != null && pgSplitSize > cache.getMaxItemSize()) { if (cache != null && pgSplitSize > cache.getMaxItemSize()) {
pgSplitSize = (int)cache.getMaxItemSize(); pgSplitSize = (int)cache.getMaxItemSize();
...@@ -343,10 +342,10 @@ public final class MVStore { ...@@ -343,10 +342,10 @@ public final class MVStore {
meta.init(this, c); meta.init(this, c);
if (this.fileStore != null) { if (this.fileStore != null) {
retentionTime = this.fileStore.getDefaultRetentionTime(); retentionTime = this.fileStore.getDefaultRetentionTime();
int kb = Utils.getConfigParam(config, "autoCommitBufferSize", 1024); int kb = DataUtils.getConfigParam(config, "autoCommitBufferSize", 1024);
// 19 KB memory is about 1 KB storage // 19 KB memory is about 1 KB storage
autoCommitMemory = kb * 1024 * 19; autoCommitMemory = kb * 1024 * 19;
autoCompactFillRate = Utils.getConfigParam(config, "autoCompactFillRate", 50); autoCompactFillRate = DataUtils.getConfigParam(config, "autoCompactFillRate", 50);
char[] encryptionKey = (char[]) config.get("encryptionKey"); char[] encryptionKey = (char[]) config.get("encryptionKey");
try { try {
if (!fileStoreIsProvided) { if (!fileStoreIsProvided) {
...@@ -375,7 +374,7 @@ public final class MVStore { ...@@ -375,7 +374,7 @@ public final class MVStore {
// setAutoCommitDelay starts the thread, but only if // setAutoCommitDelay starts the thread, but only if
// the parameter is different from the old value // the parameter is different from the old value
int delay = Utils.getConfigParam(config, "autoCommitDelay", 1000); int delay = DataUtils.getConfigParam(config, "autoCommitDelay", 1000);
setAutoCommitDelay(delay); setAutoCommitDelay(delay);
} }
} }
......
...@@ -124,7 +124,7 @@ public class ColumnNamer { ...@@ -124,7 +124,7 @@ public class ColumnNamer {
return newColumnName; return newColumnName;
} }
public boolean isAllowableColumnName(String proposedName) { private boolean isAllowableColumnName(String proposedName) {
// check null // check null
if (proposedName == null) { if (proposedName == null) {
......
...@@ -161,6 +161,11 @@ public class ColumnNamerConfiguration { ...@@ -161,6 +161,11 @@ public class ColumnNamerConfiguration {
this.generateUniqueColumnNames = generateUniqueColumnNames; this.generateUniqueColumnNames = generateUniqueColumnNames;
} }
/**
* Configure the rules.
*
* @param modeEnum the mode
*/
public void configure(ModeEnum modeEnum) { public void configure(ModeEnum modeEnum) {
switch (modeEnum) { switch (modeEnum) {
case Oracle: case Oracle:
......
...@@ -17,7 +17,6 @@ import java.lang.reflect.Modifier; ...@@ -17,7 +17,6 @@ import java.lang.reflect.Modifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
...@@ -699,20 +698,6 @@ public class Utils { ...@@ -699,20 +698,6 @@ public class Utils {
return defaultValue; return defaultValue;
} }
public static int getConfigParam(Map<String,?> config, String key, int defaultValue) {
Object o = config.get(key);
if (o instanceof Number) {
return ((Number) o).intValue();
} else if (o != null) {
try {
return Integer.decode(o.toString());
} catch (NumberFormatException e) {
// ignore
}
}
return defaultValue;
}
/** /**
* Scale the value with the available memory. If 1 GB of RAM is available, * Scale the value with the available memory. If 1 GB of RAM is available,
* the value is returned, if 2 GB are available, then twice the value, and * the value is returned, if 2 GB are available, then twice the value, and
......
...@@ -184,6 +184,9 @@ public class ValueLobDb extends Value implements Value.ValueClob, ...@@ -184,6 +184,9 @@ public class ValueLobDb extends Value implements Value.ValueClob,
* except when converting to BLOB or CLOB. * except when converting to BLOB or CLOB.
* *
* @param t the new type * @param t the new type
* @param precision the precision
* @param mode the mode
* @param column the column
* @return the converted value * @return the converted value
*/ */
@Override @Override
......
...@@ -2475,6 +2475,8 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -2475,6 +2475,8 @@ public class TestFunctions extends TestBase implements AggregateFunction {
/** /**
* This method is called via reflection from the database. * This method is called via reflection from the database.
*
* @returns a fixed number
*/ */
public static long currentTimestampOverride() { public static long currentTimestampOverride() {
return 3141; return 3141;
......
...@@ -25,7 +25,10 @@ public class TestColumnNamer extends TestBase { ...@@ -25,7 +25,10 @@ public class TestColumnNamer extends TestBase {
"col2col2col2col2col2col2col2_2" }; "col2col2col2col2col2col2col2_2" };
/** /**
* Run just this test. * This method is called when executing this application from the command
* line.
*
* @param args the command line parameters
*/ */
public static void main(String[] args) { public static void main(String[] args) {
new TestColumnNamer().test(); new TestColumnNamer().test();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论