Class DefaultPartitioner
- All Implemented Interfaces:
IDocumentPartitioner,IDocumentPartitionerExtension,IDocumentPartitionerExtension2,IDocumentPartitionerExtension3
- Since:
- 3.14
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.As of 3.0, usegetManagingPositionCategories()instead.protected intDeprecated, for removal: This API element is subject to removal in a future version.The offset at which a partition has been deletedprotected IDocumentDeprecated, for removal: This API element is subject to removal in a future version.The partitioner's documentprotected intDeprecated, for removal: This API element is subject to removal in a future version.The offset at which the last changed partition endsprotected String[]Deprecated, for removal: This API element is subject to removal in a future version.The legal content types of this partitionerprotected DefaultPositionUpdaterDeprecated, for removal: This API element is subject to removal in a future version.The position updater used to for the default updating of partitionsprotected intDeprecated, for removal: This API element is subject to removal in a future version.The document length before a document change occurredprotected IPartitionTokenScannerDeprecated, for removal: This API element is subject to removal in a future version.The partitioner's scannerprotected intDeprecated, for removal: This API element is subject to removal in a future version.The offset at which the first changed partition starts -
Constructor Summary
ConstructorsConstructorDescriptionDefaultPartitioner(IPartitionTokenScanner scanner, String[] legalContentTypes) Deprecated, for removal: This API element is subject to removal in a future version.Creates a new partitioner that uses the given scanner and may return partitions of the given legal content types. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidDeprecated, for removal: This API element is subject to removal in a future version.computePartitioning(int offset, int length) Deprecated, for removal: This API element is subject to removal in a future version.Returns the partitioning of the given range of the connected document.computePartitioning(int offset, int length, boolean includeZeroLengthPartitions) Deprecated, for removal: This API element is subject to removal in a future version.Returns the partitioning of the given range of the connected document.voidDeprecated, for removal: This API element is subject to removal in a future version.Connects the partitioner to a document.voidDeprecated, for removal: This API element is subject to removal in a future version.Connects this partitioner to a document.voidDeprecated, for removal: This API element is subject to removal in a future version.Disconnects the partitioner from the document it is connected to.voidDeprecated, for removal: This API element is subject to removal in a future version.Informs about a forthcoming document change.booleanDeprecated, for removal: This API element is subject to removal in a future version.The document has been changed.Deprecated, for removal: This API element is subject to removal in a future version.The document has been changed.protected TypedPositionfindClosestPosition(int offset) Deprecated, for removal: This API element is subject to removal in a future version.Returns the position in the partitoner's position category which is close to the given offset.protected final voidDeprecated, for removal: This API element is subject to removal in a future version.Flushes the active rewrite session.Deprecated, for removal: This API element is subject to removal in a future version.Returns the active rewrite session of this document ornull.getContentType(int offset) Deprecated, for removal: This API element is subject to removal in a future version.Returns the content type of the partition containing the given offset in the connected document.getContentType(int offset, boolean preferOpenPartitions) Deprecated, for removal: This API element is subject to removal in a future version.Returns the content type of the partition containing the given offset in the connected document.String[]Deprecated, for removal: This API element is subject to removal in a future version.Returns the set of all legal content types of this partitioner.String[]Deprecated, for removal: This API element is subject to removal in a future version.Returns the position categories that this partitioners uses in order to manage the partitioning information of the documents.getPartition(int offset) Deprecated, for removal: This API element is subject to removal in a future version.Returns the partition containing the given offset of the connected document.getPartition(int offset, boolean preferOpenPartitions) Deprecated, for removal: This API element is subject to removal in a future version.Returns the partition containing the given offset of the connected document.protected StringgetTokenContentType(IToken token) Deprecated, for removal: This API element is subject to removal in a future version.Returns a content type encoded in the given token.protected voidDeprecated, for removal: This API element is subject to removal in a future version.Performs the initial partitioning of the partitioner's document.protected booleanisSupportedContentType(String contentType) Deprecated, for removal: This API element is subject to removal in a future version.Returns whether the given type is one of the legal content types.voidDeprecated, for removal: This API element is subject to removal in a future version.Tells the document partitioner that a rewrite session started.voidstopRewriteSession(DocumentRewriteSession session) Deprecated, for removal: This API element is subject to removal in a future version.Tells the document partitioner that the rewrite session has finished.
-
Field Details
-
CONTENT_TYPES_CATEGORY
Deprecated.As of 3.0, usegetManagingPositionCategories()instead.The position category this partitioner uses to store the document's partitioning information.- See Also:
-
fScanner
Deprecated, for removal: This API element is subject to removal in a future version.The partitioner's scanner -
fLegalContentTypes
Deprecated, for removal: This API element is subject to removal in a future version.The legal content types of this partitioner -
fDocument
Deprecated, for removal: This API element is subject to removal in a future version.The partitioner's document -
fPreviousDocumentLength
protected int fPreviousDocumentLengthDeprecated, for removal: This API element is subject to removal in a future version.The document length before a document change occurred -
fPositionUpdater
Deprecated, for removal: This API element is subject to removal in a future version.The position updater used to for the default updating of partitions -
fStartOffset
protected int fStartOffsetDeprecated, for removal: This API element is subject to removal in a future version.The offset at which the first changed partition starts -
fEndOffset
protected int fEndOffsetDeprecated, for removal: This API element is subject to removal in a future version.The offset at which the last changed partition ends -
fDeleteOffset
protected int fDeleteOffsetDeprecated, for removal: This API element is subject to removal in a future version.The offset at which a partition has been deleted
-
-
Constructor Details
-
DefaultPartitioner
Deprecated, for removal: This API element is subject to removal in a future version.Creates a new partitioner that uses the given scanner and may return partitions of the given legal content types.- Parameters:
scanner- the scanner this partitioner is supposed to uselegalContentTypes- the legal content types of this partitioner
-
-
Method Details
-
getManagingPositionCategories
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerExtension2Returns the position categories that this partitioners uses in order to manage the partitioning information of the documents. Returnsnullif no position category is used.- Specified by:
getManagingPositionCategoriesin interfaceIDocumentPartitionerExtension2- Returns:
- the position categories used to manage partitioning information or
null
-
connect
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerConnects the partitioner to a document. Connect indicates the begin of the usage of the receiver as partitioner of the given document. Thus, resources the partitioner needs to be operational for this document should be allocated.The caller of this method must ensure that this partitioner is also set as the document's document partitioner.
This method has been replaced with
IDocumentPartitionerExtension3.connect(IDocument, boolean). Implementers should default a callconnect(document)toconnect(document, false)in order to sustain the same semantics.- Specified by:
connectin interfaceIDocumentPartitioner- Parameters:
document- the document to be connected to
-
connect
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerExtension3Connects this partitioner to a document. Connect indicates the begin of the usage of the receiver as partitioner of the given document. Thus, resources the partitioner needs to be operational for this document should be allocated.The caller of this method must ensure that this partitioner is also set as the document's document partitioner.
delayInitializationindicates whether the partitioner is allowed to delay it initial computation of the document's partitioning until it has to answer the first query. ReplacesIDocumentPartitioner.connect(IDocument).- Specified by:
connectin interfaceIDocumentPartitionerExtension3- Parameters:
document- the document to be connected todelayInitialization-trueif initialization can be delayed,falseotherwise
-
checkInitialization
protected final void checkInitialization()Deprecated, for removal: This API element is subject to removal in a future version. -
initialize
protected void initialize()Deprecated, for removal: This API element is subject to removal in a future version.Performs the initial partitioning of the partitioner's document. -
disconnect
public void disconnect()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerDisconnects the partitioner from the document it is connected to. Disconnect indicates the end of the usage of the receiver as partitioner of the connected document. Thus, resources the partitioner needed to be operation for its connected document should be deallocated.The caller of this method should also must ensure that this partitioner is no longer the document's partitioner.
- Specified by:
disconnectin interfaceIDocumentPartitioner
-
documentAboutToBeChanged
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerInforms about a forthcoming document change. Will be called by the connected document and is not intended to be used by clients other than the connected document.- Specified by:
documentAboutToBeChangedin interfaceIDocumentPartitioner- Parameters:
e- the event describing the forthcoming change
-
documentChanged
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerThe document has been changed. The partitioner updates the document's partitioning and returns whether the structure of the document partitioning has been changed, i.e. whether partitions have been added or removed. Will be called by the connected document and is not intended to be used by clients other than the connected document.This method has been replaced by
IDocumentPartitionerExtension.documentChanged2(DocumentEvent).- Specified by:
documentChangedin interfaceIDocumentPartitioner- Parameters:
e- the event describing the document change- Returns:
trueif partitioning changed
-
documentChanged2
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerExtensionThe document has been changed. The partitioner updates the document's partitioning and returns the minimal region that comprises all partition changes caused in response to the given document event. This method returnsnullif the partitioning did not change.Will be called by the connected document and is not intended to be used by clients other than the connected document.
Replaces
IDocumentPartitioner.documentChanged(DocumentEvent).- Specified by:
documentChanged2in interfaceIDocumentPartitionerExtension- Parameters:
e- the event describing the document change- Returns:
- the region of the document in which the partition type changed or
null
-
findClosestPosition
Deprecated, for removal: This API element is subject to removal in a future version.Returns the position in the partitoner's position category which is close to the given offset. This is, the position has either an offset which is the same as the given offset or an offset which is smaller than the given offset. This method profits from the knowledge that a partitioning is a ordered set of disjoint position.- Parameters:
offset- the offset for which to search the closest position- Returns:
- the closest position in the partitioner's category
-
getContentType
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerReturns the content type of the partition containing the given offset in the connected document. There must be a document connected to this partitioner.Use
IDocumentPartitionerExtension2.getContentType(int, boolean)when zero-length partitions are supported. In that case this method is equivalent:IDocumentPartitionerExtension2 extension= (IDocumentPartitionerExtension2) partitioner; return extension.getContentType(offset, false);- Specified by:
getContentTypein interfaceIDocumentPartitioner- Parameters:
offset- the offset in the connected document- Returns:
- the content type of the offset's partition
-
getPartition
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerReturns the partition containing the given offset of the connected document. There must be a document connected to this partitioner.Use
IDocumentPartitionerExtension2.getPartition(int, boolean)when zero-length partitions are supported. In that case this method is equivalent:IDocumentPartitionerExtension2 extension= (IDocumentPartitionerExtension2) partitioner; return extension.getPartition(offset, false);- Specified by:
getPartitionin interfaceIDocumentPartitioner- Parameters:
offset- the offset for which to determine the partition- Returns:
- the partition containing the offset
-
computePartitioning
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerReturns the partitioning of the given range of the connected document. There must be a document connected to this partitioner.Use
IDocumentPartitionerExtension2.computePartitioning(int, int, boolean)when zero-length partitions are supported. In that case this method is equivalent:IDocumentPartitionerExtension2 extension= (IDocumentPartitionerExtension2) partitioner; return extension.computePartitioning(offset, length, false);- Specified by:
computePartitioningin interfaceIDocumentPartitioner- Parameters:
offset- the offset of the range of interestlength- the length of the range of interest- Returns:
- the partitioning of the range
-
getLegalContentTypes
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerReturns the set of all legal content types of this partitioner. I.e. any result delivered by this partitioner may not contain a content type which would not be included in this method's result.- Specified by:
getLegalContentTypesin interfaceIDocumentPartitioner- Returns:
- the set of legal content types
-
isSupportedContentType
Deprecated, for removal: This API element is subject to removal in a future version.Returns whether the given type is one of the legal content types.- Parameters:
contentType- the content type to check- Returns:
trueif the content type is a legal content type
-
getTokenContentType
Deprecated, for removal: This API element is subject to removal in a future version.Returns a content type encoded in the given token. If the token's data is notnulland a string it is assumed that it is the encoded content type.- Parameters:
token- the token whose content type is to be determined- Returns:
- the token's content type
-
getContentType
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerExtension2Returns the content type of the partition containing the given offset in the connected document. There must be a document connected to this partitioner.If
preferOpenPartitionsistrue, precedence is given to an open partition ending atoffsetover a delimited partition starting atoffset.This method replaces
IDocumentPartitioner.getContentType(int)and behaves like it whenprepreferOpenPartitionsisfalse, i.e. precedence is always given to the partition that does not end atoffset.- Specified by:
getContentTypein interfaceIDocumentPartitionerExtension2- Parameters:
offset- the offset in the connected documentpreferOpenPartitions-trueif precedence should be given to a open partition ending atoffsetover a delimited partition starting atoffset- Returns:
- the content type of the offset's partition
-
getPartition
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerExtension2Returns the partition containing the given offset of the connected document. There must be a document connected to this partitioner.If
preferOpenPartitionsistrue, precedence is given to an open partition ending atoffsetover a delimited partition starting atoffset.This method replaces
IDocumentPartitioner.getPartition(int)and behaves like it whenpreferOpenPartitionsisfalse, i.e. precedence is always given to the partition that does not end atoffset.- Specified by:
getPartitionin interfaceIDocumentPartitionerExtension2- Parameters:
offset- the offset for which to determine the partitionpreferOpenPartitions-trueif precedence should be given to a open partition ending atoffsetover a delimited partition starting atoffset- Returns:
- the partition containing the offset
-
computePartitioning
public ITypedRegion[] computePartitioning(int offset, int length, boolean includeZeroLengthPartitions) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerExtension2Returns the partitioning of the given range of the connected document. There must be a document connected to this partitioner.If
includeZeroLengthPartitionsistrue, a zero-length partition of an open partition type (usually the default partition) is included between two delimited partitions. If it isfalse, no zero-length partitions are included.This method replaces
IDocumentPartitioner.computePartitioning(int, int)and behaves like it whenincludeZeroLengthPartitionsisfalse.- Specified by:
computePartitioningin interfaceIDocumentPartitionerExtension2- Parameters:
offset- the offset of the range of interestlength- the length of the range of interestincludeZeroLengthPartitions-trueif zero-length partitions should be returned as part of the computed partitioning- Returns:
- the partitioning of the range
-
startRewriteSession
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerExtension3Tells the document partitioner that a rewrite session started. A rewrite session is a sequence of replace operations that form a semantic unit. The document partitioner is allowed to use that information for internal optimization.- Specified by:
startRewriteSessionin interfaceIDocumentPartitionerExtension3- Parameters:
session- the rewrite session- Throws:
IllegalStateException- in case there is already an active rewrite session
-
stopRewriteSession
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerExtension3Tells the document partitioner that the rewrite session has finished. This method is only called whenstartRewriteSessionhas been called before.- Specified by:
stopRewriteSessionin interfaceIDocumentPartitionerExtension3- Parameters:
session- the rewrite session
-
getActiveRewriteSession
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:IDocumentPartitionerExtension3Returns the active rewrite session of this document ornull.- Specified by:
getActiveRewriteSessionin interfaceIDocumentPartitionerExtension3- Returns:
- the active rewrite session or
null
-
flushRewriteSession
protected final void flushRewriteSession()Deprecated, for removal: This API element is subject to removal in a future version.Flushes the active rewrite session.- Since:
- 3.1
-
FastPartitionerinstead