Fix javadoc in org.eclipse.jgit ignore package

Change-Id: I1a81d371420cd4cf90ab9e048026c0ab8a763018
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2017-12-18 13:17:49 +01:00
parent d1804d3f74
commit 107c71a6e6
11 changed files with 55 additions and 16 deletions

View File

@ -77,6 +77,7 @@ public class FastIgnoreRule {
private final boolean dirOnly; private final boolean dirOnly;
/** /**
* Constructor for FastIgnoreRule
* *
* @param pattern * @param pattern
* ignore pattern as described in <a href= * ignore pattern as described in <a href=
@ -160,15 +161,18 @@ public boolean isMatch(String path, boolean directory) {
} }
/** /**
* @return True if the pattern is just a file name and not a path * Whether the pattern is just a file name and not a path
*
* @return {@code true} if the pattern is just a file name and not a path
*/ */
public boolean getNameOnly() { public boolean getNameOnly() {
return !(matcher instanceof PathMatcher); return !(matcher instanceof PathMatcher);
} }
/** /**
* Whether the pattern should match directories only
* *
* @return True if the pattern should match directories only * @return {@code true} if the pattern should match directories only
*/ */
public boolean dirOnly() { public boolean dirOnly() {
return dirOnly; return dirOnly;
@ -193,13 +197,17 @@ public boolean getResult() {
} }
/** /**
* @return true if the rule never matches (comment line or broken pattern) * Whether the rule never matches
*
* @return {@code true} if the rule never matches (comment line or broken
* pattern)
* @since 4.1 * @since 4.1
*/ */
public boolean isEmpty() { public boolean isEmpty() {
return matcher == NO_MATCH; return matcher == NO_MATCH;
} }
/** {@inheritDoc} */
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -212,6 +220,7 @@ public String toString() {
} }
/** {@inheritDoc} */
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
@ -222,6 +231,7 @@ public int hashCode() {
return result; return result;
} }
/** {@inheritDoc} */
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj)

View File

