class RangeTable extends Table {

    /**
     * The name of the range table.
     */
    public static final String NAME = "SYSTEM_RANGE";

    /**
     * The PostgreSQL alias for the range table.
     */
    public static final String ALIAS = "GENERATE_SERIES";

    private IExpression min, max, step;
    private boolean optimized;

    /**
     * Create a new range with the given start and end expressions.
     *
     * @param schema the schema (always the main schema)
     * @param min the start expression
     * @param max the end expression
     * @param noColumns whether this table has no columns
     */
    public RangeTable(Schema schema, IExpression min, IExpression max, boolean noColumns) {
        super(schema, 0, NAME, true, true);
        Column[] cols = noColumns ? new Column[0] : new Column[] { new Column("X", Value.LONG) };
        this.min = min;
        this.max = max;
        setColumns(cols);
    }

    public RangeTable(Schema schema, IExpression min, IExpression max, IExpression step,
            boolean noColumns) {
        this(schema, min, max, noColumns);
        this.step = step;
    }

    @Override
    public String getCreateSQL() {
        return null;
    }

    @Override
    public String getSQL() {
        String sql = NAME + "(" + min.getSQL() + ", " + max.getSQL();
        if (step != null) {
            sql += ", " + step.getSQL();
        }
        return sql + ")";
    }

    @Override
    public TableType getTableType() {
        return TableType.RANGE_TABLE;
    }

    @Override
    public Index getScanIndex(ServerSession session) {<FILL_FUNCTION_BODY>}

    @Override
    public long getMaxDataModificationId() {
        return 0;
    }

    @Override
    public boolean isDeterministic() {
        return true;
    }

    @Override
    public boolean canReference() {
        return false;
    }

    @Override
    public boolean canDrop() {
        return false;
    }

    @Override
    public boolean canGetRowCount() {
        return true;
    }

    @Override
    public long getRowCount(ServerSession session) {
        return Math.max(0, getMax(session) - getMin(session) + 1);
    }

    @Override
    public long getRowCountApproximation() {
        return 100;
    }

    /**
     * Calculate and get the start value of this range.
     *
     * @param session the session
     * @return the start value
     */
    public long getMin(ServerSession session) {
        optimize(session);
        return min.getValue(session).getLong();
    }

    /**
     * Calculate and get the end value of this range.
     *
     * @param session the session
     * @return the end value
     */
    public long getMax(ServerSession session) {
        optimize(session);
        return max.getValue(session).getLong();
    }

    /**
     * Get the increment.
     *
     * @param session the session
     * @return the increment (1 by default)
     */
    public long getStep(ServerSession session) {
        optimize(session);
        if (step == null) {
            return 1;
        }
        return step.getValue(session).getLong();
    }

    private void optimize(ServerSession s) {
        if (!optimized) {
            min = min.optimize(s);
            max = max.optimize(s);
            if (step != null) {
                step = step.optimize(s);
            }
            optimized = true;
        }
    }

}

        if (getStep(session) == 0) {
            throw DbException.get(ErrorCode.STEP_SIZE_MUST_NOT_BE_ZERO);
        }
        return new RangeIndex(this, IndexColumn.wrap(columns));
    
