/** Merge this acceptance signature with other signature, * for each tuple element calculate the maximum of the * colors according to the order * RABIN_WHITE < RABIN_GREEN < RABIN_RED */ public void maxMerge(RabinSignature other) { for (int i = 0; i < _size; i++) { if (getColor(i) < other.getColor(i)) { setColor(i, other.getColor(i)); } } }
//typedef std::vector<algo_state_t> intermediate_state_vector_t; /** * Calculate Acceptance for RabinAcceptance conditon */ private bool calculate_acceptance(List <StateInterface> state_vector, int cycle_point, RabinSignature prefix_signature, RabinSignature cycle_signature) { int states = state_vector.Count; state_vector[cycle_point].generateAcceptance(cycle_signature); // start for (int i = cycle_point + 1; i < states; i++) { cycle_signature.maxMerge(state_vector[i].generateAcceptance()); } if (prefix_signature != null) { prefix_signature = cycle_signature; for (int i = 1; i < cycle_point; i++) { prefix_signature.maxMerge(state_vector[i].generateAcceptance()); } } if (prefix_signature != null) { // check if prefix can be ommited RabinSignature p0_signature = new RabinSignature(prefix_signature.getSize()); state_vector[0].generateAcceptance(p0_signature); for (int j = 0; j < prefix_signature.getSize(); j++) { if (prefix_signature.getColor(j) <= cycle_signature.getColor(j) || prefix_signature.getColor(j) <= p0_signature.getColor(j)) { // acceptance pair j is ok ; } else { return(false); } } // all acceptance pairs are ok, return true return(true); } return(false); }
/** Merge this acceptance signature with other signature, * for each tuple element calculate the maximum of the * colors according to the order * RABIN_WHITE < RABIN_GREEN < RABIN_RED */ public void maxMerge(RabinSignature other) { for (int i = 0; i < _size; i++) { if (getColor(i) < other.getColor(i)) { setColor(i, other.getColor(i)); } } }
//typedef std::vector<algo_state_t> intermediate_state_vector_t; /** * Calculate Acceptance for RabinAcceptance conditon */ private bool calculate_acceptance(List<StateInterface> state_vector, int cycle_point, RabinSignature prefix_signature, RabinSignature cycle_signature) { int states = state_vector.Count; state_vector[cycle_point].generateAcceptance(cycle_signature); // start for (int i = cycle_point + 1; i < states; i++) { cycle_signature.maxMerge(state_vector[i].generateAcceptance()); } if (prefix_signature != null) { prefix_signature = cycle_signature; for (int i = 1; i < cycle_point; i++) { prefix_signature.maxMerge(state_vector[i].generateAcceptance()); } } if (prefix_signature != null) { // check if prefix can be ommited RabinSignature p0_signature = new RabinSignature(prefix_signature.getSize()); state_vector[0].generateAcceptance(p0_signature); for (int j = 0; j < prefix_signature.getSize(); j++) { if (prefix_signature.getColor(j) <= cycle_signature.getColor(j) || prefix_signature.getColor(j) <= p0_signature.getColor(j)) { // acceptance pair j is ok ; } else { return false; } } // all acceptance pairs are ok, return true return true; } return false; }