Module com.iamsoft.util.ui
Class SimpleEditor.PosToHighlightMapBuilder
- java.lang.Object
-
- com.iamsoft.util.ui.javafx.codearea.SimpleEditor.PosToHighlightMapBuilder
-
- Enclosing class:
- SimpleEditor
public static class SimpleEditor.PosToHighlightMapBuilder extends Object
Used for building position-to-highlight maps, which are used to apply highlights.
-
-
Constructor Summary
Constructors Constructor Description PosToHighlightMapBuilder()PosToHighlightMapBuilder(SortedMap<Integer,SimpleEditor.HighlightEntry> pPosToStylesMap)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpleEditor.PosToHighlightMapBuilderaddStyle(int pStart, int pEnd, String pStyle)SimpleEditor.PosToHighlightMapBuilderaddStyle(int pStart, int pEnd, String pStyle, boolean pOverride)SimpleEditor.PosToHighlightMapBuilderaddStyles(int pStart, int pEnd, Collection<String> pStyles)SimpleEditor.PosToHighlightMapBuilderaddStyles(int pStart, int pEnd, Collection<String> pStyles, boolean pOverride)SimpleEditor.PosToHighlightMapBuilderaddStyles(int pStart, NavigableMap<Integer,SimpleEditor.HighlightEntry> pPosToHighlightMap, int pFromPos, int pToPos)Adds the styles (from the specified map), which are within the specified range.SimpleEditor.PosToHighlightMapBuilderaddStyles(NavigableMap<Integer,SimpleEditor.HighlightEntry> pPosToHighlightMap, int pFromPos, int pToPos)Adds the styles (from the specified map), which are within the specified range, at the end.NavigableMap<Integer,SimpleEditor.HighlightEntry>createPosToHighlightMap()intgetEndPosition()static intgetEndPosition(NavigableMap<Integer,SimpleEditor.HighlightEntry> pPosToStylesMap)intgetStartPosition()static intgetStartPosition(NavigableMap<Integer,SimpleEditor.HighlightEntry> pPosToStylesMap)static NavigableMap<Integer,SimpleEditor.HighlightEntry>subMap(NavigableMap<Integer,SimpleEditor.HighlightEntry> pPosToHighlightMap, int pFromPos, int pToPos)Offsets are recalculated relative to the specified start position.static voidsubMap(NavigableMap<Integer,SimpleEditor.HighlightEntry> pInputMap, int pFromPos, int pToPos, NavigableMap<Integer,SimpleEditor.HighlightEntry> pResultMap, int pStart)Adds the styles in the specified range from the input map to the result map.
-
-
-
Constructor Detail
-
PosToHighlightMapBuilder
public PosToHighlightMapBuilder()
-
PosToHighlightMapBuilder
public PosToHighlightMapBuilder(SortedMap<Integer,SimpleEditor.HighlightEntry> pPosToStylesMap)
-
-
Method Detail
-
addStyle
public SimpleEditor.PosToHighlightMapBuilder addStyle(int pStart, int pEnd, String pStyle)
-
addStyle
public SimpleEditor.PosToHighlightMapBuilder addStyle(int pStart, int pEnd, String pStyle, boolean pOverride)
-
addStyles
public SimpleEditor.PosToHighlightMapBuilder addStyles(int pStart, int pEnd, Collection<String> pStyles)
-
addStyles
public SimpleEditor.PosToHighlightMapBuilder addStyles(int pStart, int pEnd, Collection<String> pStyles, boolean pOverride)
-
addStyles
public SimpleEditor.PosToHighlightMapBuilder addStyles(NavigableMap<Integer,SimpleEditor.HighlightEntry> pPosToHighlightMap, int pFromPos, int pToPos)
Adds the styles (from the specified map), which are within the specified range, at the end.- Throws:
UnsupportedOperationException- if overlapping of styles occurs.
-
addStyles
public SimpleEditor.PosToHighlightMapBuilder addStyles(int pStart, NavigableMap<Integer,SimpleEditor.HighlightEntry> pPosToHighlightMap, int pFromPos, int pToPos)
Adds the styles (from the specified map), which are within the specified range.- Parameters:
pStart- the position at which the styles will be added- Throws:
UnsupportedOperationException- if overlapping of styles occurs
-
getStartPosition
public int getStartPosition()
-
getStartPosition
public static int getStartPosition(NavigableMap<Integer,SimpleEditor.HighlightEntry> pPosToStylesMap)
-
getEndPosition
public int getEndPosition()
-
getEndPosition
public static int getEndPosition(NavigableMap<Integer,SimpleEditor.HighlightEntry> pPosToStylesMap)
-
createPosToHighlightMap
public NavigableMap<Integer,SimpleEditor.HighlightEntry> createPosToHighlightMap()
-
subMap
public static NavigableMap<Integer,SimpleEditor.HighlightEntry> subMap(NavigableMap<Integer,SimpleEditor.HighlightEntry> pPosToHighlightMap, int pFromPos, int pToPos)
Offsets are recalculated relative to the specified start position. The returned map is not backed by this map.- Parameters:
pPosToHighlightMap- mappFromPos- (inclusive)pToPos- (exclusive)- Returns:
- map
- Throws:
IllegalArgumentException- ifpFromPosis greater thanpToPos
-
subMap
public static void subMap(NavigableMap<Integer,SimpleEditor.HighlightEntry> pInputMap, int pFromPos, int pToPos, NavigableMap<Integer,SimpleEditor.HighlightEntry> pResultMap, int pStart)
Adds the styles in the specified range from the input map to the result map. Currently, overlapping of styles between maps is not supported.- Parameters:
pInputMap- input mappFromPos- frompToPos- topResultMap- result mappStart- Offset at which the styles will be added to the result map.- Throws:
UnsupportedOperationException- If overlapping of styles between maps
-
-