/*...............................................................................................................*/ int numSites(int it) { CharacterState cs = null; if (observedStates == null) return 0; int count = 0; for (int ic = 0; ic < observedStates.getNumChars(); ic++) { cs = observedStates.getCharacterState(cs, ic, it); if (cs == null) return 0; if (!cs.isInapplicable() && !cs.isUnassigned()) count++; } return count; } /*...............................................................................................................*/
boolean hasData(int it) { CharacterState cs = null; try { for (int ic = 0; ic < observedStates.getNumChars(); ic++) { cs = observedStates.getCharacterState(cs, ic, it); if (cs == null) return false; if (!cs.isInapplicable() && !cs.isUnassigned()) return true; } } catch (NullPointerException e) { } return false; }
/*...............................................................................................................*/ int sequenceLength(int it) { CharacterState cs = null; if (observedStates == null) return 0; int count = 0; for (int ic = 0; ic < observedStates.getNumChars(); ic++) { cs = observedStates.getCharacterState(cs, ic, it); if (cs == null) return 0; if (cs instanceof MolecularState) { if (!cs.isInapplicable()) // if Molecular, then count missing & with state count++; } else if (!cs.isInapplicable() && !cs.isUnassigned()) // if Molecular, then count missing & with state count++; } return count; }