1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Suggestion Ability to invert a query option

Discussion in 'Client & Site Suggestions' started by Cloud, May 13, 2016.

  1. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    Example: Looking to find entities with animations that don't equal -1, so you would invoke a method that would make the next method call do the exact opposite or something. Typing super quickly as I'm in a rush and this implementation I proposed is shit but yeah, the point stands that it's something useful. Gotta run.
     
  2. Party

    Party Client Developer

    Joined:
    Oct 12, 2015
    Messages:
    3,708
    Likes Received:
    1,606
    Excellent idea, I'll tag in @Vap...

    Joking aside, isn't this the purpose of predicates?
     
  3. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Good suggestion, @SlashnHax can you add this please?
     
  4. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,937
    Likes Received:
    1,266
    *previous method call

    It's more standard. animations(-1).negate(). But @Party brings up a good point. Predicates handle this already. I'd rather keep the wheel re-invention to a minimum. Our wrapper methods should be used exclusively for simple things and Bot Authors should graduate to using Predicates once their needs are greater than the available convenience methods.
     
  5. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    I would if I could ;)

    Iirc, the QueryBuilders have an .accepts(T t) method, so a simple implementation would be to use that, in a similar way that Predicate's negate uses test.
    Idk how efficient it would be though.

    Edit: nvm I misread and thought you were talking about negating the entire query xD
     
  6. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    Our convenience methods are not adequately convenient once they inconvenience me.
     
    Aidden likes this.
  7. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    What if you added MORE convenience methods? Like idsExcept() or namesExcept() : ^)
     
  8. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,937
    Likes Received:
    1,266
    pls no
    --- Double Post Merged, May 14, 2016, Original Post Date: May 14, 2016 ---
    Use a predicate. >.>
     
  9. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    We can't optimize order and implement elegant caching when a predicate is used, thus defeating the purpose of us lazily evaluating queries.
     
  10. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,937
    Likes Received:
    1,266
    Sure we can by allowing the user to specify what data the predicate tests by as an Enum... argument. It would yield a more robust solution anyway. @Vaped


    Sent from my iPhone using Tapatalk
     
  11. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,937
    Likes Received:
    1,266
    GameObjects.newQuery().filter(() -> ..., GameObject.FilterType.ID, GameObject.FilterType.MODEL)


    Sent from my iPhone using Tapatalk
     
  12. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,937
    Likes Received:
    1,266
    We could then use these FilterTypes on a 1-X intensity scale to prioritize filtering. We could also allow devs to provide their own intensity level when our defined ones aren't sufficient.


    Sent from my iPhone using Tapatalk
     

Share This Page

Loading...