/** * Create a new AcceptsItems property with the supplied value and operator. * * @param value Item types to accept * @param operator Logical operator to apply when comparing with other * properties */ public AcceptsItems(Object value, Operator operator) { super(Coerce.toListOf(value, ItemType.class), operator); }
/** * Returns true if <em>other</em> is also an {@link AcceptsItems} property * and <b>any</b> item appearing in the other property's collection appears * in this property's collection. In formal terms, the method returns true * if the size of the intersection between the two item type collections is * greater than zero. */ @Override public boolean equals(Object obj) { if (!(obj instanceof InventoryProperty)) { return false; } InventoryProperty<?, ?> other = (InventoryProperty<?, ?>) obj; if (!other.getKey().equals(this.getKey())) { return false; } List<ItemType> otherTypes = Coerce.toListOf(other.getValue(), ItemType.class); for (ItemType t : this.value) { if (otherTypes.contains(t)) { return true; } } return false; }
/** * Create a new AcceptsItems property with the supplied value and operator. * * @param value Item types to accept * @param operator Logical operator to apply when comparing with other * properties */ public AcceptsItems(Object value, Operator operator) { super(Coerce.toListOf(value, ItemType.class), operator); }
/** * Returns true if <em>other</em> is also an {@link AcceptsItems} property * and <b>any</b> item appearing in the other property's collection appears * in this property's collection. In formal terms, the method returns true * if the size of the intersection between the two item type collections is * greater than zero. */ @Override public boolean equals(Object obj) { if (!(obj instanceof InventoryProperty)) { return false; } InventoryProperty<?, ?> other = (InventoryProperty<?, ?>) obj; if (!other.getKey().equals(this.getKey())) { return false; } List<ItemType> otherTypes = Coerce.toListOf(other.getValue(), ItemType.class); for (ItemType t : this.value) { if (otherTypes.contains(t)) { return true; } } return false; }