C# Class GitSharp.Core.TreeWalk.AbstractTreeIterator

Walks a Git tree (directory) in Git sort order. A new iterator instance should be positioned on the first entry, or at eof. Data for the first entry (if not at eof) should be available immediately. Implementors must walk a tree in the Git sort order, which has the following odd sorting: A.c A/c A0c In the second item, A is the name of a subtree and c is a file within that subtree. The other two items are files in the root level tree.
Exibir arquivo Open project: jagregory/GitSharp Class Usage Examples

Public Properties

Property Type Description
DEFAULT_PATH_SIZE int

Protected Properties

Property Type Description
ZeroId byte[]

Public Methods

Method Description
back ( int delta ) : void

Move to prior entry, populating this iterator with the entry data. The delta indicates how many moves backward should occur. The most common delta is 1 to move to the prior entry. Implementations must populate the following members:

  • Mode
  • {@link #_path} (from {@link #_pathOffset} to {@link #_pathLen})
  • {@link #_pathLen}
as well as any implementation dependent information necessary to accurately return data from idBuffer() and idOffset() when demanded.

createEmptyTreeIterator ( ) : GitSharp.Core.TreeWalk.EmptyTreeIterator
createSubtreeIterator ( Repository repo ) : AbstractTreeIterator
createSubtreeIterator ( Repository repo, MutableObjectId idBuffer, WindowCursor curs ) : AbstractTreeIterator
eof ( ) : bool
first ( ) : bool
getEntryObjectId ( ) : ObjectId

Gets the ObjectId of the current entry.

getEntryObjectId ( MutableObjectId objectId ) : void

Gets the ObjectId of the current entry.

getName ( byte buffer, int offset ) : void

Get the name component of the current entry path into the provided buffer.

growPath ( int len ) : void

Grow the _path buffer larger.

idBuffer ( ) : byte[]

Get the byte array buffer object IDs must be copied out of. The id buffer contains the bytes necessary to construct an ObjectId for the current entry of this iterator. The buffer can be the same buffer for all entries, or it can be a unique buffer per-entry. Implementations are encouraged to expose their private buffer whenever possible to reduce garbage generation and copying costs.

idEqual ( AbstractTreeIterator otherIterator ) : bool

Check if the current entry of both iterators has the same id. This method is faster than getEntryObjectId()as it does not require copying the bytes out of the buffers. A direct idBuffer compare operation is performed.

idOffset ( ) : int
next ( int delta ) : void
pathCompare ( AbstractTreeIterator treeIterator ) : int

Compare the path of this current entry to another iterator's entry.

pathCompare ( AbstractTreeIterator treeIterator, int treeIteratorMode ) : int

Compare the path of this current entry to another iterator's entry.

skip ( ) : void

Advance to the next tree entry, populating this iterator with its data. This method behaves like seek(1) but is called by TreeWalk only if a TreeFilter was used and ruled out the current entry from the results. In such cases this tree iterator may perform special behavior.

stopWalk ( ) : void

Indicates to the iterator that no more entries will be Read. This is only invoked by TreeWalk when the iteration is aborted early due to a StopWalkException being thrown from within a TreeFilter.

Protected Methods

Method Description
AbstractTreeIterator ( ) : System

Create a new iterator with no parent.

AbstractTreeIterator ( AbstractTreeIterator p ) : System

Create an iterator for a subtree of an existing iterator.

AbstractTreeIterator ( AbstractTreeIterator p, byte childPath, int childPathOffset ) : System

Create an iterator for a subtree of an existing iterator. The caller is responsible for setting up the path of the child iterator.

AbstractTreeIterator ( byte prefix ) : System

Create a new iterator with no parent and a prefix. The prefix path supplied is inserted in front of all paths generated by this iterator. It is intended to be used when an iterator is being created for a subsection of an overall repository and needs to be combined with other iterators that are created to run over the entire repository namespace.

AbstractTreeIterator ( string prefix ) : System

Create a new iterator with no parent and a prefix. The prefix path supplied is inserted in front of all paths generated by this iterator. It is intended to be used when an iterator is being created for a subsection of an overall repository and needs to be combined with other iterators that are created to run over the entire repository namespace.

ensurePathCapacity ( int capacity, int length ) : void

Ensure that path is capable to hold at least capacity bytes.

Private Methods

Method Description
AlreadyMatch ( AbstractTreeIterator a, AbstractTreeIterator b ) : int
LastPathChar ( int mode ) : int
SetPathCapacity ( int capacity, int length ) : void

Set path buffer capacity to the specified size

Method Details

AbstractTreeIterator() protected method

Create a new iterator with no parent.
protected AbstractTreeIterator ( ) : System
return System

AbstractTreeIterator() protected method

Create an iterator for a subtree of an existing iterator.
protected AbstractTreeIterator ( AbstractTreeIterator p ) : System
p AbstractTreeIterator parent tree iterator.
return System

AbstractTreeIterator() protected method

Create an iterator for a subtree of an existing iterator. The caller is responsible for setting up the path of the child iterator.
protected AbstractTreeIterator ( AbstractTreeIterator p, byte childPath, int childPathOffset ) : System
p AbstractTreeIterator parent tree iterator.
childPath byte /// Path array to be used by the child iterator. This path must /// contain the path from the top of the walk to the first child /// and must end with a '/'. ///
childPathOffset int /// position within childPath where the child can /// insert its data. The value at /// childPath[childPathOffset-1] must be '/'. ///
return System

AbstractTreeIterator() protected method

Create a new iterator with no parent and a prefix. The prefix path supplied is inserted in front of all paths generated by this iterator. It is intended to be used when an iterator is being created for a subsection of an overall repository and needs to be combined with other iterators that are created to run over the entire repository namespace.
protected AbstractTreeIterator ( byte prefix ) : System
prefix byte /// position of this iterator in the repository tree. The value /// may be null or the empty array to indicate the prefix is the /// root of the repository. A trailing slash ('/') is /// automatically appended if the prefix does not end in '/'. ///
return System

AbstractTreeIterator() protected method

Create a new iterator with no parent and a prefix. The prefix path supplied is inserted in front of all paths generated by this iterator. It is intended to be used when an iterator is being created for a subsection of an overall repository and needs to be combined with other iterators that are created to run over the entire repository namespace.
protected AbstractTreeIterator ( string prefix ) : System
prefix string /// position of this iterator in the repository tree. The value /// may be null or the empty string to indicate the prefix is the /// root of the repository. A trailing slash ('/') is /// automatically appended if the prefix does not end in '/'. ///
return System

back() public abstract method

Move to prior entry, populating this iterator with the entry data. The delta indicates how many moves backward should occur. The most common delta is 1 to move to the prior entry. Implementations must populate the following members:
  • Mode
  • {@link #_path} (from {@link #_pathOffset} to {@link #_pathLen})
  • {@link #_pathLen}
as well as any implementation dependent information necessary to accurately return data from idBuffer() and idOffset() when demanded.
public abstract back ( int delta ) : void
delta int /// Number of entries to move the iterator by. Must be a positive, /// non-zero integer. ///
return void

createEmptyTreeIterator() public method

public createEmptyTreeIterator ( ) : GitSharp.Core.TreeWalk.EmptyTreeIterator
return GitSharp.Core.TreeWalk.EmptyTreeIterator

createSubtreeIterator() public abstract method

public abstract createSubtreeIterator ( Repository repo ) : AbstractTreeIterator
repo Repository
return AbstractTreeIterator

createSubtreeIterator() public method

public createSubtreeIterator ( Repository repo, MutableObjectId idBuffer, WindowCursor curs ) : AbstractTreeIterator
repo Repository
idBuffer MutableObjectId
curs WindowCursor
return AbstractTreeIterator

ensurePathCapacity() protected method

Ensure that path is capable to hold at least capacity bytes.
protected ensurePathCapacity ( int capacity, int length ) : void
capacity int the amount of bytes to hold
length int the amount of live bytes in path buffer
return void

eof() public abstract method

public abstract eof ( ) : bool
return bool

first() public abstract method

public abstract first ( ) : bool
return bool

getEntryObjectId() public method

Gets the ObjectId of the current entry.
public getEntryObjectId ( ) : ObjectId
return ObjectId

getEntryObjectId() public method

Gets the ObjectId of the current entry.
public getEntryObjectId ( MutableObjectId objectId ) : void
objectId MutableObjectId buffer to copy the object id into.
return void

getName() public method

Get the name component of the current entry path into the provided buffer.
public getName ( byte buffer, int offset ) : void
buffer byte /// The buffer to get the name into, it is assumed that buffer can hold the name. ///
offset int /// The offset of the name in the ///
return void

growPath() public method

Grow the _path buffer larger.
public growPath ( int len ) : void
len int /// Number of live bytes in the path buffer. This many bytes will /// be moved into the larger buffer. ///
return void

idBuffer() public abstract method

Get the byte array buffer object IDs must be copied out of. The id buffer contains the bytes necessary to construct an ObjectId for the current entry of this iterator. The buffer can be the same buffer for all entries, or it can be a unique buffer per-entry. Implementations are encouraged to expose their private buffer whenever possible to reduce garbage generation and copying costs.
public abstract idBuffer ( ) : byte[]
return byte[]

idEqual() public method

Check if the current entry of both iterators has the same id. This method is faster than getEntryObjectId()as it does not require copying the bytes out of the buffers. A direct idBuffer compare operation is performed.
public idEqual ( AbstractTreeIterator otherIterator ) : bool
otherIterator AbstractTreeIterator the other iterator to test against.
return bool

idOffset() public abstract method

public abstract idOffset ( ) : int
return int

next() public abstract method

public abstract next ( int delta ) : void
delta int
return void

pathCompare() public method

Compare the path of this current entry to another iterator's entry.
public pathCompare ( AbstractTreeIterator treeIterator ) : int
treeIterator AbstractTreeIterator /// The other iterator to compare the path against. ///
return int

pathCompare() public method

Compare the path of this current entry to another iterator's entry.
public pathCompare ( AbstractTreeIterator treeIterator, int treeIteratorMode ) : int
treeIterator AbstractTreeIterator /// The other iterator to compare the path against. ///
treeIteratorMode int /// The other iterator bits. ///
return int

skip() public method

Advance to the next tree entry, populating this iterator with its data. This method behaves like seek(1) but is called by TreeWalk only if a TreeFilter was used and ruled out the current entry from the results. In such cases this tree iterator may perform special behavior.
public skip ( ) : void
return void

stopWalk() public method

Indicates to the iterator that no more entries will be Read. This is only invoked by TreeWalk when the iteration is aborted early due to a StopWalkException being thrown from within a TreeFilter.
public stopWalk ( ) : void
return void

Property Details

DEFAULT_PATH_SIZE public_oe static_oe property

Default size for the Path buffer.
public static int DEFAULT_PATH_SIZE
return int

ZeroId protected_oe static_oe property

A dummy ObjectId buffer that matches the zero ObjectId.
protected static byte[] ZeroId
return byte[]