@Test public void determineBoots() throws Exception { assertEquals(0.25d, LuceneDocumentAdapterUtils.determineBoots(10000, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(0.50d, LuceneDocumentAdapterUtils.determineBoots(1000, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(0.55d, LuceneDocumentAdapterUtils.determineBoots(950, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(0.65d, LuceneDocumentAdapterUtils.determineBoots(850, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(0.75d, LuceneDocumentAdapterUtils.determineBoots(750, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(0.85d, LuceneDocumentAdapterUtils.determineBoots(650, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(0.95d, LuceneDocumentAdapterUtils.determineBoots(550, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(1.00d, LuceneDocumentAdapterUtils.determineBoots(500, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(1.05d, LuceneDocumentAdapterUtils.determineBoots(450, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(1.15d, LuceneDocumentAdapterUtils.determineBoots(350, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(1.25d, LuceneDocumentAdapterUtils.determineBoots(250, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(1.35d, LuceneDocumentAdapterUtils.determineBoots(150, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(1.45d, LuceneDocumentAdapterUtils.determineBoots(50, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(1.50d, LuceneDocumentAdapterUtils.determineBoots(0, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(2.00d, LuceneDocumentAdapterUtils.determineBoots(-500, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(5.00d, LuceneDocumentAdapterUtils.determineBoots(-10000, 500, 1000, 0.25d, 5d), 0.01d); assertEquals(1.20d, LuceneDocumentAdapterUtils.determineBoots(-10, 0, 50, 0.25d, 5d), 0.01d); assertEquals(1.00d, LuceneDocumentAdapterUtils.determineBoots(0, 0, 50, 0.25d, 5d), 0.01d); assertEquals(0.90d, LuceneDocumentAdapterUtils.determineBoots(5, 0, 50, 0.25d, 5d), 0.01d); assertEquals(0.80d, LuceneDocumentAdapterUtils.determineBoots(10, 0, 50, 0.25d, 5d), 0.01d); assertEquals(0.50d, LuceneDocumentAdapterUtils.determineBoots(25, 0, 50, 0.25d, 5d), 0.01d); assertEquals(0.25d, LuceneDocumentAdapterUtils.determineBoots(50, 0, 50, 0.25d, 5d), 0.01d); assertEquals(0.25d, LuceneDocumentAdapterUtils.determineBoots(100, 0, 50, 0.25d, 5d), 0.01d); }
public static double determineBoots(final double rank, final double origin, final double step, final double min, final double max) { if (rank == origin) { return 1.0d; } final double calc = 1.0d + (origin - rank) / step; if (calc < min) { return min; } if (calc > max) { return max; } return calc; }
LuceneDocumentAdapterUtils { public static double determineBoots(final double rank, final double origin, final double step, final double min, final double max) { if (rank == origin) { return 1.0d; } final double calc = 1.0d + (origin - rank) / step; if (calc < min) { return min; } if (calc > max) { return max; } return calc; } }
LuceneDocumentAdapterUtils { public static double determineBoots(final double rank, final double origin, final double step, final double min, final double max) { if (rank == origin) { return 1.0d; } final double calc = 1.0d + (origin - rank) / step; if (calc < min) { return min; } if (calc > max) { return max; } return calc; } private  LuceneDocumentAdapterUtils(); }
LuceneDocumentAdapterUtils { public static double determineBoots(final double rank, final double origin, final double step, final double min, final double max) { if (rank == origin) { return 1.0d; } final double calc = 1.0d + (origin - rank) / step; if (calc < min) { return min; } if (calc > max) { return max; } return calc; } private  LuceneDocumentAdapterUtils(); static T readObjectDefaultField(final Document document, final Class<T> clazz); static T readObjectField(final Document document, final String name, final Class<T> clazz); static String readPkField(final Document document); static void addObjectDefaultField(final Document document, final Object object); static void addObjectField(final Document document, final String name, final Object object); static void addPkField(final Document document, Class clazz, final String value); static void addStoredField(final Document document, final String name, final String value); static void addStoredField(final Document document, final String name, final Double value); static void addStoredField(final Document document, final String name, final Float value); static void addStoredField(final Document document, final String name, final Long value); static void addSimpleField(final Document document, final String name, final String value); static void addSearchField(final Document document, final String name, final String value); static void addSearchI18nField(final Document document, final String lang, final String name, final String value); static void addSimpleFields(final Document document, final String name, final I18NModel model); static void addSearchFields(final Document document, final String name, final I18NModel model); static void addInstantField(final Document document,
                                       final String name,
                                       final Instant value,
                                       final boolean negativeNull); static void addNumericField(final Document document,
                                       final String name,
                                       final Long value,
                                       final boolean negativeNull); static void addBoostField(final Document document,
                                     final String name,
                                     final Double value); static void addSortField(final Document document, final String name, final String value); static void addSortFields(final Document document, final String name, final I18NModel model); static void addSortField(final Document document,
                                    final String name,
                                    final Instant value,
                                    final boolean negativeNull); static void addSortField(final Document document,
                                    final String name,
                                    final Long positiveValue,
                                    final boolean zeroNull); static void addStemField(final Document document, final String name, final String value); static void addStemFields(final Document document, final String name, final String ... values); static void addStemFields(final Document document, final String name, final I18NModel model); static void addSortableNumericField(final Document document,
                                               final String name,
                                               final String sortName,
                                               final String rangeName,
                                               final Long value,
                                               final boolean negativeNull); static void addFacetField(final Document document, final String name, final String value); static void addFacetField(final Document document, final String name, final String value, final I18NModel model); static void addFacetField(final Document document, final String name, final String value, final String displayValue); static void addFacetField(final Document document, final String name, final Long value); static double determineBoots(final double rank,
                                        final double origin,
                                        final double step,
                                        final double min,
                                        final double max); }
LuceneDocumentAdapterUtils { public static double determineBoots(final double rank, final double origin, final double step, final double min, final double max) { if (rank == origin) { return 1.0d; } final double calc = 1.0d + (origin - rank) / step; if (calc < min) { return min; } if (calc > max) { return max; } return calc; } private  LuceneDocumentAdapterUtils(); static T readObjectDefaultField(final Document document, final Class<T> clazz); static T readObjectField(final Document document, final String name, final Class<T> clazz); static String readPkField(final Document document); static void addObjectDefaultField(final Document document, final Object object); static void addObjectField(final Document document, final String name, final Object object); static void addPkField(final Document document, Class clazz, final String value); static void addStoredField(final Document document, final String name, final String value); static void addStoredField(final Document document, final String name, final Double value); static void addStoredField(final Document document, final String name, final Float value); static void addStoredField(final Document document, final String name, final Long value); static void addSimpleField(final Document document, final String name, final String value); static void addSearchField(final Document document, final String name, final String value); static void addSearchI18nField(final Document document, final String lang, final String name, final String value); static void addSimpleFields(final Document document, final String name, final I18NModel model); static void addSearchFields(final Document document, final String name, final I18NModel model); static void addInstantField(final Document document,
                                       final String name,
                                       final Instant value,
                                       final boolean negativeNull); static void addNumericField(final Document document,
                                       final String name,
                                       final Long value,
                                       final boolean negativeNull); static void addBoostField(final Document document,
                                     final String name,
                                     final Double value); static void addSortField(final Document document, final String name, final String value); static void addSortFields(final Document document, final String name, final I18NModel model); static void addSortField(final Document document,
                                    final String name,
                                    final Instant value,
                                    final boolean negativeNull); static void addSortField(final Document document,
                                    final String name,
                                    final Long positiveValue,
                                    final boolean zeroNull); static void addStemField(final Document document, final String name, final String value); static void addStemFields(final Document document, final String name, final String ... values); static void addStemFields(final Document document, final String name, final I18NModel model); static void addSortableNumericField(final Document document,
                                               final String name,
                                               final String sortName,
                                               final String rangeName,
                                               final Long value,
                                               final boolean negativeNull); static void addFacetField(final Document document, final String name, final String value); static void addFacetField(final Document document, final String name, final String value, final I18NModel model); static void addFacetField(final Document document, final String name, final String value, final String displayValue); static void addFacetField(final Document document, final String name, final Long value); static double determineBoots(final double rank,
                                        final double origin,
                                        final double step,
                                        final double min,
                                        final double max); static final int CHAR_THRESHOLD; static final FieldType TYPE_OBJECT; }