/** * Applies the <b>(VAL)</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>(VAL)</b> rule to. */ @Override public void applyValue(BigStepProofContext pContext, BigStepProofNode pNode) { if ((!pNode.getExpression().isValue()) || (pNode.getExpression() instanceof Row)) { throw new IllegalArgumentException("Can not apply VAL"); // $NON-NLS-1$ } pContext.setProofNodeResult(pNode, pNode.getExpression()); }
/** * Applies the <b>(OMEGA)</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>(OMEGA)</b> rule to. */ public void applyOmega(BigStepProofContext pContext, BigStepProofNode pNode) { Row row = (Row) pNode.getExpression(); if (!row.isValue()) { throw new IllegalArgumentException("Can not apply OMEGA"); // $NON-NLS-1$ } pContext.setProofNodeResult(pNode, row); }
/** * Updates the <code>node</code> to which <b>(OBJECT)</b> was applied previously. * * @param pContext The big step proof context. * @param pNode The node to update according to <b>(OBJECT)</b>. */ public void updateObject(BigStepProofContext pContext, BigStepProofNode pNode) { if ((pNode.getChildCount() == 1) && (pNode.getChildAt(0).isProven())) { ObjectExpr oldObjectExpr = (ObjectExpr) pNode.getExpression(); Row row = (Row) pNode.getChildAt(0).getResult().getValue(); pContext.setProofNodeResult( pNode, new ObjectExpr(oldObjectExpr.getId(), oldObjectExpr.getTau(), row)); } }
/** * Updates the <code>node</code> to which <b>(METHOD)</b> was applied previously. * * @param pContext The big step proof context. * @param pNode The node to update according to <b>(METHOD)</b>. */ public void updateMethod(BigStepProofContext pContext, BigStepProofNode pNode) { if ((pNode.getChildCount() == 1) && (pNode.getChildAt(0).isProven())) { Row row = (Row) pNode.getExpression(); Row childRow = (Row) pNode.getChildAt(0).getResult().getValue(); Expression[] newRowExpressions = new Expression[row.getExpressions().length]; newRowExpressions[0] = row.getExpressions()[0]; for (int i = 1; i < newRowExpressions.length; i++) { newRowExpressions[i] = childRow.getExpressions()[i - 1]; } pContext.setProofNodeResult(pNode, new Row(newRowExpressions)); } }
/** * Updates the <code>node</code> to which <b>(SEND)</b> was applied previously. * * @param pContext The big step proof context. * @param pNode The node to update according to <b>(SEND)</b>. */ public void updateSend(BigStepProofContext pContext, BigStepProofNode pNode) { if ((pNode.getChildCount() == 1) && (pNode.getChildAt(0).isProven())) { Send send = (Send) pNode.getExpression(); ObjectExpr objectExpr = (ObjectExpr) pNode.getChildAt(0).getResult().getValue(); Row row = objectExpr.getRow(); Expression newRow; newRow = row.substitute(objectExpr.getId(), objectExpr); pContext.addProofNode(pNode, new Send(newRow, send.getId())); } else if ((pNode.getChildCount() == 2) && (pNode.getChildAt(0).isProven()) && (pNode.getChildAt(1).isProven())) { pContext.setProofNodeResult(pNode, pNode.getChildAt(1).getResult()); } }
/** * Updates the <code>node</code> to which <b>(ATTR)</b> was applied previously. * * @param pContext The big step proof context. * @param pNode The node to update according to <b>(ATTR)</b>. */ public void updateAttr(BigStepProofContext pContext, BigStepProofNode pNode) { if ((pNode.getChildCount() == 2) && (pNode.getChildAt(0).isProven()) && (pNode.getChildAt(1).isProven())) { Row row = (Row) pNode.getExpression(); Expression childExpression = pNode.getChildAt(0).getResult().getValue(); Row childRow = (Row) pNode.getChildAt(1).getResult().getValue(); Attribute attribute = (Attribute) row.getExpressions()[0]; Expression[] newRowExpressions = new Expression[row.getExpressions().length]; Attribute newAttribute = new Attribute(attribute.getId(), childExpression); newRowExpressions[0] = newAttribute; for (int i = 1; i < newRowExpressions.length; i++) { newRowExpressions[i] = childRow.getExpressions()[i - 1]; } pContext.setProofNodeResult(pNode, new Row(newRowExpressions)); } }
/** * Updates the <code>node</code> to which <b>(SEND-SKIP)</b> was applied previously. * * @param pContext The big step proof context. * @param pNode The node to update according to <b>(SEND-SKIP)</b>. */ public void updateSendSkip(BigStepProofContext pContext, BigStepProofNode pNode) { if (pNode.getChildAt(0).isProven()) { pContext.setProofNodeResult(pNode, pNode.getChildAt(0).getResult()); } }