TreeCellEditor and isCellEditable method

I'm confused about how to handle tree cell edits. See the example program below. As you click around the tree, note that the isCellEditable method is called on the cell you are leaving, and not on the cell you are going to. This causes the cell you are going to to be rendered with the editor of the cell you are coming from. There is something I'm missing. What is it?
What I thought would happen:
1) isCellEditable called on cell you are going to
2) if isCellEditable returns true, the editor is used to render the cell, otherwise the renderer is used.
What is happening:
1) isCellEditable called on the cell you are coming from. (perhaps this test is done to see if valueForPathChanged should be called on the model?)
2) ????
Example code:
public class TestTreeCellEditor extends AbstractCellEditor implements TreeCellEditor {
     private JLabel label = new JLabel();
     @Override
     public Component getTreeCellEditorComponent(JTree tree, Object value,
               boolean isSelected, boolean expanded, boolean leaf, int row) {
          label.setText(((DefaultMutableTreeNode) value).getUserObject().toString());
          return label;
     @Override
     public Object getCellEditorValue() {
          return label.getText();
     @Override
     public boolean isCellEditable(EventObject e) {
          TreePath path = ((JTree) e.getSource()).getSelectionPath();
          if (path != null) {
               DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
               String nodeText = node.getUserObject().toString();
               System.out.println("Testing node with text \"" + nodeText + "\"");
               return nodeText.indexOf("NOT") < 0;
          return false;
public class TestTreeEditBehavior {
     public static void main(String[] args) {
          SwingUtilities.invokeLater(new Runnable() {
               public void run() {
                    launchUI();
     private static void launchUI() {
          JFrame frame = new JFrame("Test Tree Edit Behavior");
          DefaultMutableTreeNode root = new DefaultMutableTreeNode("NOT Editable");
          root.add(new DefaultMutableTreeNode("I'm editable."));
          root.add(new DefaultMutableTreeNode("Me too!  I can be edited."));
          DefaultTreeModel model = new DefaultTreeModel(root);
          JTree tree = new JTree(model);
          tree.setCellEditor(new TestTreeCellEditor());
          tree.setEditable(true);
          JPanel panel = new JPanel();
          panel.add(tree);
          frame.setContentPane(panel);
          frame.pack();
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
}What I expect to happen and what actually happens are obviously not the same. What am I supposed to be doing?

Okay...here is how it looks to me:
What happens when you need to write your own custom TreeCellEditor?
TreeCellEditor requires the following methods:
    public abstract Component getTreeCellEditorComponent(JTree jtree, Object obj, boolean flag, boolean flag1, boolean flag2, int i);
    public abstract Object getCellEditorValue();
    public abstract boolean isCellEditable(EventObject eventobject);
    public abstract boolean shouldSelectCell(EventObject eventobject);
    public abstract boolean stopCellEditing();
    public abstract void cancelCellEditing();
    public abstract void addCellEditorListener(CellEditorListener celleditorlistener);
    public abstract void removeCellEditorListener(CellEditorListener celleditorlistener);However, you can probably get away with AbstractCellEditor handling most of the work. With AbstractCellEditor extended, you then only need to implement two methods:
    public abstract Component getTreeCellEditorComponent(JTree jtree, Object obj, boolean flag, boolean flag1, boolean flag2, int i);
    public abstract Object getCellEditorValue();However, you may still want to override some of the methods AbstractCellEditor handles for you. For example, AbstractCellEditor always returns true from the isCellEditable method. If you cells are not always editable, you will want to override this method.
You will note, however, using AbstractCellEditor you lose certain things provided by the DefaultTreeCellEditor. For example, fields are edited automatically on selection (if editable) rather than using the more complex behavior of the DefaultTreeCellEditor (triple-click or click-pause-click), and icons for the tree will be missing. You can reimplement this behavior on your own, but there is a potentially better approach. One of the DefaultTreeCellEditor constructors takes a TreeCellEditor as an argument. Pass your custom TreeCellEditor to this constructor, and you get the DefaultTreeCellEditor behaviors back (assuming you didn't already override them).
More about isCellEditable
When you ask whether or not a cell is editable, you are really asking two questions:
1) Is the cell editable?
2) Should the editor be activated given the user actions? (e.g. double-click, triple-click, etc)
Your cell editor should answer question 1 (AbstractCellEditor always returns true). The DefaultTreeCellEditor answers question 2. If you do not use the DefaultTreeCellEditor, then you should also answer question 2.
An odd happenstance of the DefaultTreeCellEditor is it's click-pause-click behavior to activate the editor. When this happens, the second click causes isCellEditable to be called again with a null EventObject (at least with Java 1.6.0_20-b02). If we assume this is the only time the EventObject will be null, you should probably just return true when the EventObject is null. Unless you wanted to specifically disable the click-pause-click behavior, in which case you could return false. But either way, make sure you check the EventObject for a null value.

Similar Messages

  • COM+ Event System failed to fire the StartShell and Logon method after installation of PM 1.43

    Hi Guys,
    After installation of Power Manager 1.43, the following errors were immediate shown at event viewer: COM+ Event System failed to fire the StartShell and Logon method on subscription {F6FE5592-FCBC-44AD-A836-D37F5085ED5B}-{00000000-0000-0000-0000-000000000000}-{00000000-0000-0000-0000-000000000000}.  The subscriber returned HRESULT 80004001.
    Please advice if this is a known issue? Thanks!

    Hello,
    this is a known problem. See this thread
    Follow @LenovoForums on Twitter! Try the forum search, before first posting: Forum Search Option
    Please insert your type, model (not S/N) number and used OS in your posts.
    I´m a volunteer here using New X1 Carbon, ThinkPad Yoga, Yoga 11s, Yoga 13, T430s,T510, X220t, IdeaCentre B540.
    TIP: If your computer runs satisfactorily now, it may not be necessary to update the system.
     English Community       Deutsche Community       Comunidad en Español

  • Abstract class with set and get methods

    hi
    how to write set and get methods(plain methods) in an abstartc class
    ex: setUsername(String)
    String getUsername()
    and one class is extending this abstract class and same methods existing in that sub class also..... how to write......plz provide some ideas
    am new to programming....
    asap
    thnx in advance

    yes... as i told u.... i am new to coding......
    and my problem is ..... i have 2 classes one is abstract class without abstract methods.. and another class is extending abstract class.....
    in abstract class i have 2 methods...one is setusername(string) and getusername() ..... how to write these two methods.... in abstract class i have private variables username...... when user logins ..... i need to catch the user name and i need to validate with my oracle database and i need to identify the role of that user and based on role of that user i need to direct him to appropriate jsp page.......
    for that now i am writing business process classes..... the above mentioned two classes are from business process.....
    could u help me now
    thnx in advance

  • I want to transfer all my iPhoto, iTunes, contacts, etc. files from my MacBook, which I am selling to a MacBook Pro. What is the easiest and safest method of achieving this? Can the files backed up on Time Machine be transferred to the Pro?.

    I want to transfer all my iPhoto, iTunes, contacts,documents, etc. files from my MacBook, which I am selling, to a MacBook Pro. What is the easiest and safest method of achieving this? Can the files backed up on Time Machine from the MacBook be transferred to the Pro in some way? I would like to capture the files as they appear on the MacBook, such as "Events" in iPhoto and the various song categories within iTunes without having to rename them all once saved on the Pro, which is the case with photos when I simply save them to thumb drive and import them to the Pro. Sny advice would be appreciated.
    Best regards,
    Rob.

    Michael,
                 Thanks for all your assistance. There is no need for apologies, Migration Assistant did indeed create a second account for the MacBook data. It has just taken me some time to figure out how to access it. I now have all the MB data in one account and the MBP files in another, which suits me fine. In fact, it is an advantage in my case as it keeps the private and business aspects separated.
    I will however try the fatcatsoftware to transfer all the iPhoto files to my iMac, where I keep my main photo library. and it will be of help to keep the events, etc in the transfer. As far as iTunes is concerned, I have HomeSharing on all my computers and this has obviated the need to worry about playlists being transferred successfully. However, HomeSharing did not appear to share the iPhone/iPod apps that were stored on the MB and although these have now come across with the new MacBook account on the MBP, I was wondering whether my iPhone and iPod will be recognised by the MBP and sync with it? Will I need to have the MB account open to achieve this or will the MBP recognise and sync with the iPhone/iPod automatically irrespective of which account is open?
    Thanks for the tip on deauthorising my iTunes account from the MB before sellng. This I will do and I believe the best way to remove all of my data from the hard drive is to reinstall the MacOSX operating system software. Is this the right approach to securely delete everything?
    Thanks again for sharing your expertise and your guidance through this exercise.
    Best regards,
    Rob.

  • Dynamic creation of class and calling methods

    I've got and interface called Transformation and then two implementations called TxA and TxB, where TxA and TxB have their own attribtues and setter and getters for these attributes.
    The question is, I need to create instances of TxA and TxB and called the setter and getters where I at runtime I only know the attribute to set, how can I create and instance and call the right getters and setters methods?
    Thanks in advance

    Smart money says your design sucks and needs to be rethought entirely. Can we get specifics?
    Drake

  • Error in CALL TRANSACTION and SESSION Method

    I have 8 records (1,2,3,4,5,6,7,8) to update into SAP database using CALL TRANSACTION and SESSION Method. If there is a error in 6th record. What happens in both call transaction and session method.
    Please let me know which records will process and what about the error record. How to process only the error record if all other records have updated into database.

    Hi Patil_sumeet,
    if your code for this is not protected secret of some federal agency, you may read [How to post code in SCN, and some things NOT to do...|How to post code in SCN, and some things NOT to do...; and then post relevant lines here.
    According to the facts presented until know it may have been better to ask Radio Eriwan
    Regards
    Clemens

  • HT2729 i have been trying to copy videos from my pc to ipad but it is not working .. i have tried the "drag and drop method and even add files to library but to no avail please help

    please help me regarding moving videos from pc to ipad .. i have ipad 2 wih ios5 and windows xp.. ihave tried add files to library and drag and drop method but they are not working.. what should i do

    Are you trying to add videos to itunes or to your ipad from itunes.
    Your question is very confusing.

  • Housebank and payment method for vendor

    Hi
    While doing MIRO, i want housebank and payment method to populate from vendor master data.  I maintained both these details in VM data but its not populating automatically in MIRO.  Please help.  (m using ECC 6)
    Sadhana

    Thanks Rinku.
    If we keep house bank and payment method fields blank while doing data entry, system will pick them up from VM data at the time of payment run. Right??
    But if the housebank field is mandatory for data entry (as in my scenario),  then we have no option but to fill the fields up at the time of MIRO or FB60.
    In my scenario, daily there are 150 bills processed at one centre, and the user has to fill up these two fields every time.  Is there any other solution so that this trouble can be saved?
    Thanks (points assigned).

  • Why does a find and replace method remove whitespace?

    I have method that searches for a string in a FM document and replaces it with a variable. If for example, there was a string foobar that I wanted to replace with the variable barfoo. Then, I expect this text:
    Lorem ipsum dolor sit amet, foobar consectetur adipiscing elit. Vivamus sed purus urna, ac tristique tortor. Nam auctor tellus non enim pulvinar a vestibulum neque tincidunt.
    To be changed to this text:
    Lorem ipsum dolor sit amet, barfoo consectetur adipiscing elit. Vivamus sed purus urna, ac tristique tortor. Nam auctor tellus non enim pulvinar a vestibulum neque tincidunt.
    However, while the text does do the replace it also removes the whitespace between the variable and the text that appears right after the variable so it actually looks looks like this:
    Lorem ipsum dolor sit amet, barfooconsectetur adipiscing elit. Vivamus sed purus urna, ac tristique tortor. Nam auctor tellus non enim pulvinar a vestibulum neque tincidunt.
    Why is the find and replace method removing the whitespace and how do I prevent that from happening? The method is provided below.
    function FindAndReplaceString(pDoc, findString, replaceVariable)
        if (typeof pDoc != 'undefined'&&typeof findString != 'undefined'&&typeof replaceVariable != 'undefined'&&pDoc.ObjectValid()&&findString.length>0&&replaceVariable.length>0)
            var vVarFmtStatus=checkVarFmStatus (pDoc, replaceVariable);
            if (vVarFmtStatus=='In Doc')
                var tr = new TextRange();
                var findParams = new PropVals();
                var frame = pDoc.MainFlowInDoc.FirstTextFrameInFlow;
                var restoreTR = pDoc.TextSelection;
                tr.beg.obj = tr.end.obj = frame.FirstPgf;
                tr.beg.offset = tr.end.offset = 0;
                findParams = AllocatePropVals(1);
                findParams[0].propIdent.num = Constants.FS_FindText;
                findParams[0].propVal.valType = Constants.FT_String;
                findParams[0].propVal.sval = findString;
                tr = pDoc.Find(tr.beg, findParams);
                var vLoopCounter=0;
                while(FA_errno === Constants.FE_Success&&vLoopCounter++< 1000)
                    pDoc.TextSelection = tr;
                    pDoc.Clear(0);
                    var newVar = pDoc.NewAnchoredFormattedVar(replaceVariable, tr.beg);
                    var varLength = newVar.TextRange.end.offset - newVar.TextRange.beg.offset;
                    tr.beg.offset += varLength;
                    tr = pDoc.Find(tr.beg, findParams);
                if (vLoopCounter>0)
                    Log (vLogFileName, 'In the document \''+pDoc.Name+'\', the string \''+findString+'\' was replaced with the variable \''+replaceVariable+'\' '+vLoopCounter+' times.\n')
                if (vLoopCounter>1000)
                    recordErrors (vErrorLog, 'ERROR: In the document "'+pDoc.Name+'", the find and replace operation was stopped after executing '+vLoopCounter+' times. The term being searched for is "'+findString+'" the replacement variable is "'+ replaceVariable+'".')
                pDoc.TextSelection = restoreTR;
                pDoc.ScrollToText(restoreTR);
                } else {
                    recordErrors (vErrorLog, 'ERROR: The find and replace operation failed because the variable '+replaceVariable+' does not exist in the following doc: '+pDoc.Name)
            } else {
                recordErrors (vErrorLog,'Invalid or unitialized parameter passed to function FindAndReplaceString')

    Hi,
    Not at the moment. Please post in http://forums.adobe.com/community/muse/ideas so other users can vote on the feature request.
    Thanks,
    Abhishek

  • HashSet get() and contains() methods, by value or reference?

    All the tutorials I've seen on HashSets use Strings as the object type. With Strings, it seems the get() and contains() methods work by value, not by reference.
    <CODE>
    String s1 = "dog";
    String s2 = "cat";
    String s3 = "dog";
    HashSet<String> set = new HashSet<String>();
    set.add(s1);
    System.out.println(set.contains(s1)); //true;
    System.out.println(set.contains(s2)); //false
    System.out.println(set.contains(s3)); //true
    </CODE>
    But when I use a custom object, it works by reference:
    <CODE>
    MyClass c1 = new MyClass("dog", 1);
    MyClass c2 = new MyClass("cat", 1);
    MyClass c3 = new MyClass("dog", 2);
    MyClass c4 = new MyClass("dog", 1);
    HashSet<MyClass> myClassSet = new HashSet<MyClass>();
    myClassSet.add(c1);
    System.out.println(myClassSet.contains(c1)); //true
    System.out.println(myClassSet.contains(c2)); //false
    System.out.println(myClassSet.contains(c3)); //false
    System.out.println(myClassSet.contains(c4)); //false
    </CODE>
    ("MyClass" is a simple class that holds a String and an int).
    Is there any way I can get the set to select by value rather than reference for objects that aren't String?
    If so, is it possible that the value test could be customised, so that, for example, the above will return true if the String in MyClass is the same, regardless of the int value?

    803559 wrote:
    With Strings, it seems the get() and contains() methods work by value, not by reference.
    String s1 = "dog";
    String s2 = "cat";
    String s3 = "dog";
    System.out.println(set.contains(s1)); //true;
    System.out.println(set.contains(s2)); //false
    System.out.println(set.contains(s3)); //true
    Is there any way I can get the set to select by value rather than reference for objects that aren't String?Warning: Never use the term "by reference" around Java geeks. It makes 'em go all green at the gills and they start muttering about 'bloody C++ crossovers'.
    However, as DrClap pointed out, you've mis-diagnosed the problem:
    System.out.println(s1 == s1);
    System.out.println(s1 == s2);
    System.out.println(s1 == s3));would print out the exact same results.
    For an explanation why, Google "Java String pool" or try [url http://stackoverflow.com/questions/3297867/difference-between-string-object-and-string-literal]here.
    If so, is it possible that the value test could be customised, so that, for example, the above will return true if the String in MyClass is the same, regardless of the int value?Absolutely. But, as others have said, you'd need to override equals() and hashCode().
    Winston

  • Write a servlet without doGet() and doPost() methods

    Hi,
    Can we write a servlet without doGet() and doPost() methods ?

    public class MyCoolServlet extends HttpServlet
    public void init(ServletConfig servletConfig) throws ServletException
    public void service(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
    // your code here
    }Just an example on how to do it.
    A servlet is loaded by server (before any request). It will run the init function. Then pick up an request, spawn a thread and put this servlet code into the thread, give it session, request and response objects, then call serivce.
    Remember that init is called before, outside the thread, while service is inside the thread and the last to be called. Nice place to put your code.
    If you need to have some sort of init function to be called first on every request PR USER, then make your own function, and call it first in service method.
    Stuff that are put in init() function might only get runned once in the entire server lifetime. Until restart.

  • Re: No G/L accounts are defined for bank ICICI and payment method C

    < MODERATOR:  Message locked.  Please read [this|Before you post: Rules of Engagement; before posting next time. use an appropriate subject...  something other than what was copied from an email would be appreciated. >
    Hi Friends,
    When i am doing T.Code F-58 i am getting an error of
    (No G/L accounts are defined for bank ICICI and payment method C) so could anybody please help me how to solve this problem awaiting for your reply friends.
    Points will be assigned.
    Thanks in advance.
    KUMAR.

    Hi Kumar,
    You will have to configure the House Bank with T Code FI12 and further mention the payment method in FBZP. You will have to select one of the  follwing as payment method, check/transfer/postal giro transfer/bill of exchange. Though check (C) is widely used.
    Assign points, if useful.
    Regards,
    Saurabh Agarwal

  • Accessing Custom Controller from setter and Getter methods

    Hi Gurus
    How can we access the custom controller from setter and getter methods,is there any way to do that.
    Thanks & Regards
    Rajasekhar

    Hi Steve.
    Thanks very much for valuable information,  the main controller class is getting tracked in mo_owner which is declared as  CL_BSP_WD_VIEW_CONTROLLER, and I'm getting the reference through
    mo_owner ?= owner. (since mo_owner = owner is not getting converted of type mo_owner ). After doing this on whatever the contexnode class (say zl_xxxx_xxx_cnxx) the corressponding context node values are getting turned as  <#ERROR IN METADATA.
    I mean when I'm checking the configuration in bsp_wd_cmpwb configuration tab -> Available Fields->Enlarge the contex node->BTSTATUS (say for Example) there the values are showing as <#ERROR IN METADATA , After executing the above procedure
    I cross checked several times before and after redefining the context node method IF_BSP_MODEL~INIT, before redefining this method UI is working fine, after redefintion UI is throwing below error .
    Exception Details
    CX_SY_REF_IS_INITIAL - Dereferencing of the NULL reference
    Method: CL_BSP_MODEL=>IF_BSP_MODEL_BINDING~IS_ATTRIBUTE_VALID
    Source Text Row: 13
    Thanks & Regards
    Rajasekhar

  • My ipod cclassic 80gb is hang after trying dat press and hold method then also its not working please tell me solution

    My ipod cclassic 80gb is hang after trying dat press and hold method then also its not working please tell me solution

    Thanks for your response and good luck wishes, I suspect I will need them!
    In principle, I agree re: the manufacturer's warranty. However, I am pretty upset that this is now my second iPod to develop a critical fault within weeks of the warranty expiring, and frankly, it is not unreasonable to expect a state-of-the-art $500 electronic device to last well beyond one year of life.
    I agree talking to Apple is not likely to do me any good (the clue is in how impossible they make it to talk to them in the first place) - but that is not necessarily OK. I expect I will have to pay money to get the battery replaced - again, not OK (full stop - but especially given the cost of the device and the money I have spent with Apple). Yes, the batteries have a limited lifespan, but it should last longer than this (and surely, I should notice a gradual decline in its functionality, not an instant stop).
    I will try Deggie's suggestion (see my reply post), but probably won't hold my breath (think I have already done this). I probably will have to get the new battery - and probably under my own steam. It is a principle at stake and I feel I should be able to let Apple know how I'm feeling - and am frustrated that they make this virtually impossible. It sends the very clear message that they are not interested in listening to their customers.

  • Multiple dispatch and Symmetric methods - Where Does That Code Live?

    Hi all.
    I am stuck with the above problem, which looks to be a very common and fundamental one. Supposing I have some sort of relation or operation to be performed on various different pairs (or n-tuples) of classes of object. Where does this code belong, given that it is not sole property of any one of the classes, but a kind of property of the collection of classes?
    An bad example for me to bring up, but one that neatly illustrates the point, is the equals method. In order to retain the symmetric and transitive properties of the equals method, and object can only make judgement calls about it being equal to another object of it's own type. This prevents the concept of equivalency from crossing between types.
    In order to compare a with b (if a and b are of different types), b must supply some sort of representation of itself as an a, then the comparison statement a.equals(b.asA()); must be called.
    This of course means b must supply an 'asXXX()' method for each class XXX it wishes to equate itself to. Furthermore, by an extension of the equals contract for symmetricality, the method AsB() in class A (if it exists) must be such that, if a.AsB() .equals (b), then b.AsA.equals( a ).
    This sort of design is unfeasible for obvious reasons, the main reason being that it is impossible to anticipate evey case where an instance of class A could reasonably be compared to an instance of some other class X.
    The other annoyance is all that hard work of providing methods to equate A with something else, would go unused for 99% of the time.
    With this in mind, I was thinking. Suppose in some program environment, we have only 3 classes, A, B, and C, such that:
    {A,B} can be meaningfully compared
    {B, C} and {A, C} cannot.
    It would be OK to supply code (somewhere) for comparing A's with B's. We also know that under no circumstances will an A or a B, and a C, ever need to be compared for equality.
    Supposing an extension of this environment were created, introducing class D.
    {D, A} and {D, B} can be meaningfully compared.
    Now, neither A nor C knows what a D is, or how to compare themselves to it. But D was developed with A, B and C in mind, and contains logic for the various comparisons (with A and with B). An obvious idea for this is to let D bring it's new code into play, by registering these new comparison functions in the environment somehow.
    Supposing instead that equality comparison was delegated to some third party, instead. This third party contains a table of pairs of classes, which act as keys to look up a comparison object.
    So, when class A is loaded, something of the sort happens:
    public class A {
        static {
            Equals.comparer.addEntry(A.class, B.class, new EqualsMethod() {
               // details of the EqualsMethod interface implementation go here
    public class B {
        static {
            // since equals is symmetric, this method clashes with the above in A
            // This could happen...
            Equals.comparer.addEntry(B.class, A.class, new EqualsMethod() {
               // ... different approach to the above
    public class D {
        static {
            Equals.comparer.addEntry(D.class, A.class, new EqualsMethod() {
            Equals.comparer.addEntry(D.class, B.class, new EqualsMethod() {
        } // Ds can now be compared with Bs and As. They can now be compared with Ds
    }There is a problem with the above. As can clearly be seen, there are 3 unique situations that might occur between two classes (call them X and Y).
    o One of X or Y contains code to compare them both.
    o Neither X nor Y contain code to compare the two. X equals Y is always false
    o Both X and Y contain code to compare the two.
    The third causes the problem. What if X and Y disagree on how to compare themselves? Which method gets chosen? The only solution would be to let whosever static initialiser gets called first be the one to supply the code.
    I said before that equals was a bad example to bring up. this is because the usage of equals and the concept of equality in java is already well defined, and works just fine. However, in my own pet project at the moment, I have run into the same problems as outlined above.
    I am currently assembling a generic pattern API for use in various other applications I am writing (I was finding that I was writing code for matching objects to patterns, in different guises, quite frequently, so I made the decision to refactor it into its own package). An important part of the API is the section that handles the logic for combining patterns, ie with AND, OR and NOT operations.
    The Pattern interface is this:
    interface Pattern<E> {
         public boolean match(E toMatch);
         public Pattern<E> not();
         public Pattern<E> or(Pattern<E> other);
         public Pattern<E> and(Pattern<E> other);
    }There are a few basic Patterns:
    TruePattern<E> - a pattern that always returns true no matter what E is passed for it toMatch
    FalsePattern<E> - self-explanatory.
    ExactValuePattern<E> - true if and only if the E that it is passed toMatch is .equal to the E that this pattern was constructed with.
    NotPattern<E> - a pattern that contains another pattern, and returns true for any E that returns does not match it's contained pattern. Used for when the contained pattern cannot be logically reduced to one pattern under the NOT method in the Pattern interface
    AndPattern<E> - a pattern that contains 2 other patterns, and returns true for some E iff both contained patterns return true for that E. Used for when the 2 patterns cannot be logically reduced into one pattern via the AND method in the Pattern interface
    OrPattern<E> - self explanatory
    RangePattern<E extends Comparable <E>> - a pattern for comparing if some Comparable lies between two other comparables.
    Every pattern has the opportunity to provide a reduction, when combined with another pattern through And or Or. For example, any pattern AND a FalsePattern can be reduced just the FalsePattern. any pattern OR a TruePattern can be reduced to just the TruePattern.
    The methods AND and OR from the Pattern interface present the same problems as the .equals() example I was using before.
    o AND and OR are symmetric operations
    o There exist situations where two patterns of unrelated class could be meaningfully combined (and reduced) under these two operations.
    Example: The pattern on Integers '0 < X < 3' and 'X is 5' can be reduce to the FalsePattern
    Example: The pattern on Doubles '0 < X <= 10' or 'X is 5.5' or 'X is 7.2' can be reduced to '0 < X <= 10'.
    Example: The pattern on Integers ('0 <= X <= 5' and 'X is not 0') or ('X is 6') or ('x is 7') can be reduced to '1<=X<=7'.
    So the question is, where does the code belong? a.and(b) should return the same as b.and(a), but both b and a may well disagree as to what happens when they are combined under and. At present, both a and b need to supply their own separate implementations. Clearly though, the code for combining patterns A and B belongs to neither A alone, not B alone, but to A and B as a whole.
    Thanks in advance, and sorry for this overlong post.

    So the equivalent thing in my scenario would be an
    AndAnator, and an OrAnator? :)
    The thing is, it would be nice for comparison between
    A and B to take place automatically, without the poor
    coder having to maintain a reference to a Comparator
    and invoke the comparison method each time. Likewise
    in my situation, it'd be nice to say A.or(B) instead
    of andAnator.and(A,B), yet have all the goodness of a
    third party doing the comparison (or in this case,
    the anding).
    I am going to go and test this all out, but do you
    have any suggestions on a good structure? I think it
    would involve pulling the and/or/not methods from the
    interface (this appeals, as many implementors may not
    wish to supply logic for running these methods
    anyhow), and then putting them... somewhere else.I didn't consider your speicifc problem very deeply because after such a long detailed explanation I figured you'd be up for kicking around the idea for a while.
    In your case, I see that you would want to be able to call the and and or methods on the Objects themselves. Luckily, in this case, I think you can have your cake and eat it too.
    You can make your and and or methods fa�ades to the third party 'referee'. This way you can enfore symmetry. It's difficult (if not impossible) to enoforce transitivity with this design but I think you don't even need that in this case. That is if a == b and b == c then a == c should be true but if a and b and b and c then a and c is not necessarily true. In your case, it may not even make sense.

Maybe you are looking for