org.entityfs.util.dirdiff
Class FileSizeAndModificationTimeMatchStrategy
java.lang.Object
org.entityfs.util.dirdiff.EntitySizeAndModificationTimeMatchStrategy
org.entityfs.util.dirdiff.FileSizeAndModificationTimeMatchStrategy
- All Implemented Interfaces:
- EntityMatchStrategy
public class FileSizeAndModificationTimeMatchStrategy
- extends EntitySizeAndModificationTimeMatchStrategy
This EntityMatchStrategy
only matches files with the same names and
sizes. The modification time of the target file must be equal to or later
than the modification time of the master file.
Files with dissimilar contents that happen to have the same size are matched
by this filter.
This strategy does not match any other entities than files.
Since objects of this class contains no mutable internal state, the singleton
instance INSTANCE
may be used instead of instantiating this class.
- Since:
- 1.0
- Author:
- Karl Gustafsson
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INSTANCE
public static final FileSizeAndModificationTimeMatchStrategy INSTANCE
FileSizeAndModificationTimeMatchStrategy
public FileSizeAndModificationTimeMatchStrategy()
getMatchingEntityName
public String getMatchingEntityName(EntityView ev,
Map<String,? extends EntityView> m)
- Description copied from interface:
EntityMatchStrategy
- Check if there is a matching entity in the supplied entity map. If there
is one, return its name.
When this method is called, the master directory (ev
's parent) is
locked for reading, and the target directory (the parent of all entities
in the map) is locked for writing.
- Specified by:
getMatchingEntityName
in interface EntityMatchStrategy
- Overrides:
getMatchingEntityName
in class EntitySizeAndModificationTimeMatchStrategy
- Parameters:
ev
- The entity to search for a matching entity to.m
- A map containing all remaining entities in the target
directory, keyed under their names. Remaining entities are all of the
entities in the target directory that has not been matched by a previous
invocation of this method.
- Returns:
- The name of the matching entity, or
null
if no entity in
the target directory matched ev
. The returned name, if non-null,
must be the same as one of the keys in the map.