Modifier and Type | Field and Description |
---|---|
static String |
NAME_DELIMITER
The delimiter used to separate Topic tree name elements.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compares this tree node with some object for equality.
|
Set<Topic> |
getAllTopics()
Returns all Topics subordinate to this node.
|
int |
getLevel()
Returns the level of the node within the Topic tree.
|
String |
getNodeName()
Returns the node name.
|
TopicTreeNode |
getParent()
Returns the parent node.
|
TopicTree |
getRoot()
Returns the root node.
|
Topic |
getTopic(String topicName)
Gets a child or descendant Topic of the current node.
|
Set<Topic> |
getTopics()
Returns any child Topics of this Topic node.
|
Set<Topic> |
getTopics(Collection<TopicSelector> selectors)
Returns a set of Topics that match one or more of a given set of
selectors . |
Set<Topic> |
getTopics(String pattern)
Returns a set of Topics that are children/descendants of this node that
match with a supplied Topic 'specifier'.
|
Set<Topic> |
getTopics(TopicSelector selector)
Returns a set of Topics that match a given
selector relative to this node. |
Set<Topic> |
getTopics(TopicSet topicSet)
Returns a set of Topics that are children/descendants of this node.
|
int |
hashCode()
Returns the hashCode of the full hierarchic name of the tree node.
|
boolean |
hasTopic(String topicName)
Indicates whether the node has a subordinate Topic matching the given
full hierarchic Topic name.
|
boolean |
hasTopics()
Indicates whether this node has subordinate Topics.
|
boolean |
isAutoSubscribing()
Deprecated.
since 5.5, auto-subscription is always enabled
|
boolean |
isRoot()
Returns true if this is the root node in the tree.
|
boolean |
isTopic()
Returns true if this node is a
Topic . |
boolean |
remove()
Removes this node (and all of its children) from the Topic tree.
|
boolean |
removeTopic(String topicName)
Removes a child or descendant Topic of the current node.
|
void |
setAutoSubscribe(boolean auto)
Deprecated.
since 5.5, auto-subscription is always enabled
|
static final String NAME_DELIMITER
Topic getTopic(String topicName)
The name may be a simple Topic name or a hierarchic Topic name with
each element of the name separated by NAME_DELIMITER
.
If a simple topic name is supplied then the Topic that is directly subordinate to this node with the supplied name is returned.
If a hierarchic name is supplied then the Topic tree from this node downwards is navigated until a matching node is found. The first element representing a child of this node and the next a child of that node and so forth.
topicName
- the name of a Topic that is a direct child of this node
or the full hierarchic name of a descendant of this node.boolean hasTopic(String topicName)
This is a convenience method that will return true if
getTopic(String)
would return a non null value for the given
name.
topicName
- the hierarchic Topic name to check for.boolean hasTopics()
Set<Topic> getTopics()
If this is a hierarchical Topic with subordinate Topic nodes then this will return the Topics that are directly subordinate to this node (i.e. its children) otherwise an empty set is returned.
If you wish to select only certain child Topics or include Topics
further down the hierarchy then you should use getTopics(String)
.
To check whether a node has child Topics it is more efficient to use
hasTopics()
rather than using this method and checking for an
empty set.
Set<Topic> getTopics(String pattern) throws TopicInvalidException
The 'specifier' is used to select Topics within the topic hierarchy
beneath this node. The specifier comprises one or more
Pattern regular expression patterns
separated by NAME_DELIMITER
.
See the user manual for full details on how to use Topic specifiers.
pattern
- TopicSelector
pattern.TopicInvalidException
- if the Topic filter is invalid.Set<Topic> getAllTopics()
This is effectively the same as calling getTopics(String)
with a
filter of "/".
Set<Topic> getTopics(TopicSet topicSet)
This is a convenience method which is equivalent to calling
getTopics(String)
for each entry in the set and accumulating the
results in a single set.
topicSet
- set of Topics and/or Topic filters.Set<Topic> getTopics(Collection<TopicSelector> selectors)
selectors
.selectors
- a collection of selectorsSet<Topic> getTopics(TopicSelector selector)
selector
relative to this node.selector
- a topic selectorboolean remove()
If called for a root node this has no effect.
boolean removeTopic(String topicName)
The name may be a simple Topic name or a hierarchic Topic name with
each element of the name separated by NAME_DELIMITER
.
topicName
- the name of a Topic that is a direct child of this node
or the full hierarchic name of a descendant of this node.String getNodeName()
This is the name of the Topic node (or root node) within the Topic tree and not the full Topic name.
TopicTreeNode getParent()
boolean isRoot()
topic
node.boolean isTopic()
Topic
.
TopicTree getRoot()
int getLevel()
The root node (or any node without a parent) is level 0, nodes directly under the root are level 1 and so on down the tree.
@Deprecated void setAutoSubscribe(boolean auto)
@Deprecated boolean isAutoSubscribing()
boolean equals(Object obj)
This only returns true if the supplied object is also a TopicTreeNode and has the same hierarchic name.
equals
in class Object
obj
- the object to check equality againstObject.equals(Object)
int hashCode()
hashCode
in class Object
Object.hashCode()
Copyright © 2016 Push Technology Ltd. All Rights Reserved.