Bug 68743 - QuickAssists for DeMorgan's laws [quick assist]
Summary: QuickAssists for DeMorgan's laws [quick assist]
Status: RESOLVED DUPLICATE of bug 82220
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-28 08:28 EDT by Markus Keller CLA
Modified: 2005-01-27 04:47 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2004-06-28 08:28:56 EDT
QuickAssists for DeMorgan's laws:
1)  !a & !b  <=>  ! (a | b)
2)  !a || !b <=> ! (a && b)
3) ... and both with & and | (&& and ||, resp.) interchanged

The => way (reducing ! count) is probably more useful than the other one, but
offering both could still be helpful once in a while.
Comment 1 Adam Kiezun CLA 2004-06-28 11:04:57 EDT
another way to call these is 'push nagation in' and 'pull negation out' 
i'd find them very useful sometimes
boolean expressions get complicated easy to mess up after 2 or 3 clauses
once you get them right it's easy to mess stuff up with what seems like a benigh
change - you forget a ! here or a paratheses there and you're in trouble

+1 here
Comment 2 Konstantin Scheglov CLA 2004-10-14 13:53:26 EDT
I would like to implement this QuickAssist and post patch for it.
But I not fully understand, how and in which cases to activate it.

As I can imagine, "push" is when we stay on ! before parenthesis, for example:
  !(a && b)
and want to transform into:
  (!a || !b)
may be also remove perenthesis if they are not required.

"Pull" is when we select some boolean expression, place it in parenthesis and
add ! before. I.e. for:
  !a || !b
we will have:
  !(a && b)

  May be I don't understand right what is needed? I feel that this method can be
too tiring, each time specify exactly, where to perform transformation, so may
be you have better idea, that I just don't imagine. So, correct me, if I am
wrong, or confirm that this is what required, so I will able to start work on
this quick assist. ;-)
Comment 3 Markus Keller CLA 2004-10-29 10:33:31 EDT
IMO, the quick assist should be available when either
[a] the whole expression "!(a && b)" or "(!a || !b)" or "!a || !b" is selected,
[b] or when the caret is somewhere inside or on the border of the expression.

For [a], you would need to look top-down ("is there an && inside the !" / "does
the || have ! as children"). The user can simply use "Edit > Expand Selection
To" to select the right expression.

For [b], you would probably start from !s and &&s, and check whether their
parents form a suitable expression.
Comment 4 Martin Aeschlimann CLA 2005-01-27 04:47:43 EST

*** This bug has been marked as a duplicate of 82220 ***