kieker.visualization.trace.call.tree.AbstractCallTreeNode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tools Show documentation
Show all versions of tools Show documentation
Kieker: Application Performance Monitoring and Dynamic Software Analysis
The newest version!
/***************************************************************************
* Copyright 2022 Kieker Project (http://kieker-monitoring.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***************************************************************************/
package kieker.visualization.trace.call.tree;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import kieker.model.system.model.MessageTrace;
import kieker.tools.trace.analysis.filter.visualization.graph.AbstractVertex;
import kieker.tools.trace.analysis.filter.visualization.graph.IOriginRetentionPolicy;
/**
* This is an abstract base for a single node within a call tree.
*
* @param
* The type of the entity to be stored in the node.
*
* @author Andre van Hoorn
*
* @since 1.1
*/
public abstract class AbstractCallTreeNode extends AbstractVertex, WeightedDirectedCallTreeEdge, MessageTrace> {
private final T entity;
private final int id;
private final boolean rootNode;
private final List> childEdges = Collections.synchronizedList(new ArrayList<>());
/**
* This constructor uses the given parameters to initialize the fields of this class.
*
* @param id
* The identifier of this node.
* @param entity
* The content of this node.
* @param rootNode
* Determines whether this node is the root node or not.
* @param origin
* The meta data of this node.
* @param originPolicy
* The origin policy.
*/
public AbstractCallTreeNode(final int id, final T entity, final boolean rootNode, final MessageTrace origin, final IOriginRetentionPolicy originPolicy) {
super(origin, originPolicy);
this.id = id;
this.rootNode = rootNode;
this.entity = entity;
}
/**
* Delivers the stored entity.
*
* @return The content of this node.
*/
public final T getEntity() {
return this.entity;
}
/**
* Delivers the child edges.
*
* @return A collection containing the child edges.
*/
public final Collection> getChildEdges() {
return this.childEdges;
}
/**
* Append edge to *sorted* list of children.
*
* @param destination
* The edge to add to the list of children edges.
*/
protected final void appendChildEdge(final WeightedDirectedCallTreeEdge destination) {
this.childEdges.add(destination);
}
public abstract AbstractCallTreeNode newCall(T destination, MessageTrace origin, IOriginRetentionPolicy originPolicy);
public final int getId() {
return this.id;
}
/**
* Tells whether the current node is a root node.
*
* @return true if and only if the current node has to be interpreted as a root node.
*/
public final boolean isRootNode() {
return this.rootNode;
}
@Override
public Collection> getOutgoingEdges() {
return this.getChildEdges();
}
@Override
public String toString() {
return this.getClass().getName() + "[" + this.entity + "]";
}
}