<methods>public void <init>(com.lealone.db.schema.Schema, int, java.lang.String, boolean, boolean) ,public void addConstraint(com.lealone.db.constraint.Constraint) ,public void addDependencies(Set<com.lealone.db.DbObject>) ,public com.lealone.db.index.Index addIndex(com.lealone.db.session.ServerSession, java.lang.String, int, com.lealone.db.index.IndexColumn[], com.lealone.db.index.IndexType, boolean, java.lang.String, com.lealone.db.lock.DbObjectLock) ,public Future<java.lang.Integer> addRow(com.lealone.db.session.ServerSession, com.lealone.db.result.Row) ,public void addSequence(com.lealone.db.schema.Sequence) ,public void addTrigger(com.lealone.db.schema.TriggerObject) ,public void addView(com.lealone.db.table.TableView) ,public void analyze(com.lealone.db.session.ServerSession, int) ,public abstract boolean canDrop() ,public abstract boolean canGetRowCount() ,public boolean canReference() ,public boolean canTruncate() ,public void checkRename() ,public void checkSupportAlter() ,public void checkWritingAllowed() ,public void close(com.lealone.db.session.ServerSession) ,public int compareTypeSafe(com.lealone.db.value.Value, com.lealone.db.value.Value) ,public boolean containsIndex() ,public boolean containsLargeObject() ,public boolean doesColumnExist(java.lang.String) ,public void dropSingleColumnConstraintsAndIndexes(com.lealone.db.session.ServerSession, com.lealone.db.table.Column, com.lealone.db.lock.DbObjectLock) ,public com.lealone.db.table.Column findColumn(java.lang.String) ,public com.lealone.db.index.Index findPrimaryKey() ,public void fire(com.lealone.db.session.ServerSession, int, boolean) ,public void fireAfterRow(com.lealone.db.session.ServerSession, com.lealone.db.result.Row, com.lealone.db.result.Row, boolean) ,public boolean fireBeforeRow(com.lealone.db.session.ServerSession, com.lealone.db.result.Row, com.lealone.db.result.Row) ,public boolean fireRow() ,public boolean getCheckForeignKeyConstraints() ,public List<com.lealone.db.DbObject> getChildren() ,public java.lang.String getCodePath() ,public com.lealone.db.table.Column getColumn(int) ,public com.lealone.db.table.Column getColumn(java.lang.String) ,public com.lealone.db.table.Column[] getColumns() ,public com.lealone.db.value.CompareMode getCompareMode() ,public ArrayList<com.lealone.db.constraint.Constraint> getConstraints() ,public com.lealone.db.DataHandler getDataHandler() ,public com.lealone.db.value.Value getDefaultValue(com.lealone.db.session.ServerSession, com.lealone.db.table.Column) ,public long getDiskSpaceUsed() ,public com.lealone.db.index.Index getIndexForColumn(com.lealone.db.table.Column) ,public ArrayList<com.lealone.db.index.Index> getIndexes() ,public abstract long getMaxDataModificationId() ,public synchronized com.lealone.db.result.Row getNullRow() ,public com.lealone.db.table.Column[] getOldColumns() ,public boolean getOnCommitDrop() ,public boolean getOnCommitTruncate() ,public java.lang.String getPackageName() ,public java.lang.String getParameter(java.lang.String) ,public Map<java.lang.String,java.lang.String> getParameters() ,public com.lealone.db.index.Index getPrimaryKey() ,public ArrayList<com.lealone.db.constraint.ConstraintReferential> getReferentialConstraints() ,public com.lealone.db.result.Row getRow(com.lealone.db.session.ServerSession, long) ,public com.lealone.db.result.Row getRow(com.lealone.db.result.Row) ,public abstract long getRowCount(com.lealone.db.session.ServerSession) ,public abstract long getRowCountApproximation() ,public com.lealone.db.table.Column getRowIdColumn() ,public abstract com.lealone.db.index.Index getScanIndex(com.lealone.db.session.ServerSession) ,public abstract com.lealone.db.table.TableType getTableType() ,public com.lealone.db.result.Row getTemplateRow() ,public com.lealone.db.result.SearchRow getTemplateSimpleRow(boolean) ,public com.lealone.db.DbObjectType getType() ,public int getVersion() ,public ArrayList<com.lealone.db.table.TableView> getViews() ,public boolean hasSelectTrigger() ,public int incrementAndGetVersion() ,public void initVersion() ,public abstract boolean isDeterministic() ,public boolean isGlobalTemporary() ,public boolean isHidden() ,public boolean isPersistData() ,public boolean isPersistIndexes() ,public boolean isRowChanged(com.lealone.db.result.Row) ,public boolean lock(com.lealone.db.session.ServerSession, boolean) ,public void removeChildrenAndResources(com.lealone.db.session.ServerSession, com.lealone.db.lock.DbObjectLock) ,public void removeConstraint(com.lealone.db.constraint.Constraint) ,public void removeIndex(com.lealone.db.index.Index) ,public void removeIndexOrTransferOwnership(com.lealone.db.session.ServerSession, com.lealone.db.index.Index, com.lealone.db.lock.DbObjectLock) ,public Future<java.lang.Integer> removeRow(com.lealone.db.session.ServerSession, com.lealone.db.result.Row) ,public Future<java.lang.Integer> removeRow(com.lealone.db.session.ServerSession, com.lealone.db.result.Row, boolean) ,public void removeSequence(com.lealone.db.schema.Sequence) ,public void removeTrigger(com.lealone.db.schema.TriggerObject) ,public void removeView(com.lealone.db.table.TableView) ,public void rename(java.lang.String) ,public void renameColumn(com.lealone.db.table.Column, java.lang.String) ,public void repair(com.lealone.db.session.ServerSession) ,public void setCheckForeignKeyConstraints(com.lealone.db.session.ServerSession, boolean, boolean) ,public void setCodePath(java.lang.String) ,public void setHidden(boolean) ,public void setNewColumns(com.lealone.db.table.Column[]) ,public void setOnCommitDrop(boolean) ,public void setOnCommitTruncate(boolean) ,public void setPackageName(java.lang.String) ,public void truncate(com.lealone.db.session.ServerSession) ,public boolean tryExclusiveLock(com.lealone.db.session.ServerSession) ,public int tryLockRow(com.lealone.db.session.ServerSession, com.lealone.db.result.Row, int[]) ,public boolean trySharedLock(com.lealone.db.session.ServerSession) ,public Future<java.lang.Integer> updateRow(com.lealone.db.session.ServerSession, com.lealone.db.result.Row, com.lealone.db.result.Row, int[]) ,public Future<java.lang.Integer> updateRow(com.lealone.db.session.ServerSession, com.lealone.db.result.Row, com.lealone.db.result.Row, int[], boolean) ,public void validateConvertUpdateSequence(com.lealone.db.session.ServerSession, com.lealone.db.result.Row) <variables>public static final int TYPE_CACHED,public static final int TYPE_MEMORY,private boolean checkForeignKeyConstraints,private java.lang.String codePath,private final non-sealed HashMap<java.lang.String,com.lealone.db.table.Column> columnMap,protected com.lealone.db.table.Column[] columns,private final non-sealed com.lealone.db.value.CompareMode compareMode,private ArrayList<com.lealone.db.constraint.Constraint> constraints,private final com.lealone.db.lock.DbObjectLock dbObjectLock,protected boolean isHidden,private com.lealone.db.result.Row nullRow,private boolean onCommitDrop,private boolean onCommitTruncate,private java.lang.String packageName,private final non-sealed boolean persistData,private final non-sealed boolean persistIndexes,private ArrayList<com.lealone.db.schema.Sequence> sequences,private ArrayList<com.lealone.db.schema.TriggerObject> triggers,private int version,private ArrayList<com.lealone.db.table.TableView> views