view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QKmsImpl.java @ 4890:bf38ea4cb0f7

Added bodies to macros. Use the bodies of <dc:call-macro><body></dc:call-macro> as <dc:macro-body/> in tthe macro. Example: <dc:macro name="greet"><hello><dc:macro-body/></hello></dc:macro> <dc:call-macro name="greet"><planet>Earth</planet></dc:call-macro> Result: <hello><panet>Earth</planet></hello>
author Sascha L. Teichmann <teichmann@intevation.de>
date Mon, 28 Jan 2013 18:55:55 +0100
parents bcf25d8c183e
children
line wrap: on
line source
package de.intevation.flys.artifacts.model;

import gnu.trove.TDoubleArrayList;

import de.intevation.flys.utils.DoubleUtil;

public class QKmsImpl
extends      NamedObjectImpl
implements   QKms
{
    protected TDoubleArrayList kms;
    protected TDoubleArrayList qs;

    public QKmsImpl() {
        super("");
        kms = new TDoubleArrayList();
        qs  = new TDoubleArrayList();
    }

    public QKmsImpl(String name) {
        super(name);
        kms = new TDoubleArrayList();
        qs  = new TDoubleArrayList();
    }


    public QKmsImpl(int capacity) {
        super("");
        kms = new TDoubleArrayList(capacity);
        qs  = new TDoubleArrayList(capacity);
    }


    public QKmsImpl(TDoubleArrayList kms, TDoubleArrayList qs) {
        this(kms, qs, "");
    }

    public QKmsImpl(
        TDoubleArrayList kms,
        TDoubleArrayList qs,
        String           name
    ) {
        super(name);
        this.kms = kms;
        this.qs  = qs;
    }

    public void add(double km, double q) {
        kms.add(km);
        qs .add(q);
    }

    @Override
    public double getQ(int index) {
        return qs.getQuick(index);
    }


    @Override
    public double getKm(int index) {
        return kms.getQuick(index);
    }

    @Override
    public int size() {
        return kms.size();
    }

    @Override
    public TDoubleArrayList allKms() {
        return kms;
    }

    @Override
    public TDoubleArrayList allQs() {
        return qs;
    }

    public void removeNaNs() {
        DoubleUtil.removeNaNs(new TDoubleArrayList [] { kms, qs });
    }
}

http://dive4elements.wald.intevation.org