@ -81,7 +81,9 @@ public static enum MatchResult {
/** The rules that have been parsed into this node. */ /** The rules that have been parsed into this node. */
private final List<FastIgnoreRule> rules; private final List<FastIgnoreRule> rules;
/** Create an empty ignore node with no rules. */ /**
* Create an empty ignore node with no rules.
*/
public IgnoreNode() { public IgnoreNode() {
rules = new ArrayList<>(); rules = new ArrayList<>();
} }
@ -91,7 +93,7 @@ public IgnoreNode() {
* *
* @param rules * @param rules
* list of rules. * list of rules.
**/ */
public IgnoreNode(List<FastIgnoreRule> rules) { public IgnoreNode(List<FastIgnoreRule> rules) {
this.rules = rules; this.rules = rules;
} }
@ -102,7 +104,7 @@ public IgnoreNode(List<FastIgnoreRule> rules) {
* @param in * @param in
* input stream holding the standard ignore format. The caller is * input stream holding the standard ignore format. The caller is
* responsible for closing the stream. * responsible for closing the stream.
* @throws IOException * @throws java.io.IOException
* Error thrown when reading an ignore file. * Error thrown when reading an ignore file.
*/ */
public void parse(InputStream in) throws IOException { public void parse(InputStream in) throws IOException {
@ -122,7 +124,11 @@ private static BufferedReader asReader(InputStream in) {
return new BufferedReader(new InputStreamReader(in, Constants.CHARSET)); return new BufferedReader(new InputStreamReader(in, Constants.CHARSET));
} }
/** @return list of all ignore rules held by this node. */ /**
* Get list of all ignore rules held by this node
*
* @return list of all ignore rules held by this node
*/
public List<FastIgnoreRule> getRules() { public List<FastIgnoreRule> getRules() {
return Collections.unmodifiableList(rules); return Collections.unmodifiableList(rules);
} }
@ -194,6 +200,7 @@ public MatchResult isIgnored(String entryPath, boolean isDirectory,
return MatchResult.CHECK_PARENT; return MatchResult.CHECK_PARENT;
} }
/** {@inheritDoc} */
@Override @Override
public String toString() { public String toString() {
return rules.toString(); return rules.toString();

View File

@ -64,16 +64,19 @@ public abstract class AbstractMatcher implements IMatcher {
this.dirOnly = dirOnly; this.dirOnly = dirOnly;
} }
/** {@inheritDoc} */
@Override @Override
public String toString() { public String toString() {
return pattern; return pattern;
} }
/** {@inheritDoc} */
@Override @Override
public int hashCode() { public int hashCode() {
return pattern.hashCode(); return pattern.hashCode();
} }
/** {@inheritDoc} */
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj)

View File

@ -74,9 +74,10 @@ public boolean matches(String segment, int startIncl, int endExcl,
* with a slash) * with a slash)
* @param pathMatch * @param pathMatch
* {@code true} if the match is for the full path: prefix-only * {@code true} if the match is for the full path: prefix-only
* matches are not allowed, and {@link NameMatcher}s must match * matches are not allowed, and
* only the last component (if they can -- they may not, if they * {@link org.eclipse.jgit.ignore.internal.NameMatcher}s must
* are anchored at the beginning) * match only the last component (if they can -- they may not, if
* they are anchored at the beginning)
* @return true if this matcher pattern matches given string * @return true if this matcher pattern matches given string
*/ */
boolean matches(String path, boolean assumeDirectory, boolean pathMatch); boolean matches(String path, boolean assumeDirectory, boolean pathMatch);

View File

@ -55,6 +55,7 @@ public class LeadingAsteriskMatcher extends NameMatcher {
"Pattern must have leading asterisk: " + pattern); //$NON-NLS-1$ "Pattern must have leading asterisk: " + pattern); //$NON-NLS-1$
} }
/** {@inheritDoc} */
@Override @Override
public boolean matches(String segment, int startIncl, int endExcl, public boolean matches(String segment, int startIncl, int endExcl,
boolean assumeDirectory) { boolean assumeDirectory) {

View File

@ -71,6 +71,7 @@ public class NameMatcher extends AbstractMatcher {
} }
} }
/** {@inheritDoc} */
@Override @Override
public boolean matches(String path, boolean assumeDirectory, public boolean matches(String path, boolean assumeDirectory,
boolean pathMatch) { boolean pathMatch) {
@ -120,6 +121,7 @@ public boolean matches(String path, boolean assumeDirectory,
return false; return false;
} }
/** {@inheritDoc} */
@Override @Override
public boolean matches(String segment, int startIncl, int endExcl, public boolean matches(String segment, int startIncl, int endExcl,
boolean assumeDirectory) { boolean assumeDirectory) {

View File

@ -105,14 +105,17 @@ private static List<IMatcher> createMatchers(List<String> segments,
} }
/** /**
* Create path matcher
* *
* @param pattern * @param pattern
* a pattern
* @param pathSeparator * @param pathSeparator
* if this parameter isn't null then this character will not * if this parameter isn't null then this character will not
* match at wildcards(* and ? are wildcards). * match at wildcards(* and ? are wildcards).
* @param dirOnly * @param dirOnly
* a boolean.
* @return never null * @return never null
* @throws InvalidPatternException * @throws org.eclipse.jgit.errors.InvalidPatternException
*/ */
public static IMatcher createPathMatcher(String pattern, public static IMatcher createPathMatcher(String pattern,
Character pathSeparator, boolean dirOnly) Character pathSeparator, boolean dirOnly)
@ -170,6 +173,7 @@ private static IMatcher createNameMatcher0(String segment,
} }
} }
/** {@inheritDoc} */
@Override @Override
public boolean matches(String path, boolean assumeDirectory, public boolean matches(String path, boolean assumeDirectory,
boolean pathMatch) { boolean pathMatch) {
@ -212,6 +216,7 @@ private boolean simpleMatch(String path, boolean assumeDirectory,
return false; return false;
} }
/** {@inheritDoc} */
@Override @Override
public boolean matches(String segment, int startIncl, int endExcl, public boolean matches(String segment, int startIncl, int endExcl,
boolean assumeDirectory) { boolean assumeDirectory) {

View File

@ -56,8 +56,8 @@
import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.internal.JGitText;
/** /**
* Various {@link String} related utility methods, written mostly to avoid * Various {@link java.lang.String} related utility methods, written mostly to
* generation of new String objects (e.g. via splitting Strings etc). * avoid generation of new String objects (e.g. via splitting Strings etc).
*/ */
public class Strings { public class Strings {
@ -67,6 +67,8 @@ static char getPathSeparator(Character pathSeparator) {
} }
/** /**
* Strip trailing characters
*
* @param pattern * @param pattern
* non null * non null
* @param c * @param c
@ -87,6 +89,8 @@ public static String stripTrailing(String pattern, char c) {
} }
/** /**
* Strip trailing whitespace characters
*
* @param pattern * @param pattern
* non null * non null
* @return new string with all trailing whitespace removed * @return new string with all trailing whitespace removed
@ -105,10 +109,12 @@ public static String stripTrailingWhitespace(String pattern) {
} }
/** /**
* Check if pattern is a directory pattern ending with a path separator
*
* @param pattern * @param pattern
* non null * non null
* @return true if the last character, which is not whitespace, is a path * @return {@code true} if the last character, which is not whitespace, is a
* separator * path separator
*/ */
public static boolean isDirectoryPattern(String pattern) { public static boolean isDirectoryPattern(String pattern) {
for (int i = pattern.length() - 1; i >= 0; i--) { for (int i = pattern.length() - 1; i >= 0; i--) {

View File

@ -55,6 +55,7 @@ public class TrailingAsteriskMatcher extends NameMatcher {
"Pattern must have trailing asterisk: " + pattern); //$NON-NLS-1$ "Pattern must have trailing asterisk: " + pattern); //$NON-NLS-1$
} }
/** {@inheritDoc} */
@Override @Override
public boolean matches(String segment, int startIncl, int endExcl, public boolean matches(String segment, int startIncl, int endExcl,
boolean assumeDirectory) { boolean assumeDirectory) {

View File

@ -50,7 +50,7 @@
/** /**
* Matcher built from path segments containing wildcards. This matcher converts * Matcher built from path segments containing wildcards. This matcher converts
* glob wildcards to Java {@link Pattern}'s. * glob wildcards to Java {@link java.util.regex.Pattern}'s.
* <p> * <p>
* This class is immutable and thread safe. * This class is immutable and thread safe.
*/ */
@ -64,6 +64,7 @@ public class WildCardMatcher extends NameMatcher {
p = convertGlob(subPattern); p = convertGlob(subPattern);
} }
/** {@inheritDoc} */
@Override @Override
public boolean matches(String segment, int startIncl, int endExcl, public boolean matches(String segment, int startIncl, int endExcl,
boolean assumeDirectory) { boolean assumeDirectory) {

View File

@ -61,12 +61,14 @@ private WildMatcher() {
super(WILDMATCH, false); super(WILDMATCH, false);
} }
/** {@inheritDoc} */
@Override @Override
public final boolean matches(String path, boolean assumeDirectory, public final boolean matches(String path, boolean assumeDirectory,
boolean pathMatch) { boolean pathMatch) {
return true; return true;
} }
/** {@inheritDoc} */
@Override @Override
public final boolean matches(String segment, int startIncl, int endExcl, public final boolean matches(String segment, int startIncl, int endExcl,
boolean assumeDirectory) { boolean assumeDirectory) {