/** * Applies the <b>(ATTR)</b> rule to the <code>pNode</code> using the <code>pContext</code>. * * @param pContext The big step proof pContext. * @param pNode The node to apply the <b>(ATTR)</b> rule to. */ public void applyAttr(BigStepProofContext pContext, BigStepProofNode pNode) { Row row = (Row) pNode.getExpression(); Expression[] rowExpressions = row.getExpressions(); Attribute attribute = (Attribute) rowExpressions[0]; pContext.addProofNode(pNode, attribute.getE()); pContext.addProofNode(pNode, row.tailRow()); }
/** * Applies the <b>(SEND-SKIP)</b> rule to the <code>pNode</code> using the <code>pContext</code>. * * @param pContext The big step proof pContext. * @param pNode The node to apply the <b>(SEND-SKIP)</b> rule to. */ public void applySendSkip(BigStepProofContext pContext, BigStepProofNode pNode) { Send send = (Send) pNode.getExpression(); Row row = (Row) send.getE(); if (!row.isValue()) { throw new IllegalArgumentException("Can not apply SEND-SKIP"); // $NON-NLS-1$ } Expression[] rowExpressions = row.getExpressions(); Identifier methodName; if (rowExpressions[0] instanceof Method) { Method method = (Method) rowExpressions[0]; methodName = method.getId(); } else if (rowExpressions[0] instanceof CurriedMethod) { CurriedMethod curriedMethod = (CurriedMethod) rowExpressions[0]; methodName = curriedMethod.getIdentifiers()[0]; } else { throw new IllegalArgumentException("Can not apply SEND-SKIP"); // $NON-NLS-1$ } boolean definedLater = false; for (int i = 1; i < row.getExpressions().length; i++) { Expression rowChild = rowExpressions[i]; if ((rowChild instanceof Method) && (((Method) rowChild).getId().equals(send.getId()))) { definedLater = true; break; } else if ((rowChild instanceof CurriedMethod) && (((CurriedMethod) rowChild).getIdentifiers()[0].equals(send.getId()))) { definedLater = true; break; } } if ((definedLater) || (!(send.getId().equals(methodName)))) { pContext.addProofNode(pNode, new Send(row.tailRow(), send.getId())); } else { throw new IllegalArgumentException("Can not apply SEND-SKIP"); // $NON-NLS-1$ } }
/** * Applies the <b>(METHOD)</b> rule to the <code>pNode</code> using the <code>pContext</code>. * * @param pContext The big step proof pContext. * @param pNode The node to apply the <b>(METHOD)</b> rule to. */ public void applyMethod(BigStepProofContext pContext, BigStepProofNode pNode) { Row row = (Row) pNode.getExpression(); Expression[] rowExpressions = row.getExpressions(); if ((!(rowExpressions[0] instanceof Method)) && (!(rowExpressions[0] instanceof CurriedMethod))) { throw new IllegalArgumentException("Can not apply METHOD"); // $NON-NLS-1$ } pContext.addProofNode(pNode, row.tailRow()); }