[JGIT PATCH 07/22] Added the class Rule.
Signed-off-by: Florian Koeberle <florianskarten@web.de>
---
.../org/spearce/jgit/lib/fileiteration/Rule.java | 58 ++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
create mode 100644 org.spearce.jgit/src/org/spearce/jgit/lib/fileiteration/Rule.java
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/fileiteration/Rule.java b/org.spearce.jgit/src/org/spearce/jgit/lib/fileiteration/Rule.java
new file mode 100644
index 0000000..733bb6a
--- /dev/null
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/fileiteration/Rule.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2008 Florian Köberle
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License, version 2, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ */
+package org.spearce.jgit.lib.fileiteration;
+
+/**
+ * A Rule defines what to do with a files which match a specified
+ * {@link FilePattern}.
+ */
+class Rule {
+ private boolean ignoreAtMatch;
+
+ private FilePattern pattern;
+
+ Rule(boolean ignoreAtMatch, FilePattern pattern) {
+ this.ignoreAtMatch = ignoreAtMatch;
+ this.pattern = pattern;
+ }
+
+ FilePattern getPattern() {
+ return pattern;
+ }
+
+ boolean isIgnoreAtMatch() {
+ return ignoreAtMatch;
+ }
+
+ Rule getRuleForSubDirectory(String directoryName) {
+ final FilePattern subPattern = pattern
+ .getPatternForSubDirectory(directoryName);
+ if (subPattern == pattern) {
+ return this;
+ }
+ return new Rule(ignoreAtMatch, subPattern);
+ }
+
+ boolean canMatchAtThisDirectoryLevel() {
+ return pattern.canMatchAtThisDirectoryLevel();
+ }
+
+ boolean isSameForSubDirectories() {
+ return pattern.isSameForSubDirectories();
+ }
+
+}
--
1.5.2.5