Top Description Fields Constructors Methods
org.eclipse.jgit.ignore

public Class FastIgnoreRule

extends Object
Class Inheritance
Static Imports
org.eclipse.jgit.ignore.IMatcher.NO_MATCH, org.eclipse.jgit.ignore.internal.Strings.isDirectoryPattern, .Strings.stripTrailing, .Strings.stripTrailingWhitespace

"Fast" (compared with IgnoreRule) git ignore rule implementation supporting also double star ** pattern.

This class is immutable and thread safe.

Since
3.6

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private static final Logger
private IMatcher
public static final char
PATH_SEPARATOR

Character used as default path separator for ignore entries

Constructor Summary

AccessConstructor and Description
public
FastIgnoreRule(String
ignore pattern as described in git manual. If pattern is invalid or is not a pattern (comment), this rule doesn't match anything.
pattern
)

Constructor for FastIgnoreRule

pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the pattern should match directories only
dirOnly
()

Whether the pattern should match directories only

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public boolean

Returns:

true if the pattern is just a file name and not a path
getNameOnly
()

Whether the pattern is just a file name and not a path

public boolean

Returns:

True if the pattern had a "!" in front of it
getNegation
()

Indicates whether the rule is non-negation or negation.

public boolean

Returns:

True if the target is to be ignored, false otherwise.
getResult
()

Indicates whether the rule is non-negation or negation.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean

Returns:

true if the rule never matches (comment line or broken pattern)
isEmpty
()

Whether the rule never matches

public boolean

Returns:

True if a match was made. This does not necessarily mean that the target is ignored. Call getResult() for the result.
isMatch
(String
Name pattern of the file, relative to the base directory of this rule
path
,
boolean
Whether the target file is a directory or not
directory
)

Returns true if a match was made.

public boolean

Returns:

True if a match was made. This does not necessarily mean that the target is ignored. Call getResult() for the result.
isMatch
(String
Name pattern of the file, relative to the base directory of this rule
path
,
boolean
Whether the target file is a directory or not
directory
,
boolean
true if the match is for the full path: see IMatcher#matches(String, int, int)
pathMatch
)

Returns true if a match was made.

pack-priv void
parse(String pattern)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

dirOnlyback to summary
private boolean dirOnly
inverseback to summary
private boolean inverse
LOGback to summary
private static final Logger LOG
matcherback to summary
private IMatcher matcher
PATH_SEPARATORback to summary
public static final char PATH_SEPARATOR

Character used as default path separator for ignore entries

Constructor Detail

FastIgnoreRuleback to summary
public FastIgnoreRule(String pattern)

Constructor for FastIgnoreRule

Parameters
pattern:String

ignore pattern as described in git manual. If pattern is invalid or is not a pattern (comment), this rule doesn't match anything.

FastIgnoreRuleback to summary
pack-priv FastIgnoreRule()

Method Detail

dirOnlyback to summary
public boolean dirOnly()

Whether the pattern should match directories only

Returns:boolean

true if the pattern should match directories only

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getNameOnlyback to summary
public boolean getNameOnly()

Whether the pattern is just a file name and not a path

Returns:boolean

true if the pattern is just a file name and not a path

getNegationback to summary
public boolean getNegation()

Indicates whether the rule is non-negation or negation.

Returns:boolean

True if the pattern had a "!" in front of it

getResultback to summary
public boolean getResult()

Indicates whether the rule is non-negation or negation.

Returns:boolean

True if the target is to be ignored, false otherwise.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Whether the rule never matches

Returns:boolean

true if the rule never matches (comment line or broken pattern)

Since
4.1
isMatchback to summary
public boolean isMatch(String path, boolean directory)

Returns true if a match was made.
This function does NOT return the actual ignore status of the target! Please consult getResult() for the negation status. The actual ignore status may be true or false depending on whether this rule is an ignore rule or a negation rule.

Parameters
path:String

Name pattern of the file, relative to the base directory of this rule

directory:boolean

Whether the target file is a directory or not

Returns:boolean

True if a match was made. This does not necessarily mean that the target is ignored. Call getResult() for the result.

isMatchback to summary
public boolean isMatch(String path, boolean directory, boolean pathMatch)

Returns true if a match was made.
This function does NOT return the actual ignore status of the target! Please consult getResult() for the negation status. The actual ignore status may be true or false depending on whether this rule is an ignore rule or a negation rule.

Parameters
path:String

Name pattern of the file, relative to the base directory of this rule

directory:boolean

Whether the target file is a directory or not

pathMatch:boolean

true if the match is for the full path: see IMatcher#matches(String, int, int)

Returns:boolean

True if a match was made. This does not necessarily mean that the target is ignored. Call getResult() for the result.

Since
4.11
parseback to summary
pack-priv void parse(String pattern) throws InvalidPatternException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override