private String convertNextStateTransitions(ContextState state, KripkeStructureModel kripkeModel) { StringBuffer buffer = new StringBuffer(); Iterator<String> symbolsIt = null; ContextPropositionAssignment assignment = state.getAssignment(); if (assignment.size() > 0) { symbolsIt = assignment.getSymbols().iterator(); while (symbolsIt.hasNext()) { String symbol = symbolsIt.next(); if (assignment.getValuationOf(symbol)) { buffer.append(symbol); } else { buffer.append("!" + symbol); } if (symbolsIt.hasNext()) { buffer.append(" & "); } } String currentState = buffer.toString(); buffer = new StringBuffer(); int[] nextStatesId = state.getNextStatesId(); Set<ContextState> nextStates = new LinkedHashSet<ContextState>(); for (int nextStateId : nextStatesId) { nextStates.add(kripkeModel.getState(nextStateId)); } Iterator<ContextState> nextStatesIt = nextStates.iterator(); while (nextStatesIt.hasNext()) { ContextState next = nextStatesIt.next(); buffer.append("(" + currentState + " & "); ContextPropositionAssignment nextAssignment = next.getAssignment(); symbolsIt = nextAssignment.getSymbols().iterator(); while (symbolsIt.hasNext()) { String symbol = symbolsIt.next(); if (nextAssignment.getValuationOf(symbol)) { buffer.append(symbol + "'"); } else { buffer.append("!" + symbol + "'"); } if (symbolsIt.hasNext()) { buffer.append(" & "); } } buffer.append(")"); if (nextStatesIt.hasNext()) { buffer.append(" |\n"); } } } return buffer.toString(); }
private String convertInitialState(ContextState state) { ContextPropositionAssignment assignment = state.getAssignment(); Iterator<String> symbols = assignment.getSymbols().iterator(); StringBuffer buffer = new StringBuffer(); while (symbols.hasNext()) { buffer.append("!" + symbols.next()); if (symbols.hasNext()) { buffer.append(" & "); } } return buffer.toString(); }