protected void writeDistribution(Parameter parameter,boolean isRef,XMLWriter writer){
switch (parameter.priorType) {
case UNIFORM_PRIOR:
    String id=parameter.taxaId + "-uniformDist";
  if (isRef) {
    writer.writeIDref(UniformDistributionModelParser.UNIFORM_DISTRIBUTION_MODEL,id);
  }
 else {
    writer.writeOpenTag(UniformDistributionModelParser.UNIFORM_DISTRIBUTION_MODEL,new Attribute[]{new Attribute.Default<String>(XMLParser.ID,id)});
    writer.writeOpenTag(UniformDistributionModelParser.LOWER);
    writer.writeText(Double.toString(parameter.uniformLower));
    writer.writeCloseTag(UniformDistributionModelParser.LOWER);
    writer.writeOpenTag(UniformDistributionModelParser.UPPER);
    writer.writeText(Double.toString(parameter.uniformUpper));
    writer.writeCloseTag(UniformDistributionModelParser.UPPER);
    writer.writeCloseTag(UniformDistributionModelParser.UNIFORM_DISTRIBUTION_MODEL);
  }
break;
case EXPONENTIAL_PRIOR:
writer.writeOpenTag(ExponentialDistributionModel.EXPONENTIAL_DISTRIBUTION_MODEL);
writer.writeOpenTag(DistributionModelParser.MEAN);
writer.writeText(Double.toString(parameter.mean));
writer.writeCloseTag(DistributionModelParser.MEAN);
writer.writeOpenTag(DistributionModelParser.OFFSET);
writer.writeText(Double.toString(parameter.offset));
writer.writeCloseTag(DistributionModelParser.OFFSET);
writer.writeCloseTag(ExponentialDistributionModel.EXPONENTIAL_DISTRIBUTION_MODEL);
break;
case NORMAL_PRIOR:
writer.writeOpenTag(NormalDistributionModelParser.NORMAL_DISTRIBUTION_MODEL);
writer.writeOpenTag(NormalDistributionModelParser.MEAN);
writer.writeText(Double.toString(parameter.mean));
writer.writeCloseTag(NormalDistributionModelParser.MEAN);
writer.writeOpenTag(NormalDistributionModelParser.STDEV);
writer.writeText(Double.toString(parameter.stdev));
writer.writeCloseTag(NormalDistributionModelParser.STDEV);
writer.writeCloseTag(NormalDistributionModelParser.NORMAL_DISTRIBUTION_MODEL);
break;
case LOGNORMAL_PRIOR:
writer.writeOpenTag(LogNormalDistributionModelParser.LOGNORMAL_DISTRIBUTION_MODEL,new Attribute[]{new Attribute.Default<Boolean>(LogNormalDistributionModelParser.MEAN_IN_REAL_SPACE,parameter.isMeanInRealSpace()),new Attribute.Default<Boolean>(LogNormalDistributionModelParser.STDEV_IN_REAL_SPACE,parameter.isMeanInRealSpace())});
writer.writeOpenTag(LogNormalDistributionModelParser.MEAN);
writer.writeText(Double.toString(parameter.mean));
writer.writeCloseTag(LogNormalDistributionModelParser.MEAN);
writer.writeOpenTag(LogNormalDistributionModelParser.STDEV);
writer.writeText(Double.toString(parameter.stdev));
writer.writeCloseTag(LogNormalDistributionModelParser.STDEV);
writer.writeOpenTag(LogNormalDistributionModelParser.OFFSET);
writer.writeText(Double.toString(parameter.offset));
writer.writeCloseTag(LogNormalDistributionModelParser.OFFSET);
writer.writeCloseTag(LogNormalDistributionModelParser.LOGNORMAL_DISTRIBUTION_MODEL);
break;
case GAMMA_PRIOR:
writer.writeOpenTag(GammaDistributionModel.GAMMA_DISTRIBUTION_MODEL);
writer.writeOpenTag(DistributionModelParser.SHAPE);
writer.writeText(Double.toString(parameter.shape));
writer.writeCloseTag(DistributionModelParser.SHAPE);
writer.writeOpenTag(DistributionModelParser.SCALE);
writer.writeText(Double.toString(parameter.scale));
writer.writeCloseTag(DistributionModelParser.SCALE);
writer.writeOpenTag(DistributionModelParser.OFFSET);
writer.writeText(Double.toString(parameter.offset));
writer.writeCloseTag(DistributionModelParser.OFFSET);
writer.writeCloseTag(GammaDistributionModel.GAMMA_DISTRIBUTION_MODEL);
break;
default :
throw new IllegalArgumentException("Unknown Distribution Model for " + parameter.getName());
}
}

