Project

General

Profile

Task #5421

Utility methods on expression nodes

Added by Artem Kotsynyak almost 5 years ago. Updated about 4 years ago.

Status:
Open
Priority:
Normal
Category:
Expression
Target version:
Start date:
11/12/2014
Due date:
% Done:

20%

Estimated time:
Detected in build:
svn
Published in build:

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.

History

#1

Updated by Andrei Tatarnikov almost 5 years ago

Для реализации "Shortcuts for standard operations" нужно осудить:

1. Добавление фабричных методов ExprUtils. Там уже есть методы getConjunction, getDisjunction, getNegation, в которые добавлены проверки isCondition. Не нарушат ли новые методы концепцию ExprUtils?

2. Создать новый утилитный класс для статических фабричных методов. Например, OperationFactory (имя не должно быть длинным). Тогда StandardOperations нужно переименовать (класс Operation уже есть в калькуляторе - будет конфликт). Нужно другое имя.

#2

Updated by Andrei Tatarnikov over 4 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).

#3

Updated by Andrei Tatarnikov over 4 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()
    
#4

Updated by Artem Kotsynyak over 4 years ago

Nominating method List<Node> NodeOperation.getOperands() returning immutable list view on operands.

#5

Updated by Andrei Tatarnikov over 4 years ago

Nominating method List<Node> NodeOperation.getOperands() returning immutable list view on operands

Done in r782

#6

Updated by Andrei Tatarnikov over 4 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).

#7

Updated by Alexander Kamkin over 4 years ago

  • Subject changed from [expression] Utility methods on expression nodes to Utility methods on expression nodes
  • Category set to Expression
#8

Updated by Andrei Tatarnikov about 4 years ago

  • Target version changed from 0.3 to 0.4

Also available in: Atom PDF