001package com.dev9.mvnwatcher.event;
002
003import java.nio.file.Path;
004import java.util.ArrayList;
005import java.util.Collections;
006import java.util.List;
007
008/**
009 * Created by IntelliJ IDEA.
010 * User: bbejeck
011 * Date: 2/20/12
012 * Time: 2:05 PM
013 */
014public class PathEvents implements PathEventContext {
015
016    private final List<PathEvent> pathEvents = new ArrayList<>();
017    private final Path watchedDirectory;
018    private final boolean isValid;
019
020    PathEvents(boolean valid, Path watchedDirectory) {
021        isValid = valid;
022        this.watchedDirectory = watchedDirectory;
023    }
024
025    @Override
026    public boolean isValid() {
027        return isValid;
028    }
029
030    @Override
031    public Path getWatchedDirectory() {
032        return watchedDirectory;
033    }
034
035    @Override
036    public List<PathEvent> getEvents() {
037        return Collections.unmodifiableList(pathEvents);
038    }
039
040    public void add(PathEvent pathEvent) {
041        pathEvents.add(pathEvent);
042    }
043}