com.ibm.wala.util.graph.labeled.AbstractNumberedLabeledGraph Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.ibm.wala.util Show documentation
Show all versions of com.ibm.wala.util Show documentation
T. J. Watson Libraries for Analysis
The newest version!
/*
* Copyright (c) 2007 Juergen Graf
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Juergen Graf
*/
package com.ibm.wala.util.graph.labeled;
import com.ibm.wala.util.graph.AbstractNumberedGraph;
import com.ibm.wala.util.intset.IntSet;
import java.util.Iterator;
import java.util.Set;
import org.jspecify.annotations.Nullable;
public abstract class AbstractNumberedLabeledGraph extends AbstractNumberedGraph
implements LabeledGraph, NumberedLabeledGraph {
/**
* @return the object which manages edges in the graph
*/
@Override
protected abstract NumberedLabeledEdgeManager getEdgeManager();
@Override
public void addEdge(T src, T dst, U label) {
getEdgeManager().addEdge(src, dst, label);
}
@Override
public Iterator extends U> getPredLabels(T N) {
return getEdgeManager().getPredLabels(N);
}
@Override
public int getPredNodeCount(T N, U label) {
return getEdgeManager().getPredNodeCount(N, label);
}
@Override
public Iterator getPredNodes(T N, U label) {
return getEdgeManager().getPredNodes(N, label);
}
@Override
public Iterator extends U> getSuccLabels(T N) {
return getEdgeManager().getSuccLabels(N);
}
@Override
public int getSuccNodeCount(T N, U label) {
return getEdgeManager().getSuccNodeCount(N, label);
}
@Override
public Iterator extends T> getSuccNodes(T N, U label) {
return getEdgeManager().getSuccNodes(N, label);
}
@Override
public IntSet getPredNodeNumbers(T node, U label) throws IllegalArgumentException {
return getEdgeManager().getPredNodeNumbers(node, label);
}
@Override
public IntSet getSuccNodeNumbers(T node, U label) throws IllegalArgumentException {
return getEdgeManager().getSuccNodeNumbers(node, label);
}
@Override
public boolean hasEdge(T src, T dst, U label) {
return getEdgeManager().hasEdge(src, dst, label);
}
@Override
public void removeEdge(T src, T dst, U label) {
getEdgeManager().removeEdge(src, dst, label);
}
@Override
public Set extends U> getEdgeLabels(T src, T dst) {
return getEdgeManager().getEdgeLabels(src, dst);
}
@Nullable
@Override
public U getDefaultLabel() {
return getEdgeManager().getDefaultLabel();
}
@Override
protected String edgeString(T from, T to) {
Set extends U> labels = getEdgeLabels(from, to);
if (labels != null && !labels.isEmpty()) {
return "-" + labels + "->";
} else {
return super.edgeString(from, to);
}
}
}