view src/main/java/nl/cwi/monetdb/embedded/column/DecimalColumn.java @ 31:787a4fdba56e embedded

More cleaning
author Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
date Thu, 27 Oct 2016 18:33:42 +0200 (2016-10-27)
parents src/main/java/nl/cwi/monetdb/mcl/embedded/result/column/DecimalColumn.java@7e0d71a22677
children
line wrap: on
line source
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0.  If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * Copyright 2008-2015 MonetDB B.V.
 */

package nl.cwi.monetdb.embedded.column;

import nl.cwi.monetdb.embedded.EmbeddedQueryResult;

import java.math.BigDecimal;

/**
 * Mapping for MonetDB DECIMAL data type
 */
public class DecimalColumn extends Column<BigDecimal> {

    private final BigDecimal[] values;

    private final int precision;

    private final int scale;

    public DecimalColumn(EmbeddedQueryResult result, int index, BigDecimal[] values, boolean[] nullIndex, int precision, int scale) {
        super(result, index, nullIndex);
        this.values = values;
        this.precision = precision;
        this.scale = scale;
    }

    public int getPrecision() {
        return precision;
    }

    public int getScale() {
        return scale;
    }

    @Override
    public BigDecimal[] getAllValues() {
        return this.values;
    }

    @Override
    protected BigDecimal getValueImplementation(int index) {
        return this.values[index];
    }
}