本文整理汇总了Java中beast.core.BEASTObject类的典型用法代码示例。如果您正苦于以下问题:Java BEASTObject类的具体用法?Java BEASTObject怎么用?Java BEASTObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BEASTObject类属于beast.core包,在下文中一共展示了BEASTObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testDescriptions
import beast.core.BEASTObject; //导入依赖的package包/类
/**
* Check all plug-ins have a proper description so that
* everything is at least moderately well documented. *
*/
@Test
public void testDescriptions() {
final List<String> pluginNames = AddOnManager.find(beast.core.BEASTObject.class, AddOnManager.IMPLEMENTATION_DIR);
final List<String> undocumentedPlugins = new ArrayList<String>();
for (final String beastObjectName : pluginNames) {
try {
final Class<?> pluginClass = Class.forName(beastObjectName);
final Annotation[] classAnnotations = pluginClass.getAnnotations();
boolean hasSatisfactoryDescription = false;
for (final Annotation annotation : classAnnotations) {
if (annotation instanceof Description) {
final Description description = (Description) annotation;
final String descriptionString = description.value();
if (isProperDocString(descriptionString)) {
hasSatisfactoryDescription = true;
}
}
}
if (!hasSatisfactoryDescription) {
undocumentedPlugins.add(beastObjectName);
}
} catch (Exception e) {
}
}
assertTrue("No proper description for: " + undocumentedPlugins.toString(), undocumentedPlugins.size() == 0);
}
开发者ID:CompEvol,项目名称:beast2,代码行数:31,代码来源:DocumentationTest.java
示例2: testInputTipText
import beast.core.BEASTObject; //导入依赖的package包/类
/**
* Check all inputs of plug-ins have a proper tip text, again
* to facilitate proper documentation. *
*/
@Test
public void testInputTipText() {
final List<String> pluginNames = AddOnManager.find(beast.core.BEASTObject.class, AddOnManager.IMPLEMENTATION_DIR);
final List<String> undocumentedInputs = new ArrayList<String>();
for (final String beastObjectName : pluginNames) {
try {
final BEASTObject beastObject = (BEASTObject) Class.forName(beastObjectName).newInstance();
final List<Input<?>> inputs = beastObject.listInputs();
for (final Input<?> input : inputs) {
boolean hasSatisfactoryDescription = false;
final String tipText = input.getTipText();
if (isProperDocString(tipText)) {
hasSatisfactoryDescription = true;
}
if (!hasSatisfactoryDescription) {
undocumentedInputs.add(beastObjectName + ":" + input.getName());
}
}
} catch (Exception e) {
}
}
assertTrue("No proper input tip text (at least " + N_WORDS + " words and " + N_CHARS + " characters) for: "
+ undocumentedInputs.toString(), undocumentedInputs.size() == 0);
}
开发者ID:CompEvol,项目名称:beast2,代码行数:30,代码来源:DocumentationTest.java
示例3: initAndValidate
import beast.core.BEASTObject; //导入依赖的package包/类
@Override
public void initAndValidate() {
// Assemble name->param map
Map<String, Function> functionsMap = new HashMap<>();
for (Function func : functionsInput.get()) {
BEASTObject obj = (BEASTObject)func;
functionsMap.put(obj.getID(), func);
}
// Build AST from expression string
ANTLRInputStream input = new ANTLRInputStream(expressionInput.get());
ExpressionLexer lexer = new ExpressionLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
ExpressionParser parser = new ExpressionParser(tokens);
parseTree = parser.expression();
// Create new visitor for calculating expression values:
visitor = new ExpCalculatorVisitor(functionsMap);
update();
}
开发者ID:tgvaughan,项目名称:feast,代码行数:23,代码来源:ExpCalculator.java
示例4: initAndValidate
import beast.core.BEASTObject; //导入依赖的package包/类
@Override
public void initAndValidate() {
// Assemble name->param map
Map<String, Function> functionsMap = new HashMap<>();
for (Function func : functionsInput.get()) {
BEASTObject obj = (BEASTObject)func;
functionsMap.put(obj.getID(), func);
}
// Build AST from expression string
ANTLRInputStream input = new ANTLRInputStream(expressionInput.get());
ExpressionLexer lexer = new ExpressionLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
ExpressionParser parser = new ExpressionParser(tokens);
parseTree = parser.expression();
// Create new visitor for calculating expression values:
visitor = new ExpCalculatorVisitor(functionsMap);
update();
if (res.length != 1)
throw new IllegalArgumentException("ExpCalculatorDistribution "
+ "expressions must be single-valued.");
}
开发者ID:tgvaughan,项目名称:feast,代码行数:27,代码来源:ExpCalculatorDistribution.java
示例5: findAlignments
import beast.core.BEASTObject; //导入依赖的package包/类
/**
* Return first alignment object found underneath BEASTObject obj.
*
* @param obj
* @return Alignment object if found, null otherwise.
* @throws IllegalArgumentException
* @throws IllegalAccessException
*/
private static Set<Alignment> findAlignments(BEASTObject obj) throws IllegalArgumentException, IllegalAccessException {
Set<Alignment> alignments = new HashSet<>();
for (Input input : obj.listInputs()) {
if (input.get() != null) {
if (input.get() instanceof Alignment)
alignments.add((Alignment)input.get());
if (input.get() instanceof List) {
for (Object child : (List)input.get()) {
if (child instanceof BEASTObject) {
alignments.addAll(findAlignments((BEASTObject)child));
}
}
}
if (input.get() instanceof BEASTObject) {
alignments.addAll(findAlignments((BEASTObject)(input.get())));
}
}
}
return alignments;
}
开发者ID:tgvaughan,项目名称:feast,代码行数:30,代码来源:SequenceExtractor.java
示例6: main
import beast.core.BEASTObject; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
XMLParser parser = new XMLParser();
BEASTObject o = parser.parseFile(new File(args[0]));
if (!(o instanceof TreeDrawingGrid)) {
throw new RuntimeException("Expected top level element of type TreeDrawingGrid");
}
TreeDrawingGrid grid = (TreeDrawingGrid) o;
JFrame frame = new JFrame();
TreeDrawPanel panel = new TreeDrawPanel(grid);
frame.add(panel);
frame.setSize(1024, 768);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
开发者ID:CompEvol,项目名称:beastshell,代码行数:15,代码来源:TreeDrawPanel.java
示例7: evalFunctionInputs
import beast.core.BEASTObject; //导入依赖的package包/类
public static void evalFunctionInputs(Interpreter interpreter, List<Function> functions) {
try {
for (Function function : functions) {
String id = ((BEASTObject) function).getID();
if (function instanceof NamedFunction) {
id = ((NamedFunction)function).getName();
interpreter.set(id, ((NamedFunction)function).getFunction());
} else {
interpreter.set(id, function);
}
}
} catch (EvalError e) {
throw new RuntimeException("Error in BSHOperator: " + e.getMessage());
}
}
开发者ID:CompEvol,项目名称:beastshell,代码行数:16,代码来源:NamedFunction.java
示例8: getParameterIds
import beast.core.BEASTObject; //导入依赖的package包/类
public List<String> getParameterIds() {
List<String> paramIDs = new ArrayList<>();
paramIDs.add(((BEASTObject) popSizes).getID());
paramIDs.add(groupSizes.getID());
return paramIDs;
}
开发者ID:CompEvol,项目名称:beast2,代码行数:9,代码来源:BayesianSkyline.java
示例9: makeJavaDoc
import beast.core.BEASTObject; //导入依赖的package包/类
/**
* print @Description and Input.description info so that it can
* be inserted in the code before creating Javadoc documentation
* for the Beast II SDK.
*/
void makeJavaDoc() {
for (String beastObjectName : m_beastObjectNames) {
try {
BEASTObject beastObject = (BEASTObject) Class.forName(beastObjectName).newInstance();
Log.info.println(beastObjectName + ":@description:" + beastObject.getDescription());
for (Input<?> input : beastObject.listInputs()) {
Log.info.println(beastObjectName + ":" + input.getName() + ":" + input.getTipText());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
开发者ID:CompEvol,项目名称:beast2,代码行数:19,代码来源:DocMaker.java
示例10: getImplementations
import beast.core.BEASTObject; //导入依赖的package包/类
/**
* Find all beastObjects that are derived from given beastObject *
*/
String[] getImplementations(BEASTObject beastObject) {
String name = beastObject.getClass().getName();
List<String> implementations = new ArrayList<>();
for (String beastObjectName : m_beastObjectNames) {
try {
if (!beastObjectName.equals(name) && beastObject.getClass().isAssignableFrom(Class.forName(beastObjectName))) {
implementations.add(beastObjectName);
}
} catch (ClassNotFoundException e) {
}
}
return implementations.toArray(new String[0]);
}
开发者ID:CompEvol,项目名称:beast2,代码行数:17,代码来源:DocMaker.java
示例11: initAndValidate
import beast.core.BEASTObject; //导入依赖的package包/类
@Override
public void initAndValidate() {
// determine dimension
int dimension = 0;
for (BEASTObject beastObject : m_values.get()) {
if (!(beastObject instanceof Function)) {
throw new IllegalArgumentException("Input does not implement Valuable");
}
dimension += ((Function) beastObject).getDimension();
}
m_fValues = new double[dimension];
}
开发者ID:CompEvol,项目名称:beast2,代码行数:13,代码来源:CompoundValuable.java
示例12: recompute
import beast.core.BEASTObject; //导入依赖的package包/类
/**
* collect values of the compounds into an array *
*/
private void recompute() {
int k = 0;
for (BEASTObject beastObject : m_values.get()) {
Function valuable = (Function) beastObject;
if (beastObject instanceof StateNode) {
valuable = ((StateNode) beastObject).getCurrent();
}
int dimension = valuable.getDimension();
for (int i = 0; i < dimension; i++) {
m_fValues[k++] = valuable.getArrayValue(i);
}
}
m_bRecompute = false;
}
开发者ID:CompEvol,项目名称:beast2,代码行数:18,代码来源:CompoundValuable.java
示例13: testInputTypeCanBeSet
import beast.core.BEASTObject; //导入依赖的package包/类
@Test
public void testInputTypeCanBeSet() throws Exception {
List<String> beastObjectNames = AddOnManager.find(beast.core.BEASTObject.class,
AddOnManager.IMPLEMENTATION_DIR);
List<String> failingInputs = new ArrayList<String>();
for (String beastObjectName : beastObjectNames) {
try {
BEASTObject beastObject = (BEASTObject) Class.forName(beastObjectName).newInstance();
List<Input<?>> inputs = beastObject.listInputs();
for (Input<?> input : inputs) {
if (input.getType() == null) {
try {
input.determineClass(beastObject);
if (input.getType() == null) {
failingInputs.add(beastObject + ":" + input.getName());
}
} catch (Exception e2) {
failingInputs.add(beastObject + ":" + input.getName());
}
}
}
} catch (Exception e) {
// ignore
}
}
assertTrue(
"Type of input could not be set for these inputs (probably requires to be set by using the appropriate constructure of Input): "
+ failingInputs.toString(),
failingInputs.size() == 0);
}
开发者ID:CompEvol,项目名称:beast2,代码行数:32,代码来源:InputTypeTest.java
示例14: pluginListAsString
import beast.core.BEASTObject; //导入依赖的package包/类
private String pluginListAsString(List<?> list) {
if (list.size() == 0) {
return "";
}
StringBuffer bf = new StringBuffer();
for (Object o : list) {
BEASTObject beastObject = (BEASTObject) o;
bf.append('"');
bf.append(beastObject.getID());
bf.append("\", ");
}
String str = bf.toString();
return "(" + str.substring(0, str.length()-2) + ");";
}
开发者ID:CompEvol,项目名称:beast2,代码行数:15,代码来源:BeautiBase.java
示例15: assertTraceLogEqual
import beast.core.BEASTObject; //导入依赖的package包/类
void assertTraceLogEqual(String... ids) {
System.err.println("assertTraceLogEqual");
Logger logger = (Logger) doc.pluginmap.get("tracelog");
List<BEASTObject> logs = logger.loggersInput.get();
asserListsEqual(logs, ids);
}
开发者ID:CompEvol,项目名称:beast2,代码行数:7,代码来源:BeautiBase.java
示例16: testJSONtoXMLtoJSON
import beast.core.BEASTObject; //导入依赖的package包/类
@Test
public void testJSONtoXMLtoJSON() throws Exception {
JSONParser parser = new JSONParser();
BEASTObject beastObject = parser.parseFile(new File(JSON_FILE));
JSONProducer producer = new JSONProducer();
String actual = producer.toJSON(beastObject).trim();//.replaceAll("\\s+", " ");
String expected = BeautiDoc.load(JSON_FILE).trim();//.replaceAll("\\s+", " ");
assertEquals("Produced JSON differs from original",
expected,
actual);
}
开发者ID:CompEvol,项目名称:beast2,代码行数:13,代码来源:JSONTest.java
示例17: getParameterName
import beast.core.BEASTObject; //导入依赖的package包/类
/** return name of the parameter this prior is applied to **/
public String getParameterName() {
if (parameter instanceof BEASTObject) {
return ((BEASTObject) parameter).getID();
}
return parameter + "";
}
开发者ID:jessiewu,项目名称:substBMA,代码行数:8,代码来源:ConditionalDistribution.java
示例18: init
import beast.core.BEASTObject; //导入依赖的package包/类
@Override
public void init(PrintStream out) {
final String id = ((BEASTObject) functionInput.get()).getID();
out.print("ESS(" + id + ")\t");
}
开发者ID:CompEvol,项目名称:beast2,代码行数:6,代码来源:ESS.java
示例19: init
import beast.core.BEASTObject; //导入依赖的package包/类
/**
* Loggable interface implementation follows
*/
@Override
public void init(PrintStream out) {
out.print("sum(" + ((BEASTObject) functionInput.get().get(0)).getID() + ")\t");
}
开发者ID:CompEvol,项目名称:beast2,代码行数:8,代码来源:Sum.java
示例20: traceLogAsString
import beast.core.BEASTObject; //导入依赖的package包/类
String traceLogAsString() {
Logger logger = (Logger) doc.pluginmap.get("tracelog");
List<BEASTObject> logs = logger.loggersInput.get();
return "assertTraceLogEqual" + pluginListAsString(logs);
}
开发者ID:CompEvol,项目名称:beast2,代码行数:6,代码来源:BeautiBase.java
注:本文中的beast.core.BEASTObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论