package org.gnode.nix;

import org.bytedeco.javacpp.Loader;
import org.bytedeco.javacpp.annotation.*;
import org.gnode.nix.internal.None;
import org.gnode.nix.internal.VectorUtils;

import java.util.List;

@Properties(value = {
        @Platform(include = {"<nix/Dimensions.hpp>"}, link = "nix"),
        @Platform(value = "linux"),
        @Platform(value = "windows")})
@Namespace("nix")
public class SetDimension extends Dimension {
    static {
        Loader.load();
    }

    //--------------------------------------------------
    // Constructors
    //--------------------------------------------------

    /**
     * Constructor that creates an uninitialized SetDimension.
     * <p/>
     * Calling any method on an uninitialized dimension will throw a {@link java.lang.RuntimeException}.
     */
    public SetDimension() {
        allocate();
    }

    private native void allocate();

    //--------------------------------------------------
    // Base class methods
    //--------------------------------------------------

    public native
    @Cast("bool")
    boolean isNone();

    //--------------------------------------------------
    // Methods concerning SetDimension
    //--------------------------------------------------

    /**
     * The actual dimension that is described by the dimension descriptor.
     * <p/>
     * The index of the dimension entity representing the dimension of the actual
     * data that is defined by this descriptor.
     *
     * @return The dimension index of the dimension.
     */
    public native
    @Name("index")
    @Cast("size_t")
    long getIndex();

    /**
     * The type of the dimension.
     * <p/>
     * This field indicates whether the dimension is a SampledDimension, SetDimension or
     * RangeDimension.
     *
     * @return The dimension type.
     */
    public native
    @Name("dimensionType")
    @ByVal
    @Cast("nix::DimensionType")
    int getDimensionType();

    private native
    @ByVal
    VectorUtils.StringVector labels();

    /**
     * Get the labels of the range dimension.
     * <p/>
     * The labels serve as names for each index of the data at the respective
     * dimension.
     *
     * @return The labels of the dimension as a list of strings.
     */
    public List<String> getLabels() {
        return labels().getStrings();
    }

    private native void labels(@Const @ByRef VectorUtils.StringVector labels);

    private native void labels(@Const @ByVal None t);

    /**
     * Set the labels for the dimension.
     *
     * @param labels A list containing all new labels. If {@link null} removes the labels from the dimension.
     */
    public void setLabels(List<String> labels) {
        if (labels != null) {
            labels(new VectorUtils.StringVector(labels));
        } else {
            labels(new None());
        }
    }
}
@@ -95,16 +95,57 @@
 tion.*;%0A
+import org.gnode.nix.base.ImplContainer;%0A
 import o
@@ -449,16 +449,18 @@
 imension
+%3CT
  extends
@@ -460,16 +460,19 @@
 extends 
+Set
 Dimensio
@@ -472,16 +472,64 @@
 imension
+%3E extends ImplContainer implements Comparable%3CT%3E
  %7B%0A    s
@@ -2953,10 +2953,331 @@
  %7D%0A    %7D
+%0A%0A    //--------------------------------------------------%0A    // Overrides%0A    //--------------------------------------------------%0A%0A    @Override%0A    public int compareTo(T dimension) %7B%0A        if (this == dimension) %7B%0A            return 0;%0A        %7D%0A        return (int) (this.getIndex() - dimension.getIndex());%0A    %7D
 %0A%7D

fix base