public class FileCallbackLocalCmp extends java.lang.Object implements FileRemoteWalkerCallback
Modifier and Type | Class and Description |
---|---|
(package private) class |
FileCallbackLocalCmp.CompareCtrl |
SortedTreeWalkerCallback.Result
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
aborted |
private java.lang.String |
basepath1 |
private FileRemoteWalkerCallback |
callbackUser
Event to walk through the second tree.
|
(package private) static int |
cmp_content |
(package private) static int |
cmp_onlyTimestamp |
(package private) static int |
cmp_withoutComment |
(package private) static int |
cmp_withoutEndlineComment |
(package private) static int |
cmp_withoutLineend |
private FileCallbackLocalCmp.CompareCtrl |
cmpCtrl |
private FileRemote |
dir1 |
private FileRemote |
dir2 |
private EventWithDst<FileRemoteProgressEvData,?> |
evBack
Event instance for user callback.
|
(package private) long |
minDiffTimestamp |
(package private) int |
mode |
private FileRemoteProgressEvData |
progress |
static java.lang.String |
sVersion
Version, history and license.
|
(package private) FileRemoteWalkerCallback |
XXXcallbackMarkSecondAlone
Callback to mark all files of the second directory as 'alone' on open directory.
|
private int |
zBasePath1 |
callbackTemplate
Constructor and Description |
---|
FileCallbackLocalCmp(FileRemote dir1,
FileRemote dir2,
FileRemoteWalkerCallback callbackUser,
EventWithDst<FileRemoteProgressEvData,?> evBack)
Constructs an instance to execute a comparison of directory trees.
|
Modifier and Type | Method and Description |
---|---|
(package private) int |
compareFile(FileRemote file1,
FileRemote file2)
Compare two files.
|
(package private) boolean |
compareFileContent(FileRemote file1,
FileRemote file2)
Compare two files.
|
void |
finished(FileRemote startDir)
Invoked after finishing the walking through.
|
SortedTreeWalkerCallback.Result |
finishedParentNode(FileRemote file,
java.lang.Object data,
java.lang.Object oWalkInfo)
Checks whether all files are compared or whether there are alone files.
|
SortedTreeWalkerCallback.Result |
offerLeafNode(FileRemote file,
java.lang.Object info)
Invoked for any node which has no children or which is not processed because the depth of walking through the tree is reached.
|
SortedTreeWalkerCallback.Result |
offerParentNode(FileRemote dir,
java.lang.Object oPath,
java.lang.Object oWalkInfo)
Invoked on start on walking through a parent node which have children.
|
private java.lang.String |
readIgnoreComment(java.io.BufferedReader reader) |
boolean |
shouldAborted()
Returns true if the tree walking should be terminated respectively aborted.
|
void |
start(FileRemote startDir,
FileRemoteCmdEventData co)
On start of comparison it refreshes the second dir tree.
|
public static final java.lang.String sVersion
FileRemoteProgressEvData
: remove progress.show(...)
because it is called in the timer thread instead. Independent of continue the process here.
readIgnoreComment(BufferedReader)
: The second line after //line is ignored too. In a rarely case
it was the only one line which was different, and the comparison has failed.
compareFileContent(FileRemote, FileRemote)
: if the 2. file is longer, it is a difference!
FileCallbackLocalCmp.CompareCtrl
: Comparison with suppressed parts especially comments.
private final FileCallbackLocalCmp.CompareCtrl cmpCtrl
private final FileRemote dir1
private final FileRemote dir2
private final java.lang.String basepath1
private final int zBasePath1
private final EventWithDst<FileRemoteProgressEvData,?> evBack
private final FileRemoteProgressEvData progress
private final FileRemoteWalkerCallback callbackUser
int mode
long minDiffTimestamp
static final int cmp_onlyTimestamp
static final int cmp_content
static final int cmp_withoutLineend
static final int cmp_withoutEndlineComment
static final int cmp_withoutComment
boolean aborted
final FileRemoteWalkerCallback XXXcallbackMarkSecondAlone
#offerParentNode(FileRemote)
on any directory
in the dir1. A new dir is searched in the dir2 tree, then the children in 1 level are marked.public FileCallbackLocalCmp(FileRemote dir1, FileRemote dir2, FileRemoteWalkerCallback callbackUser, EventWithDst<FileRemoteProgressEvData,?> evBack)
dir1
- One directory which contains a file tree. All files are compared with dir2dir2
- The other directory to comparecallbackUser
- Maybe null. If given, on each directory entry, exit and file the callback will be invoked
with the handled directory or file. The second argument is an boxed Integer, which contains the bits from
FileMark
to inform what is with that file.timeOrderProgress
- maybe null. If given this timeOrder is used to show the progression of the comparison.
The timeOrder is set with datapublic void start(FileRemote startDir, FileRemoteCmdEventData co)
start
in interface SortedTreeWalkerCallback<FileRemote,FileRemoteCmdEventData>
public SortedTreeWalkerCallback.Result offerParentNode(FileRemote dir, java.lang.Object oPath, java.lang.Object oWalkInfo)
SortedTreeWalkerCallback
#offerLeafNode(TypeNode)
is not invoked.offerParentNode
in interface SortedTreeWalkerCallback<FileRemote,FileRemoteCmdEventData>
oPath
- Specific data presentation of the nodeoWalkInfo
- internal possible information about walking, depending on usage.public SortedTreeWalkerCallback.Result finishedParentNode(FileRemote file, java.lang.Object data, java.lang.Object oWalkInfo)
finishedParentNode
in interface SortedTreeWalkerCallback<FileRemote,FileRemoteCmdEventData>
file
- the node which was walked throughdata
- Specific data presentation of the nodeoWalkInfo
- internal possible information about walking, depending on usage.public SortedTreeWalkerCallback.Result offerLeafNode(FileRemote file, java.lang.Object info)
SortedTreeWalkerCallback
#offerLeafNode(Object)
, only one of both is called for a node.
For example it is invoked for a sub directory only if the depth is reached and #offerParentNode(TypeNode)
is not called.offerLeafNode
in interface SortedTreeWalkerCallback<FileRemote,FileRemoteCmdEventData>
public boolean shouldAborted()
SortedTreeWalkerCallback
shouldAborted
in interface SortedTreeWalkerCallback<FileRemote,FileRemoteCmdEventData>
int compareFile(FileRemote file1, FileRemote file2)
file1
- file2
- both file should be exist. It is tested before.FileMark.cmpContentEqual
or boolean compareFileContent(FileRemote file1, FileRemote file2) throws java.io.IOException
file
- java.io.FileNotFoundException
java.io.IOException
private java.lang.String readIgnoreComment(java.io.BufferedReader reader) throws java.io.IOException
java.io.IOException
public void finished(FileRemote startDir)
SortedTreeWalkerCallback
finished
in interface SortedTreeWalkerCallback<FileRemote,FileRemoteCmdEventData>