<commit_before>package it.sad.sii.transit.sdk.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonValue;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;


/**
 * Created by ldematte on 9/9/14.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class TimeTable implements Serializable, Comparable<TimeTable> {
    protected static final long serialVersionUID = 1L;

    public enum Direction {
        OUTWARDS("A"),
        RETURN("R"),
        UNKNOWN("X");

        private final String name;

        private Direction(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return name;
        }

        // DO NOT REMOVE! Needed for serialization of object with jackson...
        @JsonValue
        public String toValue(){
            return toString();
        }

        public static Direction fromString(String s) {
            switch (s) {
                case "A":
                case "OUTWARDS":
                case "As":
                case "H":
                    return OUTWARDS;

                case "R":
                case "RETURN":
                case "Di":
                    return RETURN;

                case "X":
                    return UNKNOWN;

                default:
                    throw new IllegalArgumentException("Unknown direction " + s);
            }
        }
    }

    protected String id;
    protected String carrierId;
    protected String lineId;
    protected String runId;
    protected String commercialCode;
    protected Integer validFrom;
    protected Integer validTo;
    protected List<? extends TimeTableData> entries;
    protected List<? extends TimeTableData> entriesForTrain;
    protected List<? extends TimeTableCalendar> periods;

    public TimeTable() {
    }

    public TimeTable(String carrierId, String lineId, String runId, String commercialCode, Integer validFrom, Integer validTo) {
        setCarrierId(carrierId);
        setLineId(lineId);
        setRunId(runId);
        setCommercialCode(commercialCode);
        setValidFrom(validFrom);
        setValidTo(validTo);
    }

    public TimeTable(String carrierId, String lineId, String runId, String commercialCode, Integer validFrom, Integer validTo,
                     List<TimeTableData> ttd, List<TimeTableCalendar> ttc) {
        this(carrierId, lineId, runId, commercialCode, validFrom, validTo);
        setEntries(ttd);
        setPeriods(ttc);
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCarrierId() {
        return carrierId;
    }

    public void setCarrierId(String carrierId) {
        this.carrierId = carrierId;
    }

    public String getLineId() {
        return lineId;
    }

    public void setLineId(String lineId) {
        this.lineId = lineId;
    }

    public String getRunId() {
        return runId;
    }

    public void setRunId(String runId) {
        this.runId = runId;
    }

    public Integer getValidFrom() {
        return validFrom;
    }

    public void setValidFrom(Integer validFrom) {
        this.validFrom = validFrom;
    }

    public Integer getValidTo() {
        return validTo;
    }

    public void setValidTo(Integer validTo) {
        this.validTo = validTo;
    }

    public String getCommercialCode() {
        return commercialCode;
    }

    public void setCommercialCode(String commercialCode) {
        this.commercialCode = commercialCode;
    }

    public void setEntries(List<? extends TimeTableData> entries) {
        this.entries = entries;
    }

    public void setPeriods(List<? extends TimeTableCalendar> periods) {
        this.periods = periods;
    }

    public List<? extends TimeTableData> getEntries() {
        return entries;
    }

    public List<? extends TimeTableCalendar> getPeriods() {
        return periods;
    }

    @JsonIgnore
    public List<? extends TimeTableData> getEntriesOrdered() {
        if (entries == null)
            return null;
        return sort(entries);
    }

    @JsonIgnore
    public List<? extends TimeTableCalendar> getPeriodsOrdered() {<commit_msg>added trim() to TimeTable set-functions<commit_after>package it.sad.sii.transit.sdk.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonValue;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;


/**
 * Created by ldematte on 9/9/14.
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class TimeTable implements Serializable, Comparable<TimeTable> {
    protected static final long serialVersionUID = 1L;

    public enum Direction {
        OUTWARDS("A"),
        RETURN("R"),
        UNKNOWN("X");

        private final String name;

        private Direction(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return name;
        }

        // DO NOT REMOVE! Needed for serialization of object with jackson...
        @JsonValue
        public String toValue(){
            return toString();
        }

        public static Direction fromString(String s) {
            switch (s) {
                case "A":
                case "OUTWARDS":
                case "As":
                case "H":
                    return OUTWARDS;

                case "R":
                case "RETURN":
                case "Di":
                    return RETURN;

                case "X":
                    return UNKNOWN;

                default:
                    throw new IllegalArgumentException("Unknown direction " + s);
            }
        }
    }

    protected String id;
    protected String carrierId;
    protected String lineId;
    protected String runId;
    protected String commercialCode;
    protected Integer validFrom;
    protected Integer validTo;
    protected List<? extends TimeTableData> entries;
    protected List<? extends TimeTableData> entriesForTrain;
    protected List<? extends TimeTableCalendar> periods;

    public TimeTable() {
    }

    public TimeTable(String carrierId, String lineId, String runId, String commercialCode, Integer validFrom, Integer validTo) {
        setCarrierId(carrierId.trim());
        setLineId(lineId.trim());
        setRunId(runId.trim());
        setCommercialCode(commercialCode.trim());
        setValidFrom(validFrom);
        setValidTo(validTo);
    }

    public TimeTable(String carrierId, String lineId, String runId, String commercialCode, Integer validFrom, Integer validTo,
                     List<TimeTableData> ttd, List<TimeTableCalendar> ttc) {
        this(carrierId, lineId, runId, commercialCode, validFrom, validTo);
        setEntries(ttd);
        setPeriods(ttc);
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id.trim();
    }

    public String getCarrierId() {
        return carrierId;
    }

    public void setCarrierId(String carrierId) {
        this.carrierId = carrierId.trim();
    }

    public String getLineId() {
        return lineId;
    }

    public void setLineId(String lineId) {
        this.lineId = lineId.trim();
    }

    public String getRunId() {
        return runId;
    }

    public void setRunId(String runId) {
        this.runId = runId.trim();
    }

    public Integer getValidFrom() {
        return validFrom;
    }

    public void setValidFrom(Integer validFrom) {
        this.validFrom = validFrom;
    }

    public Integer getValidTo() {
        return validTo;
    }

    public void setValidTo(Integer validTo) {
        this.validTo = validTo;
    }

    public String getCommercialCode() {
        return commercialCode;
    }

    public void setCommercialCode(String commercialCode) {
        this.commercialCode = commercialCode.trim();
    }

    public void setEntries(List<? extends TimeTableData> entries) {
        this.entries = entries;
    }

    public void setPeriods(List<? extends TimeTableCalendar> periods) {
        this.periods = periods;
    }

    public List<? extends TimeTableData> getEntries() {
        return entries;
    }

    public List<? extends TimeTableCalendar> getPeriods() {
        return periods;
    }

    @JsonIgnore
    public List<? extends TimeTableData> getEntriesOrdered() {
        if (entries == null)
            return null;
        return sort(entries);
    }

    @JsonIgnore
    public List<? extends TimeTableCalendar> getPeriodsOrdered() {
{'fraction_non_alphanumeric': 0.08581536003651717, 'fraction_numerical': 0.0011411617026132602, 'mean_word_length': 2.160476018752254, 'pattern_counts': {'":': 16, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3953019', 'n_tokens_mistral': 2431, 'n_tokens_neox': 2304, 'n_words': 630}