@Override public boolean isCompatible(Flavor flavor) { if (flavor.satisfies(requestedFlavor)) return true; return requestedFlavorCanBeAchievedByResizing(flavor); }
private static boolean hasReplacement(Collection<Flavor> flavors, Flavor flavor) { return flavors.stream() .filter(f -> !f.equals(flavor)) .anyMatch(f -> f.satisfies(flavor)); }
/** * Returns whether this flavor satisfies the requested flavor, either directly * (by being the same), or by directly or indirectly replacing it */ public boolean satisfies(Flavor flavor) { if (this.equals(flavor)) { return true; } if (this.retired) { return false; } for (Flavor replaces : replacesFlavors) if (replaces.satisfies(flavor)) return true; return false; }