Package org.eclipse.handly.snapshot
Class DocumentSnapshot
java.lang.Object
org.eclipse.handly.snapshot.Snapshot
org.eclipse.handly.snapshot.DocumentSnapshot
- All Implemented Interfaces:
ISnapshot
A snapshot of an
IDocument. Thread-safe.-
Constructor Summary
ConstructorsConstructorDescriptionDocumentSnapshot(org.eclipse.jface.text.IDocument document) Constructs a new snapshot of the given document. -
Method Summary
Modifier and TypeMethodDescriptionA snapshot returns the same contents until it expires.protected BooleanpredictEquality(Snapshot other)
-
Constructor Details
-
DocumentSnapshot
public DocumentSnapshot(org.eclipse.jface.text.IDocument document) Constructs a new snapshot of the given document.- Parameters:
document- must not benulland must implementIDocumentExtension4.
-
-
Method Details
-
getContents
Description copied from interface:ISnapshotA snapshot returns the same contents until it expires. This is the contents of the underlying resource or buffer at the moment the snapshot was taken. Expired snapshots returnnull.Protractedly holding on to the returned contents is not recommended, as it may potentially consume significant amount of space.
- Returns:
- the contents of the snapshot, or
nullif the snapshot has expired
-
predictEquality
Description copied from class:SnapshotPredicts whether this snapshot isequalto the given snapshot without actually obtaining snapshotcontents. Must returnnullif cannot tell for sure. Any non-null result must meet the contract ofISnapshot.isEqualTo(ISnapshot).- Overrides:
predictEqualityin classSnapshot- Parameters:
other- the other snapshot (notnulland not identical to the receiver)- Returns:
trueif the snapshots are predicted to be equal,falseif the snapshots are predicted to be unequal, andnullif there is no prediction
-