From: <rv...@us...> - 2012-01-31 21:23:39
|
Revision: 1026 http://treebase.svn.sourceforge.net/treebase/?rev=1026&view=rev Author: rvos Date: 2012-01-31 21:23:29 +0000 (Tue, 31 Jan 2012) Log Message: ----------- Apparently, missing and gap state sets aren't considered states that a DicreteMatrix would return in its set of sets. We will just have to hardcode them in. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-01-31 21:10:45 UTC (rev 1025) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-01-31 21:23:29 UTC (rev 1026) @@ -82,31 +82,24 @@ // then create the single state set out of the map, assigning all non-missing characters to missing Set<CharacterState> xmlMissingStates = new HashSet<CharacterState>(); - UncertainCharacterState missing = null; for ( Character symbol : stateForSymbol.keySet() ) { - char sym = symbol.charValue(); - CharacterState xmlState = null; - String symString = symbol.toString(); - if ( sym == '-' ) { - xmlState = xmlStateSet.createUncertainCharacterState(symString, new HashSet<CharacterState>()); + char sym = symbol.charValue(); + if ( sym != '-' && sym != '?' ) { + String symString = symbol.toString(); + CharacterState xmlState = xmlStateSet.createCharacterState(symString); xmlMissingStates.add(xmlState); - } - else if ( sym == '?' ) { - xmlState = xmlStateSet.createUncertainCharacterState(symString, new HashSet<CharacterState>()); - missing = (UncertainCharacterState) xmlState; - } - else { - xmlState = xmlStateSet.createCharacterState(symString); - xmlMissingStates.add(xmlState); + DiscreteCharState tbState = stateForSymbol.get(symbol); + xmlState.setLabel(symString); + attachTreeBaseID((Annotatable)xmlState,tbState,DiscreteCharState.class); } - DiscreteCharState tbState = stateForSymbol.get(symbol); - xmlState.setLabel(symString); - attachTreeBaseID((Annotatable)xmlState,tbState,DiscreteCharState.class); } - if ( null != missing ) { - missing.setStates(xmlMissingStates); - } + UncertainCharacterState gap = xmlStateSet.createUncertainCharacterState("-", new HashSet<CharacterState>()); + gap.setLabel("-"); + xmlMissingStates.add(gap); + UncertainCharacterState missing = xmlStateSet.createUncertainCharacterState("?", xmlMissingStates); + missing.setLabel("?"); + // then create the XML characters, assigning them all the same state set List<MatrixColumn> tbColumns = tbMatrix.getColumnsReadOnly(); for ( int i = 0; i < tbColumns.size(); i++ ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |