/*
 * The MIT License
 *
 * Copyright © 2014 Filip Plesinger, Juraj Jurco.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 * 
 * Authors: 
 * 
 * Filip Plesinger <fplesinger@isibrno.cz>
 * Institute of Scientific Instruments of the ASCR, v. v. i.
 * Brno, Czech Republic
 * 
 * Juraj Jurco <xjuraj@isibrno.cz>
 * Institute of Scientific Instruments of the ASCR, v. v. i.
 * Brno, Czech Republic
 */


package cz.academyofscience.upt.challenge2014.qrs;

import cz.academyofscience.upt.challenge2014.Channel;

/**
 *
 * @author xjuraj
 */
public class SelectionMember {
    private String channelName;
    private String info;
    private int leftIndex;
    private int rightIndex;
    private float validity;
    private int group;
    
    //output annotation data
    private int sampleNumber;
    private char type = 'N';
    private int channelNumber = 0;
    private int sub = 0;
    private int num = 0;
    private String aux = "";
    private Channel timeChannel = null;

    public SelectionMember(int leftIndex, int rightIndex, String info) {
        this.info = info;
        this.leftIndex = leftIndex;
        this.rightIndex = rightIndex;
        this.sampleNumber = leftIndex;
    }
    
    public SelectionMember(int sampleNumber, int channelNumber) {
        this.sampleNumber = sampleNumber;
        this.leftIndex = sampleNumber;
        this.rightIndex = sampleNumber;
        this.channelNumber = channelNumber;
    }

    public Channel getTimeChannel() {
        return timeChannel;
    }

    public void setTimeChannel(Channel timeChannel) {
        this.timeChannel = timeChannel;
    }

    
    
    @Override
    public String toString() {
//      Time   Sample #  Type  Sub Chan  Num	Aux
//    0:00.532      133     N    0    0    0
        return String.format("%12s%9d%6s%5d%5d%5d%s", (timeChannel!=null)?timeChannel.getData()[sampleNumber]:"--NA--", 
                sampleNumber, type, sub, channelNumber, num, aux);
        //return String.format("%d-%d (%s)\n", leftIndex, rightIndex, channelName);
    }

    public int getGroup() {
        return group;
    }

    public void setGroup(int group) {
        this.group = group;
    }
    
    public int getSampleNumber() {
        return sampleNumber;
    }

    public void setSampleNumber(int sampleNumber) {
        this.sampleNumber = sampleNumber;
    }

    public char getType() {
        return type;
    }

    public void setType(char type) {
        this.type = type;
    }

    public int getChannelNumber() {
        return channelNumber;
    }

    public void setChannelNumber(int channelNumber) {
        this.channelNumber = channelNumber;
    }

    public int getSub() {
        return sub;
    }

    public void setSub(int sub) {
        this.sub = sub;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public String getAux() {
        return aux;
    }

    public void setAux(String aux) {
        this.aux = aux;
    }

    public String getChannelName() {
        return channelName;
    }

    public void setChannelName(String channelName) {
        this.channelName = channelName;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public int getLeftIndex() {
        return leftIndex;
    }

    public void setLeftIndex(int leftIndex) {
        this.leftIndex = leftIndex;
    }

    public int getRightIndex() {
        return rightIndex;
    }

    public void setRightIndex(int rightIndex) {
        this.rightIndex = rightIndex;
    }

    public float getValidity() {
        return validity;
    }

    public void setValidity(float validity) {
        this.validity = validity;
    }

    
    
}
