Task #5421
openUtility methods on expression nodes
20%
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.
Updated by Andrei Tatarnikov about 10 years ago
Для реализации "Shortcuts for standard operations" нужно осудить:
1. Добавление фабричных методов ExprUtils. Там уже есть методы getConjunction, getDisjunction, getNegation, в которые добавлены проверки isCondition. Не нарушат ли новые методы концепцию ExprUtils?
2. Создать новый утилитный класс для статических фабричных методов. Например, OperationFactory (имя не должно быть длинным). Тогда StandardOperations нужно переименовать (класс Operation уже есть в калькуляторе - будет конфликт). Нужно другое имя.
Updated by Andrei Tatarnikov about 10 years ago
- 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).
Updated by Andrei Tatarnikov almost 10 years ago
- 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()
Updated by Artem Kotsynyak almost 10 years ago
Nominating method List<Node> NodeOperation.getOperands() returning immutable list view on operands.
Updated by Andrei Tatarnikov almost 10 years ago
Nominating method List<Node> NodeOperation.getOperands() returning immutable list view on operands
Done in r782
Updated by Andrei Tatarnikov almost 10 years ago
Default TRUE and FALSE nodes w/o user data.
Decided not to implement because NodeValue is mutable (the setData method can change its state).
Updated by Alexander Kamkin over 9 years ago
- Subject changed from [expression] Utility methods on expression nodes to Utility methods on expression nodes
- Category set to Expression
Updated by Andrei Tatarnikov over 9 years ago
- Target version changed from 0.3 to 0.4