Class AbstractCommentManager<C,U extends IInteractiveUnit>
java.lang.Object
com.pnfsoftware.jeb.core.units.impl.AbstractCommentManager<C,U>
- Type Parameters:
C- coordinate typeU- managed unit type
- Direct Known Subclasses:
CodeCommentManager,CommentManager
A comment manager to be used by
IInteractiveUnit. It supports dual-addressing: regular
string address (per the interactive unit specifications), and custom address (methods for custom
addressing are suffixed by 2). The conversion methods are to be provided by the
subclass.
Specialized subclasses exist.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intFlag indicating that a comment should be treated as a favorite marker.static final intConstant used to identify an item's primary comment inlined with the item (for rendering purposes).static final intConstant used to identify an item's primary comment located above/before the item (for rendering purposes). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddMetaComment(String address, MetaComment c, boolean notify) Add a meta-comment at the provided address.booleanaddMetaComment(String address, String str, boolean notify) Add a meta-comment at the provided address.booleanaddMetaComment2(C coord, MetaComment c, boolean notify) Add a meta-comment at the provided coordinate.booleanaddMetaComment2(C coord, String str, boolean notify) Add a meta-comment at the provided coordinate.abstract CaddressToCoord(String address) Convert a string address to a custom coordinate.abstract StringcoordToAddress(C coord) Convert a custom coordinate to a string address.formatComments(String address, boolean includePre, int flagsMustHave, int flagsCantHave) Format comments at the provided address.formatComments2(C coord, boolean includePre, int flagsMustHave, int flagsCantHave) Format comments at the provided coordinate.Format a meta-comment for display.formatMetaFlags(int flags) Format meta-comment flags for display.getComment(String address) Retrieve the comment at the provided address.getComment2(C coord) Retrieve the comment at the provided coordinate.Retrieve comments keyed by string address.Retrieve comments keyed by custom coordinate.getInlineComment(String address) Retrieve the inline comment at the provided address.getInlineComment2(C coord) Retrieve the inline comment at the provided coordinate.getMetaCommentObjects(String address, int flagsMustHave, int flagsCantHave) Retrieve meta-comment text values at the provided address filtered by flags.getMetaCommentObjects2(C coord, int flagsMustHave, int flagsCantHave) Retrieve meta-comment text values at the provided coordinate filtered by flags.getMetaComments(String address) Retrieve meta-comments at the provided address.getMetaComments(String address, int flagsMustHave, int flagsCantHave) Retrieve meta-comments at the provided address filtered by flags.getMetaComments2(C coord) Retrieve meta-comments at the provided coordinate.getMetaComments2(C coord, int flagsMustHave, int flagsCantHave) Retrieve meta-comments at the provided coordinate filtered by flags.getPreComment(String address) Retrieve the pre-comment at the provided address.getPreComment2(C coord) Retrieve the pre-comment at the provided coordinate.getPrimary(String address, int position) Retrieve a primary comment at the provided address.getPrimary2(C coord, int position) Retrieve a primary comment at the provided coordinate.getPrimaryMap(int position) Retrieve primary comments keyed by string address.getPrimaryMap2(int position) Retrieve primary comments keyed by custom coordinate.getUnit()Retrieve the managed unit.voidAdd all provided comments to this manager.booleanremoveMetaComment(String address, MetaComment c, boolean notify) Remove a meta-comment at the provided address.booleanremoveMetaComment2(C coord, MetaComment c, boolean notify) Remove a meta-comment at the provided coordinate.booleansetComment(String address, Comment comment, boolean notify) Set or delete the comment at the provided address.booleansetComment2(C coord, Comment comment, boolean notify) Set or delete the comment at the provided coordinate.booleansetInlineComment(String address, String value) Set or delete the inline comment at the provided address and notify listeners.booleansetInlineComment(String address, String value, boolean notify) Set or delete the inline comment at the provided address.booleansetInlineComment2(C coord, String value) Set or delete the inline comment at the provided coordinate and notify listeners.booleansetInlineComment2(C coord, String value, boolean notify) Set or delete the inline comment at the provided coordinate.booleansetPreComment(String address, String value) Set or delete the pre-comment at the provided address and notify listeners.booleansetPreComment(String address, String value, boolean notify) Set or delete the pre-comment at the provided address.booleansetPreComment2(C coord, String value) Set or delete the pre-comment at the provided coordinate and notify listeners.booleansetPreComment2(C coord, String value, boolean notify) Set or delete the pre-comment at the provided coordinate.booleansetPrimary(String address, String value, int position, boolean notify) Set or delete a primary comment at the provided address.booleansetPrimary2(C coord, String value, int position, boolean notify) Set or delete a primary comment at the provided coordinate.
-
Field Details
-
INLINE
public static final int INLINEConstant used to identify an item's primary comment inlined with the item (for rendering purposes).- See Also:
-
PRE
public static final int PREConstant used to identify an item's primary comment located above/before the item (for rendering purposes).- See Also:
-
COMMENT_FLAG_FAVORITE
public static final int COMMENT_FLAG_FAVORITEFlag indicating that a comment should be treated as a favorite marker.- See Also:
-
-
Constructor Details
-
AbstractCommentManager
Create a comment manager.- Parameters:
unit- managed unit
-
-
Method Details
-
getUnit
Retrieve the managed unit.- Returns:
- the managed unit
-
getComments
Retrieve comments keyed by string address.- Returns:
- a map of addresses to comments
-
getComments2
Retrieve comments keyed by custom coordinate.- Returns:
- a map of coordinates to comments
-
getComment
Retrieve the comment at the provided address.- Parameters:
address- address- Returns:
- the comment, or null if none
-
getComment2
Retrieve the comment at the provided coordinate.- Parameters:
coord- coordinate- Returns:
- the comment, or null if none
-
setComment
Set or delete the comment at the provided address.- Parameters:
address- addresscomment- new comment; null to deletenotify- true to notify listeners- Returns:
- success indicator
-
setComment2
Set or delete the comment at the provided coordinate.- Parameters:
coord- coordinatecomment- new comment; null to deletenotify- true to notify listeners- Returns:
- success indicator
-
getInlineComment
Retrieve the inline comment at the provided address.- Parameters:
address- address- Returns:
- the inline comment, or null if none
-
setInlineComment
Set or delete the inline comment at the provided address and notify listeners.- Parameters:
address- addressvalue- new comment; null or empty to delete- Returns:
- success indicator
-
setInlineComment
Set or delete the inline comment at the provided address.- Parameters:
address- addressvalue- new comment; null or empty to deletenotify- true to notify listeners- Returns:
- success indicator
-
getInlineComment2
Retrieve the inline comment at the provided coordinate.- Parameters:
coord- coordinate- Returns:
- the inline comment, or null if none
-
setInlineComment2
Set or delete the inline comment at the provided coordinate and notify listeners.- Parameters:
coord- coordinatevalue- new comment; null or empty to delete- Returns:
- success indicator
-
setInlineComment2
Set or delete the inline comment at the provided coordinate.- Parameters:
coord- coordinatevalue- new comment; null or empty to deletenotify- true to notify listeners- Returns:
- success indicator
-
getPreComment
Retrieve the pre-comment at the provided address.- Parameters:
address- address- Returns:
- the pre-comment, or null if none
-
setPreComment
Set or delete the pre-comment at the provided address and notify listeners.- Parameters:
address- addressvalue- new comment; null or empty to delete- Returns:
- success indicator
-
setPreComment
Set or delete the pre-comment at the provided address.- Parameters:
address- addressvalue- new comment; null or empty to deletenotify- true to notify listeners- Returns:
- success indicator
-
getPreComment2
Retrieve the pre-comment at the provided coordinate.- Parameters:
coord- coordinate- Returns:
- the pre-comment, or null if none
-
setPreComment2
Set or delete the pre-comment at the provided coordinate and notify listeners.- Parameters:
coord- coordinatevalue- new comment; null or empty to delete- Returns:
- success indicator
-
setPreComment2
Set or delete the pre-comment at the provided coordinate.- Parameters:
coord- coordinatevalue- new comment; null or empty to deletenotify- true to notify listeners- Returns:
- success indicator
-
getPrimary
Retrieve a primary comment at the provided address. -
getPrimary2
Retrieve a primary comment at the provided coordinate. -
setPrimary
Set or delete a primary comment at the provided address. -
setPrimary2
Set or delete a primary comment at the provided coordinate. -
getPrimaryMap
Retrieve primary comments keyed by string address. -
getPrimaryMap2
Retrieve primary comments keyed by custom coordinate. -
getMetaComments
Retrieve meta-comments at the provided address.- Parameters:
address- address- Returns:
- meta-comments, possibly empty
-
getMetaComments2
Retrieve meta-comments at the provided coordinate.- Parameters:
coord- coordinate- Returns:
- meta-comments, possibly empty
-
getMetaComments
public Collection<MetaComment> getMetaComments(String address, int flagsMustHave, int flagsCantHave) Retrieve meta-comments at the provided address filtered by flags.- Parameters:
address- addressflagsMustHave- mask of flags that must be presentflagsCantHave- mask of flags that must be absent- Returns:
- filtered meta-comments, possibly empty
-
getMetaComments2
Retrieve meta-comments at the provided coordinate filtered by flags.- Parameters:
coord- coordinateflagsMustHave- mask of flags that must be presentflagsCantHave- mask of flags that must be absent- Returns:
- filtered meta-comments, possibly empty
-
addMetaComment
Add a meta-comment at the provided address.- Parameters:
address- addressstr- comment textnotify- true to notify listeners- Returns:
- success indicator
-
addMetaComment
Add a meta-comment at the provided address.- Parameters:
address- addressc- meta-commentnotify- true to notify listeners- Returns:
- success indicator
-
addMetaComment2
Add a meta-comment at the provided coordinate.- Parameters:
coord- coordinatestr- comment textnotify- true to notify listeners- Returns:
- success indicator
-
addMetaComment2
Add a meta-comment at the provided coordinate.- Parameters:
coord- coordinatec- meta-commentnotify- true to notify listeners- Returns:
- success indicator
-
removeMetaComment
Remove a meta-comment at the provided address.- Parameters:
address- addressc- meta-comment to removenotify- true to notify listeners- Returns:
- success indicator
-
removeMetaComment2
Remove a meta-comment at the provided coordinate.- Parameters:
coord- coordinatec- meta-comment to removenotify- true to notify listeners- Returns:
- success indicator
-
getMetaCommentObjects
public Collection<String> getMetaCommentObjects(String address, int flagsMustHave, int flagsCantHave) Retrieve meta-comment text values at the provided address filtered by flags.- Parameters:
address- addressflagsMustHave- mask of flags that must be presentflagsCantHave- mask of flags that must be absent- Returns:
- filtered meta-comment text values
-
getMetaCommentObjects2
Retrieve meta-comment text values at the provided coordinate filtered by flags.- Parameters:
coord- coordinateflagsMustHave- mask of flags that must be presentflagsCantHave- mask of flags that must be absent- Returns:
- filtered meta-comment text values
-
formatComments
public String formatComments(String address, boolean includePre, int flagsMustHave, int flagsCantHave) Format comments at the provided address.- Parameters:
address- addressincludePre- true to include the pre-commentflagsMustHave- mask of meta-comment flags that must be presentflagsCantHave- mask of meta-comment flags that must be absent- Returns:
- formatted comments, or an empty string if none
-
formatComments2
Format comments at the provided coordinate.- Parameters:
coord- coordinateincludePre- true to include the pre-commentflagsMustHave- mask of meta-comment flags that must be presentflagsCantHave- mask of meta-comment flags that must be absent- Returns:
- formatted comments, or an empty string if none
-
formatMetaComment
Format a meta-comment for display.- Parameters:
c- meta-comment- Returns:
- formatted meta-comment
-
formatMetaFlags
Format meta-comment flags for display.- Parameters:
flags- flags- Returns:
- formatted flags
-
addressToCoord
Convert a string address to a custom coordinate.- Parameters:
address- address- Returns:
- coordinate, or null if the address cannot be converted
-
coordToAddress
Convert a custom coordinate to a string address.- Parameters:
coord- coordinate- Returns:
- address, or null if the coordinate cannot be converted
-
putAll
Add all provided comments to this manager.- Parameters:
map- comments keyed by coordinate
-