/** * Get a list of factories that match the given parameter. * * <p>It is a combination of listGetElement and listFilter passing all the results of the first * call to the second. * * <p>This method improves performance because there is no need to map to java list the elements * returned by the first call. * * @param type a {@link ElementFactoryListType} * @param minrank Minimum rank * @param caps a {@link Caps} * @param direction a {@link PadDirection} to filter on * @param subsetonly whether to filter on caps subsets or not. * @return a {@link List} of {@link ElementFactory} elements that match the given requisits. */ public static List<ElementFactory> listGetElementFilter( ElementFactoryListType type, Rank minrank, Caps caps, PadDirection direction, boolean subsetonly) { GList glist = gst.gst_element_factory_list_get_elements(type.getValue(), minrank.getValue()); return lister(glist, caps, direction, subsetonly); }
/** * Get a list of factories that match the given type. Only elements with a rank greater or equal * to minrank will be returned. The list of factories is returned by decreasing rank. * * @param type a {@link ElementFactoryListType} * @param minrank Minimum rank * @return a List of ElementFactory elements. */ public static List<ElementFactory> listGetElement(ElementFactoryListType type, Rank minrank) { GList glist = gst.gst_element_factory_list_get_elements(type.getValue(), minrank.getValue()); List<ElementFactory> list = new ArrayList<ElementFactory>(); GList next = glist; while (next != null) { if (next.data != null) { ElementFactory fact = new ElementFactory(initializer(next.data, true, true)); list.add(fact); } next = next.next(); } gst.gst_plugin_list_free(glist); return list; }
/** * Returns the top played card's value for a given suit. If no card has been played for that suit, * the return value is zero, otherwise the top {@link Rank#getValue() value} of the suit is * returned. * * @param suit a suit * @return the top value of the suit on the board */ public int getTopValue(Suit suit) { Objects.requireNonNull(suit); Rank topRank = topPlayedCards.get(suit); if (topRank == null) return 0; else return topRank.getValue(); }