org.entityfs.util.dirdiff
Class EntitySizeAndModificationTimeMatchStrategy
java.lang.Object
org.entityfs.util.dirdiff.EntitySizeAndModificationTimeMatchStrategy
- All Implemented Interfaces:
- EntityMatchStrategy
- Direct Known Subclasses:
- EntitySizeAndFileModificationTimeMatchStrategy, FileSizeAndModificationTimeMatchStrategy
public class EntitySizeAndModificationTimeMatchStrategy
- extends Object
- implements EntityMatchStrategy
This EntityMatchStrategy
matches entities with the same names and
types. The modification time of the target entity must be equal to or later
than the modification time of the master entity. If the entities are files,
their sizes must be equal.
Files with dissimilar contents that happen to have the same size are matched
by this filter.
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
- In_jar:
- entityfs-util
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INSTANCE
public static final EntitySizeAndModificationTimeMatchStrategy INSTANCE
EntitySizeAndModificationTimeMatchStrategy
public EntitySizeAndModificationTimeMatchStrategy()
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
- 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.