All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.wselwood.mpcreader.modifiers.YearOfObservationModifier Maven / Gradle / Ivy

There is a newer version: 0.1.1
Show newest version
package com.wselwood.mpcreader.modifiers;

import com.wselwood.mpcreader.InvalidDataException;
import com.wselwood.mpcreader.columns.Container;

/**
 * Created by wselwood on 03/05/14.
 */
public class YearOfObservationModifier implements Modifier {

    public YearOfObservationModifier(Container num, Container input, Container firstYear, Container lastYear) {
        this.num = num;
        this.input = input;
        this.firstYear = firstYear;
        this.lastYear = lastYear;
    }

    @Override
    public void process() throws InvalidDataException {
        if(num.get() > 1) {
            firstYear.set(Integer.parseInt(input.get().substring(0, 4)));
            lastYear.set(Integer.parseInt(input.get().substring(5, 9)));
        }
        else {
            firstYear.set(-1);
            lastYear.set(-1);
        }
    }

    private final Container num;
    private final Container input;
    private final Container firstYear;
    private final Container lastYear;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy