Project

General

Profile

Actions

Task #5421

open

Utility methods on expression nodes

Added by Artem Kotsynyak about 10 years ago. Updated over 4 years ago.

Status:
Open
Priority:
Normal
Assignee:
Andrei Tatarnikov
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.

Actions #1

Updated by Andrei Tatarnikov about 10 years ago

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

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

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

Actions #2

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

Actions #3

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()
    
Actions #4

Updated by Artem Kotsynyak almost 10 years ago

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

Actions #5

Updated by Andrei Tatarnikov almost 10 years ago

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

Done in r782

Actions #6

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).

Actions #7

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
Actions #8

Updated by Andrei Tatarnikov over 9 years ago

  • Target version changed from 0.3 to 0.4
Actions #9

Updated by Alexander Kamkin over 4 years ago

Close?

Actions

Also available in: Atom PDF