Task #5421
open
Utility methods on expression nodes
Added by Artem Kotsynyak almost 10 years ago.
Updated over 4 years ago.
Assignee:
Andrei Tatarnikov
Description
- Shortcuts for standard operations, e.g. AND (...) to replace new NodeOperation(StandardOperation.AND, ...) etc.
- Default TRUE and FALSE nodes w/o user data.
- Node hierarchy checks: check if Node is a specific operation (Node x opId -> boolean), check if Node is a specific DataType value (Node x DataType -> boolean).
- Complementary to NodeValue.newXXX: isXXX and getXXX.
- Operands extraction.
Some of these can be found implemented or even duplicated in the codebase. This list is a subject to updates.
Для реализации "Shortcuts for standard operations" нужно осудить:
1. Добавление фабричных методов ExprUtils. Там уже есть методы getConjunction, getDisjunction, getNegation, в которые добавлены проверки isCondition. Не нарушат ли новые методы концепцию ExprUtils?
2. Создать новый утилитный класс для статических фабричных методов. Например, OperationFactory (имя не должно быть длинным). Тогда StandardOperations нужно переименовать (класс Operation уже есть в калькуляторе - будет конфликт). Нужно другое имя.
- Assignee set to Andrei Tatarnikov
- Target version set to 0.3
We decided that, to solve this task, static factory methods should be added to the StandardOperations enumeration (they will have the same name as corresponding enumeration elements).
- Status changed from New to Open
- % Done changed from 0 to 20
Complementary to NodeValue.newXXX: isXXX and getXXX.
The following methods have been added (r769):
- To the Data class:
public boolean isType(DataTypeId typeId);
public boolean isType(DataType type);
public BigInteger getInteger();
public BitVector getBitVector();
public boolean getBoolean();
public double getReal();
public DataMap getArray();
- To the Node class:
public boolean isType(DataTypeId typeId);
public boolean isType(DataType type);
- To the NodeValue class:
public BigInteger getInteger();
public BitVector getBitVector();
public boolean getBoolean();
public double getReal();
public DataMap getArray()
Nominating method List<Node> NodeOperation.getOperands() returning immutable list view on operands.
Nominating method List<Node> NodeOperation.getOperands() returning immutable list view on operands
Done in r782
Default TRUE and FALSE nodes w/o user data.
Decided not to implement because NodeValue is mutable (the setData method can change its state).
- Subject changed from [expression] Utility methods on expression nodes to Utility methods on expression nodes
- Category set to Expression
- Target version changed from 0.3 to 0.4
Also available in: Atom
PDF