/** * Creates a new derived set from the specified storage set. * * @param storage the set which actually store the elements. * @param converter the converter from the type in the storage set to the type in the derived set. */ static <S,E> Set<E> create(final Set<S> storage, final ObjectConverter<S,E> converter) { final Set<FunctionProperty> properties = converter.properties(); if (properties.contains(FunctionProperty.INVERTIBLE)) { if (FunctionProperty.isBijective(properties)) { return new Bijective<>(storage, converter); } return new Invertible<>(storage, converter); } return new DerivedSet<>(storage, converter); }
/** * Creates a new derived set from the specified storage set. * * @param storage the set which actually store the elements. * @param converter the converter from the type in the storage set to the type in the derived set. */ static <S,E> Set<E> create(final Set<S> storage, final ObjectConverter<S,E> converter) { final Set<FunctionProperty> properties = converter.properties(); if (properties.contains(FunctionProperty.INVERTIBLE)) { if (FunctionProperty.isBijective(properties)) { return new Bijective<>(storage, converter); } return new Invertible<>(storage, converter); } return new DerivedSet<>(storage, converter); }