Class ResourceDiff

All Implemented Interfaces:
IDiff, ITwoWayDiff, IResourceDiff

public class ResourceDiff extends TwoWayDiff implements IResourceDiff
Implementation of IResourceDiff.

This class may be subclassed by clients.

Since:
3.2
  • Constructor Details

    • ResourceDiff

      public ResourceDiff(IResource resource, int kind, int flags, IFileRevision before, IFileRevision after)
      Create a two-way resource diff
      Parameters:
      resource - the resource
      kind - the kind of change (ADDED, REMOVED or CHANGED)
      flags - additional flags that describe the change
      before - the before state of the model object
      after - the after state of the model object
    • ResourceDiff

      public ResourceDiff(IResource resource, int kind)
      Convenience constructor for creating a simple folder diff that consists of a resource and a kind only. It is equivalent to ResourceDiff(resource, kind, 0, null, null)
      Parameters:
      resource - a resource
      kind - the kind of change (ADDED, REMOVED or CHANGED)
  • Method Details

    • getBeforeState

      public IFileRevision getBeforeState()
      Description copied from interface: IResourceDiff
      Return a handle to the file state representing the "before" state of the file used to calculate this diff. A null is returned if the resource is not a file or if the file does not exist in the before state. If a file state is returned, clients should still check the IFileState.exists() method to see if the file existed in the before state.
      Specified by:
      getBeforeState in interface IResourceDiff
      Returns:
      a handle to the file state representing the "before" state used to calculate this diff
    • getAfterState

      public IFileRevision getAfterState()
      Description copied from interface: IResourceDiff
      Return a handle to the file state representing the "after" state of the file used to calculate this diff. A null is returned if the resource is not a file or if the file does not exist in the after state. If a file state is returned, clients should still check the IFileState.exists() method to see if the file existed in the after state.
      Specified by:
      getAfterState in interface IResourceDiff
      Returns:
      a handle to the file state representing the "before" state used to calculate this diff
    • getResource

      public IResource getResource()
      Description copied from interface: IResourceDiff
      Return the local resource to which this diff applies.
      Specified by:
      getResource in interface IResourceDiff
      Returns:
      the local resource to which this diff applies
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class TwoWayDiff