• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Binary AND Qualifier
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binary AND Qualifier


  • Subject: Re: Binary AND Qualifier
  • From: Chuck Hill <email@hidden>
  • Date: Fri, 26 Sep 2008 11:01:32 -0700


On Sep 26, 2008, at 10:27 AM, John Huss wrote:

How can I test an Integer attribute to see if it has a bit set, like (myAttribute & 1 != 0)?

I'd like to do this with a qualifier, only in memory right now, although having DB support would be cool (since FrontBase does allow this).

I tried messing around with an EOKeyValueQualifier with a custom selector but had no luck.

I could see this qualifier being useful as well as a Binary OR qualifier and a MOD qualifier.


Your best best is probably to subclass EOQualifier into EOBinaryQualifier and implement the method
public boolean evaluateWithObject(Object object)
That should (IIRC) handle your in-memory needs. Maybe something like
EOBinaryAndQualifier(String keyPath, long mask, boolean match)
so the implementation would be something like
boolean result = ((Number)object.valueForKeyPath(keyPath)).longValue() & mask != 0
result = match ? result : ! result
Obviously, there is a lot more that could be handled, like passing in a constant to indicate &, |, ^ etc.
DB support is more complicated. Wonder and the Houdah frameworks have examples.


Chuck
--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Binary AND Qualifier (From: "John Huss" <email@hidden>)

  • Prev by Date: Binary AND Qualifier
  • Next by Date: Re: WebObjects Error in Wonder D2W when populating MS SQL Server example
  • Previous by thread: Binary AND Qualifier
  • Next by thread: caseInsensitiveLike unknown operator exception
  • Index(es):
    • Date
    • Thread