Package org.eclipse.handly.snapshot

# Class Snapshot

java.lang.Object
org.eclipse.handly.snapshot.Snapshot

All Implemented Interfaces:
  `ISnapshot`

Direct Known Subclasses:
  `DocumentSnapshot`, `NonExpiringSnapshot`, `TextFileBufferSnapshot`, `TextFileSnapshot`, `TextFileStoreSnapshot`

public abstract class Snapshot extends Object implements ISnapshot
Abstract superclass of all snapshots. Implements an equivalence relation on snapshots.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Snapshot()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final boolean`
  `isEqualTo(ISnapshot other)`
  Indicates whether some other snapshot is "equal to" this one.
  `protected Boolean`
  `predictEquality(Snapshot other)`
  Predicts whether this snapshot is `equal` to the given snapshot without actually obtaining snapshot `contents`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.eclipse.handly.snapshot.ISnapshot

  `getContents`

- ## Constructor Details

  - ### Snapshot

    public Snapshot()

- ## Method Details

  - ### isEqualTo

    public final boolean isEqualTo(ISnapshot other)
    Description copied from interface: `ISnapshot`
    Indicates whether some other snapshot is "equal to" this one.

    If snapshots are equal they have equal contents (or had had equal contents before one or both of them expired). However, the converse is not necessarily true.

    Note that snapshots which are equal but not identical may become unequal when one or both of them expire, and may become equal again in case they return to the valid (unexpired) state.

    Implementations of this method must be reflexive, symmetric and transitive on non-null references.

    Specified by:
      `isEqualTo` in interface `ISnapshot`
    Parameters:
      `other` - a snapshot to compare or `null`
    Returns:
      `true` if the snapshots are equal, and `false` otherwise

  - ### predictEquality

    protected Boolean predictEquality(Snapshot other)
    Predicts whether this snapshot is `equal` to the given snapshot without actually obtaining snapshot `contents`. Must return `null` if cannot tell for sure. Any non-null result must meet the contract of `ISnapshot.isEqualTo(ISnapshot)`.
    Parameters:
      `other` - the other snapshot (not `null` and not identical to the receiver)
    Returns:
      `true` if the snapshots are predicted to be equal, `false` if the snapshots are predicted to be unequal, and `null` if there is no prediction