<commit_before>/*
 * Copyright (c) 2015-2017, <NAME>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package no.vegvesen.nvdbapi.client.clients;

import no.vegvesen.nvdbapi.client.model.Page;
import no.vegvesen.nvdbapi.client.model.Projection;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

public class RoadNetRequest {
    public static final RoadNetRequest DEFAULT = newBuilder().build();

    private final Optional<Page> page;
    private final Optional<String> roadRefFilter;
    private final List<Integer> regions;
    private final List<Integer> counties;
    private final List<Integer> municipalities;
    private final List<Integer> roadDepartments;
    private final List<Integer> topologyLevel;
    private final List<Integer> superId;
    private final Optional<Projection> projection;
    private final Optional<String> bbox;
    private final Optional<String> contractArea;
    private final Optional<String> nationalRoute;

    private RoadNetRequest(Builder b) {
        page = b.page;
        roadRefFilter = b.roadRefFilter;
        regions = b.regions;
        counties = b.counties;
        municipalities = b.municipalities;
        roadDepartments = b.roadDepartments;
        topologyLevel = b.topologyLevel;
        this.superId = b.superId;
        projection = b.projection;
        bbox = b.bbox;
        contractArea = b.contractArea;
        nationalRoute = b.nationalRoute;
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public Optional<Page> getPage() {
        return page;
    }

    public Optional<String> getRoadRefFilter() {
        return roadRefFilter;
    }

    public List<Integer> getRegions() {
        return regions;
    }

    public List<Integer> getCounties() {
        return counties;
    }

    public List<Integer> getMunicipalities() {
        return municipalities;
    }

    public List<Integer> getRoadDepartments() {
        return roadDepartments;
    }

    public List<Integer> getTopologyLevel() {
        return topologyLevel;
    }

    public List<Integer> getSuperId() {
        return superId;
    }

    public Optional<String> getBbox() {
        return bbox;
    }

    public Optional<Projection> getProjection() {
        return projection;
    }

    public Optional<String> getContractArea() {
        return contractArea;
    }

    public Optional<String> getNationalRoute() {
        return nationalRoute;
    }

    public static class Builder {
        private Optional<Page> page = Optional.empty();
        private Optional<String> roadRefFilter = Optional.empty();
        private List<Integer> regions = Collections.emptyList();
        private List<Integer> counties = Collections.emptyList();
        private List<Integer> municipalities = Collections.emptyList();
        private List<Integer> roadDepartments = Collections.emptyList();
        private List<Integer> topologyLevel = Collections.emptyList();
        private List<Integer> superId = Collections.emptyList();
        private Optional<String> bbox = Optional.empty();
        private Optional<Projection> projection = Optional.empty();
        private Optional<String> contractArea = Optional.empty();
        private Optional<String> nationalRoute = Optional.empty();

        private Builder() {
        }

        public RoadNetRequest build() {
            return new RoadNetRequest(this);
        }

        public Builder withPage(Page page) {
            this.page = Optional.ofNullable(page);
            return this;
        }

        public Builder withRoadRefFilter(String filter) {
            this.roadRefFilter = Optional.ofNullable(filter);
            return this;
        }

        public Builder withRegions(List<Integer> regions) {
            this.regions = Optional.ofNullable(regions).orElse(Collections.emptyList());
            return this;
        }

        public Builder withRegion(Integer region) {
            this.regions = Optional.ofNullable(region).map(Collections::singletonList).orElse(Collections.emptyList());
            return this;
        }

        public Builder withCounties(List<Integer> counties) {
            this.counties = Optional.ofNullable(counties).orElse(Collections.emptyList());
            return this;
        }

        public Builder withCounty(Integer county) {
            this.counties = Optional.ofNullable(county).map(Collections::singletonList).orElse(Collections.emptyList());
            return this;
        }

        public Builder withMunicipalities(List<Integer> municipalities) {
            this.municipalities = Optional.ofNullable(municipalities).orElse(Collections.emptyList());
            return this;
        }

        public Builder withMunicipality(Integer municipality) {
            this.municipalities = Optional.ofNullable(municipality).map(Collections::singletonList).orElse(Collections.emptyList());
            return this;
        }

        public Builder withRoadDepartments(List<Integer> roadDepartments) {
            this.roadDepartments = Optional.ofNullable(roadDepartments).orElse(Collections.emptyList());
            return this;
        }

        public Builder withTopologyLevel(List<Integer> topologyLevel) {
            this.topologyLevel = Optional.ofNullable(topologyLevel).orElse(Collections.emptyList());
            return this;
        }

        public Builder withSuperId(List<Integer> superId) {
            this.superId = Optional.ofNullable(superId).orElse(Collections.emptyList());
            return this;
        }

        public Builder withRoadDepartment(Integer roadDepartment) {
            this.roadDepartments = Optional.ofNullable(roadDepartment).map(Collections::singletonList).orElse(Collections.emptyList());
            return this;
        }

        public Builder withBbox(String bbox) {
            this.bbox = Optional.ofNullable(bbox);
            return this;
        }

        public Builder withProjection(Projection projection) {
            this.projection = Optional.ofNullable(projection);
            return this;
        }

        public Builder withContractArea(String contractArea) {
            this.contractArea = Optional.ofNullable(contractArea);
            return this;
        }<commit_msg>NVDB-3236:  Added parameter id (query for nodes/links with given ids)<commit_after>/*
 * Copyright (c) 2015-2017, <NAME>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package no.vegvesen.nvdbapi.client.clients;

import no.vegvesen.nvdbapi.client.model.Page;
import no.vegvesen.nvdbapi.client.model.Projection;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

public class RoadNetRequest {
    public static final RoadNetRequest DEFAULT = newBuilder().build();

    private final Optional<Page> page;
    private final Optional<String> roadRefFilter;
    private final List<Integer> regions;
    private final List<Integer> counties;
    private final List<Integer> municipalities;
    private final List<Integer> roadDepartments;
    private final List<Integer> topologyLevel;
    private final List<Integer> superId;
    private final Optional<Projection> projection;
    private final Optional<String> bbox;
    private final Optional<String> contractArea;
    private final Optional<String> nationalRoute;

    private RoadNetRequest(Builder b) {
        page = b.page;
        roadRefFilter = b.roadRefFilter;
        regions = b.regions;
        counties = b.counties;
        municipalities = b.municipalities;
        roadDepartments = b.roadDepartments;
        topologyLevel = b.topologyLevel;
        this.superId = b.superId;
        projection = b.projection;
        bbox = b.bbox;
        contractArea = b.contractArea;
        nationalRoute = b.nationalRoute;
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public Optional<Page> getPage() {
        return page;
    }

    public Optional<String> getRoadRefFilter() {
        return roadRefFilter;
    }

    public List<Integer> getRegions() {
        return regions;
    }

    public List<Integer> getCounties() {
        return counties;
    }

    public List<Integer> getMunicipalities() {
        return municipalities;
    }

    public List<Integer> getRoadDepartments() {
        return roadDepartments;
    }

    public List<Integer> getTopologyLevel() {
        return topologyLevel;
    }

    public List<Integer> getSuperId() {
        return superId;
    }

    public Optional<String> getBbox() {
        return bbox;
    }

    public Optional<Projection> getProjection() {
        return projection;
    }

    public Optional<String> getContractArea() {
        return contractArea;
    }

    public Optional<String> getNationalRoute() {
        return nationalRoute;
    }

    public static class Builder {
        private Optional<Page> page = Optional.empty();
        private Optional<String> roadRefFilter = Optional.empty();
        private List<Integer> regions = Collections.emptyList();
        private List<Integer> counties = Collections.emptyList();
        private List<Integer> municipalities = Collections.emptyList();
        private List<Integer> roadDepartments = Collections.emptyList();
        private List<Integer> topologyLevel = Collections.emptyList();
        private List<Integer> superId = Collections.emptyList();
        private List<Integer> id = Collections.emptyList();
        private Optional<String> bbox = Optional.empty();
        private Optional<Projection> projection = Optional.empty();
        private Optional<String> contractArea = Optional.empty();
        private Optional<String> nationalRoute = Optional.empty();

        private Builder() {
        }

        public RoadNetRequest build() {
            return new RoadNetRequest(this);
        }

        public Builder withPage(Page page) {
            this.page = Optional.ofNullable(page);
            return this;
        }

        public Builder withRoadRefFilter(String filter) {
            this.roadRefFilter = Optional.ofNullable(filter);
            return this;
        }

        public Builder withRegions(List<Integer> regions) {
            this.regions = Optional.ofNullable(regions).orElse(Collections.emptyList());
            return this;
        }

        public Builder withRegion(Integer region) {
            this.regions = Optional.ofNullable(region).map(Collections::singletonList).orElse(Collections.emptyList());
            return this;
        }

        public Builder withCounties(List<Integer> counties) {
            this.counties = Optional.ofNullable(counties).orElse(Collections.emptyList());
            return this;
        }

        public Builder withCounty(Integer county) {
            this.counties = Optional.ofNullable(county).map(Collections::singletonList).orElse(Collections.emptyList());
            return this;
        }

        public Builder withMunicipalities(List<Integer> municipalities) {
            this.municipalities = Optional.ofNullable(municipalities).orElse(Collections.emptyList());
            return this;
        }

        public Builder withMunicipality(Integer municipality) {
            this.municipalities = Optional.ofNullable(municipality).map(Collections::singletonList).orElse(Collections.emptyList());
            return this;
        }

        public Builder withRoadDepartments(List<Integer> roadDepartments) {
            this.roadDepartments = Optional.ofNullable(roadDepartments).orElse(Collections.emptyList());
            return this;
        }

        public Builder withTopologyLevel(List<Integer> topologyLevel) {
            this.topologyLevel = Optional.ofNullable(topologyLevel).orElse(Collections.emptyList());
            return this;
        }

        public Builder withSuperId(List<Integer> superId) {
            this.superId = Optional.ofNullable(superId).orElse(Collections.emptyList());
            return this;
        }

        public Builder withId(List<Integer> id) {
            this.id = Optional.ofNullable(id).orElse(Collections.emptyList());
            return this;
        }

        public Builder withRoadDepartment(Integer roadDepartment) {
            this.roadDepartments = Optional.ofNullable(roadDepartment).map(Collections::singletonList).orElse(Collections.emptyList());
            return this;
        }

        public Builder withBbox(String bbox) {
            this.bbox = Optional.ofNullable(bbox);
            return this;
        }

        public Builder withProjection(Projection projection) {
            this.projection = Optional.ofNullable(projection);
            return this;
        }

        public Builder withContractArea(String contractArea) {
            this.contractArea = Optional.ofNullable(contractArea);
            return this;
        }
{'fraction_non_alphanumeric': 0.08338199987022257, 'fraction_numerical': 0.001557329180455519, 'mean_word_length': 2.8694451418528746, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '679510', 'n_tokens_mistral': 4038, 'n_tokens_neox': 3745, 'n_words': 1093}