code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 844
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public TreeNode[] getPath() {
return getPathToRoot(this, 0);
} |
Returns the path from the root, to get to this node. The last
element in the path is this node.
@return an array of TreeNode objects giving the path, where the
first element in the path is the root and the last
element is this node.
| DefaultMutableTreeNode::getPath | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
protected TreeNode[] getPathToRoot(TreeNode aNode, int depth) {
TreeNode[] retNodes;
/* Check for null, in case someone passed in a null node, or
they passed in an element that isn't rooted at root. */
if(aNode == null) {
if(depth == 0)
return null;
else
retNodes = new TreeNode[depth];
}
else {
depth++;
retNodes = getPathToRoot(aNode.getParent(), depth);
retNodes[retNodes.length - depth] = aNode;
}
return retNodes;
} |
Builds the parents of node up to and including the root node,
where the original node is the last element in the returned array.
The length of the returned array gives the node's depth in the
tree.
@param aNode the TreeNode to get the path for
@param depth an int giving the number of steps already taken towards
the root (on recursive calls), used to size the returned array
@return an array of TreeNodes giving the path from the root to the
specified node
| DefaultMutableTreeNode::getPathToRoot | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public Object[] getUserObjectPath() {
TreeNode[] realPath = getPath();
Object[] retPath = new Object[realPath.length];
for(int counter = 0; counter < realPath.length; counter++)
retPath[counter] = ((DefaultMutableTreeNode)realPath[counter])
.getUserObject();
return retPath;
} |
Returns the user object path, from the root, to get to this node.
If some of the TreeNodes in the path have null user objects, the
returned path will contain nulls.
| DefaultMutableTreeNode::getUserObjectPath | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public TreeNode getRoot() {
TreeNode ancestor = this;
TreeNode previous;
do {
previous = ancestor;
ancestor = ancestor.getParent();
} while (ancestor != null);
return previous;
} |
Returns the root of the tree that contains this node. The root is
the ancestor with a null parent.
@see #isNodeAncestor
@return the root of the tree that contains this node
| DefaultMutableTreeNode::getRoot | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public boolean isRoot() {
return getParent() == null;
} |
Returns true if this node is the root of the tree. The root is
the only node in the tree with a null parent; every tree has exactly
one root.
@return true if this node is the root of its tree
| DefaultMutableTreeNode::isRoot | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public DefaultMutableTreeNode getNextNode() {
if (getChildCount() == 0) {
// No children, so look for nextSibling
DefaultMutableTreeNode nextSibling = getNextSibling();
if (nextSibling == null) {
DefaultMutableTreeNode aNode = (DefaultMutableTreeNode)getParent();
do {
if (aNode == null) {
return null;
}
nextSibling = aNode.getNextSibling();
if (nextSibling != null) {
return nextSibling;
}
aNode = (DefaultMutableTreeNode)aNode.getParent();
} while(true);
} else {
return nextSibling;
}
} else {
return (DefaultMutableTreeNode)getChildAt(0);
}
} |
Returns the node that follows this node in a preorder traversal of this
node's tree. Returns null if this node is the last node of the
traversal. This is an inefficient way to traverse the entire tree; use
an enumeration, instead.
@see #preorderEnumeration
@return the node that follows this node in a preorder traversal, or
null if this node is last
| DefaultMutableTreeNode::getNextNode | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public DefaultMutableTreeNode getPreviousNode() {
DefaultMutableTreeNode previousSibling;
DefaultMutableTreeNode myParent = (DefaultMutableTreeNode)getParent();
if (myParent == null) {
return null;
}
previousSibling = getPreviousSibling();
if (previousSibling != null) {
if (previousSibling.getChildCount() == 0)
return previousSibling;
else
return previousSibling.getLastLeaf();
} else {
return myParent;
}
} |
Returns the node that precedes this node in a preorder traversal of
this node's tree. Returns <code>null</code> if this node is the
first node of the traversal -- the root of the tree.
This is an inefficient way to
traverse the entire tree; use an enumeration, instead.
@see #preorderEnumeration
@return the node that precedes this node in a preorder traversal, or
null if this node is the first
| DefaultMutableTreeNode::getPreviousNode | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public Enumeration preorderEnumeration() {
return new PreorderEnumeration(this);
} |
Creates and returns an enumeration that traverses the subtree rooted at
this node in preorder. The first node returned by the enumeration's
<code>nextElement()</code> method is this node.<P>
Modifying the tree by inserting, removing, or moving a node invalidates
any enumerations created before the modification.
@see #postorderEnumeration
@return an enumeration for traversing the tree in preorder
| DefaultMutableTreeNode::preorderEnumeration | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public Enumeration postorderEnumeration() {
return new PostorderEnumeration(this);
} |
Creates and returns an enumeration that traverses the subtree rooted at
this node in postorder. The first node returned by the enumeration's
<code>nextElement()</code> method is the leftmost leaf. This is the
same as a depth-first traversal.<P>
Modifying the tree by inserting, removing, or moving a node invalidates
any enumerations created before the modification.
@see #depthFirstEnumeration
@see #preorderEnumeration
@return an enumeration for traversing the tree in postorder
| DefaultMutableTreeNode::postorderEnumeration | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public Enumeration breadthFirstEnumeration() {
return new BreadthFirstEnumeration(this);
} |
Creates and returns an enumeration that traverses the subtree rooted at
this node in breadth-first order. The first node returned by the
enumeration's <code>nextElement()</code> method is this node.<P>
Modifying the tree by inserting, removing, or moving a node invalidates
any enumerations created before the modification.
@see #depthFirstEnumeration
@return an enumeration for traversing the tree in breadth-first order
| DefaultMutableTreeNode::breadthFirstEnumeration | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public Enumeration depthFirstEnumeration() {
return postorderEnumeration();
} |
Creates and returns an enumeration that traverses the subtree rooted at
this node in depth-first order. The first node returned by the
enumeration's <code>nextElement()</code> method is the leftmost leaf.
This is the same as a postorder traversal.<P>
Modifying the tree by inserting, removing, or moving a node invalidates
any enumerations created before the modification.
@see #breadthFirstEnumeration
@see #postorderEnumeration
@return an enumeration for traversing the tree in depth-first order
| DefaultMutableTreeNode::depthFirstEnumeration | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public Enumeration pathFromAncestorEnumeration(TreeNode ancestor) {
return new PathBetweenNodesEnumeration(ancestor, this);
} |
Creates and returns an enumeration that follows the path from
<code>ancestor</code> to this node. The enumeration's
<code>nextElement()</code> method first returns <code>ancestor</code>,
then the child of <code>ancestor</code> that is an ancestor of this
node, and so on, and finally returns this node. Creation of the
enumeration is O(m) where m is the number of nodes between this node
and <code>ancestor</code>, inclusive. Each <code>nextElement()</code>
message is O(1).<P>
Modifying the tree by inserting, removing, or moving a node invalidates
any enumerations created before the modification.
@see #isNodeAncestor
@see #isNodeDescendant
@exception IllegalArgumentException if <code>ancestor</code> is
not an ancestor of this node
@return an enumeration for following the path from an ancestor of
this node to this one
| DefaultMutableTreeNode::pathFromAncestorEnumeration | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public boolean isNodeChild(TreeNode aNode) {
boolean retval;
if (aNode == null) {
retval = false;
} else {
if (getChildCount() == 0) {
retval = false;
} else {
retval = (aNode.getParent() == this);
}
}
return retval;
} |
Returns true if <code>aNode</code> is a child of this node. If
<code>aNode</code> is null, this method returns false.
@return true if <code>aNode</code> is a child of this node; false if
<code>aNode</code> is null
| DefaultMutableTreeNode::isNodeChild | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public TreeNode getFirstChild() {
if (getChildCount() == 0) {
throw new NoSuchElementException("node has no children");
}
return getChildAt(0);
} |
Returns this node's first child. If this node has no children,
throws NoSuchElementException.
@return the first child of this node
@exception NoSuchElementException if this node has no children
| DefaultMutableTreeNode::getFirstChild | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public TreeNode getLastChild() {
if (getChildCount() == 0) {
throw new NoSuchElementException("node has no children");
}
return getChildAt(getChildCount()-1);
} |
Returns this node's last child. If this node has no children,
throws NoSuchElementException.
@return the last child of this node
@exception NoSuchElementException if this node has no children
| DefaultMutableTreeNode::getLastChild | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public TreeNode getChildAfter(TreeNode aChild) {
if (aChild == null) {
throw new IllegalArgumentException("argument is null");
}
int index = getIndex(aChild); // linear search
if (index == -1) {
throw new IllegalArgumentException("node is not a child");
}
if (index < getChildCount() - 1) {
return getChildAt(index + 1);
} else {
return null;
}
} |
Returns the child in this node's child array that immediately
follows <code>aChild</code>, which must be a child of this node. If
<code>aChild</code> is the last child, returns null. This method
performs a linear search of this node's children for
<code>aChild</code> and is O(n) where n is the number of children; to
traverse the entire array of children, use an enumeration instead.
@see #children
@exception IllegalArgumentException if <code>aChild</code> is
null or is not a child of this node
@return the child of this node that immediately follows
<code>aChild</code>
| DefaultMutableTreeNode::getChildAfter | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public TreeNode getChildBefore(TreeNode aChild) {
if (aChild == null) {
throw new IllegalArgumentException("argument is null");
}
int index = getIndex(aChild); // linear search
if (index == -1) {
throw new IllegalArgumentException("argument is not a child");
}
if (index > 0) {
return getChildAt(index - 1);
} else {
return null;
}
} |
Returns the child in this node's child array that immediately
precedes <code>aChild</code>, which must be a child of this node. If
<code>aChild</code> is the first child, returns null. This method
performs a linear search of this node's children for <code>aChild</code>
and is O(n) where n is the number of children.
@exception IllegalArgumentException if <code>aChild</code> is null
or is not a child of this node
@return the child of this node that immediately precedes
<code>aChild</code>
| DefaultMutableTreeNode::getChildBefore | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public boolean isNodeSibling(TreeNode anotherNode) {
boolean retval;
if (anotherNode == null) {
retval = false;
} else if (anotherNode == this) {
retval = true;
} else {
TreeNode myParent = getParent();
retval = (myParent != null && myParent == anotherNode.getParent());
if (retval && !((DefaultMutableTreeNode)getParent())
.isNodeChild(anotherNode)) {
throw new Error("sibling has different parent");
}
}
return retval;
} |
Returns true if <code>anotherNode</code> is a sibling of (has the
same parent as) this node. A node is its own sibling. If
<code>anotherNode</code> is null, returns false.
@param anotherNode node to test as sibling of this node
@return true if <code>anotherNode</code> is a sibling of this node
| DefaultMutableTreeNode::isNodeSibling | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public int getSiblingCount() {
TreeNode myParent = getParent();
if (myParent == null) {
return 1;
} else {
return myParent.getChildCount();
}
} |
Returns the number of siblings of this node. A node is its own sibling
(if it has no parent or no siblings, this method returns
<code>1</code>).
@return the number of siblings of this node
| DefaultMutableTreeNode::getSiblingCount | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public DefaultMutableTreeNode getNextSibling() {
DefaultMutableTreeNode retval;
DefaultMutableTreeNode myParent = (DefaultMutableTreeNode)getParent();
if (myParent == null) {
retval = null;
} else {
retval = (DefaultMutableTreeNode)myParent.getChildAfter(this); // linear search
}
if (retval != null && !isNodeSibling(retval)) {
throw new Error("child of parent is not a sibling");
}
return retval;
} |
Returns the next sibling of this node in the parent's children array.
Returns null if this node has no parent or is the parent's last child.
This method performs a linear search that is O(n) where n is the number
of children; to traverse the entire array, use the parent's child
enumeration instead.
@see #children
@return the sibling of this node that immediately follows this node
| DefaultMutableTreeNode::getNextSibling | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public DefaultMutableTreeNode getPreviousSibling() {
DefaultMutableTreeNode retval;
DefaultMutableTreeNode myParent = (DefaultMutableTreeNode)getParent();
if (myParent == null) {
retval = null;
} else {
retval = (DefaultMutableTreeNode)myParent.getChildBefore(this); // linear search
}
if (retval != null && !isNodeSibling(retval)) {
throw new Error("child of parent is not a sibling");
}
return retval;
} |
Returns the previous sibling of this node in the parent's children
array. Returns null if this node has no parent or is the parent's
first child. This method performs a linear search that is O(n) where n
is the number of children.
@return the sibling of this node that immediately precedes this node
| DefaultMutableTreeNode::getPreviousSibling | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public boolean isLeaf() {
return (getChildCount() == 0);
} |
Returns true if this node has no children. To distinguish between
nodes that have no children and nodes that <i>cannot</i> have
children (e.g. to distinguish files from empty directories), use this
method in conjunction with <code>getAllowsChildren</code>
@see #getAllowsChildren
@return true if this node has no children
| DefaultMutableTreeNode::isLeaf | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public DefaultMutableTreeNode getFirstLeaf() {
DefaultMutableTreeNode node = this;
while (!node.isLeaf()) {
node = (DefaultMutableTreeNode)node.getFirstChild();
}
return node;
} |
Finds and returns the first leaf that is a descendant of this node --
either this node or its first child's first leaf.
Returns this node if it is a leaf.
@see #isLeaf
@see #isNodeDescendant
@return the first leaf in the subtree rooted at this node
| DefaultMutableTreeNode::getFirstLeaf | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public DefaultMutableTreeNode getLastLeaf() {
DefaultMutableTreeNode node = this;
while (!node.isLeaf()) {
node = (DefaultMutableTreeNode)node.getLastChild();
}
return node;
} |
Finds and returns the last leaf that is a descendant of this node --
either this node or its last child's last leaf.
Returns this node if it is a leaf.
@see #isLeaf
@see #isNodeDescendant
@return the last leaf in the subtree rooted at this node
| DefaultMutableTreeNode::getLastLeaf | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public DefaultMutableTreeNode getNextLeaf() {
DefaultMutableTreeNode nextSibling;
DefaultMutableTreeNode myParent = (DefaultMutableTreeNode)getParent();
if (myParent == null)
return null;
nextSibling = getNextSibling(); // linear search
if (nextSibling != null)
return nextSibling.getFirstLeaf();
return myParent.getNextLeaf(); // tail recursion
} |
Returns the leaf after this node or null if this node is the
last leaf in the tree.
<p>
In this implementation of the <code>MutableNode</code> interface,
this operation is very inefficient. In order to determine the
next node, this method first performs a linear search in the
parent's child-list in order to find the current node.
<p>
That implementation makes the operation suitable for short
traversals from a known position. But to traverse all of the
leaves in the tree, you should use <code>depthFirstEnumeration</code>
to enumerate the nodes in the tree and use <code>isLeaf</code>
on each node to determine which are leaves.
@see #depthFirstEnumeration
@see #isLeaf
@return returns the next leaf past this node
| DefaultMutableTreeNode::getNextLeaf | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public DefaultMutableTreeNode getPreviousLeaf() {
DefaultMutableTreeNode previousSibling;
DefaultMutableTreeNode myParent = (DefaultMutableTreeNode)getParent();
if (myParent == null)
return null;
previousSibling = getPreviousSibling(); // linear search
if (previousSibling != null)
return previousSibling.getLastLeaf();
return myParent.getPreviousLeaf(); // tail recursion
} |
Returns the leaf before this node or null if this node is the
first leaf in the tree.
<p>
In this implementation of the <code>MutableNode</code> interface,
this operation is very inefficient. In order to determine the
previous node, this method first performs a linear search in the
parent's child-list in order to find the current node.
<p>
That implementation makes the operation suitable for short
traversals from a known position. But to traverse all of the
leaves in the tree, you should use <code>depthFirstEnumeration</code>
to enumerate the nodes in the tree and use <code>isLeaf</code>
on each node to determine which are leaves.
@see #depthFirstEnumeration
@see #isLeaf
@return returns the leaf before this node
| DefaultMutableTreeNode::getPreviousLeaf | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public int getLeafCount() {
int count = 0;
TreeNode node;
Enumeration enum_ = breadthFirstEnumeration(); // order matters not
while (enum_.hasMoreElements()) {
node = (TreeNode)enum_.nextElement();
if (node.isLeaf()) {
count++;
}
}
if (count < 1) {
throw new Error("tree has zero leaves");
}
return count;
} |
Returns the total number of leaves that are descendants of this node.
If this node is a leaf, returns <code>1</code>. This method is O(n)
where n is the number of descendants of this node.
@see #isNodeAncestor
@return the number of leaves beneath this node
| DefaultMutableTreeNode::getLeafCount | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public String toString() {
if (userObject == null) {
return null;
} else {
return userObject.toString();
}
} |
Returns the result of sending <code>toString()</code> to this node's
user object, or null if this node has no user object.
@see #getUserObject
| DefaultMutableTreeNode::toString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public Object clone() {
DefaultMutableTreeNode newNode = null;
try {
newNode = (DefaultMutableTreeNode)super.clone();
// shallow copy -- the new node has no parent or children
newNode.children = null;
newNode.parent = null;
} catch (CloneNotSupportedException e) {
// Won't happen because we implement Cloneable
throw new Error(e.toString());
}
return newNode;
} |
Overridden to make clone public. Returns a shallow copy of this node;
the new node has no parent or children and has a reference to the same
user object, if any.
@return a copy of this node
| DefaultMutableTreeNode::clone | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultMutableTreeNode.java | Apache-2.0 |
public DefaultTreeModel(TreeNode root) {
this(root, false);
} |
Creates a tree in which any node can have children.
@param root a TreeNode object that is the root of the tree
@see #DefaultTreeModel(TreeNode, boolean)
| DefaultTreeModel::DefaultTreeModel | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public DefaultTreeModel(TreeNode root, boolean asksAllowsChildren) {
super();
this.root = root;
this.asksAllowsChildren = asksAllowsChildren;
} |
Creates a tree specifying whether any node can have children,
or whether only certain nodes can have children.
@param root a TreeNode object that is the root of the tree
@param asksAllowsChildren a boolean, false if any node can
have children, true if each node is asked to see if
it can have children
@see #asksAllowsChildren
| DefaultTreeModel::DefaultTreeModel | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void setAsksAllowsChildren(boolean newValue) {
asksAllowsChildren = newValue;
} |
Sets whether or not to test leafness by asking getAllowsChildren()
or isLeaf() to the TreeNodes. If newvalue is true, getAllowsChildren()
is messaged, otherwise isLeaf() is messaged.
| DefaultTreeModel::setAsksAllowsChildren | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public boolean asksAllowsChildren() {
return asksAllowsChildren;
} |
Tells how leaf nodes are determined.
@return true if only nodes which do not allow children are
leaf nodes, false if nodes which have no children
(even if allowed) are leaf nodes
@see #asksAllowsChildren
| DefaultTreeModel::asksAllowsChildren | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void setRoot(TreeNode root) {
Object oldRoot = this.root;
this.root = root;
if (root == null && oldRoot != null) {
fireTreeStructureChanged(this, null);
}
else {
nodeStructureChanged(root);
}
} |
Sets the root to <code>root</code>. A null <code>root</code> implies
the tree is to display nothing, and is legal.
| DefaultTreeModel::setRoot | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public Object getRoot() {
return root;
} |
Returns the root of the tree. Returns null only if the tree has
no nodes.
@return the root of the tree
| DefaultTreeModel::getRoot | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public int getIndexOfChild(Object parent, Object child) {
if(parent == null || child == null)
return -1;
return ((TreeNode)parent).getIndex((TreeNode)child);
} |
Returns the index of child in parent.
If either the parent or child is <code>null</code>, returns -1.
@param parent a note in the tree, obtained from this data source
@param child the node we are interested in
@return the index of the child in the parent, or -1
if either the parent or the child is <code>null</code>
| DefaultTreeModel::getIndexOfChild | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public Object getChild(Object parent, int index) {
return ((TreeNode)parent).getChildAt(index);
} |
Returns the child of <I>parent</I> at index <I>index</I> in the parent's
child array. <I>parent</I> must be a node previously obtained from
this data source. This should not return null if <i>index</i>
is a valid index for <i>parent</i> (that is <i>index</i> >= 0 &&
<i>index</i> < getChildCount(<i>parent</i>)).
@param parent a node in the tree, obtained from this data source
@return the child of <I>parent</I> at index <I>index</I>
| DefaultTreeModel::getChild | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public int getChildCount(Object parent) {
return ((TreeNode)parent).getChildCount();
} |
Returns the number of children of <I>parent</I>. Returns 0 if the node
is a leaf or if it has no children. <I>parent</I> must be a node
previously obtained from this data source.
@param parent a node in the tree, obtained from this data source
@return the number of children of the node <I>parent</I>
| DefaultTreeModel::getChildCount | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public boolean isLeaf(Object node) {
if(asksAllowsChildren)
return !((TreeNode)node).getAllowsChildren();
return ((TreeNode)node).isLeaf();
} |
Returns whether the specified node is a leaf node.
The way the test is performed depends on the
<code>askAllowsChildren</code> setting.
@param node the node to check
@return true if the node is a leaf node
@see #asksAllowsChildren
@see TreeModel#isLeaf
| DefaultTreeModel::isLeaf | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void reload() {
reload(root);
} |
Invoke this method if you've modified the {@code TreeNode}s upon which
this model depends. The model will notify all of its listeners that the
model has changed.
| DefaultTreeModel::reload | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void valueForPathChanged(TreePath path, Object newValue) {
MutableTreeNode aNode = (MutableTreeNode)path.getLastPathComponent();
aNode.setUserObject(newValue);
nodeChanged(aNode);
} |
This sets the user object of the TreeNode identified by path
and posts a node changed. If you use custom user objects in
the TreeModel you're going to need to subclass this and
set the user object of the changed node to something meaningful.
| DefaultTreeModel::valueForPathChanged | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void insertNodeInto(MutableTreeNode newChild,
MutableTreeNode parent, int index){
parent.insert(newChild, index);
int[] newIndexs = new int[1];
newIndexs[0] = index;
nodesWereInserted(parent, newIndexs);
} |
Invoked this to insert newChild at location index in parents children.
This will then message nodesWereInserted to create the appropriate
event. This is the preferred way to add children as it will create
the appropriate event.
| DefaultTreeModel::insertNodeInto | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void removeNodeFromParent(MutableTreeNode node) {
MutableTreeNode parent = (MutableTreeNode)node.getParent();
if(parent == null)
throw new IllegalArgumentException("node does not have a parent.");
int[] childIndex = new int[1];
Object[] removedArray = new Object[1];
childIndex[0] = parent.getIndex(node);
parent.remove(childIndex[0]);
removedArray[0] = node;
nodesWereRemoved(parent, childIndex, removedArray);
} |
Message this to remove node from its parent. This will message
nodesWereRemoved to create the appropriate event. This is the
preferred way to remove a node as it handles the event creation
for you.
| DefaultTreeModel::removeNodeFromParent | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void nodeChanged(TreeNode node) {
if(listenerList != null && node != null) {
TreeNode parent = node.getParent();
if(parent != null) {
int anIndex = parent.getIndex(node);
if(anIndex != -1) {
int[] cIndexs = new int[1];
cIndexs[0] = anIndex;
nodesChanged(parent, cIndexs);
}
}
else if (node == getRoot()) {
nodesChanged(node, null);
}
}
} |
Invoke this method after you've changed how node is to be
represented in the tree.
| DefaultTreeModel::nodeChanged | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void reload(TreeNode node) {
if(node != null) {
fireTreeStructureChanged(this, getPathToRoot(node), null, null);
}
} |
Invoke this method if you've modified the {@code TreeNode}s upon which
this model depends. The model will notify all of its listeners that the
model has changed below the given node.
@param node the node below which the model has changed
| DefaultTreeModel::reload | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void nodesWereInserted(TreeNode node, int[] childIndices) {
if(listenerList != null && node != null && childIndices != null
&& childIndices.length > 0) {
int cCount = childIndices.length;
Object[] newChildren = new Object[cCount];
for(int counter = 0; counter < cCount; counter++)
newChildren[counter] = node.getChildAt(childIndices[counter]);
fireTreeNodesInserted(this, getPathToRoot(node), childIndices,
newChildren);
}
} |
Invoke this method after you've inserted some TreeNodes into
node. childIndices should be the index of the new elements and
must be sorted in ascending order.
| DefaultTreeModel::nodesWereInserted | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void nodesWereRemoved(TreeNode node, int[] childIndices,
Object[] removedChildren) {
if(node != null && childIndices != null) {
fireTreeNodesRemoved(this, getPathToRoot(node), childIndices,
removedChildren);
}
} |
Invoke this method after you've removed some TreeNodes from
node. childIndices should be the index of the removed elements and
must be sorted in ascending order. And removedChildren should be
the array of the children objects that were removed.
| DefaultTreeModel::nodesWereRemoved | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void nodesChanged(TreeNode node, int[] childIndices) {
if(node != null) {
if (childIndices != null) {
int cCount = childIndices.length;
if(cCount > 0) {
Object[] cChildren = new Object[cCount];
for(int counter = 0; counter < cCount; counter++)
cChildren[counter] = node.getChildAt
(childIndices[counter]);
fireTreeNodesChanged(this, getPathToRoot(node),
childIndices, cChildren);
}
}
else if (node == getRoot()) {
fireTreeNodesChanged(this, getPathToRoot(node), null, null);
}
}
} |
Invoke this method after you've changed how the children identified by
childIndicies are to be represented in the tree.
| DefaultTreeModel::nodesChanged | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void nodeStructureChanged(TreeNode node) {
if(node != null) {
fireTreeStructureChanged(this, getPathToRoot(node), null, null);
}
} |
Invoke this method if you've totally changed the children of
node and its childrens children... This will post a
treeStructureChanged event.
| DefaultTreeModel::nodeStructureChanged | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public TreeNode[] getPathToRoot(TreeNode aNode) {
return getPathToRoot(aNode, 0);
} |
Builds the parents of node up to and including the root node,
where the original node is the last element in the returned array.
The length of the returned array gives the node's depth in the
tree.
@param aNode the TreeNode to get the path for
| DefaultTreeModel::getPathToRoot | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
protected TreeNode[] getPathToRoot(TreeNode aNode, int depth) {
TreeNode[] retNodes;
// This method recurses, traversing towards the root in order
// size the array. On the way back, it fills in the nodes,
// starting from the root and working back to the original node.
/* Check for null, in case someone passed in a null node, or
they passed in an element that isn't rooted at root. */
if(aNode == null) {
if(depth == 0)
return null;
else
retNodes = new TreeNode[depth];
}
else {
depth++;
if(aNode == root)
retNodes = new TreeNode[depth];
else
retNodes = getPathToRoot(aNode.getParent(), depth);
retNodes[retNodes.length - depth] = aNode;
}
return retNodes;
} |
Builds the parents of node up to and including the root node,
where the original node is the last element in the returned array.
The length of the returned array gives the node's depth in the
tree.
@param aNode the TreeNode to get the path for
@param depth an int giving the number of steps already taken towards
the root (on recursive calls), used to size the returned array
@return an array of TreeNodes giving the path from the root to the
specified node
| DefaultTreeModel::getPathToRoot | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public void addTreeModelListener(TreeModelListener l) {
listenerList.add(TreeModelListener.class, l);
} |
Adds a listener for the TreeModelEvent posted after the tree changes.
@see #removeTreeModelListener
@param l the listener to add
| DefaultTreeModel::addTreeModelListener | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/DefaultTreeModel.java | Apache-2.0 |
public TreePath(Object[] path) {
if(path == null || path.length == 0)
throw new IllegalArgumentException("path in TreePath must be non null and not empty.");
lastPathComponent = path[path.length - 1];
if(path.length > 1)
parentPath = new TreePath(path, path.length - 1);
} |
Constructs a path from an array of Objects, uniquely identifying
the path from the root of the tree to a specific node, as returned
by the tree's data model.
<p>
The model is free to return an array of any Objects it needs to
represent the path. The DefaultTreeModel returns an array of
TreeNode objects. The first TreeNode in the path is the root of the
tree, the last TreeNode is the node identified by the path.
@param path an array of Objects representing the path to a node
| TreePath::TreePath | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
public TreePath(Object singlePath) {
if(singlePath == null)
throw new IllegalArgumentException("path in TreePath must be non null.");
lastPathComponent = singlePath;
parentPath = null;
} |
Constructs a TreePath containing only a single element. This is
usually used to construct a TreePath for the the root of the TreeModel.
<p>
@param singlePath an Object representing the path to a node
@see #TreePath(Object[])
| TreePath::TreePath | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
protected TreePath(TreePath parent, Object lastElement) {
if(lastElement == null)
throw new IllegalArgumentException("path in TreePath must be non null.");
parentPath = parent;
lastPathComponent = lastElement;
} |
Constructs a new TreePath, which is the path identified by
<code>parent</code> ending in <code>lastElement</code>.
| TreePath::TreePath | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
protected TreePath(Object[] path, int length) {
lastPathComponent = path[length - 1];
if(length > 1)
parentPath = new TreePath(path, length - 1);
} |
Constructs a new TreePath with the identified path components of
length <code>length</code>.
| TreePath::TreePath | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
protected TreePath() {
} |
Primarily provided for subclasses
that represent paths in a different manner.
If a subclass uses this constructor, it should also override
the <code>getPath</code>,
<code>getPathCount</code>, and
<code>getPathComponent</code> methods,
and possibly the <code>equals</code> method.
| TreePath::TreePath | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
public Object[] getPath() {
int i = getPathCount();
Object[] result = new Object[i--];
for(TreePath path = this; path != null; path = path.parentPath) {
result[i--] = path.lastPathComponent;
}
return result;
} |
Returns an ordered array of Objects containing the components of this
TreePath. The first element (index 0) is the root.
@return an array of Objects representing the TreePath
@see #TreePath(Object[])
| TreePath::getPath | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
public Object getLastPathComponent() {
return lastPathComponent;
} |
Returns the last component of this path. For a path returned by
DefaultTreeModel this will return an instance of TreeNode.
@return the Object at the end of the path
@see #TreePath(Object[])
| TreePath::getLastPathComponent | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
public int getPathCount() {
int result = 0;
for(TreePath path = this; path != null; path = path.parentPath) {
result++;
}
return result;
} |
Returns the number of elements in the path.
@return an int giving a count of items the path
| TreePath::getPathCount | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
public Object getPathComponent(int element) {
int pathLength = getPathCount();
if(element < 0 || element >= pathLength)
throw new IllegalArgumentException("Index " + element + " is out of the specified range");
TreePath path = this;
for(int i = pathLength-1; i != element; i--) {
path = path.parentPath;
}
return path.lastPathComponent;
} |
Returns the path component at the specified index.
@param element an int specifying an element in the path, where
0 is the first element in the path
@return the Object at that index location
@throws IllegalArgumentException if the index is beyond the length
of the path
@see #TreePath(Object[])
| TreePath::getPathComponent | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
public boolean equals(Object o) {
if(o == this)
return true;
if(o instanceof TreePath oTreePath) {
if(getPathCount() != oTreePath.getPathCount())
return false;
for(TreePath path = this; path != null; path = path.parentPath) {
if (!(path.lastPathComponent.equals
(oTreePath.lastPathComponent))) {
return false;
}
oTreePath = oTreePath.parentPath;
}
return true;
}
return false;
} |
Tests two TreePaths for equality by checking each element of the
paths for equality. Two paths are considered equal if they are of
the same length, and contain
the same elements (<code>.equals</code>).
@param o the Object to compare
| TreePath::equals | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
public int hashCode() {
return lastPathComponent.hashCode();
} |
Returns the hashCode for the object. The hash code of a TreePath
is defined to be the hash code of the last component in the path.
@return the hashCode for the object
| TreePath::hashCode | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
public boolean isDescendant(TreePath aTreePath) {
if(aTreePath == this)
return true;
if(aTreePath != null) {
int pathLength = getPathCount();
int oPathLength = aTreePath.getPathCount();
if(oPathLength < pathLength)
// Can't be a descendant, has fewer components in the path.
return false;
while(oPathLength-- > pathLength)
aTreePath = aTreePath.getParentPath();
return equals(aTreePath);
}
return false;
} |
Returns true if <code>aTreePath</code> is a
descendant of this
TreePath. A TreePath P1 is a descendant of a TreePath P2
if P1 contains all of the components that make up
P2's path.
For example, if this object has the path [a, b],
and <code>aTreePath</code> has the path [a, b, c],
then <code>aTreePath</code> is a descendant of this object.
However, if <code>aTreePath</code> has the path [a],
then it is not a descendant of this object. By this definition
a TreePath is always considered a descendant of itself. That is,
<code>aTreePath.isDescendant(aTreePath)</code> returns true.
@return true if <code>aTreePath</code> is a descendant of this path
| TreePath::isDescendant | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
public TreePath pathByAddingChild(Object child) {
if(child == null)
throw new NullPointerException("Null child not allowed");
return new TreePath(this, child);
} |
Returns a new path containing all the elements of this object
plus <code>child</code>. <code>child</code> will be the last element
of the newly created TreePath.
This will throw a NullPointerException
if child is null.
| TreePath::pathByAddingChild | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
public TreePath getParentPath() {
return parentPath;
} |
Returns a path containing all the elements of this object, except
the last path component.
| TreePath::getParentPath | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
public String toString() {
StringBuffer tempSpot = new StringBuffer("[");
for(int counter = 0, maxCounter = getPathCount();counter < maxCounter;
counter++) {
if(counter > 0)
tempSpot.append(", ");
tempSpot.append(getPathComponent(counter));
}
tempSpot.append("]");
return tempSpot.toString();
} |
Returns a string that displays and identifies this
object's properties.
@return a String representation of this object
| TreePath::toString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/TreePath.java | Apache-2.0 |
public Object[] getListenerList() {
return listenerList;
} |
Passes back the event listener list as an array
of ListenerType-listener pairs. Note that for
performance reasons, this implementation passes back
the actual data structure in which the listener data
is stored internally!
This method is guaranteed to pass back a non-null
array, so that no null-checking is required in
fire methods. A zero-length array of Object should
be returned if there are currently no listeners.
WARNING!!! Absolutely NO modification of
the data contained in this array should be made -- if
any such manipulation is necessary, it should be done
on a copy of the array returned rather than the array
itself.
| EventListenerList::getListenerList | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | Apache-2.0 |
public <T extends EventListener> T[] getListeners(Class<T> t) {
Object[] lList = listenerList;
int n = getListenerCount(lList, t);
T[] result = (T[])Array.newInstance(t, n);
int j = 0;
for (int i = lList.length-2; i>=0; i-=2) {
if (lList[i] == t) {
result[j++] = (T)lList[i+1];
}
}
return result;
} |
Return an array of all the listeners of the given type.
@return all of the listeners of the specified type.
@exception ClassCastException if the supplied class
is not assignable to EventListener
@since 1.3
| EventListenerList::getListeners | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | Apache-2.0 |
public int getListenerCount() {
return listenerList.length/2;
} |
Returns the total number of listeners for this listener list.
| EventListenerList::getListenerCount | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | Apache-2.0 |
public int getListenerCount(Class<?> t) {
Object[] lList = listenerList;
return getListenerCount(lList, t);
} |
Returns the total number of listeners of the supplied type
for this listener list.
| EventListenerList::getListenerCount | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | Apache-2.0 |
public synchronized <T extends EventListener> void add(Class<T> t, T l) {
if (l==null) {
// In an ideal world, we would do an assertion here
// to help developers know they are probably doing
// something wrong
return;
}
if (!t.isInstance(l)) {
throw new IllegalArgumentException("Listener " + l +
" is not of type " + t);
}
if (listenerList == NULL_ARRAY) {
// if this is the first listener added,
// initialize the lists
listenerList = new Object[] { t, l };
} else {
// Otherwise copy the array and add the new listener
int i = listenerList.length;
Object[] tmp = new Object[i+2];
System.arraycopy(listenerList, 0, tmp, 0, i);
tmp[i] = t;
tmp[i+1] = l;
listenerList = tmp;
}
} |
Adds the listener as a listener of the specified type.
@param t the type of the listener to be added
@param l the listener to be added
| EventListenerList::add | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | Apache-2.0 |
public synchronized <T extends EventListener> void remove(Class<T> t, T l) {
if (l ==null) {
// In an ideal world, we would do an assertion here
// to help developers know they are probably doing
// something wrong
return;
}
if (!t.isInstance(l)) {
throw new IllegalArgumentException("Listener " + l +
" is not of type " + t);
}
// Is l on the list?
int index = -1;
for (int i = listenerList.length-2; i>=0; i-=2) {
if ((listenerList[i]==t) && (listenerList[i + 1].equals(l))) {
index = i;
break;
}
}
// If so, remove it
if (index != -1) {
Object[] tmp = new Object[listenerList.length-2];
// Copy the list up to index
System.arraycopy(listenerList, 0, tmp, 0, index);
// Copy from two past the index, up to
// the end of tmp (which is two elements
// shorter than the old list)
if (index < tmp.length)
System.arraycopy(listenerList, index+2, tmp, index,
tmp.length - index);
// set the listener array to the new array or null
listenerList = (tmp.length == 0) ? NULL_ARRAY : tmp;
}
} |
Removes the listener as a listener of the specified type.
@param t the type of the listener to be removed
@param l the listener to be removed
| EventListenerList::remove | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | Apache-2.0 |
public String toString() {
Object[] lList = listenerList;
String s = "EventListenerList: ";
s += lList.length/2 + " listeners: ";
for (int i = 0 ; i <= lList.length-2 ; i+=2) {
s += " type " + ((Class)lList[i]).getName();
s += " listener " + lList[i+1];
}
return s;
} |
Returns a string representation of the EventListenerList.
| EventListenerList::toString | java | ZTFtrue/MonsterMusic | app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/org/jaudiotagger/utils/tree/EventListenerList.java | Apache-2.0 |
public DelayEffect(float echoLength, float decay, float sampleRate) {
this.sampleRate = sampleRate;
setDecay(decay);
setEchoLength(echoLength);
applyNewEchoLength();
} |
@param echoLength in seconds
@param sampleRate the sample rate in Hz.
@param decay The decay of the echo, a value between 0 and 1. 1 meaning no decay, 0 means immediate decay (not echo effect).
| DelayEffect::DelayEffect | java | ZTFtrue/MonsterMusic | app/src/main/java/com/ztftrue/music/effects/DelayEffect.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/com/ztftrue/music/effects/DelayEffect.java | Apache-2.0 |
public void setEchoLength(float newEchoLength) {
this.newEchoLength = newEchoLength;
} |
@param newEchoLength A new echo buffer length in seconds.
| DelayEffect::setEchoLength | java | ZTFtrue/MonsterMusic | app/src/main/java/com/ztftrue/music/effects/DelayEffect.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/com/ztftrue/music/effects/DelayEffect.java | Apache-2.0 |
public void setDecay(float newDecay) {
this.decay = newDecay;
} |
A decay, should be a value between zero and one.
@param newDecay the new decay (preferably between zero and one).
| DelayEffect::setDecay | java | ZTFtrue/MonsterMusic | app/src/main/java/com/ztftrue/music/effects/DelayEffect.java | https://github.com/ZTFtrue/MonsterMusic/blob/master/app/src/main/java/com/ztftrue/music/effects/DelayEffect.java | Apache-2.0 |
private TitleCaseMacro(String name, String description) {
super(name, description);
} |
Strictly to uphold contract for constructors in base class.
| TitleCaseMacro::TitleCaseMacro | java | JetBrains/intellij-sdk-code-samples | live_templates/src/main/java/org/intellij/sdk/liveTemplates/TitleCaseMacro.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/live_templates/src/main/java/org/intellij/sdk/liveTemplates/TitleCaseMacro.java | Apache-2.0 |
public boolean isAvailable(@NotNull Project project, Editor editor, @Nullable PsiElement element) {
// Quick sanity check
if (element == null) {
return false;
}
// Is this a token of type representing a "?" character?
if (element instanceof PsiJavaToken token) {
if (token.getTokenType() != JavaTokenType.QUEST) {
return false;
}
// Is this token part of a fully formed conditional, i.e. a ternary?
if (token.getParent() instanceof PsiConditionalExpression conditionalExpression) {
// Satisfies all criteria; call back invoke method
return conditionalExpression.getThenExpression() != null && conditionalExpression.getElseExpression() != null;
}
return false;
}
return false;
} |
Checks whether this intention is available at the caret offset in file - the caret must sit just before a "?"
character in a ternary statement. If this condition is met, this intention's entry is shown in the available
intentions list.
<p>Note: this method must do its checks quickly and return.</p>
@param project a reference to the Project object being edited.
@param editor a reference to the object editing the project source
@param element a reference to the PSI element currently under the caret
@return {@code true} if the caret is in a literal string element, so this functionality should be added to the
intention menu or {@code false} for all other types of caret positions
| ConditionalOperatorConverter::isAvailable | java | JetBrains/intellij-sdk-code-samples | conditional_operator_intention/src/main/java/org/intellij/sdk/intention/ConditionalOperatorConverter.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/conditional_operator_intention/src/main/java/org/intellij/sdk/intention/ConditionalOperatorConverter.java | Apache-2.0 |
public PopupDialogAction() {
super();
} |
This default constructor is used by the IntelliJ Platform framework to instantiate this class based on plugin.xml
declarations. Only needed in {@link PopupDialogAction} class because a second constructor is overridden.
| PopupDialogAction::PopupDialogAction | java | JetBrains/intellij-sdk-code-samples | action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java | Apache-2.0 |
public void testRelationalEq() {
doTest("Eq");
} |
Test the '==' case.
| ComparingStringReferencesInspectionTest::testRelationalEq | java | JetBrains/intellij-sdk-code-samples | comparing_string_references_inspection/src/test/java/org/intellij/sdk/codeInspection/ComparingStringReferencesInspectionTest.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/comparing_string_references_inspection/src/test/java/org/intellij/sdk/codeInspection/ComparingStringReferencesInspectionTest.java | Apache-2.0 |
public void testRelationalNeq() {
doTest("Neq");
} |
Test the '!=' case.
| ComparingStringReferencesInspectionTest::testRelationalNeq | java | JetBrains/intellij-sdk-code-samples | comparing_string_references_inspection/src/test/java/org/intellij/sdk/codeInspection/ComparingStringReferencesInspectionTest.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/comparing_string_references_inspection/src/test/java/org/intellij/sdk/codeInspection/ComparingStringReferencesInspectionTest.java | Apache-2.0 |
protected void doTest(@NotNull String testName) {
// Initialize the test based on the testData file
myFixture.configureByFile(testName + ".java");
// Initialize the inspection and get a list of highlighted
List<HighlightInfo> highlightInfos = myFixture.doHighlighting();
assertFalse(highlightInfos.isEmpty());
// Get the quick fix action for comparing references inspection and apply it to the file
final IntentionAction action = myFixture.findSingleIntention(QUICK_FIX_NAME);
assertNotNull(action);
myFixture.launchAction(action);
// Verify the results
myFixture.checkResultByFile(testName + ".after.java");
} |
Given the name of a test file, runs comparing references inspection quick fix and tests
the results against a reference outcome file.
File name pattern 'foo.java' and 'foo.after.java' are matching before and after files
in the testData directory.
@param testName test file name base
| ComparingStringReferencesInspectionTest::doTest | java | JetBrains/intellij-sdk-code-samples | comparing_string_references_inspection/src/test/java/org/intellij/sdk/codeInspection/ComparingStringReferencesInspectionTest.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/comparing_string_references_inspection/src/test/java/org/intellij/sdk/codeInspection/ComparingStringReferencesInspectionTest.java | Apache-2.0 |
public ImagesProjectNode(@NotNull Project project,
@NotNull ViewSettings settings,
@NotNull VirtualFile rootDir,
@NotNull Disposable parentDisposable) {
super(project, rootDir, settings);
scanImages(project);
setupImageFilesRefresher(project, parentDisposable); // subscribe to changes only in the root node
updateQueue = new MergingUpdateQueue(ImagesProjectNode.class.getName(), 200, true, null, parentDisposable, null);
} |
Creates root node.
| ImagesProjectNode::ImagesProjectNode | java | JetBrains/intellij-sdk-code-samples | project_view_pane/src/main/java/org/intellij/sdk/view/pane/ImagesProjectNode.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/project_view_pane/src/main/java/org/intellij/sdk/view/pane/ImagesProjectNode.java | Apache-2.0 |
public static List<SimpleProperty> findProperties(Project project, String key) {
List<SimpleProperty> result = new ArrayList<>();
Collection<VirtualFile> virtualFiles =
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project));
for (VirtualFile virtualFile : virtualFiles) {
SimpleFile simpleFile = (SimpleFile) PsiManager.getInstance(project).findFile(virtualFile);
if (simpleFile != null) {
SimpleProperty[] properties = PsiTreeUtil.getChildrenOfType(simpleFile, SimpleProperty.class);
if (properties != null) {
for (SimpleProperty property : properties) {
if (key.equals(property.getKey())) {
result.add(property);
}
}
}
}
}
return result;
} |
Searches the entire project for Simple language files with instances of the Simple property with the given key.
@param project current project
@param key to check
@return matching properties
| SimpleUtil::findProperties | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleUtil.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleUtil.java | Apache-2.0 |
private void addKeyValueSection(String key, String value, StringBuilder sb) {
sb.append(DocumentationMarkup.SECTION_HEADER_START);
sb.append(key);
sb.append(DocumentationMarkup.SECTION_SEPARATOR);
sb.append("<p>");
sb.append(value);
sb.append(DocumentationMarkup.SECTION_END);
} |
Creates a key/value row for the rendered documentation.
| SimpleDocumentationProvider::addKeyValueSection | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleDocumentationProvider.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleDocumentationProvider.java | Apache-2.0 |
private String renderFullDoc(String key, String value, String file, String docComment) {
StringBuilder sb = new StringBuilder();
sb.append(DocumentationMarkup.DEFINITION_START);
sb.append("Simple Property");
sb.append(DocumentationMarkup.DEFINITION_END);
sb.append(DocumentationMarkup.CONTENT_START);
sb.append(value);
sb.append(DocumentationMarkup.CONTENT_END);
sb.append(DocumentationMarkup.SECTIONS_START);
addKeyValueSection("Key:", key, sb);
addKeyValueSection("Value:", value, sb);
addKeyValueSection("File:", file, sb);
addKeyValueSection("Comment:", docComment, sb);
sb.append(DocumentationMarkup.SECTIONS_END);
return sb.toString();
} |
Creates the formatted documentation using {@link DocumentationMarkup}. See the Java doc of
{@link com.intellij.lang.documentation.DocumentationProvider#generateDoc(PsiElement, PsiElement)} for more
information about building the layout.
| SimpleDocumentationProvider::renderFullDoc | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleDocumentationProvider.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleDocumentationProvider.java | Apache-2.0 |
SimpleLexer(java.io.Reader in) {
this.zzReader = in;
} |
Creates a new scanner
@param in the java.io.Reader to read input from.
| SimpleLexer::SimpleLexer | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
private int zzMaxBufferLen() {
return Integer.MAX_VALUE;
} |
Creates a new scanner
@param in the java.io.Reader to read input from.
SimpleLexer(java.io.Reader in) {
this.zzReader = in;
}
/** Returns the maximum size of the scanner buffer, which limits the size of tokens. | SimpleLexer::zzMaxBufferLen | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
private boolean zzCanGrow() {
return true;
} |
Creates a new scanner
@param in the java.io.Reader to read input from.
SimpleLexer(java.io.Reader in) {
this.zzReader = in;
}
/** Returns the maximum size of the scanner buffer, which limits the size of tokens.
private int zzMaxBufferLen() {
return Integer.MAX_VALUE;
}
/** Whether the scanner buffer can grow to accommodate a larger token. | SimpleLexer::zzCanGrow | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
private static int zzCMap(int input) {
int offset = input & 255;
return offset == input ? ZZ_CMAP_BLOCKS[offset] : ZZ_CMAP_BLOCKS[ZZ_CMAP_TOP[input >> 8] | offset];
} |
Translates raw input code points to DFA table row
| SimpleLexer::zzCMap | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
private boolean zzRefill() throws java.io.IOException {
return true;
} |
Refills the input buffer.
@return {@code false}, iff there was new input.
@exception java.io.IOException if any I/O-Error occurs
| SimpleLexer::zzRefill | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
public final int yystate() {
return zzLexicalState;
} |
Returns the current lexical state.
| SimpleLexer::yystate | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
public final void yybegin(int newState) {
zzLexicalState = newState;
} |
Enters a new lexical state
@param newState the new lexical state
| SimpleLexer::yybegin | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
public final CharSequence yytext() {
return zzBuffer.subSequence(zzStartRead, zzMarkedPos);
} |
Returns the text matched by the current regular expression.
| SimpleLexer::yytext | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
public final char yycharat(int pos) {
return zzBuffer.charAt(zzStartRead+pos);
} |
Returns the character at position {@code pos} from the
matched text.
It is equivalent to yytext().charAt(pos), but faster
@param pos the position of the character to fetch.
A value from 0 to yylength()-1.
@return the character at position pos
| SimpleLexer::yycharat | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
public final int yylength() {
return zzMarkedPos-zzStartRead;
} |
Returns the length of the matched text region.
| SimpleLexer::yylength | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
} |
Reports an error that occurred while scanning.
In a wellformed scanner (no or only correct usage of
yypushback(int) and a match-all fallback rule) this method
will only be called with things that "Can't Possibly Happen".
If this method is called, something is seriously wrong
(e.g. a JFlex bug producing a faulty scanner etc.).
Usual syntax/scanner level error handling should be done
in error fallback rules.
@param errorCode the code of the errormessage to display
| SimpleLexer::zzScanError | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
} |
Pushes the specified amount of characters back into the input stream.
They will be read again by then next call of the scanning method
@param number the number of characters to be read again.
This number must not be greater than yylength()!
| SimpleLexer::yypushback | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
private void zzDoEOF() {
if (!zzEOFDone) {
zzEOFDone = true;
}
} |
Contains user EOF-code, which will be executed exactly once,
when the end of file is reached
| SimpleLexer::zzDoEOF | java | JetBrains/intellij-sdk-code-samples | simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | https://github.com/JetBrains/intellij-sdk-code-samples/blob/master/simple_language_plugin/src/main/gen/org/intellij/sdk/language/SimpleLexer.java | Apache-2.0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.