提交 4354f8a0 authored 作者: tledkov's avatar tledkov

javadoc cleanup

上级 c3afed94
......@@ -39,22 +39,51 @@ public class SequenceOptions {
return null;
}
/**
* Gets start value.
*
* @param session The session to calculate the value.
* @return start value.
*/
public Long getStartValue(Session session) {
return getLong(session, start);
}
/**
* Sets start value expression.
*
* @param start START WITH value expression.
*/
public void setStartValue(Expression start) {
this.start = start;
}
/**
* Gets increment value.
*
* @param session The session to calculate the value.
* @return increment value.
*/
public Long getIncrement(Session session) {
return getLong(session, increment);
}
/**
* Sets increment value expression.
*
* @param increment INCREMENT BY value expression.
*/
public void setIncrement(Expression increment) {
this.increment = increment;
}
/**
* Gets max value.
*
* @param sequence the sequence to get default max value.
* @param session The session to calculate the value.
* @return max value when the MAXVALUE expression is set, otherwise returns default max value.
*/
public Long getMaxValue(Sequence sequence, Session session) {
if (maxValue == ValueExpression.getNull() && sequence != null) {
return Sequence.getDefaultMaxValue(getCurrentStart(sequence, session),
......@@ -63,10 +92,22 @@ public class SequenceOptions {
return getLong(session, maxValue);
}
/**
* Sets max value expression.
*
* @param maxValue MAXVALUE expression.
*/
public void setMaxValue(Expression maxValue) {
this.maxValue = maxValue;
}
/**
* Gets min value.
*
* @param sequence the sequence to get default min value.
* @param session The session to calculate the value.
* @return max value when the MINVALUE expression is set, otherwise returns default min value.
*/
public Long getMinValue(Sequence sequence, Session session) {
if (minValue == ValueExpression.getNull() && sequence != null) {
return Sequence.getDefaultMinValue(getCurrentStart(sequence, session),
......@@ -75,32 +116,57 @@ public class SequenceOptions {
return getLong(session, minValue);
}
public long getCurrentStart(Sequence sequence, Session session) {
return start != null ? getStartValue(session) : sequence.getCurrentValue() + sequence.getIncrement();
}
/**
* Sets min value expression.
*
* @param minValue MINVALUE expression.
*/
public void setMinValue(Expression minValue) {
this.minValue = minValue;
}
/**
* Gets cycle flag.
*
* @return cycle flag value.
*/
public Boolean getCycle() {
return cycle;
}
/**
* Sets cycle flag.
*
* @param cycle flag value.
*/
public void setCycle(Boolean cycle) {
this.cycle = cycle;
}
/**
* Gets cache size.
*
* @param session The session to calculate the value.
* @return cache size.
*/
public Long getCacheSize(Session session) {
return getLong(session, cacheSize);
}
/**
* Sets cache size.
*
* @param cacheSize cache size.
*/
public void setCacheSize(Expression cacheSize) {
this.cacheSize = cacheSize;
}
protected boolean isRangeSet() {
boolean isRangeSet() {
return start != null || minValue != null || maxValue != null || increment != null;
}
private long getCurrentStart(Sequence sequence, Session session) {
return start != null ? getStartValue(session) : sequence.getCurrentValue() + sequence.getIncrement();
}
}
......@@ -26,7 +26,11 @@ public class AllColumnsForPlan {
this.filters = filters;
}
/** Called by ExpressionVisitor. */
/**
* Called by ExpressionVisitor.
*
* @param newCol new column to be added.
*/
public void add(Column newCol) {
ArrayList<Column> cols = map.get(newCol.getTable());
if (cols == null) {
......@@ -37,6 +41,12 @@ public class AllColumnsForPlan {
cols.add(newCol);
}
/**
* Used by index to calculate the cost of a scan.
*
* @param table the table.
* @return all table's referenced columns.
*/
public ArrayList<Column> get(Table table) {
if (map == null) {
map = new HashMap<>();
......
......@@ -36,10 +36,19 @@ import org.h2.value.Value;
*/
public class MergeUsing extends Prepared {
/**
* Abstract WHEN command of the MERGE statement.
*/
public static abstract class When {
/**
* The parent MERGE statement.
*/
final MergeUsing mergeUsing;
/**
* AND condition of the command.
*/
Expression andCondition;
When(MergeUsing mergeUsing) {
......@@ -55,12 +64,23 @@ public class MergeUsing extends Prepared {
this.andCondition = andCondition;
}
/**
* Reset updated keys if needs.
*/
void reset() {
// Nothing to do
}
/**
* Merges rows.
*
* @return count of updated rows.
*/
abstract int merge();
/**
* Prepares WHEN command.
*/
void prepare() {
if (andCondition != null) {
andCondition.mapColumns(mergeUsing.sourceTableFilter, 2, Expression.MAP_INITIAL);
......@@ -68,8 +88,16 @@ public class MergeUsing extends Prepared {
}
}
/**
* Evaluates trigger mask (UPDATE, INSERT, DELETE).
*
* @return the trigger mask.
*/
abstract int evaluateTriggerMasks();
/**
* Checks user's INSERT, UPDATE, DELETE permission in appropriate cases.
*/
abstract void checkRights();
}
......@@ -224,12 +252,27 @@ public class MergeUsing extends Prepared {
}
// Merge fields
/**
* Target table.
*/
Table targetTable;
/**
* Target table filter.
*/
TableFilter targetTableFilter;
private Query query;
// MergeUsing fields
/**
* Source table filter.
*/
TableFilter sourceTableFilter;
/**
* ON condition expression.
*/
Expression onCondition;
private ArrayList<When> when = Utils.newSmallArrayList();
private String queryAlias;
......@@ -403,6 +446,11 @@ public class MergeUsing extends Prepared {
return when;
}
/**
* Adds WHEN command.
*
* @param w new WHEN command to add (update, delete or insert).
*/
public void addWhen(When w) {
when.add(w);
}
......
......@@ -431,6 +431,9 @@ public abstract class SelectGroups {
}
/**
* Gets the query's column list, including invisible expressions
* such as order by expressions.
*
* @return Expressions.
*/
public ArrayList<Expression> expressions() {
......
......@@ -414,6 +414,13 @@ public abstract class Page implements Cloneable
return copy(false);
}
/**
* Create a copy of this page.
*
* @param countRemoval When {@code true} the current page is removed,
* when {@code false} just copy the page.
* @return a mutable copy of this page
*/
public final Page copy(boolean countRemoval) {
Page newPage = clone();
newPage.pos = 0;
......@@ -795,10 +802,18 @@ public abstract class Page implements Cloneable
return r;
}
/**
* Increase estimated memory used in persistent case.
*
* @param mem additional memory size.
*/
final void addMemory(int mem) {
memory += mem;
}
/**
* Recalculate estimated memory used in persistent case.
*/
final void recalculateMemory() {
assert isPersistent();
memory = calculateMemory();
......
......@@ -17,18 +17,26 @@ import org.h2.value.Value;
*/
public class SimpleResult implements ResultInterface {
/**
* Column info for the simple result.
*/
static final class Column {
/** Column alias. */
final String alias;
/** Column name. */
final String columnName;
/** Column type. */
final int columnType;
/** Column precision. */
final long columnPrecision;
/** Column scale. */
final int columnScale;
/** Displayed size of the column. */
final int displaySize;
Column(String alias, String columnName, int columnType, long columnPrecision, int columnScale,
......
......@@ -148,6 +148,13 @@ public class Sequence extends SchemaObjectBase {
Math.abs(increment) + Long.MIN_VALUE <= maxValue - minValue + Long.MIN_VALUE;
}
/**
* Calculates default min value.
*
* @param startValue the start value of the sequence.
* @param increment the increment of the sequence value.
* @return min value.
*/
public static long getDefaultMinValue(Long startValue, long increment) {
long v = increment >= 0 ? 1 : Long.MIN_VALUE;
if (startValue != null && increment >= 0 && startValue < v) {
......@@ -156,6 +163,13 @@ public class Sequence extends SchemaObjectBase {
return v;
}
/**
* Calculates default max value.
*
* @param startValue the start value of the sequence.
* @param increment the increment of the sequence value.
* @return min value.
*/
public static long getDefaultMaxValue(Long startValue, long increment) {
long v = increment >= 0 ? Long.MAX_VALUE : -1;
if (startValue != null && increment < 0 && startValue > v) {
......
......@@ -19,7 +19,7 @@ public class AuthenticationInfo {
private String realm;
/*
/**
* Can be used by authenticator to hold information.
*/
Object nestedIdentity;
......@@ -58,7 +58,7 @@ public class AuthenticationInfo {
}
/**
* Gets nested identity.
* Gets nested identity object that can be used by authenticator to hold information.
*
* @return nested identity object.
*/
......
......@@ -114,7 +114,6 @@ public class CompareMode implements Comparator<Value> {
*
* @param name the collation name or null
* @param strength the collation strength
* @param binaryUnsigned whether to compare binaries as unsigned
* @param binaryUnsigned whether to compare UUIDs as unsigned
* @return the compare mode
*/
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论