class HashIndex extends IndexBase {

    /**
     * The index of the indexed column.
     */
    protected final int indexColumn;

    protected HashIndex(Table table, int id, String indexName, IndexType indexType,
            IndexColumn[] columns) {
        super(table, id, indexName, indexType, columns);
        this.indexColumn = columns[0].column.getColumnId();
    }

    protected abstract void reset();

    protected Value getKey(SearchRow row) {
        return row.getValue(indexColumn);
    }

    protected void checkSearchKey(SearchRow first, SearchRow last) {
        if (first == null || last == null) {
            throw DbException.getInternalError();
        }
        if (first != last) {
            if (!getKey(first).equals(getKey(last))) {
                throw DbException.getInternalError();
            }
        }
    }

    @Override
    public void truncate(ServerSession session) {
        reset();
    }

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

    @Override
    public void close(ServerSession session) {
        // nothing to do
    }

    @Override
    public void remove(ServerSession session) {
        // nothing to do
    }

    @Override
    public double getCost(ServerSession session, int[] masks, SortOrder sortOrder) {<FILL_FUNCTION_BODY>}

    @Override
    public void checkRename() {
        // ok
    }

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

    @Override
    public SearchRow findFirstOrLast(ServerSession session, boolean first) {
        throw DbException.getUnsupportedException("HASH");
    }

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

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

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

        if (masks == null) {
            return Long.MAX_VALUE;
        }
        for (Column column : columns) {
            int index = column.getColumnId();
            int mask = masks[index];
            if ((mask & IndexConditionType.EQUALITY) != IndexConditionType.EQUALITY) {
                return Long.MAX_VALUE;
            }
        }
        return 2;
    
<methods>public boolean canGetFirstOrLast() ,public boolean canScan() ,public void checkRename() ,public void close(com.lealone.db.session.ServerSession) ,public int compareRows(com.lealone.db.result.SearchRow, com.lealone.db.result.SearchRow) ,public com.lealone.db.index.Cursor find(com.lealone.db.session.ServerSession, CursorParameters<com.lealone.db.result.SearchRow>) ,public com.lealone.db.index.Cursor findDistinct(com.lealone.db.session.ServerSession) ,public com.lealone.db.result.SearchRow findFirstOrLast(com.lealone.db.session.ServerSession, boolean) ,public int[] getColumnIds() ,public int getColumnIndex(com.lealone.db.table.Column) ,public com.lealone.db.table.Column[] getColumns() ,public java.lang.String getCreateSQL() ,public long getDiskSpaceUsed() ,public com.lealone.db.index.IndexColumn[] getIndexColumns() ,public com.lealone.db.index.IndexType getIndexType() ,public long getMemorySpaceUsed() ,public java.lang.String getPlanSQL() ,public com.lealone.db.result.Row getRow(com.lealone.db.session.ServerSession, long) ,public com.lealone.db.table.Table getTable() ,public com.lealone.db.DbObjectType getType() ,public boolean isHidden() ,public boolean isInMemory() ,public boolean isRowIdIndex() ,public boolean needRebuild() ,public void remove(com.lealone.db.session.ServerSession) ,public void removeChildrenAndResources(com.lealone.db.session.ServerSession, com.lealone.db.lock.DbObjectLock) ,public boolean supportsDistinctQuery() ,public void truncate(com.lealone.db.session.ServerSession) <variables>protected int[] columnIds,protected com.lealone.db.table.Column[] columns,protected com.lealone.db.index.IndexColumn[] indexColumns,protected final non-sealed com.lealone.db.index.IndexType indexType,protected final non-sealed com.lealone.db.table.Table table