提交 144aec21 authored 作者: thomasmueller's avatar thomasmueller

Javadocs, formatting

上级 2e68b5c1
......@@ -171,7 +171,8 @@ import org.h2.value.ValueTimestampTimeZone;
* @author Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888
*/
public class Parser {
public static final String WITH_STATEMENT_SUPPORTS_LIMITED_SUB_STATEMENTS =
private static final String WITH_STATEMENT_SUPPORTS_LIMITED_SUB_STATEMENTS =
"WITH statement supports only SELECT, CREATE TABLE, INSERT, UPDATE, MERGE or DELETE statements";
// used during the tokenizer phase
......@@ -1050,7 +1051,7 @@ public class Parser {
}
}
public static Prepared prepare(Session s, String sql,
private static Prepared prepare(Session s, String sql,
ArrayList<Value> paramValues) {
Prepared prep = s.prepare(sql);
ArrayList<Parameter> params = prep.getParameters();
......
......@@ -450,6 +450,8 @@ public abstract class Prepared {
/**
* Set the temporary views created for CTE's.
*
* @param cteCleanups the temporary views
*/
public void setCteCleanups(List<TableView> cteCleanups) {
this.cteCleanups = cteCleanups;
......
......@@ -43,6 +43,7 @@ import java.util.HashSet;
* @author Joel Turkel (Group sorted query)
*/
public class Select extends Query {
TableFilter topTableFilter;
private final ArrayList<TableFilter> filters = New.arrayList();
private final ArrayList<TableFilter> topFilters = New.arrayList();
......
......@@ -59,8 +59,17 @@ public class SelectUnion extends Query {
public static final int INTERSECT = 3;
private int unionType;
/**
* The left hand side of the union (the first subquery).
*/
final Query left;
/**
* The right hand side of the union (the second subquery).
*/
Query right;
private ArrayList<Expression> expressions;
private Expression[] expressionArray;
private ArrayList<SelectOrderBy> orderList;
......
......@@ -723,6 +723,9 @@ public class FullTextLucene extends FullText {
}
}
/**
* Commit the changes.
*/
public synchronized void commit() throws IOException {
writer.commit();
if (counter != 0) {
......
......@@ -96,6 +96,11 @@ public class ColumnNamerConfiguration {
this.compiledRegularExpressionMatchDisallowed = compiledRegularExpressionMatchDisallowed;
}
/**
* Configure the column namer.
*
* @param stringValue the configuration
*/
public void configure(String stringValue) {
try {
if (stringValue.equalsIgnoreCase(DEFAULT_COMMAND)) {
......
......@@ -198,6 +198,12 @@ public class SourceCompiler {
return isJavascriptSource(source) || isRubySource(source);
}
/**
* Get the compiled script.
*
* @param packageAndClassName the package and class name
* @return the compiled script
*/
public CompiledScript getCompiledScript(String packageAndClassName) throws ScriptException {
CompiledScript compiledScript = compiledScripts.get(packageAndClassName);
if (compiledScript == null) {
......
......@@ -82,6 +82,7 @@ public class ThreadDeadlockDetector {
* Dump all deadlocks (if any).
*
* @param msg the message
* @param out the output
*/
public static void dumpAllThreadsAndLocks(String msg, PrintStream out) {
final ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
......
......@@ -43,6 +43,12 @@ public class CharsetCollator extends Collator {
return COMPARATOR.compare(toBytes(source), toBytes(target));
}
/**
* Convert the source to bytes, using the character set.
*
* @param source the source
* @return the bytes
*/
byte[] toBytes(String source) {
return source.getBytes(charset);
}
......
......@@ -389,7 +389,7 @@ public class DataType {
}
}
static void addDecimal() {
private static void addDecimal() {
add(Value.DECIMAL, Types.DECIMAL, "BigDecimal",
createDecimal(Integer.MAX_VALUE,
ValueDecimal.DEFAULT_PRECISION,
......@@ -401,7 +401,7 @@ public class DataType {
);
}
static void addNumeric() {
private static void addNumeric() {
add(Value.DECIMAL, Types.NUMERIC, "BigDecimal",
createDecimal(Integer.MAX_VALUE,
ValueDecimal.DEFAULT_PRECISION,
......
......@@ -59,6 +59,7 @@ public class Transfer {
* Create a new transfer object for the specified session.
*
* @param session the session
* @param s the socket
*/
public Transfer(SessionInterface session, Socket s) {
this.session = session;
......
......@@ -188,6 +188,13 @@ public abstract class Value {
private static final BigDecimal MIN_LONG_DECIMAL =
BigDecimal.valueOf(Long.MIN_VALUE);
/**
* Check the range of the parameters.
*
* @param zeroBasedOffset the offset (0 meaning no offset)
* @param length the length of the target
* @param dataSize the length of the source
*/
static void rangeCheck(long zeroBasedOffset, long length, long dataSize) {
if ((zeroBasedOffset | length) < 0 || length > dataSize - zeroBasedOffset) {
if (zeroBasedOffset < 0 || zeroBasedOffset > dataSize) {
......@@ -479,10 +486,17 @@ public abstract class Value {
return new ByteArrayInputStream(getBytesNoCopy());
}
/**
* Get the input stream
* @param oneBasedOffset the offset (1 means no offset)
* @param length the requested length
* @return the new input stream
*/
public InputStream getInputStream(long oneBasedOffset, long length) {
byte[] bytes = getBytesNoCopy();
rangeCheck(--oneBasedOffset, length, bytes.length);
return new ByteArrayInputStream(bytes, /* 0-based */ (int) oneBasedOffset, (int) length);
long zeroBasedOffset = oneBasedOffset - 1;
rangeCheck(zeroBasedOffset, length, bytes.length);
return new ByteArrayInputStream(bytes, (int) zeroBasedOffset, (int) length);
}
public Reader getReader() {
......@@ -491,8 +505,9 @@ public abstract class Value {
public Reader getReader(long oneBasedOffset, long length) {
String string = getString();
rangeCheck(--oneBasedOffset, length, string.length());
int offset = /* 0-based */ (int) oneBasedOffset;
long zeroBasedOffset = oneBasedOffset - 1;
rangeCheck(zeroBasedOffset, length, string.length());
int offset = (int) zeroBasedOffset;
return new StringReader(string.substring(offset, offset + (int) length));
}
......@@ -578,6 +593,7 @@ public abstract class Value {
* @param precision the precision of the column to convert this value to.
* The special constant <code>-1</code> is used to indicate that
* the precision plays no role when converting the value
* @param mode the mode
* @return the converted value
*/
public final Value convertTo(int targetType, int precision, Mode mode) {
......
......@@ -59,6 +59,15 @@ public class ValueLob extends Value {
}
}
/**
* Create an input stream that is s subset of the given stream.
*
* @param inputStream the input stream
* @param oneBasedOffset the offset (1 means no offset)
* @param length the length of the result, in bytes
* @param dataSize the length of the input, in bytes
* @return the smaller input stream
*/
static InputStream rangeInputStream(InputStream inputStream, long oneBasedOffset, long length, long dataSize) {
if (dataSize > 0)
rangeCheck(oneBasedOffset - 1, length, dataSize);
......
......@@ -2476,7 +2476,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
/**
* This method is called via reflection from the database.
*
* @returns a fixed number
* @return a fixed number
*/
public static long currentTimestampOverride() {
return 3141;
......
......@@ -44,9 +44,14 @@ public class TestKillRestartMulti extends TestBase {
/**
* This method is called when executing this application from the command
* line.
*
* Note that this entry can be used in two different ways, either
* (a) running just this test
* (b) or when this test invokes itself in a child process
*
* @param args the command line parameters
*/
public static void main(String... args) throws Exception {
if (args != null && args.length > 0) {
......
......@@ -759,3 +759,6 @@ contextual unknowns enquote respectively sessionid reconnection selfreferential
zzbbzz cldr booleans maria enquotes mtc cbuf checksummed nreturn despite bbzz readlimit retries cceecc reconnects
unconditionally coco aren eecccc decimals charsets zzbb lsb msb usecount outdir endian misleading precompiled
assorted reimplemented hangups confirmation predefined
mdy destfile hclf forbids spellchecking selfdestruct expects accident jacocoagent cli historic mitigate
jacoco xdata invokes sourcefiles classfiles duplication crypto stacktraces prt directions handled overly asm hardcoded
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论