Represents an array update expression of the form " arr[e1:=e2] " where arr is the source array , e1 the subscript expression and e2 is the value expression. This returns a new array which is equivalent to arr but whe
| 4528 | * |
| 4529 | */ |
| 4530 | public static class ArrayUpdate extends AbstractExpr implements Expr, TernaryOperator { |
| 4531 | public ArrayUpdate(Type type, Expr src, Expr index, Expr value) { |
| 4532 | super(EXPR_arrayupdate, type, src, index, value); |
| 4533 | } |
| 4534 | |
| 4535 | /** |
| 4536 | * Get the source array operand for this update. That is <code>xs</code> in |
| 4537 | * <code>xs[i:=v]</code>. |
| 4538 | */ |
| 4539 | @Override |
| 4540 | public Expr getFirstOperand() { |
| 4541 | return (Expr) get(1); |
| 4542 | } |
| 4543 | |
| 4544 | /** |
| 4545 | * Get the index operand for this update. That is <code>i</code> in |
| 4546 | * <code>xs[i:=v]</code>. |
| 4547 | */ |
| 4548 | @Override |
| 4549 | public Expr getSecondOperand() { |
| 4550 | return (Expr) get(2); |
| 4551 | } |
| 4552 | |
| 4553 | /** |
| 4554 | * Get the value operand of this update. That is <code>v</code> in |
| 4555 | * <code>xs[i:=v]</code>. |
| 4556 | */ |
| 4557 | @Override |
| 4558 | public Expr getThirdOperand() { |
| 4559 | return (Expr) get(3); |
| 4560 | } |
| 4561 | |
| 4562 | @Override |
| 4563 | public ArrayUpdate clone(Syntactic.Item[] operands) { |
| 4564 | return new ArrayUpdate((Type) operands[0], (Expr) operands[1], (Expr) operands[2], (Expr) operands[3]); |
| 4565 | } |
| 4566 | |
| 4567 | @Override |
| 4568 | public String toString() { |
| 4569 | return getFirstOperand() + "[" + getSecondOperand() + ":=" + getThirdOperand() + "]"; |
| 4570 | } |
| 4571 | |
| 4572 | public static final Descriptor DESCRIPTOR_0 = new Descriptor(Operands.FOUR, Data.ZERO, "EXPR_arrayupdate") { |
| 4573 | @Override |
| 4574 | public Syntactic.Item construct(int opcode, Syntactic.Item[] operands, byte[] data) { |
| 4575 | return new ArrayUpdate((Type) operands[0], (Expr) operands[1], (Expr) operands[2], |
| 4576 | (Expr) operands[3]); |
| 4577 | } |
| 4578 | }; |
| 4579 | } |
| 4580 | |
| 4581 | /** |
| 4582 | * Represents an <i>array initialiser expression</i> of the form |
nothing calls this directly
no outgoing calls
no test coverage detected