History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-16440
Type: New Feature New Feature
Status: Open Open
Priority: Normal Normal
Assignee: Bas Leijdekkers
Reporter: Esko Luontola
Votes: 1
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

Intention action: Apply "Distributive Law" and other laws of boolean algebra to boolean expressions

Created: 21 Feb 07 16:43   Updated: 25 Apr 07 15:35
Component/s: Editor. Intention Actions
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 6,148


 Description  « Hide
IDEA already has some quickfixes for refactoring boolean expressions, for example applying Morgan's Law, but there are still some refactorings which are not supported.

For example I needed the Distributive Law to simplify the following code, but IDEA does not have a refactoring for that. Also I had to apply the rule (i % 2 == 0) equals (i % 2 != 1), and an intention action for it might also be possible.

String propEvenOdd;
boolean createEven;
int i;

if ((propEvenOdd == null || !createEven || i % 2 != 1) &&
        (propEvenOdd == null || createEven || i % 2 != 0)) {
    // do something
}

// ...after some refactoring:

if (propEvenOdd == null
        || (createEven && i % 2 == 0)
        || (!createEven && i % 2 == 1)) {
    // do something
}

In short, I would like IDEA to have more intention actions for boolean handling, so that the above refactoring would be fully possible by using only the intention actions. This would prevent human errors when refactoring complicated boolean expressions.

Here are some lists of the laws of boolean algebra:

http://en.wikipedia.org/wiki/Boolean_algebra#Formal_definition
http://www.laynetworks.com/Boolean%20Algebra.htm



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.