public Object parseXMLObject(XMLObject xo) throws XMLParseException {
  SiteList siteList=(SiteList)xo.getChild(SiteList.class);
  boolean negativeMask=xo.getBooleanAttribute(NEGATIVE);
  String maskString=(String)xo.getElementFirstChild(MASK);
  boolean[] mask=new boolean[siteList.getSiteCount()];
  int k=0;
  for (  char c : maskString.toCharArray()) {
    if (Character.isDigit(c)) {
      if (k >= mask.length) {
        break;
      }
      mask[k]=(c == '0' ? negativeMask : !negativeMask);
      k++;
    }
  }
  if (k != mask.length) {
    throw new XMLParseException("The mask needs to be the same length as the alignment (spaces are ignored)");
  }
  SitePatterns patterns=new SitePatterns(siteList,mask,false,false);
  if (patterns == null) {
    throw new XMLParseException("The mask needs include at least one pattern");
  }
  if (xo.hasAttribute(XMLParser.ID)) {
    final Logger logger=Logger.getLogger("dr.evoxml");
    logger.info("Site patterns '" + xo.getId() + "' created by masking alignment with id '"+ siteList.getId()+ "'");
    logger.info("  pattern count = " + patterns.getPatternCount());
  }
  return patterns;
}

public Object parseXMLObject ( XMLObject xo ) throws XMLParseException { SiteList siteList = ( SiteList ) xo . getChild ( SiteList . class ) ; boolean negativeMask = xo . getBooleanAttribute ( NEGATIVE ) ; String maskString = ( String ) xo . getElementFirstChild ( MASK ) ; boolean [ ] mask = new boolean [ siteList . getSiteCount ( ) ] ; int k = 0 ; for ( char c : maskString . toCharArray ( ) ) { if ( Character . isDigit ( c ) ) { if ( k >= mask . length ) { break ; } mask [ k ] = ( c == '0' ? negativeMask : ! negativeMask ) ; k ++ ; } } if ( k != mask . length ) { throw new XMLParseException ( "The mask needs to be the same length as the alignment (spaces are ignored)" ) ; } SitePatterns patterns = new SitePatterns ( siteList , mask , false , false ) ; if ( patterns == null ) { throw new XMLParseException ( "The mask needs include at least one pattern" ) ; } if ( xo . hasAttribute ( XMLParser . ID ) ) { final Logger logger = Logger . getLogger ( "dr.evoxml" ) ; logger . info ( "Site patterns '" + xo . getId ( ) + "' created by masking alignment with id '" + siteList . getId ( ) + "'" ) ; logger . info ( "  pattern count = " + patterns . getPatternCount ( ) ) ; } return patterns ; }
parses a patterns element and returns a patterns object .
