QueueNode.java

[sourcecode language=”java” wraplines=”false” collapse=”false”]
/* Author: Jourdan Bul-lalayao
* Class: QueueNode.java
* Purpose: Sub-data structure used in Binomial Queue.
*/

public class QueueNode {

private int vertex;
private int degree;
private int distance;
private QueueNode parent;
private QueueNode leftChild;
private QueueNode rightSib;

public QueueNode(int vertex, int degree, int distance, QueueNode parent,
QueueNode leftChild, QueueNode rightSib) {
this.vertex = vertex;
this.degree = degree;
this.distance = distance;
this.parent = parent;
this.leftChild = leftChild;
this.rightSib = rightSib;
}

public void setVertex(int vertex) {
this.vertex = vertex;
}

public void setDegree(int degree) {
this.degree = degree;
}

public void setDistance(int distance) {
this.distance = distance;
}

public void setParent(QueueNode parent) {
this.parent = parent;
}

public void setLeftChild(QueueNode leftChild) {
this.leftChild = leftChild;
}

public void setRightSib(QueueNode rightSib) {
this.rightSib = rightSib;
}

public void incrementDegree() {
degree++;
}

public int getVertex() {
return vertex;
}

public int getDegree() {
return degree;
}

public int getDistance() {
return distance;
}

public QueueNode getParent() {
return parent;
}

public QueueNode getLeftChild() {
return leftChild;
}

public QueueNode getRightSib() {
return rightSib;
}
}
[/sourcecode]

Leave a Reply

Your email address will not be published. Required fields are marked *