protected void writeDistribution ( Parameter parameter , boolean isRef , XMLWriter writer ) { switch ( parameter . priorType ) { case UNIFORM_PRIOR : String id = parameter . taxaId + "-uniformDist" ; if ( isRef ) { writer . writeIDref ( UniformDistributionModelParser . UNIFORM_DISTRIBUTION_MODEL , id ) ; } else { writer . writeOpenTag ( UniformDistributionModelParser . UNIFORM_DISTRIBUTION_MODEL , new Attribute [ ] { new Attribute . Default < String > ( XMLParser . ID , id ) } ) ; writer . writeOpenTag ( UniformDistributionModelParser . LOWER ) ; writer . writeText ( Double . toString ( parameter . uniformLower ) ) ; writer . writeCloseTag ( UniformDistributionModelParser . LOWER ) ; writer . writeOpenTag ( UniformDistributionModelParser . UPPER ) ; writer . writeText ( Double . toString ( parameter . uniformUpper ) ) ; writer . writeCloseTag ( UniformDistributionModelParser . UPPER ) ; writer . writeCloseTag ( UniformDistributionModelParser . UNIFORM_DISTRIBUTION_MODEL ) ; } break ; case EXPONENTIAL_PRIOR : writer . writeOpenTag ( ExponentialDistributionModel . EXPONENTIAL_DISTRIBUTION_MODEL ) ; writer . writeOpenTag ( DistributionModelParser . MEAN ) ; writer . writeText ( Double . toString ( parameter . mean ) ) ; writer . writeCloseTag ( DistributionModelParser . MEAN ) ; writer . writeOpenTag ( DistributionModelParser . OFFSET ) ; writer . writeText ( Double . toString ( parameter . offset ) ) ; writer . writeCloseTag ( DistributionModelParser . OFFSET ) ; writer . writeCloseTag ( ExponentialDistributionModel . EXPONENTIAL_DISTRIBUTION_MODEL ) ; break ; case NORMAL_PRIOR : writer . writeOpenTag ( NormalDistributionModelParser . NORMAL_DISTRIBUTION_MODEL ) ; writer . writeOpenTag ( NormalDistributionModelParser . MEAN ) ; writer . writeText ( Double . toString ( parameter . mean ) ) ; writer . writeCloseTag ( NormalDistributionModelParser . MEAN ) ; writer . writeOpenTag ( NormalDistributionModelParser . STDEV ) ; writer . writeText ( Double . toString ( parameter . stdev ) ) ; writer . writeCloseTag ( NormalDistributionModelParser . STDEV ) ; writer . writeCloseTag ( NormalDistributionModelParser . NORMAL_DISTRIBUTION_MODEL ) ; break ; case LOGNORMAL_PRIOR : writer . writeOpenTag ( LogNormalDistributionModelParser . LOGNORMAL_DISTRIBUTION_MODEL , new Attribute [ ] { new Attribute . Default < Boolean > ( LogNormalDistributionModelParser . MEAN_IN_REAL_SPACE , parameter . isMeanInRealSpace ( ) ) , new Attribute . Default < Boolean > ( LogNormalDistributionModelParser . STDEV_IN_REAL_SPACE , parameter . isMeanInRealSpace ( ) ) } ) ; writer . writeOpenTag ( LogNormalDistributionModelParser . MEAN ) ; writer . writeText ( Double . toString ( parameter . mean ) ) ; writer . writeCloseTag ( LogNormalDistributionModelParser . MEAN ) ; writer . writeOpenTag ( LogNormalDistributionModelParser . STDEV ) ; writer . writeText ( Double . toString ( parameter . stdev ) ) ; writer . writeCloseTag ( LogNormalDistributionModelParser . STDEV ) ; writer . writeOpenTag ( LogNormalDistributionModelParser . OFFSET ) ; writer . writeText ( Double . toString ( parameter . offset ) ) ; writer . writeCloseTag ( LogNormalDistributionModelParser . OFFSET ) ; writer . writeCloseTag ( LogNormalDistributionModelParser . LOGNORMAL_DISTRIBUTION_MODEL ) ; break ; case GAMMA_PRIOR : writer . writeOpenTag ( GammaDistributionModel . GAMMA_DISTRIBUTION_MODEL ) ; writer . writeOpenTag ( DistributionModelParser . SHAPE ) ; writer . writeText ( Double . toString ( parameter . shape ) ) ; writer . writeCloseTag ( DistributionModelParser . SHAPE ) ; writer . writeOpenTag ( DistributionModelParser . SCALE ) ; writer . writeText ( Double . toString ( parameter . scale ) ) ; writer . writeCloseTag ( DistributionModelParser . SCALE ) ; writer . writeOpenTag ( DistributionModelParser . OFFSET ) ; writer . writeText ( Double . toString ( parameter . offset ) ) ; writer . writeCloseTag ( DistributionModelParser . OFFSET ) ; writer . writeCloseTag ( GammaDistributionModel . GAMMA_DISTRIBUTION_MODEL ) ; break ; default : throw new IllegalArgumentException ( "Unknown Distribution Model for " + parameter . getName ( ) ) ; } }
write the distribution for * distributionmodel
