public final class TextFragmentUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_INLINE_CODES |
| Constructor and Description |
|---|
TextFragmentUtil() |
| Modifier and Type | Method and Description |
|---|---|
static CodeAnomalies |
catalogCodeAnomalies(TextFragment source,
TextFragment target)
Store the missing, added or modified codes in the target as compared to
the source.
|
static CodeAnomalies |
catalogCodeAnomalies(TextFragment source,
TextFragment target,
boolean includeDeletable)
Store the missing oradded codes in the target as compared to the source.
|
static void |
copyCodes(TextFragment source,
TextFragment target,
boolean simplified)
Update the
Code's in "target" to match those of "source". |
static boolean |
moreThanMaxCodes(TextFragment tf) |
static TextFragment |
removeMoreThanMaxCodes(TextFragment tf) |
static String |
toText(TextFragment tf)
Render the
TextFragment including all Codes. |
public static final int MAX_INLINE_CODES
public static CodeAnomalies catalogCodeAnomalies(TextFragment source, TextFragment target)
To assure consistent ids and code data run
TextFragment.alignCodeIds(TextFragment) first.
source - - source TextFragment, use as the standard to compare
against.target - - target TextFragment to compare codes with source.CodeAnomalies or null if no anomalies.public static CodeAnomalies catalogCodeAnomalies(TextFragment source, TextFragment target, boolean includeDeletable)
To assure consistent ids and code data run
TextFragment.alignCodeIds(TextFragment) first.
source - - source TextFragment, use as the standard to compare
against.target - - target TextFragment to compare codes with source.includeDeletable - - do we count deletable codes as missing? True by default.CodeAnomalies or null if no anomalies.public static boolean moreThanMaxCodes(TextFragment tf)
public static TextFragment removeMoreThanMaxCodes(TextFragment tf)
public static String toText(TextFragment tf)
TextFragment including all Codes.
differs from TextFragment.toText() by also using outerData.tf - The TextFragment to renderpublic static void copyCodes(TextFragment source, TextFragment target, boolean simplified)
Code's in "target" to match those of "source". But only if the "target"
code has empty data. Otherwise keep the target code data as-is.
Codes match if both data and TagType are the same.source - TextFragment codes are used to match codes in "to"target - TextFragment that has its code id's updated to match "from"simplified - not used(?)Copyright © 2020. All rights reserved.