Jump to content

Botre

Members
  • Posts

    5883
  • Joined

  • Last visited

  • Days Won

    18
  • Feedback

    100%

Everything posted by Botre

  1. Consider this a little follow up to: http://osbot.org/forum/topic/94595-chart-picking-the-appropriate-collection-interface/ Source: http://infotechgems.blogspot.be/2011/11/java-collections-performance-time.html
  2. spaghetti confetti never forgetti
  3. I was talking about tracking data for dynamic sigs and stuff like that. isVIP... meh. isMirror... sucks it's gone
  4. You can still just cache a text file with a unique key generated by you to track anonymously-ish. getUsername() didn't map to the forum username anyways I think :p
  5. Build a proper testing loop/script that isolates and prints every involved variable, there are multiple reasons why Mirror could be failing or appear to be failing (because of it's slowness).
  6. I'm pretty sure widget string checking isn't broken in mirror. Maybe you're checking the wrong widget? To be sure, test both clients and compare the results... but I'd be surprised.
  7. For caching across the multiple methods I've found: 1. The following string values are tested for "Click here to continue", "to continue", "please wait..." "Click to continue" 2. They following sprite is also checked Sprites.SELECT_OPTION_SWORD2
  8. The client caches them conditionally they don't use a static list. You should probably do the same. ... or just use the Dialogue API :p
  9. isPendingOption() at no point checks for widget 219's visibility. It checks if the chatbox is not visible, whether a specific (or set of specific) widget(s) is/are active and it checks for sprite matches.
  10. Botre

    Veteran

    check, check, boge
  11. tricky I would suggest you post the problem you are trying to solve with this specific visibility check instead
  12. Chain, negate, combine, ... Filter Example: public static void main(String[] args) { Filter<String> IS_EMPTY = s -> s.isEmpty(); Filter<String> CONTAINS_O = s -> s.contains("o"); String a = ""; String b = "osbot"; // Check if empty System.out.println(IS_EMPTY.match(a)); //true System.out.println(IS_EMPTY.match(b)); //false //Check if NOT empty System.out.println(FilterOperation.negate(IS_EMPTY).match(a)); //false System.out.println(FilterOperation.negate(IS_EMPTY).match(b)); //true // Check if empty OR contains o System.out.println(FilterOperation.or(IS_EMPTY, CONTAINS_O).match(a)); //true System.out.println(FilterOperation.or(IS_EMPTY, CONTAINS_O).match(b)); //true // Check if empty AND contains o System.out.println(FilterOperation.and(IS_EMPTY, CONTAINS_O).match(a)); //false System.out.println(FilterOperation.and(IS_EMPTY, CONTAINS_O).match(b)); //false } Filter Operations: package org.botre.functional; import org.osbot.rs07.api.filter.Filter; public final class FilterOperation { private FilterOperation() { } /** * Returns a filter that represents the logical negation of the supplied filter. * * @return a filter that represents the logical negation of the supplied filter */ public static final <T> Filter<T> negate(Filter<? super T> filter) { return e -> !filter.match(e); } /** * Returns a filter that represents a short-circuiting logical AND of the supplied filters. * * @return a filter that represents a short-circuiting logical AND of the supplied filters */ @SafeVarargs public static final <T> Filter<T> and(Filter<? super T>... filters) { if(filters.length < 1) throw new IllegalArgumentException(); return new Filter<T>() { @Override public boolean match(T e) { for (Filter<? super T> filter : filters) if(!filter.match(e)) return false; return true; } }; } /** * Returns a composed filter that represents a short-circuiting logical OR of the supplied filters. * * @return a composed filter that represents a short-circuiting logical OR of the supplied filters */ @SafeVarargs public static final <T> Filter<T> or(Filter<? super T>... filters) { if(filters.length < 1) throw new IllegalArgumentException(); return new Filter<T>() { @Override public boolean match(T e) { for (Filter<? super T> filter : filters) if(filter.match(e)) return true; return false; } }; } } Functional Operations: package org.botre.functional; import java.util.function.BooleanSupplier; import java.util.function.Predicate; public final class FunctionalOperation { private FunctionalOperation() { } /** * Returns a composed boolean supplier that represents a short-circuiting logical AND of the supplied boolean suppliers. * * @return a composed boolean supplier that represents a short-circuiting logical AND of the supplied boolean suppliers */ public static final BooleanSupplier and(BooleanSupplier... suppliers) { if(suppliers.length < 1) throw new IllegalArgumentException(); return () -> { for (BooleanSupplier s : suppliers) if(!s.getAsBoolean()) return false; return true; }; } /** * Returns a composed boolean supplier that represents a short-circuiting logical OR of the supplied boolean suppliers. * * @return a composed boolean supplier that represents a short-circuiting logical OR of the supplied boolean suppliers */ public static final BooleanSupplier or(BooleanSupplier... suppliers) { if(suppliers.length < 1) throw new IllegalArgumentException(); return () -> { for (BooleanSupplier s : suppliers) if(s.getAsBoolean()) return true; return false; }; } /** * Returns a composed predicate that represents a short-circuiting logical AND of the supplied predicates. * * @return a composed predicate that represents a short-circuiting logical AND of the supplied predicates */ @SafeVarargs public static final <T> Predicate<T> and(Predicate<T>... predicates) { if(predicates.length < 1) throw new IllegalArgumentException(); Predicate<T> result = predicates[0]; for (int i = 1; i < predicates.length; i++) { result = result.and(predicates[i]); } return result; } /** * Returns a composed predicate that represents a short-circuiting logical OR of the supplied predicates. * * @return a composed predicate that represents a short-circuiting logical OR of the supplied predicates */ @SafeVarargs public static final <T> Predicate<T> or(Predicate<T>... predicates) { if(predicates.length < 1) throw new IllegalArgumentException(); Predicate<T> result = predicates[0]; for (int i = 1; i < predicates.length; i++) { result = result.or(predicates[i]); } return result; } }
  13. Why no neutral fb?
×
×
  • Create New...