/** * Applies the <b>(OBJECT)</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>(OBJECT)</b> rule to. */ public void applyObject(BigStepProofContext pContext, BigStepProofNode pNode) { ObjectExpr objectExpr = (ObjectExpr) pNode.getExpression(); Row row = objectExpr.getRow(); if (row.isValue()) { throw new IllegalArgumentException("Can not apply OBJECT"); // $NON-NLS-1$ } pContext.addProofNode(pNode, row); }
/** * 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()); } }
/** * Applies the <b>(OBJECT)</b> rule to the * <code>node</node> using the <code>context</code>. * * @param context the minimal typing proof context. * @param pNode the minimal typing proof node. */ public void applyObject(MinimalTypingProofContext context, MinimalTypingProofNode pNode) { MinimalTypingExpressionProofNode node = (MinimalTypingExpressionProofNode) pNode; ObjectExpr object = (ObjectExpr) node.getExpression(); MonoType tau = object.getTau(); // check if user entered type for self if (tau == null) { throw new RuntimeException( MessageFormat.format( Messages.getString("MinimalTypingException.2"), "self")); // $NON-NLS-1$ //$NON-NLS-2$ } // if type is a rec type, unfold to get a object type if (tau instanceof RecType) { RecType rec = (RecType) tau; tau = rec.getTau().substitute(rec.getTypeName(), rec); } TypeEnvironment environment = node.getEnvironment(); environment = environment.star(); // generate new child node context.addProofNode(node, environment.extend(object.getId(), tau), object.getRow()); }