From 8065aa2185475554bac555111fa138d1c54a8630 Mon Sep 17 00:00:00 2001 From: rbouckaert Date: Thu, 16 May 2024 12:28:49 +1200 Subject: [PATCH] make Alignment a StateNode -- needs testing #1150 --- .../base/evolution/alignment/Alignment.java | 94 +++++++++++++++++++ src/beast/base/inference/StateNode.java | 6 +- src/beast/base/inference/parameter/Map.java | 4 +- 3 files changed, 98 insertions(+), 6 deletions(-) diff --git a/src/beast/base/evolution/alignment/Alignment.java b/src/beast/base/evolution/alignment/Alignment.java index 736c696f..d1ba69c8 100644 --- a/src/beast/base/evolution/alignment/Alignment.java +++ b/src/beast/base/evolution/alignment/Alignment.java @@ -24,13 +24,17 @@ */ package beast.base.evolution.alignment; +import java.io.PrintStream; import java.util.*; +import org.w3c.dom.Node; + import beast.base.core.Description; import beast.base.core.Input; import beast.base.core.Log; import beast.base.core.Input.Validate; import beast.base.evolution.datatype.DataType; +import beast.base.inference.StateNode; import beast.base.inference.parameter.Map; import beast.pkgmgmt.BEASTClassLoader; import beast.pkgmgmt.PackageManager; @@ -880,5 +884,95 @@ public String getSequenceAsString(String taxon) { } while (difference > 1E-8 && attempts < 1000); return freqs; } // calcFrequencies + + @Override + public void init(PrintStream out) { + // TODO Auto-generated method stub + + } + + @Override + public void log(long sample, PrintStream out) { + // TODO Auto-generated method stub + + } + + @Override + public void close(PrintStream out) { + // TODO Auto-generated method stub + + } + + @Override + public int getDimension() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public double getArrayValue(int dim) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void setEverythingDirty(boolean isDirty) { + // TODO Auto-generated method stub + + } + + @Override + public StateNode copy() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void assignTo(StateNode other) { + // TODO Auto-generated method stub + + } + + @Override + public void assignFrom(StateNode other) { + // TODO Auto-generated method stub + + } + + @Override + public void assignFromFragile(StateNode other) { + // TODO Auto-generated method stub + + } + + @Override + public void fromXML(Node node) { + // TODO Auto-generated method stub + + } + + @Override + public String toXML() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int scale(double scale) { + // TODO Auto-generated method stub + return 0; + } + + @Override + protected void store() { + // TODO Auto-generated method stub + + } + + @Override + public void restore() { + // TODO Auto-generated method stub + + } } // class Data diff --git a/src/beast/base/inference/StateNode.java b/src/beast/base/inference/StateNode.java index c3e362ba..98771039 100644 --- a/src/beast/base/inference/StateNode.java +++ b/src/beast/base/inference/StateNode.java @@ -117,15 +117,13 @@ public void assignFromWithoutID(StateNode other) { * for storing a state * */ final public void toXML(PrintStream out) { - out.print(""); - out.print(normalise(toString())); - out.print("\n"); + out.println(toXML()); } /** * stores a state node in XML format, to be restored by fromXML() * */ - final public String toXML() { + public String toXML() { return "" + normalise(toString()) + "\n"; diff --git a/src/beast/base/inference/parameter/Map.java b/src/beast/base/inference/parameter/Map.java index f4e70ed6..28e5a710 100644 --- a/src/beast/base/inference/parameter/Map.java +++ b/src/beast/base/inference/parameter/Map.java @@ -6,10 +6,10 @@ import beast.base.core.Description; import beast.base.core.Input; -import beast.base.inference.CalculationNode; +import beast.base.inference.StateNode; @Description("Unordered set mapping keys to values") -abstract public class Map extends CalculationNode { +abstract public class Map extends StateNode { final public Input> defaultInput = new Input<>("*", "Input containing the map", new LinkedHashMap<>());