Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
  /*...............................................................................................................*/
  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;
  } /*...............................................................................................................*/
Ejemplo n.º 3
0
  /*...............................................................................................................*/
  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;
  }
Ejemplo n.º 4
0
 /** returns the state of character ic in taxon it */
 public CharacterState getCharacterState(CharacterState cs, int ic, int it) {
   if (cs == null || cs.getClass() != GeographicState.class) {
     cs = new GeographicState();
   }
   ((GeographicState) cs).setItemsAs(this);
   for (int i = 0; i < getNumItems(); i++) {
     ((GeographicState) cs).setValue(i, getState(ic, it, i));
   }
   return cs;
 }