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

com.exasol.adapter.document.documentfetcher.files.segmentation.ExplicitSegmentDescription Maven / Gradle / Ivy

There is a newer version: 8.1.3
Show newest version
package com.exasol.adapter.document.documentfetcher.files.segmentation;

import java.util.*;

/**
 * This {@link SegmentDescription} describes a segment by an explicit list of files.
 */
public class ExplicitSegmentDescription implements SegmentDescription {
    private static final long serialVersionUID = -9092990439459054785L;
    /** @serial */
    private final HashMap> segmentKeys;

    /**
     * Create a new instance of {@link SegmentDescription}.
     * 
     * @param filesToMatch list of files to match
     */
    public ExplicitSegmentDescription(final List filesToMatch) {
        this.segmentKeys = new HashMap<>();
        for (final FileSegment segmentToMatch : filesToMatch) {
            final String key = segmentToMatch.getFile().getResourceName();
            this.segmentKeys.putIfAbsent(key, new ArrayList<>());
            this.segmentKeys.get(key).add(segmentToMatch.getSegmentDescription());
        }
    }

    /**
     * Get the segment keys.
     * 
     * @return segment keys
     */
    public Map> getSegmentKeys() {
        return segmentKeys;
    }

    @Override
    public void accept(final SegmentDescriptionVisitor visitor) {
        visitor.visit(this);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy