+ return Float.isNaN(f2) ? f1 : f2;
+ }
+ else
+ {
+ return Float.isNaN(f2) ? f1 : Math.min(f1, f2);
+ }
+ }
+
+ /**
+ * standard constructor
+ */
+ public FeatureStore()
+ {
+ this(INTERVAL_STORE_DEFAULT);
+ }
+
+ /**
+ * constructor for testing only
+ */
+ public FeatureStore(int intervalStoreType)
+ {
+ features =
+ // Platform.isJS()
+ // ? new intervalstore.nonc.IntervalStore<>(true)
+ // : new intervalstore.impl.IntervalStore<>();
+ getIntervalStore(intervalStoreType);
+ positionalFeatureGroups = new HashSet<>();
+ nonPositionalFeatureGroups = new HashSet<>();
+ positionalMinScore = Float.NaN;
+ positionalMaxScore = Float.NaN;
+ nonPositionalMinScore = Float.NaN;
+ nonPositionalMaxScore = Float.NaN;
+
+ // we only construct nonPositionalFeatures, contactFeatures if we need to
+ }
+
+ private IntervalStoreI<SequenceFeature> getIntervalStore(int type)
+ {
+ switch (type != INTERVAL_STORE_DEFAULT ? type : //
+ Platform.isJS() //
+ ? intervalStoreJSOption
+ : intervalStoreJavaOption)
+ {
+ default:
+ case INTERVAL_STORE_NCLIST_OBJECT:
+ return new intervalstore.impl.IntervalStore<>();
+ case INTERVAL_STORE_NCARRAY:
+ return new intervalstore.nonc.IntervalStoreImpl();
+ case INTERVAL_STORE_LINKED_LIST:
+ return new intervalstore.nonc.IntervalStore0Impl();