+ public int getTotalGains() {
+ return _total_gains;
+ }
+
+ public int getTotalLosses() {
+ return _total_losses;
+ }
+
+ public int getTotalUnchanged() {
+ return _total_unchanged;
+ }
+
+ public boolean isVerbose() {
+ return _verbose;
+ }
+
+ public void setRandomize( final boolean randomize ) {
+ if ( randomize && isUseLast() ) {
+ throw new IllegalArgumentException( "attempt to allways use last state (ordered) if more than one choices and randomization at the same time" );
+ }
+ _randomize = randomize;
+ }
+
+ public void setRandomNumberSeed( final long random_number_seed ) {
+ if ( !isRandomize() ) {
+ throw new IllegalArgumentException( "attempt to set random number generator seed without randomization enabled" );
+ }
+ _random_number_seed = random_number_seed;
+ }
+
+ public void setReturnGainLossMatrix( final boolean return_gain_loss ) {
+ _return_gain_loss = return_gain_loss;
+ }
+
+ public void setReturnInternalStates( final boolean return_internal_states ) {
+ _return_internal_states = return_internal_states;
+ }
+
+ /**
+ * This sets whether to use the first or last state in the sorted
+ * states at the undecided internal nodes.
+ * For randomized choices set randomize to true (and this to false).
+ *
+ * Note. It might be advisable to set this to false
+ * for BinaryStates if absence at the root is preferred
+ * (given the enum BinaryStates sorts in the following order:
+ * ABSENT, UNKNOWN, PRESENT).
+ *
+ *
+ * @param use_last
+ */
+ public void setUseLast( final boolean use_last ) {
+ if ( use_last && isRandomize() ) {
+ throw new IllegalArgumentException( "attempt to allways use last state (ordered) if more than one choices and randomization at the same time" );
+ }
+ _use_last = use_last;
+ }
+
+ public void setVerbose( final boolean verbose ) {
+ _verbose = verbose;
+ }
+
+ private int determineIndex( final SortedSet<STATE_TYPE> current_node_states, int i ) {
+ if ( isRandomize() ) {
+ i = getRandomGenerator().nextInt( current_node_states.size() );
+ }
+ else if ( isUseLast() ) {
+ i = current_node_states.size() - 1;
+ }
+ return i;
+ }
+
+ private void executeForOneCharacter( final Phylogeny p,
+ final Map<PhylogenyNode, SortedSet<STATE_TYPE>> states,
+ final Map<PhylogenyNode, STATE_TYPE> traceback_states,
+ final int character_state_column ) {
+ postOrderTraversal( p, states );
+ preOrderTraversal( p, states, traceback_states, character_state_column );
+ }
+