private void writePatternList(final PartitionData partition,int offset,int every,final String codonPrefix,final boolean unique,final boolean strip,final XMLWriter writer){
  Alignment alignment=partition.getAlignment();
  int from=partition.getFromSite();
  int to=partition.getToSite();
  int partEvery=partition.getEvery();
  if (partEvery > 1 && every > 1)   throw new IllegalArgumentException();
  if (from < 1)   from=1;
  every=Math.max(partEvery,every);
  from+=offset;
  SitePatterns patterns=new SitePatterns(alignment,null,from - 1,to - 1,every,strip,unique);
  writer.writeComment("The " + (unique ? "unique " : "") + "patterns from "+ from+ " to "+ (to > 0 ? to : "end")+ ((every > 1) ? " every " + every : ""),"npatterns=" + patterns.getPatternCount());
  List<Attribute> attributes=new ArrayList<Attribute>();
  if (codonPrefix != null) {
    attributes.add(new Attribute.Default<String>(XMLParser.ID,partition.getPrefix() + codonPrefix + SitePatternsParser.PATTERNS));
  }
  attributes.add(new Attribute.Default<String>("from","" + from));
  if (to >= 0)   attributes.add(new Attribute.Default<String>("to","" + to));
  if (every > 1) {
    attributes.add(new Attribute.Default<String>("every","" + every));
  }
  if (!unique) {
    attributes.add(new Attribute.Default<Boolean>(SitePatternsParser.UNIQUE,false));
  }
  if (strip) {
    attributes.add(new Attribute.Default<Boolean>(SitePatternsParser.STRIP,false));
  }
  writer.writeOpenTag(SitePatternsParser.PATTERNS,attributes);
  writer.writeIDref(AlignmentParser.ALIGNMENT,alignment.getId());
  writer.writeCloseTag(SitePatternsParser.PATTERNS);
}

private void writePatternList ( final PartitionData partition , int offset , int every , final String codonPrefix , final boolean unique , final boolean strip , final XMLWriter writer ) { Alignment alignment = partition . getAlignment ( ) ; int from = partition . getFromSite ( ) ; int to = partition . getToSite ( ) ; int partEvery = partition . getEvery ( ) ; if ( partEvery > 1 && every > 1 ) throw new IllegalArgumentException ( ) ; if ( from < 1 ) from = 1 ; every = Math . max ( partEvery , every ) ; from += offset ; SitePatterns patterns = new SitePatterns ( alignment , null , from - 1 , to - 1 , every , strip , unique ) ; writer . writeComment ( "The " + ( unique ? "unique " : "" ) + "patterns from " + from + " to " + ( to > 0 ? to : "end" ) + ( ( every > 1 ) ? " every " + every : "" ) , "npatterns=" + patterns . getPatternCount ( ) ) ; List < Attribute > attributes = new ArrayList < Attribute > ( ) ; if ( codonPrefix != null ) { attributes . add ( new Attribute . Default < String > ( XMLParser . ID , partition . getPrefix ( ) + codonPrefix + SitePatternsParser . PATTERNS ) ) ; } attributes . add ( new Attribute . Default < String > ( "from" , "" + from ) ) ; if ( to >= 0 ) attributes . add ( new Attribute . Default < String > ( "to" , "" + to ) ) ; if ( every > 1 ) { attributes . add ( new Attribute . Default < String > ( "every" , "" + every ) ) ; } if ( ! unique ) { attributes . add ( new Attribute . Default < Boolean > ( SitePatternsParser . UNIQUE , false ) ) ; } if ( strip ) { attributes . add ( new Attribute . Default < Boolean > ( SitePatternsParser . STRIP , false ) ) ; } writer . writeOpenTag ( SitePatternsParser . PATTERNS , attributes ) ; writer . writeIDref ( AlignmentParser . ALIGNMENT , alignment . getId ( ) ) ; writer . writeCloseTag ( SitePatternsParser . PATTERNS ) ; }
write a single pattern list
