2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.openapi.vcs.changes;
18 import com.intellij.openapi.vcs.FilePathImpl;
19 import com.intellij.openapi.vcs.VcsRoot;
21 import java.util.ArrayList;
22 import java.util.List;
24 public class DirtBuilder implements DirtBuilderReader {
25 private final VcsGuess myGuess;
27 private final List<FilePathUnderVcs> myFiles;
28 private final List<FilePathUnderVcs> myDirs;
29 private boolean myEverythingDirty;
31 public DirtBuilder(final VcsGuess guess) {
33 myDirs = new ArrayList<FilePathUnderVcs>();
34 myFiles = new ArrayList<FilePathUnderVcs>();
35 myEverythingDirty = false;
38 public DirtBuilder(final DirtBuilder builder) {
39 myGuess = builder.myGuess;
40 myDirs = new ArrayList<FilePathUnderVcs>(builder.myDirs);
41 myFiles = new ArrayList<FilePathUnderVcs>(builder.myFiles);
42 myEverythingDirty = builder.myEverythingDirty;
48 myEverythingDirty = false;
51 public void everythingDirty() {
52 myEverythingDirty = true;
55 public void addDirtyFile(final VcsRoot root) {
56 myFiles.add(new FilePathUnderVcs(new FilePathImpl(root.path), root.vcs));
59 public void addDirtyDirRecursively(final VcsRoot root) {
60 myDirs.add(new FilePathUnderVcs(new FilePathImpl(root.path), root.vcs));
63 public void addDirtyFile(final FilePathUnderVcs root) {
67 public void addDirtyDirRecursively(final FilePathUnderVcs root) {
71 public boolean isEverythingDirty() {
72 return myEverythingDirty;
75 public List<FilePathUnderVcs> getFilesForVcs() {
79 public List<FilePathUnderVcs> getDirsForVcs() {
83 public boolean isEmpty() {
84 return myFiles.isEmpty() && myDirs.isEmpty();