Unverified 提交 9cd06d96 authored 作者: Andrei Tokar's avatar Andrei Tokar 提交者: GitHub

Merge pull request #1631 from tledkov-gridgain/pre-release-javadoc-cleanup

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