X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=srcjar%2Ffr%2Forsay%2Flri%2Fvarna%2Fmodels%2Ftreealign%2FRNANodeValue2.java;fp=srcjar%2Ffr%2Forsay%2Flri%2Fvarna%2Fmodels%2Ftreealign%2FRNANodeValue2.java;h=0000000000000000000000000000000000000000;hb=4f77328104498504339216829abf5ea87e2791ec;hp=6fff9a9b030618ad6e009d33f555d9cfda76405d;hpb=2b8c0785318a3528e1876e8e2dd48b7d831eae69;p=jalview.git diff --git a/srcjar/fr/orsay/lri/varna/models/treealign/RNANodeValue2.java b/srcjar/fr/orsay/lri/varna/models/treealign/RNANodeValue2.java deleted file mode 100644 index 6fff9a9..0000000 --- a/srcjar/fr/orsay/lri/varna/models/treealign/RNANodeValue2.java +++ /dev/null @@ -1,136 +0,0 @@ -package fr.orsay.lri.varna.models.treealign; -import java.util.ArrayList; -import java.util.List; - - - -/** - * In this model, nodes are either: - * 1. a couple of paired bases, and in that case they may have children, - * in this case singleNode is true - * 2. a single base that comes from a broken base pair - * (broken during planarization), without children, - * in this case singleNode is true - * 3. a list of consecutive non-paired bases, without children. - * in this case singleNode is false - * Note that case 2 happens only if original sequences contained - * pseudoknots, otherwise this case can be ignored. - * - * @author Raphael Champeimont - * - */ -public class RNANodeValue2 implements GraphvizDrawableNodeValue { - /** - * Says whether we have a single node or a list of nodes. - */ - private boolean singleNode = true; - - /** - * Defined if singleNode is true. - */ - private RNANodeValue node; - - /** - * Defined if singleNode is false; - */ - private List nodes; - - public RNANodeValue2(boolean singleNode) { - this.singleNode = singleNode; - if (singleNode) { - node = new RNANodeValue(); - } else { - nodes = new ArrayList(); - } - } - - /** - * In case of a single node, return it. - * Will throw RNANodeValue2WrongTypeException if singleNode = false. - */ - public RNANodeValue getNode() { - if (singleNode) { - return node; - } else { - throw (new RNANodeValue2WrongTypeException()); - } - } - - public void setNode(RNANodeValue node) { - if (singleNode) { - this.node = node; - } else { - throw (new RNANodeValue2WrongTypeException()); - } - } - - /** - * In case of multiple nodes, return them. - * Will throw RNANodeValue2WrongTypeException if singleNode = true. - */ - public List getNodes() { - if (!singleNode) { - return nodes; - } else { - throw (new RNANodeValue2WrongTypeException()); - } - } - /** - * In case of multiple nodes, return the sequence of nucleotides. - */ - public char[] computeSequence() { - if (!singleNode) { - final int n = nodes.size(); - char[] sequence = new char[n]; - for (int i=0; i nodes) { - if (!singleNode) { - this.nodes = nodes; - } else { - throw (new RNANodeValue2WrongTypeException()); - } - } - - public boolean isSingleNode() { - return singleNode; - } - - public String toString() { - if (singleNode) { - return node.toString(); - } else { - String s = ""; - for (RNANodeValue node: nodes) { - if (s != "") { - s += " "; - } - s += node.toString(); - } - return s; - } - } - - public String toGraphvizNodeName() { - if (singleNode) { - return node.toGraphvizNodeName(); - } else { - String s = ""; - for (RNANodeValue node: nodes) { - if (s != "") { - s += " "; - } - s += node.toGraphvizNodeName(); - } - return s; - } - } - -}