target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void setWeightingMethod() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setWeightingMethod(WeightingMethod.RECOMMENDED); Assert.assertEquals(WeightingMethod.RECOMMENDED, routeSearchParameters.getWeightingMethod(), 0.0); }
public void setWeightingMethod(int weightingMethod) { this.weightingMethod = weightingMethod; }
RouteSearchParameters { public void setWeightingMethod(int weightingMethod) { this.weightingMethod = weightingMethod; } }
RouteSearchParameters { public void setWeightingMethod(int weightingMethod) { this.weightingMethod = weightingMethod; } }
RouteSearchParameters { public void setWeightingMethod(int weightingMethod) { this.weightingMethod = weightingMethod; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public void setWeightingMethod(int weightingMethod) { this.weightingMethod = weightingMethod; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void getAvoidAreas() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertArrayEquals(null, routeSearchParameters.getAvoidAreas()); }
public Polygon[] getAvoidAreas() { return avoidAreas; }
RouteSearchParameters { public Polygon[] getAvoidAreas() { return avoidAreas; } }
RouteSearchParameters { public Polygon[] getAvoidAreas() { return avoidAreas; } }
RouteSearchParameters { public Polygon[] getAvoidAreas() { return avoidAreas; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public Polygon[] getAvoidAreas() { return avoidAreas; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void setAvoidAreas() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidAreas(new Polygon[0]); Assert.assertArrayEquals(new Polygon[0], routeSearchParameters.getAvoidAreas()); }
public void setAvoidAreas(Polygon[] avoidAreas) { this.avoidAreas = avoidAreas; }
RouteSearchParameters { public void setAvoidAreas(Polygon[] avoidAreas) { this.avoidAreas = avoidAreas; } }
RouteSearchParameters { public void setAvoidAreas(Polygon[] avoidAreas) { this.avoidAreas = avoidAreas; } }
RouteSearchParameters { public void setAvoidAreas(Polygon[] avoidAreas) { this.avoidAreas = avoidAreas; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public void setAvoidAreas(Polygon[] avoidAreas) { this.avoidAreas = avoidAreas; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void hasAvoidAreas() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.hasAvoidAreas()); routeSearchParameters.setAvoidAreas(new Polygon[1]); Assert.assertTrue(routeSearchParameters.hasAvoidAreas()); }
public boolean hasAvoidAreas() { return avoidAreas != null && avoidAreas.length > 0; }
RouteSearchParameters { public boolean hasAvoidAreas() { return avoidAreas != null && avoidAreas.length > 0; } }
RouteSearchParameters { public boolean hasAvoidAreas() { return avoidAreas != null && avoidAreas.length > 0; } }
RouteSearchParameters { public boolean hasAvoidAreas() { return avoidAreas != null && avoidAreas.length > 0; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public boolean hasAvoidAreas() { return avoidAreas != null && avoidAreas.length > 0; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void getAvoidFeatureTypes() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertEquals(0, routeSearchParameters.getAvoidFeatureTypes()); }
public int getAvoidFeatureTypes() { return avoidFeaturesTypes; }
RouteSearchParameters { public int getAvoidFeatureTypes() { return avoidFeaturesTypes; } }
RouteSearchParameters { public int getAvoidFeatureTypes() { return avoidFeaturesTypes; } }
RouteSearchParameters { public int getAvoidFeatureTypes() { return avoidFeaturesTypes; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public int getAvoidFeatureTypes() { return avoidFeaturesTypes; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void setAvoidFeatureTypes() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidFeatureTypes(1); Assert.assertEquals(1, routeSearchParameters.getAvoidFeatureTypes()); }
public void setAvoidFeatureTypes(int avoidFeatures) { avoidFeaturesTypes = avoidFeatures; }
RouteSearchParameters { public void setAvoidFeatureTypes(int avoidFeatures) { avoidFeaturesTypes = avoidFeatures; } }
RouteSearchParameters { public void setAvoidFeatureTypes(int avoidFeatures) { avoidFeaturesTypes = avoidFeatures; } }
RouteSearchParameters { public void setAvoidFeatureTypes(int avoidFeatures) { avoidFeaturesTypes = avoidFeatures; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public void setAvoidFeatureTypes(int avoidFeatures) { avoidFeaturesTypes = avoidFeatures; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void TestIsSameCountry() { VirtualEdgeIteratorState ve1 = generateEdge(1); VirtualEdgeIteratorState ve2 = generateEdge(2); VirtualEdgeIteratorState ve3 = generateEdge(3); BordersExtractor be = new BordersExtractor(_graphstorage, new int[] {2, 4}); List<Integer> countries = new ArrayList<>(); countries.add(1); countries.add(2); assertFalse(be.isSameCountry(countries)); countries = new ArrayList<>(); countries.add(3); countries.add(4); assertTrue(be.isSameCountry(countries)); countries = new ArrayList<>(); countries.add(4); countries.add(5); assertFalse(be.isSameCountry(countries)); countries = new ArrayList<>(); countries.add(5); countries.add(6); assertTrue(be.isSameCountry(countries)); }
public boolean isSameCountry(List<Integer> edgeIds){ if(edgeIds.isEmpty()) return true; short country0 = storage.getEdgeValue(edgeIds.get(0), BordersGraphStorage.Property.START); short country1 = storage.getEdgeValue(edgeIds.get(0), BordersGraphStorage.Property.END); for(int edgeId : edgeIds) { short country2 = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.START); short country3 = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.END); if(country0 != country2 && country0 != country3 && country1 != country2 && country1 != country3) return false; } return true; }
BordersExtractor { public boolean isSameCountry(List<Integer> edgeIds){ if(edgeIds.isEmpty()) return true; short country0 = storage.getEdgeValue(edgeIds.get(0), BordersGraphStorage.Property.START); short country1 = storage.getEdgeValue(edgeIds.get(0), BordersGraphStorage.Property.END); for(int edgeId : edgeIds) { short country2 = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.START); short country3 = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.END); if(country0 != country2 && country0 != country3 && country1 != country2 && country1 != country3) return false; } return true; } }
BordersExtractor { public boolean isSameCountry(List<Integer> edgeIds){ if(edgeIds.isEmpty()) return true; short country0 = storage.getEdgeValue(edgeIds.get(0), BordersGraphStorage.Property.START); short country1 = storage.getEdgeValue(edgeIds.get(0), BordersGraphStorage.Property.END); for(int edgeId : edgeIds) { short country2 = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.START); short country3 = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.END); if(country0 != country2 && country0 != country3 && country1 != country2 && country1 != country3) return false; } return true; } BordersExtractor(BordersGraphStorage storage, int[] avoidCountries); }
BordersExtractor { public boolean isSameCountry(List<Integer> edgeIds){ if(edgeIds.isEmpty()) return true; short country0 = storage.getEdgeValue(edgeIds.get(0), BordersGraphStorage.Property.START); short country1 = storage.getEdgeValue(edgeIds.get(0), BordersGraphStorage.Property.END); for(int edgeId : edgeIds) { short country2 = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.START); short country3 = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.END); if(country0 != country2 && country0 != country3 && country1 != country2 && country1 != country3) return false; } return true; } BordersExtractor(BordersGraphStorage storage, int[] avoidCountries); int getValue(int edgeId); boolean isBorder(int edgeId); boolean isControlledBorder(int edgeId); boolean isOpenBorder(int edgeId); boolean restrictedCountry(int edgeId); boolean isSameCountry(List<Integer> edgeIds); }
BordersExtractor { public boolean isSameCountry(List<Integer> edgeIds){ if(edgeIds.isEmpty()) return true; short country0 = storage.getEdgeValue(edgeIds.get(0), BordersGraphStorage.Property.START); short country1 = storage.getEdgeValue(edgeIds.get(0), BordersGraphStorage.Property.END); for(int edgeId : edgeIds) { short country2 = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.START); short country3 = storage.getEdgeValue(edgeId, BordersGraphStorage.Property.END); if(country0 != country2 && country0 != country3 && country1 != country2 && country1 != country3) return false; } return true; } BordersExtractor(BordersGraphStorage storage, int[] avoidCountries); int getValue(int edgeId); boolean isBorder(int edgeId); boolean isControlledBorder(int edgeId); boolean isOpenBorder(int edgeId); boolean restrictedCountry(int edgeId); boolean isSameCountry(List<Integer> edgeIds); }
@Test public void hasAvoidFeatures() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.hasAvoidFeatures()); routeSearchParameters.setAvoidFeatureTypes(1); Assert.assertTrue(routeSearchParameters.hasAvoidFeatures()); }
public boolean hasAvoidFeatures() { return avoidFeaturesTypes > 0; }
RouteSearchParameters { public boolean hasAvoidFeatures() { return avoidFeaturesTypes > 0; } }
RouteSearchParameters { public boolean hasAvoidFeatures() { return avoidFeaturesTypes > 0; } }
RouteSearchParameters { public boolean hasAvoidFeatures() { return avoidFeaturesTypes > 0; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public boolean hasAvoidFeatures() { return avoidFeaturesTypes > 0; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void getAvoidCountries() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertNull(routeSearchParameters.getAvoidCountries()); }
public int[] getAvoidCountries() { return avoidCountries; }
RouteSearchParameters { public int[] getAvoidCountries() { return avoidCountries; } }
RouteSearchParameters { public int[] getAvoidCountries() { return avoidCountries; } }
RouteSearchParameters { public int[] getAvoidCountries() { return avoidCountries; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public int[] getAvoidCountries() { return avoidCountries; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void setAvoidCountries() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidCountries(new int[1]); Assert.assertArrayEquals(new int[1], routeSearchParameters.getAvoidCountries()); }
public void setAvoidCountries(int[] avoidCountries) { this.avoidCountries = avoidCountries; }
RouteSearchParameters { public void setAvoidCountries(int[] avoidCountries) { this.avoidCountries = avoidCountries; } }
RouteSearchParameters { public void setAvoidCountries(int[] avoidCountries) { this.avoidCountries = avoidCountries; } }
RouteSearchParameters { public void setAvoidCountries(int[] avoidCountries) { this.avoidCountries = avoidCountries; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public void setAvoidCountries(int[] avoidCountries) { this.avoidCountries = avoidCountries; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void hasAvoidCountries() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.hasAvoidCountries()); routeSearchParameters.setAvoidCountries(new int[1]); Assert.assertTrue(routeSearchParameters.hasAvoidCountries()); }
public boolean hasAvoidCountries() { return avoidCountries != null && avoidCountries.length > 0; }
RouteSearchParameters { public boolean hasAvoidCountries() { return avoidCountries != null && avoidCountries.length > 0; } }
RouteSearchParameters { public boolean hasAvoidCountries() { return avoidCountries != null && avoidCountries.length > 0; } }
RouteSearchParameters { public boolean hasAvoidCountries() { return avoidCountries != null && avoidCountries.length > 0; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public boolean hasAvoidCountries() { return avoidCountries != null && avoidCountries.length > 0; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void hasAvoidBorders() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.hasAvoidBorders()); routeSearchParameters.setAvoidBorders(BordersExtractor.Avoid.CONTROLLED); Assert.assertTrue(routeSearchParameters.hasAvoidBorders()); }
public boolean hasAvoidBorders() { return avoidBorders != BordersExtractor.Avoid.NONE; }
RouteSearchParameters { public boolean hasAvoidBorders() { return avoidBorders != BordersExtractor.Avoid.NONE; } }
RouteSearchParameters { public boolean hasAvoidBorders() { return avoidBorders != BordersExtractor.Avoid.NONE; } }
RouteSearchParameters { public boolean hasAvoidBorders() { return avoidBorders != BordersExtractor.Avoid.NONE; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public boolean hasAvoidBorders() { return avoidBorders != BordersExtractor.Avoid.NONE; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void setAvoidBorders() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidBorders(BordersExtractor.Avoid.CONTROLLED); Assert.assertEquals(BordersExtractor.Avoid.CONTROLLED, routeSearchParameters.getAvoidBorders()); }
public void setAvoidBorders(BordersExtractor.Avoid avoidBorders) { this.avoidBorders = avoidBorders; }
RouteSearchParameters { public void setAvoidBorders(BordersExtractor.Avoid avoidBorders) { this.avoidBorders = avoidBorders; } }
RouteSearchParameters { public void setAvoidBorders(BordersExtractor.Avoid avoidBorders) { this.avoidBorders = avoidBorders; } }
RouteSearchParameters { public void setAvoidBorders(BordersExtractor.Avoid avoidBorders) { this.avoidBorders = avoidBorders; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public void setAvoidBorders(BordersExtractor.Avoid avoidBorders) { this.avoidBorders = avoidBorders; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void getAvoidBorders() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertEquals(BordersExtractor.Avoid.NONE, routeSearchParameters.getAvoidBorders()); }
public BordersExtractor.Avoid getAvoidBorders() { return avoidBorders; }
RouteSearchParameters { public BordersExtractor.Avoid getAvoidBorders() { return avoidBorders; } }
RouteSearchParameters { public BordersExtractor.Avoid getAvoidBorders() { return avoidBorders; } }
RouteSearchParameters { public BordersExtractor.Avoid getAvoidBorders() { return avoidBorders; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public BordersExtractor.Avoid getAvoidBorders() { return avoidBorders; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void getConsiderTurnRestrictions() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.getConsiderTurnRestrictions()); }
public Boolean getConsiderTurnRestrictions() { return considerTurnRestrictions; }
RouteSearchParameters { public Boolean getConsiderTurnRestrictions() { return considerTurnRestrictions; } }
RouteSearchParameters { public Boolean getConsiderTurnRestrictions() { return considerTurnRestrictions; } }
RouteSearchParameters { public Boolean getConsiderTurnRestrictions() { return considerTurnRestrictions; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public Boolean getConsiderTurnRestrictions() { return considerTurnRestrictions; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void setConsiderTurnRestrictions() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setConsiderTurnRestrictions(true); Assert.assertTrue(routeSearchParameters.getConsiderTurnRestrictions()); }
public void setConsiderTurnRestrictions(Boolean considerTurnRestrictions) { this.considerTurnRestrictions = considerTurnRestrictions; }
RouteSearchParameters { public void setConsiderTurnRestrictions(Boolean considerTurnRestrictions) { this.considerTurnRestrictions = considerTurnRestrictions; } }
RouteSearchParameters { public void setConsiderTurnRestrictions(Boolean considerTurnRestrictions) { this.considerTurnRestrictions = considerTurnRestrictions; } }
RouteSearchParameters { public void setConsiderTurnRestrictions(Boolean considerTurnRestrictions) { this.considerTurnRestrictions = considerTurnRestrictions; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public void setConsiderTurnRestrictions(Boolean considerTurnRestrictions) { this.considerTurnRestrictions = considerTurnRestrictions; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void getVehicleType() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertEquals(HeavyVehicleAttributes.UNKNOWN, routeSearchParameters.getVehicleType()); }
public int getVehicleType() { return vehicleType; }
RouteSearchParameters { public int getVehicleType() { return vehicleType; } }
RouteSearchParameters { public int getVehicleType() { return vehicleType; } }
RouteSearchParameters { public int getVehicleType() { return vehicleType; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public int getVehicleType() { return vehicleType; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void longToByteArrayTest() { long value = 1234L; byte[] byteValue = EncodeUtils.longToByteArray(value); assertEquals(8, byteValue.length); assertEquals(-46, byteValue[7]); assertEquals(4, byteValue[6]); }
public static byte[] longToByteArray(long longValue) { ByteBuffer longToByteBuffer = ByteBuffer.allocate(Long.BYTES); longToByteBuffer.putLong(longValue); return longToByteBuffer.array(); }
EncodeUtils { public static byte[] longToByteArray(long longValue) { ByteBuffer longToByteBuffer = ByteBuffer.allocate(Long.BYTES); longToByteBuffer.putLong(longValue); return longToByteBuffer.array(); } }
EncodeUtils { public static byte[] longToByteArray(long longValue) { ByteBuffer longToByteBuffer = ByteBuffer.allocate(Long.BYTES); longToByteBuffer.putLong(longValue); return longToByteBuffer.array(); } private EncodeUtils(); }
EncodeUtils { public static byte[] longToByteArray(long longValue) { ByteBuffer longToByteBuffer = ByteBuffer.allocate(Long.BYTES); longToByteBuffer.putLong(longValue); return longToByteBuffer.array(); } private EncodeUtils(); static byte[] longToByteArray(long longValue); static long byteArrayToLong(byte[] byteArray); }
EncodeUtils { public static byte[] longToByteArray(long longValue) { ByteBuffer longToByteBuffer = ByteBuffer.allocate(Long.BYTES); longToByteBuffer.putLong(longValue); return longToByteBuffer.array(); } private EncodeUtils(); static byte[] longToByteArray(long longValue); static long byteArrayToLong(byte[] byteArray); }
@Test public void setVehicleType() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setVehicleType(HeavyVehicleAttributes.AGRICULTURE); Assert.assertEquals(HeavyVehicleAttributes.AGRICULTURE, routeSearchParameters.getVehicleType()); }
public void setVehicleType(int vehicleType) { this.vehicleType = vehicleType; }
RouteSearchParameters { public void setVehicleType(int vehicleType) { this.vehicleType = vehicleType; } }
RouteSearchParameters { public void setVehicleType(int vehicleType) { this.vehicleType = vehicleType; } }
RouteSearchParameters { public void setVehicleType(int vehicleType) { this.vehicleType = vehicleType; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public void setVehicleType(int vehicleType) { this.vehicleType = vehicleType; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void getOptions() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertNull(routeSearchParameters.getOptions()); }
public String getOptions() { return options; }
RouteSearchParameters { public String getOptions() { return options; } }
RouteSearchParameters { public String getOptions() { return options; } }
RouteSearchParameters { public String getOptions() { return options; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public String getOptions() { return options; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void hasParameters() throws Exception { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.hasParameters(routeSearchParameters.getClass())); routeSearchParameters.setProfileType(2); routeSearchParameters.setOptions("{\"profile_params\":{\"weightings\":{\"green\":{\"factor\":0.8}}}}"); Assert.assertTrue(routeSearchParameters.hasParameters(VehicleParameters.class)); }
public boolean hasParameters(Class<?> value) { if (profileParams == null) return false; return profileParams.getClass() == value; }
RouteSearchParameters { public boolean hasParameters(Class<?> value) { if (profileParams == null) return false; return profileParams.getClass() == value; } }
RouteSearchParameters { public boolean hasParameters(Class<?> value) { if (profileParams == null) return false; return profileParams.getClass() == value; } }
RouteSearchParameters { public boolean hasParameters(Class<?> value) { if (profileParams == null) return false; return profileParams.getClass() == value; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public boolean hasParameters(Class<?> value) { if (profileParams == null) return false; return profileParams.getClass() == value; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void getProfileParameters() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertNull(routeSearchParameters.getProfileParameters()); }
public ProfileParameters getProfileParameters() { return profileParams; }
RouteSearchParameters { public ProfileParameters getProfileParameters() { return profileParams; } }
RouteSearchParameters { public ProfileParameters getProfileParameters() { return profileParams; } }
RouteSearchParameters { public ProfileParameters getProfileParameters() { return profileParams; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public ProfileParameters getProfileParameters() { return profileParams; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void getFlexibleMode() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.getFlexibleMode()); }
public boolean getFlexibleMode() { return flexibleMode; }
RouteSearchParameters { public boolean getFlexibleMode() { return flexibleMode; } }
RouteSearchParameters { public boolean getFlexibleMode() { return flexibleMode; } }
RouteSearchParameters { public boolean getFlexibleMode() { return flexibleMode; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public boolean getFlexibleMode() { return flexibleMode; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void setFlexibleMode() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setFlexibleMode(true); Assert.assertTrue(routeSearchParameters.getFlexibleMode()); }
public void setFlexibleMode(boolean flexibleMode) { this.flexibleMode = flexibleMode; }
RouteSearchParameters { public void setFlexibleMode(boolean flexibleMode) { this.flexibleMode = flexibleMode; } }
RouteSearchParameters { public void setFlexibleMode(boolean flexibleMode) { this.flexibleMode = flexibleMode; } }
RouteSearchParameters { public void setFlexibleMode(boolean flexibleMode) { this.flexibleMode = flexibleMode; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public void setFlexibleMode(boolean flexibleMode) { this.flexibleMode = flexibleMode; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void getMaximumRadiuses() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertNull(routeSearchParameters.getMaximumRadiuses()); }
public double[] getMaximumRadiuses() { return maxRadiuses; }
RouteSearchParameters { public double[] getMaximumRadiuses() { return maxRadiuses; } }
RouteSearchParameters { public double[] getMaximumRadiuses() { return maxRadiuses; } }
RouteSearchParameters { public double[] getMaximumRadiuses() { return maxRadiuses; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public double[] getMaximumRadiuses() { return maxRadiuses; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void setMaximumRadiuses() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setMaximumRadiuses(new double[0]); Assert.assertNotNull(routeSearchParameters.getMaximumRadiuses()); Assert.assertSame(routeSearchParameters.getMaximumRadiuses().getClass(), double[].class); Assert.assertEquals(0, routeSearchParameters.getMaximumRadiuses().length); }
public void setMaximumRadiuses(double[] maxRadiuses) { this.maxRadiuses = maxRadiuses; }
RouteSearchParameters { public void setMaximumRadiuses(double[] maxRadiuses) { this.maxRadiuses = maxRadiuses; } }
RouteSearchParameters { public void setMaximumRadiuses(double[] maxRadiuses) { this.maxRadiuses = maxRadiuses; } }
RouteSearchParameters { public void setMaximumRadiuses(double[] maxRadiuses) { this.maxRadiuses = maxRadiuses; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public void setMaximumRadiuses(double[] maxRadiuses) { this.maxRadiuses = maxRadiuses; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void getBearings() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertNull(routeSearchParameters.getBearings()); }
public WayPointBearing[] getBearings() { return bearings; }
RouteSearchParameters { public WayPointBearing[] getBearings() { return bearings; } }
RouteSearchParameters { public WayPointBearing[] getBearings() { return bearings; } }
RouteSearchParameters { public WayPointBearing[] getBearings() { return bearings; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public WayPointBearing[] getBearings() { return bearings; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void setBearings() { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setBearings(new WayPointBearing[]{}); Assert.assertArrayEquals(new WayPointBearing[]{}, routeSearchParameters.getBearings()); }
public void setBearings(WayPointBearing[] bearings) { this.bearings = bearings; }
RouteSearchParameters { public void setBearings(WayPointBearing[] bearings) { this.bearings = bearings; } }
RouteSearchParameters { public void setBearings(WayPointBearing[] bearings) { this.bearings = bearings; } }
RouteSearchParameters { public void setBearings(WayPointBearing[] bearings) { this.bearings = bearings; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public void setBearings(WayPointBearing[] bearings) { this.bearings = bearings; } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void byteArrayToLongTest() { byte[] byteArr = {0,0,0,0,73,-106,2,-46}; long value = EncodeUtils.byteArrayToLong(byteArr); assertEquals(1234567890, value); byte[] byteArr2 = {-24,106,4,-97}; long value2 = EncodeUtils.byteArrayToLong(byteArr2); assertEquals(3899262111L, value2); byte[] byteArr3 = {124,0,0,12,-45,76,-8,-96,1}; long value3 = EncodeUtils.byteArrayToLong(byteArr3); assertEquals(14101668995073L, value3); }
public static long byteArrayToLong(byte[] byteArray) { ByteBuffer byteToLongBuffer = ByteBuffer.allocate(Long.BYTES); byte[] storageBytes = {0,0,0,0,0,0,0,0}; int differenceInSize = storageBytes.length - byteArray.length; for(int i = byteArray.length-1; i >= 0; i--) { if(differenceInSize + i >= 0) storageBytes[differenceInSize + i] = byteArray[i]; } byteToLongBuffer.put(storageBytes); byteToLongBuffer.flip(); return byteToLongBuffer.getLong(); }
EncodeUtils { public static long byteArrayToLong(byte[] byteArray) { ByteBuffer byteToLongBuffer = ByteBuffer.allocate(Long.BYTES); byte[] storageBytes = {0,0,0,0,0,0,0,0}; int differenceInSize = storageBytes.length - byteArray.length; for(int i = byteArray.length-1; i >= 0; i--) { if(differenceInSize + i >= 0) storageBytes[differenceInSize + i] = byteArray[i]; } byteToLongBuffer.put(storageBytes); byteToLongBuffer.flip(); return byteToLongBuffer.getLong(); } }
EncodeUtils { public static long byteArrayToLong(byte[] byteArray) { ByteBuffer byteToLongBuffer = ByteBuffer.allocate(Long.BYTES); byte[] storageBytes = {0,0,0,0,0,0,0,0}; int differenceInSize = storageBytes.length - byteArray.length; for(int i = byteArray.length-1; i >= 0; i--) { if(differenceInSize + i >= 0) storageBytes[differenceInSize + i] = byteArray[i]; } byteToLongBuffer.put(storageBytes); byteToLongBuffer.flip(); return byteToLongBuffer.getLong(); } private EncodeUtils(); }
EncodeUtils { public static long byteArrayToLong(byte[] byteArray) { ByteBuffer byteToLongBuffer = ByteBuffer.allocate(Long.BYTES); byte[] storageBytes = {0,0,0,0,0,0,0,0}; int differenceInSize = storageBytes.length - byteArray.length; for(int i = byteArray.length-1; i >= 0; i--) { if(differenceInSize + i >= 0) storageBytes[differenceInSize + i] = byteArray[i]; } byteToLongBuffer.put(storageBytes); byteToLongBuffer.flip(); return byteToLongBuffer.getLong(); } private EncodeUtils(); static byte[] longToByteArray(long longValue); static long byteArrayToLong(byte[] byteArray); }
EncodeUtils { public static long byteArrayToLong(byte[] byteArray) { ByteBuffer byteToLongBuffer = ByteBuffer.allocate(Long.BYTES); byte[] storageBytes = {0,0,0,0,0,0,0,0}; int differenceInSize = storageBytes.length - byteArray.length; for(int i = byteArray.length-1; i >= 0; i--) { if(differenceInSize + i >= 0) storageBytes[differenceInSize + i] = byteArray[i]; } byteToLongBuffer.put(storageBytes); byteToLongBuffer.flip(); return byteToLongBuffer.getLong(); } private EncodeUtils(); static byte[] longToByteArray(long longValue); static long byteArrayToLong(byte[] byteArray); }
@Test public void requiresDynamicPreprocessedWeights() throws Exception { RouteSearchParameters routeSearchParameters = new RouteSearchParameters(); Assert.assertFalse(routeSearchParameters.requiresDynamicPreprocessedWeights()); routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidAreas(new Polygon[1]); Assert.assertTrue("avoid areas", routeSearchParameters.requiresDynamicPreprocessedWeights()); routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidFeatureTypes(1); Assert.assertTrue("avoid features", routeSearchParameters.requiresDynamicPreprocessedWeights()); routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidBorders(BordersExtractor.Avoid.CONTROLLED); Assert.assertTrue("avoid borders", routeSearchParameters.requiresDynamicPreprocessedWeights()); routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setAvoidCountries(new int[1]); Assert.assertTrue("avoid countries", routeSearchParameters.requiresDynamicPreprocessedWeights()); routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setConsiderTurnRestrictions(true); Assert.assertTrue("turn restrictions", routeSearchParameters.requiresDynamicPreprocessedWeights()); routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setProfileType(RoutingProfileType.DRIVING_HGV); routeSearchParameters.setVehicleType(HeavyVehicleAttributes.HGV); Assert.assertTrue("heavy vehicle", routeSearchParameters.requiresDynamicPreprocessedWeights()); routeSearchParameters = new RouteSearchParameters(); routeSearchParameters.setProfileType(RoutingProfileType.DRIVING_HGV); routeSearchParameters.setOptions("{\"profile_params\":{\"weightings\":{\"green\":{\"factor\":0.8}}}}"); Assert.assertTrue("profile param", routeSearchParameters.requiresDynamicPreprocessedWeights()); }
public boolean requiresDynamicPreprocessedWeights() { return hasAvoidAreas() || hasAvoidFeatures() || hasAvoidBorders() || hasAvoidCountries() || getConsiderTurnRestrictions() || isProfileTypeHeavyVehicle() && getVehicleType() > 0 || isProfileTypeDriving() && hasParameters(VehicleParameters.class) || hasMaximumSpeed(); }
RouteSearchParameters { public boolean requiresDynamicPreprocessedWeights() { return hasAvoidAreas() || hasAvoidFeatures() || hasAvoidBorders() || hasAvoidCountries() || getConsiderTurnRestrictions() || isProfileTypeHeavyVehicle() && getVehicleType() > 0 || isProfileTypeDriving() && hasParameters(VehicleParameters.class) || hasMaximumSpeed(); } }
RouteSearchParameters { public boolean requiresDynamicPreprocessedWeights() { return hasAvoidAreas() || hasAvoidFeatures() || hasAvoidBorders() || hasAvoidCountries() || getConsiderTurnRestrictions() || isProfileTypeHeavyVehicle() && getVehicleType() > 0 || isProfileTypeDriving() && hasParameters(VehicleParameters.class) || hasMaximumSpeed(); } }
RouteSearchParameters { public boolean requiresDynamicPreprocessedWeights() { return hasAvoidAreas() || hasAvoidFeatures() || hasAvoidBorders() || hasAvoidCountries() || getConsiderTurnRestrictions() || isProfileTypeHeavyVehicle() && getVehicleType() > 0 || isProfileTypeDriving() && hasParameters(VehicleParameters.class) || hasMaximumSpeed(); } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); }
RouteSearchParameters { public boolean requiresDynamicPreprocessedWeights() { return hasAvoidAreas() || hasAvoidFeatures() || hasAvoidBorders() || hasAvoidCountries() || getConsiderTurnRestrictions() || isProfileTypeHeavyVehicle() && getVehicleType() > 0 || isProfileTypeDriving() && hasParameters(VehicleParameters.class) || hasMaximumSpeed(); } int getProfileType(); void setProfileType(int profileType); int getWeightingMethod(); void setWeightingMethod(int weightingMethod); Polygon[] getAvoidAreas(); void setAvoidAreas(Polygon[] avoidAreas); boolean hasAvoidAreas(); int getAvoidFeatureTypes(); void setAvoidFeatureTypes(int avoidFeatures); boolean hasAvoidFeatures(); int[] getAvoidCountries(); void setAvoidCountries(int[] avoidCountries); boolean hasAvoidCountries(); boolean hasAvoidBorders(); void setAvoidBorders(BordersExtractor.Avoid avoidBorders); BordersExtractor.Avoid getAvoidBorders(); Boolean getConsiderTurnRestrictions(); void setConsiderTurnRestrictions(Boolean considerTurnRestrictions); int getVehicleType(); void setVehicleType(int vehicleType); int getAlternativeRoutesCount(); void setAlternativeRoutesCount(int alternativeRoutesCount); double getAlternativeRoutesWeightFactor(); void setAlternativeRoutesWeightFactor(double alternativeRoutesWeightFactor); double getAlternativeRoutesShareFactor(); void setAlternativeRoutesShareFactor(double alternativeRoutesShareFactor); int getExtraInfo(); void setExtraInfo(int extraInfo); boolean getSuppressWarnings(); void setSuppressWarnings(boolean suppressWarnings); String getOptions(); void setOptions(String options); boolean hasParameters(Class<?> value); ProfileParameters getProfileParameters(); void setProfileParams(ProfileParameters profileParams); boolean getFlexibleMode(); void setFlexibleMode(boolean flexibleMode); boolean getOptimized(); void setOptimized(boolean optimized); double[] getMaximumRadiuses(); void setMaximumRadiuses(double[] maxRadiuses); WayPointBearing[] getBearings(); void setBearings(WayPointBearing[] bearings); boolean hasBearings(); void setRoundTripLength(float length); float getRoundTripLength(); void setRoundTripPoints(int points); int getRoundTripPoints(); void setRoundTripSeed(long seed); long getRoundTripSeed(); double getMaximumSpeed(); void setMaximumSpeed(double maximumSpeed); boolean hasMaximumSpeed(); boolean isProfileTypeDriving(); boolean isProfileTypeHeavyVehicle(); boolean requiresDynamicPreprocessedWeights(); boolean requiresFullyDynamicWeights(); static final String KEY_AVOID_COUNTRIES; static final String KEY_AVOID_BORDERS; static final String KEY_PROFILE_PARAMS; static final String KEY_AVOID_FEATURES; static final String KEY_AVOID_POLYGONS; static final String KEY_ALTERNATIVE_ROUTES_WEIGHT_FACTOR; static final String KEY_ALTERNATIVE_ROUTES_SHARE_FACTOR; }
@Test public void calculateBoundingBox() { BBox bbox3D = GeomUtility.calculateBoundingBox(pointList3D); BBox bbox2D = GeomUtility.calculateBoundingBox(pointList2D); BBox bbox_fallback = GeomUtility.calculateBoundingBox(emptyPointList); Assert.assertEquals(-35.507813,bbox3D.minLon, 0.000009); Assert.assertEquals(38.408203,bbox3D.maxLon, 0.0000009); Assert.assertEquals(-12.897489,bbox3D.minLat, 0.000009); Assert.assertEquals(50.958427,bbox3D.maxLat, 0.0000009); Assert.assertEquals(113.0,bbox3D.minEle, 0.09); Assert.assertEquals(409.0,bbox3D.maxEle, 0.09); Assert.assertEquals(-35.507813,bbox2D.minLon, 0.000009); Assert.assertEquals(38.408203,bbox2D.maxLon, 0.000009); Assert.assertEquals(-12.897489,bbox2D.minLat, 0.000009); Assert.assertEquals(50.958427,bbox2D.maxLat, 0.000009); Assert.assertEquals(0f,bbox_fallback.minLon, 0.000009); Assert.assertEquals(0f,bbox_fallback.maxLon, 0.000009); Assert.assertEquals(0f,bbox_fallback.minLat, 0.000009); Assert.assertEquals(0f,bbox_fallback.maxLat, 0.000009); }
public static BBox calculateBoundingBox(PointList pointList) { if (pointList == null || pointList.getSize() <= 0) { return new BBox(0, 0, 0, 0); } else { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for (int i = 0; i < pointList.getSize(); ++i) { minLon = Math.min(minLon, pointList.getLon(i)); maxLon = Math.max(maxLon, pointList.getLon(i)); minLat = Math.min(minLat, pointList.getLat(i)); maxLat = Math.max(maxLat, pointList.getLat(i)); if (pointList.is3D()) { minEle = Math.min(minEle, pointList.getEle(i)); maxEle = Math.max(maxEle, pointList.getEle(i)); } } if (pointList.is3D()) { return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); } else { return new BBox(minLon, maxLon, minLat, maxLat); } } }
GeomUtility { public static BBox calculateBoundingBox(PointList pointList) { if (pointList == null || pointList.getSize() <= 0) { return new BBox(0, 0, 0, 0); } else { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for (int i = 0; i < pointList.getSize(); ++i) { minLon = Math.min(minLon, pointList.getLon(i)); maxLon = Math.max(maxLon, pointList.getLon(i)); minLat = Math.min(minLat, pointList.getLat(i)); maxLat = Math.max(maxLat, pointList.getLat(i)); if (pointList.is3D()) { minEle = Math.min(minEle, pointList.getEle(i)); maxEle = Math.max(maxEle, pointList.getEle(i)); } } if (pointList.is3D()) { return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); } else { return new BBox(minLon, maxLon, minLat, maxLat); } } } }
GeomUtility { public static BBox calculateBoundingBox(PointList pointList) { if (pointList == null || pointList.getSize() <= 0) { return new BBox(0, 0, 0, 0); } else { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for (int i = 0; i < pointList.getSize(); ++i) { minLon = Math.min(minLon, pointList.getLon(i)); maxLon = Math.max(maxLon, pointList.getLon(i)); minLat = Math.min(minLat, pointList.getLat(i)); maxLat = Math.max(maxLat, pointList.getLat(i)); if (pointList.is3D()) { minEle = Math.min(minEle, pointList.getEle(i)); maxEle = Math.max(maxEle, pointList.getEle(i)); } } if (pointList.is3D()) { return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); } else { return new BBox(minLon, maxLon, minLat, maxLat); } } } private GeomUtility(); }
GeomUtility { public static BBox calculateBoundingBox(PointList pointList) { if (pointList == null || pointList.getSize() <= 0) { return new BBox(0, 0, 0, 0); } else { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for (int i = 0; i < pointList.getSize(); ++i) { minLon = Math.min(minLon, pointList.getLon(i)); maxLon = Math.max(maxLon, pointList.getLon(i)); minLat = Math.min(minLat, pointList.getLat(i)); maxLat = Math.max(maxLat, pointList.getLat(i)); if (pointList.is3D()) { minEle = Math.min(minEle, pointList.getEle(i)); maxEle = Math.max(maxEle, pointList.getEle(i)); } } if (pointList.is3D()) { return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); } else { return new BBox(minLon, maxLon, minLat, maxLat); } } } private GeomUtility(); static LineString createLinestring(Coordinate[] coords); static BBox calculateBoundingBox(PointList pointList); static BBox generateBoundingFromMultiple(BBox[] boundingBoxes); static double getLength(Geometry geom, boolean inMeters); static double metresToDegrees(double metres); static double getArea(Geometry geom, boolean inMeters); static double calculateMaxExtent(Geometry geom); }
GeomUtility { public static BBox calculateBoundingBox(PointList pointList) { if (pointList == null || pointList.getSize() <= 0) { return new BBox(0, 0, 0, 0); } else { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for (int i = 0; i < pointList.getSize(); ++i) { minLon = Math.min(minLon, pointList.getLon(i)); maxLon = Math.max(maxLon, pointList.getLon(i)); minLat = Math.min(minLat, pointList.getLat(i)); maxLat = Math.max(maxLat, pointList.getLat(i)); if (pointList.is3D()) { minEle = Math.min(minEle, pointList.getEle(i)); maxEle = Math.max(maxEle, pointList.getEle(i)); } } if (pointList.is3D()) { return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); } else { return new BBox(minLon, maxLon, minLat, maxLat); } } } private GeomUtility(); static LineString createLinestring(Coordinate[] coords); static BBox calculateBoundingBox(PointList pointList); static BBox generateBoundingFromMultiple(BBox[] boundingBoxes); static double getLength(Geometry geom, boolean inMeters); static double metresToDegrees(double metres); static double getArea(Geometry geom, boolean inMeters); static double calculateMaxExtent(Geometry geom); }
@Test public void generateBBoxFromMultiple() { BBox[] bboxes = { new BBox(1.5, 2.5, -1.5, 1.5, 10, 20), new BBox(2.6, 8.5, -0.5, 1.7, 5, 25) }; BBox bbox = GeomUtility.generateBoundingFromMultiple(bboxes); Assert.assertEquals(-1.5, bbox.minLat, 0); Assert.assertEquals(1.7, bbox.maxLat, 0); Assert.assertEquals(1.5, bbox.minLon, 0); Assert.assertEquals(8.5, bbox.maxLon, 0); Assert.assertEquals(5, bbox.minEle, 0); Assert.assertEquals(25, bbox.maxEle, 0); }
public static BBox generateBoundingFromMultiple(BBox[] boundingBoxes) { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for(BBox bbox : boundingBoxes) { minLon = Math.min(minLon, bbox.minLon); maxLon = Math.max(maxLon, bbox.maxLon); minLat = Math.min(minLat, bbox.minLat); maxLat = Math.max(maxLat, bbox.maxLat); if(!Double.isNaN(bbox.minEle)) minEle = Math.min(minEle, bbox.minEle); if(!Double.isNaN(bbox.maxEle)) maxEle = Math.max(maxEle, bbox.maxEle); } if(minEle != Double.MAX_VALUE && maxEle != Double.MAX_VALUE) return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); else return new BBox(minLon, maxLon, minLat, maxLat); }
GeomUtility { public static BBox generateBoundingFromMultiple(BBox[] boundingBoxes) { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for(BBox bbox : boundingBoxes) { minLon = Math.min(minLon, bbox.minLon); maxLon = Math.max(maxLon, bbox.maxLon); minLat = Math.min(minLat, bbox.minLat); maxLat = Math.max(maxLat, bbox.maxLat); if(!Double.isNaN(bbox.minEle)) minEle = Math.min(minEle, bbox.minEle); if(!Double.isNaN(bbox.maxEle)) maxEle = Math.max(maxEle, bbox.maxEle); } if(minEle != Double.MAX_VALUE && maxEle != Double.MAX_VALUE) return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); else return new BBox(minLon, maxLon, minLat, maxLat); } }
GeomUtility { public static BBox generateBoundingFromMultiple(BBox[] boundingBoxes) { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for(BBox bbox : boundingBoxes) { minLon = Math.min(minLon, bbox.minLon); maxLon = Math.max(maxLon, bbox.maxLon); minLat = Math.min(minLat, bbox.minLat); maxLat = Math.max(maxLat, bbox.maxLat); if(!Double.isNaN(bbox.minEle)) minEle = Math.min(minEle, bbox.minEle); if(!Double.isNaN(bbox.maxEle)) maxEle = Math.max(maxEle, bbox.maxEle); } if(minEle != Double.MAX_VALUE && maxEle != Double.MAX_VALUE) return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); else return new BBox(minLon, maxLon, minLat, maxLat); } private GeomUtility(); }
GeomUtility { public static BBox generateBoundingFromMultiple(BBox[] boundingBoxes) { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for(BBox bbox : boundingBoxes) { minLon = Math.min(minLon, bbox.minLon); maxLon = Math.max(maxLon, bbox.maxLon); minLat = Math.min(minLat, bbox.minLat); maxLat = Math.max(maxLat, bbox.maxLat); if(!Double.isNaN(bbox.minEle)) minEle = Math.min(minEle, bbox.minEle); if(!Double.isNaN(bbox.maxEle)) maxEle = Math.max(maxEle, bbox.maxEle); } if(minEle != Double.MAX_VALUE && maxEle != Double.MAX_VALUE) return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); else return new BBox(minLon, maxLon, minLat, maxLat); } private GeomUtility(); static LineString createLinestring(Coordinate[] coords); static BBox calculateBoundingBox(PointList pointList); static BBox generateBoundingFromMultiple(BBox[] boundingBoxes); static double getLength(Geometry geom, boolean inMeters); static double metresToDegrees(double metres); static double getArea(Geometry geom, boolean inMeters); static double calculateMaxExtent(Geometry geom); }
GeomUtility { public static BBox generateBoundingFromMultiple(BBox[] boundingBoxes) { double minLon = Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; double minLat = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double minEle = Double.MAX_VALUE; double maxEle = -Double.MAX_VALUE; for(BBox bbox : boundingBoxes) { minLon = Math.min(minLon, bbox.minLon); maxLon = Math.max(maxLon, bbox.maxLon); minLat = Math.min(minLat, bbox.minLat); maxLat = Math.max(maxLat, bbox.maxLat); if(!Double.isNaN(bbox.minEle)) minEle = Math.min(minEle, bbox.minEle); if(!Double.isNaN(bbox.maxEle)) maxEle = Math.max(maxEle, bbox.maxEle); } if(minEle != Double.MAX_VALUE && maxEle != Double.MAX_VALUE) return new BBox(minLon, maxLon, minLat, maxLat, minEle, maxEle); else return new BBox(minLon, maxLon, minLat, maxLat); } private GeomUtility(); static LineString createLinestring(Coordinate[] coords); static BBox calculateBoundingBox(PointList pointList); static BBox generateBoundingFromMultiple(BBox[] boundingBoxes); static double getLength(Geometry geom, boolean inMeters); static double metresToDegrees(double metres); static double getArea(Geometry geom, boolean inMeters); static double calculateMaxExtent(Geometry geom); }
@Test public void constructNegativeIsochroneBBoxTest() { BBox bbox = JsonIsochronesRequestProcessor.constructIsochroneBBox(negativeEnv); BBox expectedBBox = new BBox(-77.033874, -77.025082, -12.127332, -12.120505); Assert.assertTrue(bbox.isValid()); Assert.assertEquals(expectedBBox.maxLat, bbox.maxLat, 0.0); Assert.assertEquals(expectedBBox.maxLon, bbox.maxLon, 0.0); Assert.assertEquals(expectedBBox.minLat, bbox.minLat, 0.0); Assert.assertEquals(expectedBBox.minLon, bbox.minLon, 0.0); Assert.assertEquals(Double.NaN, bbox.minEle, 0.0); Assert.assertEquals(Double.NaN, bbox.maxEle, 0.0); }
public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; }
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; } }
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; } JsonIsochronesRequestProcessor(HttpServletRequest request); }
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; } JsonIsochronesRequestProcessor(HttpServletRequest request); @Override void process(HttpServletResponse response); static BBox constructIsochroneBBox(Envelope env); }
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; } JsonIsochronesRequestProcessor(HttpServletRequest request); @Override void process(HttpServletResponse response); static BBox constructIsochroneBBox(Envelope env); }
@Test public void constructPositiveIsochroneBBoxTest() { BBox bbox = JsonIsochronesRequestProcessor.constructIsochroneBBox(positiveEnv); BBox expectedBBox = new BBox(2.288033, 2.304801, 48.854886, 48.864247); Assert.assertTrue(bbox.isValid()); Assert.assertEquals(expectedBBox.maxLat, bbox.maxLat, 0.0); Assert.assertEquals(expectedBBox.maxLon, bbox.maxLon, 0.0); Assert.assertEquals(expectedBBox.minLat, bbox.minLat, 0.0); Assert.assertEquals(expectedBBox.minLon, bbox.minLon, 0.0); Assert.assertEquals(Double.NaN, bbox.minEle, 0.0); Assert.assertEquals(Double.NaN, bbox.maxEle, 0.0); }
public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; }
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; } }
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; } JsonIsochronesRequestProcessor(HttpServletRequest request); }
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; } JsonIsochronesRequestProcessor(HttpServletRequest request); @Override void process(HttpServletResponse response); static BBox constructIsochroneBBox(Envelope env); }
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; } JsonIsochronesRequestProcessor(HttpServletRequest request); @Override void process(HttpServletResponse response); static BBox constructIsochroneBBox(Envelope env); }
@Test public void constructMixedIsochroneBBoxTest() { BBox bbox = JsonIsochronesRequestProcessor.constructIsochroneBBox(mixedEnv); BBox expectedBBox = new BBox(18.395489, 18.409940, -33.909040, -33.897771); Assert.assertTrue(bbox.isValid()); Assert.assertEquals(expectedBBox.maxLat, bbox.maxLat, 0.0); Assert.assertEquals(expectedBBox.maxLon, bbox.maxLon, 0.0); Assert.assertEquals(expectedBBox.minLat, bbox.minLat, 0.0); Assert.assertEquals(expectedBBox.minLon, bbox.minLon, 0.0); Assert.assertEquals(Double.NaN, bbox.minEle, 0.0); Assert.assertEquals(Double.NaN, bbox.maxEle, 0.0); }
public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; }
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; } }
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; } JsonIsochronesRequestProcessor(HttpServletRequest request); }
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; } JsonIsochronesRequestProcessor(HttpServletRequest request); @Override void process(HttpServletResponse response); static BBox constructIsochroneBBox(Envelope env); }
JsonIsochronesRequestProcessor extends AbstractHttpRequestProcessor { public static BBox constructIsochroneBBox(Envelope env){ BBox bbox = new BBox(0,0,0,0); if (Double.isFinite(env.getMinX())) bbox.minLon = env.getMinX(); if (Double.isFinite(env.getMinY())) bbox.minLat = env.getMinY(); if (Double.isFinite(env.getMaxX())) bbox.maxLon = env.getMaxX(); if (Double.isFinite(env.getMaxY())) bbox.maxLat = env.getMaxY(); if (!bbox.isValid()) bbox = new BBox(0, 0, 0, 0); return bbox; } JsonIsochronesRequestProcessor(HttpServletRequest request); @Override void process(HttpServletResponse response); static BBox constructIsochroneBBox(Envelope env); }
@Test public void testGetSystemMessage() throws ParameterValueException { System.setProperty("ors_app_config", "target/test-classes/app.config.test"); RoutingRequest v1RouteRequest = new RoutingRequest(); Assert.assertEquals("This message would be sent with every request on API v1 from January 2020 until June 2050", SystemMessage.getSystemMessage(v1RouteRequest)); RouteRequest routeRequest = new RouteRequest(new Double[][] {new Double[] {1.0,1.0}, new Double[] {2.0,2.0}}); routeRequest.setProfile(APIEnums.Profile.CYCLING_REGULAR); routeRequest.setRoutePreference(APIEnums.RoutePreference.FASTEST); Assert.assertEquals("This message would be sent with every routing bike fastest request", SystemMessage.getSystemMessage(routeRequest)); IsochronesRequest isochronesRequest = new IsochronesRequest(); Assert.assertEquals("This message would be sent with every request for geojson response", SystemMessage.getSystemMessage(isochronesRequest)); MatrixRequest matrixRequest = new MatrixRequest(new ArrayList<>()); Assert.assertEquals("This message would be sent with every request", SystemMessage.getSystemMessage(matrixRequest)); Assert.assertEquals("This message would be sent with every request", SystemMessage.getSystemMessage(null)); Assert.assertEquals("This message would be sent with every request", SystemMessage.getSystemMessage("not a valid request parameter object")); }
public static String getSystemMessage(Object requestObj) { if (messages == null) { loadMessages(); } if (messages.isEmpty()) { return ""; } if (requestObj == null) { requestObj = ""; } RequestParams params = new RequestParams(); if (requestObj.getClass() == RoutingRequest.class) { extractParams((RoutingRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.matrix.MatrixRequest.class) { extractParams((org.heigit.ors.matrix.MatrixRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.isochrones.IsochroneRequest.class) { extractParams((org.heigit.ors.isochrones.IsochroneRequest)requestObj, params); } else if (requestObj.getClass() == RouteRequest.class) { extractParams((RouteRequest)requestObj, params); } else if (requestObj.getClass() == MatrixRequest.class) { extractParams((MatrixRequest)requestObj, params); } else if (requestObj.getClass() == IsochronesRequest.class) { extractParams((IsochronesRequest)requestObj, params); } return selectMessage(params); }
SystemMessage { public static String getSystemMessage(Object requestObj) { if (messages == null) { loadMessages(); } if (messages.isEmpty()) { return ""; } if (requestObj == null) { requestObj = ""; } RequestParams params = new RequestParams(); if (requestObj.getClass() == RoutingRequest.class) { extractParams((RoutingRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.matrix.MatrixRequest.class) { extractParams((org.heigit.ors.matrix.MatrixRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.isochrones.IsochroneRequest.class) { extractParams((org.heigit.ors.isochrones.IsochroneRequest)requestObj, params); } else if (requestObj.getClass() == RouteRequest.class) { extractParams((RouteRequest)requestObj, params); } else if (requestObj.getClass() == MatrixRequest.class) { extractParams((MatrixRequest)requestObj, params); } else if (requestObj.getClass() == IsochronesRequest.class) { extractParams((IsochronesRequest)requestObj, params); } return selectMessage(params); } }
SystemMessage { public static String getSystemMessage(Object requestObj) { if (messages == null) { loadMessages(); } if (messages.isEmpty()) { return ""; } if (requestObj == null) { requestObj = ""; } RequestParams params = new RequestParams(); if (requestObj.getClass() == RoutingRequest.class) { extractParams((RoutingRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.matrix.MatrixRequest.class) { extractParams((org.heigit.ors.matrix.MatrixRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.isochrones.IsochroneRequest.class) { extractParams((org.heigit.ors.isochrones.IsochroneRequest)requestObj, params); } else if (requestObj.getClass() == RouteRequest.class) { extractParams((RouteRequest)requestObj, params); } else if (requestObj.getClass() == MatrixRequest.class) { extractParams((MatrixRequest)requestObj, params); } else if (requestObj.getClass() == IsochronesRequest.class) { extractParams((IsochronesRequest)requestObj, params); } return selectMessage(params); } private SystemMessage(); }
SystemMessage { public static String getSystemMessage(Object requestObj) { if (messages == null) { loadMessages(); } if (messages.isEmpty()) { return ""; } if (requestObj == null) { requestObj = ""; } RequestParams params = new RequestParams(); if (requestObj.getClass() == RoutingRequest.class) { extractParams((RoutingRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.matrix.MatrixRequest.class) { extractParams((org.heigit.ors.matrix.MatrixRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.isochrones.IsochroneRequest.class) { extractParams((org.heigit.ors.isochrones.IsochroneRequest)requestObj, params); } else if (requestObj.getClass() == RouteRequest.class) { extractParams((RouteRequest)requestObj, params); } else if (requestObj.getClass() == MatrixRequest.class) { extractParams((MatrixRequest)requestObj, params); } else if (requestObj.getClass() == IsochronesRequest.class) { extractParams((IsochronesRequest)requestObj, params); } return selectMessage(params); } private SystemMessage(); static String getSystemMessage(Object requestObj); }
SystemMessage { public static String getSystemMessage(Object requestObj) { if (messages == null) { loadMessages(); } if (messages.isEmpty()) { return ""; } if (requestObj == null) { requestObj = ""; } RequestParams params = new RequestParams(); if (requestObj.getClass() == RoutingRequest.class) { extractParams((RoutingRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.matrix.MatrixRequest.class) { extractParams((org.heigit.ors.matrix.MatrixRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.isochrones.IsochroneRequest.class) { extractParams((org.heigit.ors.isochrones.IsochroneRequest)requestObj, params); } else if (requestObj.getClass() == RouteRequest.class) { extractParams((RouteRequest)requestObj, params); } else if (requestObj.getClass() == MatrixRequest.class) { extractParams((MatrixRequest)requestObj, params); } else if (requestObj.getClass() == IsochronesRequest.class) { extractParams((IsochronesRequest)requestObj, params); } return selectMessage(params); } private SystemMessage(); static String getSystemMessage(Object requestObj); }
@Test public void getResponseInformation() { Assert.assertEquals(MatrixResponseInfo.class, bareMatrixResponse.responseInformation.getClass()); Assert.assertNotNull(bareMatrixResponse.responseInformation); }
public MatrixResponseInfo getResponseInformation() { return responseInformation; }
MatrixResponse { public MatrixResponseInfo getResponseInformation() { return responseInformation; } }
MatrixResponse { public MatrixResponseInfo getResponseInformation() { return responseInformation; } MatrixResponse(MatrixResult result, MatrixRequest request); }
MatrixResponse { public MatrixResponseInfo getResponseInformation() { return responseInformation; } MatrixResponse(MatrixResult result, MatrixRequest request); MatrixResponseInfo getResponseInformation(); MatrixResult getMatrixResult(); MatrixRequest getMatrixRequest(); }
MatrixResponse { public MatrixResponseInfo getResponseInformation() { return responseInformation; } MatrixResponse(MatrixResult result, MatrixRequest request); MatrixResponseInfo getResponseInformation(); MatrixResult getMatrixResult(); MatrixRequest getMatrixRequest(); }
@Test public void constructDestinations() { List<JSON2DDestinations> json2DDestinations = jsonBasedIndividualMatrixResponse.constructDestinations(matrixResult); Assert.assertEquals(1, json2DDestinations.size()); Assert.assertEquals("foo", json2DDestinations.get(0).name); Assert.assertEquals(new Coordinate(8.681495, 49.41461, Double.NaN), json2DDestinations.get(0).location); Double[] location = json2DDestinations.get(0).getLocation(); Assert.assertEquals(2, location.length); Assert.assertEquals(0, location[0].compareTo(8.681495)); Assert.assertEquals(0, location[1].compareTo(49.41461)); }
List<JSON2DDestinations> constructDestinations(MatrixResult matrixResult) { List<JSON2DDestinations> destinations = new ArrayList<>(); for (ResolvedLocation location : matrixResult.getDestinations()) { if (location != null) destinations.add(new JSON2DDestinations(location, includeResolveLocations)); else destinations.add(null); } return destinations; }
JSONBasedIndividualMatrixResponse { List<JSON2DDestinations> constructDestinations(MatrixResult matrixResult) { List<JSON2DDestinations> destinations = new ArrayList<>(); for (ResolvedLocation location : matrixResult.getDestinations()) { if (location != null) destinations.add(new JSON2DDestinations(location, includeResolveLocations)); else destinations.add(null); } return destinations; } }
JSONBasedIndividualMatrixResponse { List<JSON2DDestinations> constructDestinations(MatrixResult matrixResult) { List<JSON2DDestinations> destinations = new ArrayList<>(); for (ResolvedLocation location : matrixResult.getDestinations()) { if (location != null) destinations.add(new JSON2DDestinations(location, includeResolveLocations)); else destinations.add(null); } return destinations; } JSONBasedIndividualMatrixResponse(MatrixRequest request); }
JSONBasedIndividualMatrixResponse { List<JSON2DDestinations> constructDestinations(MatrixResult matrixResult) { List<JSON2DDestinations> destinations = new ArrayList<>(); for (ResolvedLocation location : matrixResult.getDestinations()) { if (location != null) destinations.add(new JSON2DDestinations(location, includeResolveLocations)); else destinations.add(null); } return destinations; } JSONBasedIndividualMatrixResponse(MatrixRequest request); }
JSONBasedIndividualMatrixResponse { List<JSON2DDestinations> constructDestinations(MatrixResult matrixResult) { List<JSON2DDestinations> destinations = new ArrayList<>(); for (ResolvedLocation location : matrixResult.getDestinations()) { if (location != null) destinations.add(new JSON2DDestinations(location, includeResolveLocations)); else destinations.add(null); } return destinations; } JSONBasedIndividualMatrixResponse(MatrixRequest request); }
@Test public void constructSources() { List<JSON2DSources> json2DSources = jsonBasedIndividualMatrixResponse.constructSources(matrixResult); Assert.assertEquals(1, json2DSources.size()); Assert.assertEquals("foo", json2DSources.get(0).name); Assert.assertEquals(new Coordinate(8.681495, 49.41461, Double.NaN), json2DSources.get(0).location); Double[] location = json2DSources.get(0).getLocation(); Assert.assertEquals(2, location.length); Assert.assertEquals(0, location[0].compareTo(8.681495)); Assert.assertEquals(0, location[1].compareTo(49.41461)); }
List<JSON2DSources> constructSources(MatrixResult matrixResult) { List<JSON2DSources> sources = new ArrayList<>(); for (ResolvedLocation location : matrixResult.getSources()) { if (location != null) sources.add(new JSON2DSources(location, includeResolveLocations)); else sources.add(null); } return sources; }
JSONBasedIndividualMatrixResponse { List<JSON2DSources> constructSources(MatrixResult matrixResult) { List<JSON2DSources> sources = new ArrayList<>(); for (ResolvedLocation location : matrixResult.getSources()) { if (location != null) sources.add(new JSON2DSources(location, includeResolveLocations)); else sources.add(null); } return sources; } }
JSONBasedIndividualMatrixResponse { List<JSON2DSources> constructSources(MatrixResult matrixResult) { List<JSON2DSources> sources = new ArrayList<>(); for (ResolvedLocation location : matrixResult.getSources()) { if (location != null) sources.add(new JSON2DSources(location, includeResolveLocations)); else sources.add(null); } return sources; } JSONBasedIndividualMatrixResponse(MatrixRequest request); }
JSONBasedIndividualMatrixResponse { List<JSON2DSources> constructSources(MatrixResult matrixResult) { List<JSON2DSources> sources = new ArrayList<>(); for (ResolvedLocation location : matrixResult.getSources()) { if (location != null) sources.add(new JSON2DSources(location, includeResolveLocations)); else sources.add(null); } return sources; } JSONBasedIndividualMatrixResponse(MatrixRequest request); }
JSONBasedIndividualMatrixResponse { List<JSON2DSources> constructSources(MatrixResult matrixResult) { List<JSON2DSources> sources = new ArrayList<>(); for (ResolvedLocation location : matrixResult.getSources()) { if (location != null) sources.add(new JSON2DSources(location, includeResolveLocations)); else sources.add(null); } return sources; } JSONBasedIndividualMatrixResponse(MatrixRequest request); }
@Test public void TestAvoidAllBorders() { _searchParams.setAvoidBorders(BordersExtractor.Avoid.ALL); _searchParams.setAvoidCountries(new int[] {}); AvoidBordersEdgeFilter filter = new AvoidBordersEdgeFilter(_searchParams, _graphStorage); VirtualEdgeIteratorState ve1 = generateEdge(1); VirtualEdgeIteratorState ve2 = generateEdge(2); VirtualEdgeIteratorState ve3 = generateEdge(3); assertFalse(filter.accept(ve1)); assertFalse(filter.accept(ve2)); assertTrue(filter.accept(ve3)); }
@Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); }
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); } }
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); } AvoidBordersEdgeFilter(RouteSearchParameters searchParams, BordersGraphStorage extBorders); AvoidBordersEdgeFilter(RouteSearchParameters searchParams, GraphStorage graphStorage); }
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); } AvoidBordersEdgeFilter(RouteSearchParameters searchParams, BordersGraphStorage extBorders); AvoidBordersEdgeFilter(RouteSearchParameters searchParams, GraphStorage graphStorage); @Override final boolean accept(EdgeIteratorState iter); }
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); } AvoidBordersEdgeFilter(RouteSearchParameters searchParams, BordersGraphStorage extBorders); AvoidBordersEdgeFilter(RouteSearchParameters searchParams, GraphStorage graphStorage); @Override final boolean accept(EdgeIteratorState iter); }
@Test public void getMatrix() { JSONIndividualMatrixResponse durationMatrix = jsonMatrixDurationsResponse.getMatrix(); Assert.assertNotNull(durationMatrix.getDurations()); Assert.assertNull(durationMatrix.getDistances()); Assert.assertEquals(3, durationMatrix.getDestinations().size()); Assert.assertEquals(3, durationMatrix.getSources().size()); Assert.assertEquals(8.681495, durationMatrix.getSources().get(0).location.x, 0); Assert.assertEquals(49.41461, durationMatrix.getSources().get(0).location.y, 0); Assert.assertEquals(Double.NaN, durationMatrix.getSources().get(0).location.z, 0); Assert.assertNotNull(durationMatrix.getSources().get(0).name); Assert.assertEquals(0.0, durationMatrix.getSources().get(0).getSnappedDistance(), 0); JSONIndividualMatrixResponse distanceMatrix = jsonMatrixDistancesResponse.getMatrix(); Assert.assertNotNull(distanceMatrix.getDistances()); Assert.assertNull(distanceMatrix.getDurations()); Assert.assertEquals(3, distanceMatrix.getDestinations().size()); Assert.assertEquals(3, distanceMatrix.getSources().size()); Assert.assertEquals(8.681495, distanceMatrix.getSources().get(0).location.x, 0); Assert.assertEquals(49.41461, distanceMatrix.getSources().get(0).location.y, 0); Assert.assertEquals(Double.NaN, distanceMatrix.getSources().get(0).location.z, 0); Assert.assertNull(distanceMatrix.getSources().get(0).name); Assert.assertEquals(0.0, distanceMatrix.getSources().get(0).getSnappedDistance(), 0); JSONIndividualMatrixResponse combinedMatrix = jsonMatrixCombinedResponse.getMatrix(); Assert.assertNotNull(combinedMatrix.getDistances()); Assert.assertNotNull(combinedMatrix.getDurations()); Assert.assertEquals(3, combinedMatrix.getDestinations().size()); Assert.assertEquals(3, combinedMatrix.getSources().size()); Assert.assertEquals(8.681495, combinedMatrix.getSources().get(0).location.x, 0); Assert.assertEquals(49.41461, combinedMatrix.getSources().get(0).location.y, 0); Assert.assertEquals(Double.NaN, combinedMatrix.getSources().get(0).location.z, 0); Assert.assertNotNull(combinedMatrix.getSources().get(0).name); Assert.assertEquals(0.0, combinedMatrix.getSources().get(0).getSnappedDistance(), 0); }
@JsonProperty("matrix") @JsonUnwrapped public JSONIndividualMatrixResponse getMatrix() { return new JSONIndividualMatrixResponse(matrixResult, matrixRequest); }
JSONMatrixResponse extends MatrixResponse { @JsonProperty("matrix") @JsonUnwrapped public JSONIndividualMatrixResponse getMatrix() { return new JSONIndividualMatrixResponse(matrixResult, matrixRequest); } }
JSONMatrixResponse extends MatrixResponse { @JsonProperty("matrix") @JsonUnwrapped public JSONIndividualMatrixResponse getMatrix() { return new JSONIndividualMatrixResponse(matrixResult, matrixRequest); } JSONMatrixResponse(MatrixResult result, MatrixRequest request); }
JSONMatrixResponse extends MatrixResponse { @JsonProperty("matrix") @JsonUnwrapped public JSONIndividualMatrixResponse getMatrix() { return new JSONIndividualMatrixResponse(matrixResult, matrixRequest); } JSONMatrixResponse(MatrixResult result, MatrixRequest request); @JsonProperty("matrix") @JsonUnwrapped JSONIndividualMatrixResponse getMatrix(); @JsonProperty("metadata") @ApiModelProperty("Information about the service and request") MatrixResponseInfo getInfo(); }
JSONMatrixResponse extends MatrixResponse { @JsonProperty("matrix") @JsonUnwrapped public JSONIndividualMatrixResponse getMatrix() { return new JSONIndividualMatrixResponse(matrixResult, matrixRequest); } JSONMatrixResponse(MatrixResult result, MatrixRequest request); @JsonProperty("matrix") @JsonUnwrapped JSONIndividualMatrixResponse getMatrix(); @JsonProperty("metadata") @ApiModelProperty("Information about the service and request") MatrixResponseInfo getInfo(); }
@Test public void getInfo() { Assert.assertEquals(MatrixResponseInfo.class, jsonMatrixDurationsResponse.getInfo().getClass()); Assert.assertNotNull(jsonMatrixDurationsResponse.getInfo().getEngineInfo()); Assert.assertNotNull(jsonMatrixDurationsResponse.getInfo().getAttribution()); Assert.assertNotNull(jsonMatrixDurationsResponse.getInfo().getRequest()); Assert.assertNotNull(jsonMatrixDurationsResponse.getInfo().getService()); Assert.assertTrue(jsonMatrixDurationsResponse.getInfo().getTimeStamp() > 0); }
@JsonProperty("metadata") @ApiModelProperty("Information about the service and request") public MatrixResponseInfo getInfo() { return responseInformation; }
JSONMatrixResponse extends MatrixResponse { @JsonProperty("metadata") @ApiModelProperty("Information about the service and request") public MatrixResponseInfo getInfo() { return responseInformation; } }
JSONMatrixResponse extends MatrixResponse { @JsonProperty("metadata") @ApiModelProperty("Information about the service and request") public MatrixResponseInfo getInfo() { return responseInformation; } JSONMatrixResponse(MatrixResult result, MatrixRequest request); }
JSONMatrixResponse extends MatrixResponse { @JsonProperty("metadata") @ApiModelProperty("Information about the service and request") public MatrixResponseInfo getInfo() { return responseInformation; } JSONMatrixResponse(MatrixResult result, MatrixRequest request); @JsonProperty("matrix") @JsonUnwrapped JSONIndividualMatrixResponse getMatrix(); @JsonProperty("metadata") @ApiModelProperty("Information about the service and request") MatrixResponseInfo getInfo(); }
JSONMatrixResponse extends MatrixResponse { @JsonProperty("metadata") @ApiModelProperty("Information about the service and request") public MatrixResponseInfo getInfo() { return responseInformation; } JSONMatrixResponse(MatrixResult result, MatrixRequest request); @JsonProperty("matrix") @JsonUnwrapped JSONIndividualMatrixResponse getMatrix(); @JsonProperty("metadata") @ApiModelProperty("Information about the service and request") MatrixResponseInfo getInfo(); }
@Test public void getSnapped_distance() { Assert.assertEquals("foo", jsonLocationWithLocation.name); Assert.assertEquals(new Double(0.0), jsonLocationWithLocation.getSnappedDistance()); }
public Double getSnappedDistance() { return FormatUtility.roundToDecimals(snappedDistance, SNAPPED_DISTANCE_DECIMAL_PLACES); }
JSONLocation { public Double getSnappedDistance() { return FormatUtility.roundToDecimals(snappedDistance, SNAPPED_DISTANCE_DECIMAL_PLACES); } }
JSONLocation { public Double getSnappedDistance() { return FormatUtility.roundToDecimals(snappedDistance, SNAPPED_DISTANCE_DECIMAL_PLACES); } JSONLocation(ResolvedLocation location, boolean includeResolveLocations); }
JSONLocation { public Double getSnappedDistance() { return FormatUtility.roundToDecimals(snappedDistance, SNAPPED_DISTANCE_DECIMAL_PLACES); } JSONLocation(ResolvedLocation location, boolean includeResolveLocations); Double getSnappedDistance(); Double[] getLocation(); }
JSONLocation { public Double getSnappedDistance() { return FormatUtility.roundToDecimals(snappedDistance, SNAPPED_DISTANCE_DECIMAL_PLACES); } JSONLocation(ResolvedLocation location, boolean includeResolveLocations); Double getSnappedDistance(); Double[] getLocation(); }
@Test public void getLocation() { Assert.assertEquals(new Coordinate(8.681495, 49.41461, Double.NaN), jsonLocationWithLocation.location); Assert.assertArrayEquals(new Double[0], jsonLocationWithLocation.getLocation()); }
public Double[] getLocation() { return new Double[0]; }
JSONLocation { public Double[] getLocation() { return new Double[0]; } }
JSONLocation { public Double[] getLocation() { return new Double[0]; } JSONLocation(ResolvedLocation location, boolean includeResolveLocations); }
JSONLocation { public Double[] getLocation() { return new Double[0]; } JSONLocation(ResolvedLocation location, boolean includeResolveLocations); Double getSnappedDistance(); Double[] getLocation(); }
JSONLocation { public Double[] getLocation() { return new Double[0]; } JSONLocation(ResolvedLocation location, boolean includeResolveLocations); Double getSnappedDistance(); Double[] getLocation(); }
@Test public void getDistances() { Assert.assertNull(durationsMatrixResponse.getDistances()); Assert.assertArrayEquals(new Double[]{0.0, 1.0, 2.0}, distancesMatrixResponse.getDistances()[0]); Assert.assertArrayEquals(new Double[]{3.0,4.0,5.0}, combinedMatrixResponse.getDistances()[1]); }
public Double[][] getDistances() { return distances; }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public Double[][] getDistances() { return distances; } }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public Double[][] getDistances() { return distances; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public Double[][] getDistances() { return distances; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public Double[][] getDistances() { return distances; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
@Test public void setDistances() { distancesMatrixResponse.setDistances(new Double[][]{{1.0, 2.0, 3.0},{1.0, 2.0, 3.0},{1.0, 2.0, 3.0}}); Assert.assertEquals(3, distancesMatrixResponse.getDistances().length); Assert.assertArrayEquals(new Double[]{1.0, 2.0, 3.0}, distancesMatrixResponse.getDistances()[0]); Assert.assertNull(durationsMatrixResponse.getDistances()); }
public void setDistances(Double[][] distances) { this.distances = distances; }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDistances(Double[][] distances) { this.distances = distances; } }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDistances(Double[][] distances) { this.distances = distances; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDistances(Double[][] distances) { this.distances = distances; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDistances(Double[][] distances) { this.distances = distances; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
@Test public void getDurations() { Assert.assertEquals(3, durationsMatrixResponse.getDurations().length); Assert.assertArrayEquals(new Double[]{0.0, 1.0, 2.0}, durationsMatrixResponse.getDurations()[0]); Assert.assertNull(distancesMatrixResponse.getDurations()); Assert.assertArrayEquals(new Double[]{3.0,4.0,5.0}, combinedMatrixResponse.getDurations()[1]); }
public Double[][] getDurations() { return durations; }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public Double[][] getDurations() { return durations; } }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public Double[][] getDurations() { return durations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public Double[][] getDurations() { return durations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public Double[][] getDurations() { return durations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
@Test public void setDurations() { durationsMatrixResponse.setDurations(new Double[][]{{1.0, 2.0, 3.0},{1.0, 2.0, 3.0},{1.0, 2.0, 3.0}}); Assert.assertEquals(3, durationsMatrixResponse.getDurations().length); Assert.assertArrayEquals(new Double[]{1.0, 2.0, 3.0}, durationsMatrixResponse.getDurations()[0]); Assert.assertNull(distancesMatrixResponse.getDurations()); }
public void setDurations(Double[][] durations) { this.durations = durations; }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDurations(Double[][] durations) { this.durations = durations; } }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDurations(Double[][] durations) { this.durations = durations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDurations(Double[][] durations) { this.durations = durations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDurations(Double[][] durations) { this.durations = durations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
@Test public void getDestinations() { Assert.assertEquals(3, distancesMatrixResponse.getDestinations().size()); Assert.assertArrayEquals(new Double[]{8.681495, 49.41461}, distancesMatrixResponse.getDestinations().get(0).getLocation()); }
public List<JSON2DDestinations> getDestinations() { return destinations; }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public List<JSON2DDestinations> getDestinations() { return destinations; } }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public List<JSON2DDestinations> getDestinations() { return destinations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public List<JSON2DDestinations> getDestinations() { return destinations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public List<JSON2DDestinations> getDestinations() { return destinations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
@Test public void setDestinations() { Coordinate coordinate = new Coordinate(9.681495, 50.41461); ResolvedLocation resolvedLocation = new ResolvedLocation(coordinate, "foo", 0.0); List<JSON2DDestinations> json2DDestinations = new ArrayList<>(); JSON2DDestinations json2DDestination = new JSON2DDestinations(resolvedLocation, false); json2DDestinations.add(json2DDestination); durationsMatrixResponse.setDestinations(json2DDestinations); distancesMatrixResponse.setDestinations(json2DDestinations); Assert.assertEquals(1, durationsMatrixResponse.getDestinations().size()); Assert.assertArrayEquals(new Double[]{9.681495, 50.41461}, durationsMatrixResponse.getDestinations().get(0).getLocation()); Assert.assertEquals(1, distancesMatrixResponse.getDestinations().size()); Assert.assertArrayEquals(new Double[]{9.681495, 50.41461}, distancesMatrixResponse.getDestinations().get(0).getLocation()); }
public void setDestinations(List<JSON2DDestinations> destinations) { this.destinations = destinations; }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDestinations(List<JSON2DDestinations> destinations) { this.destinations = destinations; } }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDestinations(List<JSON2DDestinations> destinations) { this.destinations = destinations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDestinations(List<JSON2DDestinations> destinations) { this.destinations = destinations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setDestinations(List<JSON2DDestinations> destinations) { this.destinations = destinations; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
@Test public void TestAvoidControlledBorders() { _searchParams.setAvoidBorders(BordersExtractor.Avoid.CONTROLLED); _searchParams.setAvoidCountries(new int[] {}); AvoidBordersEdgeFilter filter = new AvoidBordersEdgeFilter(_searchParams, _graphStorage); VirtualEdgeIteratorState ve1 = generateEdge(1); VirtualEdgeIteratorState ve2 = generateEdge(2); VirtualEdgeIteratorState ve3 = generateEdge(3); assertFalse(filter.accept(ve1)); assertTrue(filter.accept(ve2)); assertTrue(filter.accept(ve3)); }
@Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); }
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); } }
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); } AvoidBordersEdgeFilter(RouteSearchParameters searchParams, BordersGraphStorage extBorders); AvoidBordersEdgeFilter(RouteSearchParameters searchParams, GraphStorage graphStorage); }
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); } AvoidBordersEdgeFilter(RouteSearchParameters searchParams, BordersGraphStorage extBorders); AvoidBordersEdgeFilter(RouteSearchParameters searchParams, GraphStorage graphStorage); @Override final boolean accept(EdgeIteratorState iter); }
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); } AvoidBordersEdgeFilter(RouteSearchParameters searchParams, BordersGraphStorage extBorders); AvoidBordersEdgeFilter(RouteSearchParameters searchParams, GraphStorage graphStorage); @Override final boolean accept(EdgeIteratorState iter); }
@Test public void getSources() { Assert.assertEquals(3, durationsMatrixResponse.getSources().size()); Assert.assertArrayEquals(new Double[]{8.681495, 49.41461}, durationsMatrixResponse.getSources().get(0).getLocation()); }
public List<JSON2DSources> getSources() { return sources; }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public List<JSON2DSources> getSources() { return sources; } }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public List<JSON2DSources> getSources() { return sources; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public List<JSON2DSources> getSources() { return sources; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public List<JSON2DSources> getSources() { return sources; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
@Test public void setSources() { Coordinate coordinate = new Coordinate(9.681495, 50.41461); ResolvedLocation resolvedLocation = new ResolvedLocation(coordinate, "foo", 0.0); List<JSON2DSources> json2DSources = new ArrayList<>(); JSON2DSources json2DSource = new JSON2DSources(resolvedLocation, false); json2DSources.add(json2DSource); durationsMatrixResponse.setSources(json2DSources); distancesMatrixResponse.setSources(json2DSources); Assert.assertEquals(1, durationsMatrixResponse.getSources().size()); Assert.assertArrayEquals(new Double[]{9.681495, 50.41461}, durationsMatrixResponse.getSources().get(0).getLocation()); Assert.assertEquals(1, distancesMatrixResponse.getSources().size()); Assert.assertArrayEquals(new Double[]{9.681495, 50.41461}, distancesMatrixResponse.getSources().get(0).getLocation()); }
public void setSources(List<JSON2DSources> sources) { this.sources = sources; }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setSources(List<JSON2DSources> sources) { this.sources = sources; } }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setSources(List<JSON2DSources> sources) { this.sources = sources; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setSources(List<JSON2DSources> sources) { this.sources = sources; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
JSONIndividualMatrixResponse extends JSONBasedIndividualMatrixResponse { public void setSources(List<JSON2DSources> sources) { this.sources = sources; } JSONIndividualMatrixResponse(MatrixResult result, MatrixRequest request); Double[][] getDurations(); List<JSON2DDestinations> getDestinations(); List<JSON2DSources> getSources(); Double[][] getDistances(); void setDistances(Double[][] distances); void setDurations(Double[][] durations); void setDestinations(List<JSON2DDestinations> destinations); void setSources(List<JSON2DSources> sources); }
@Test public void getLocation() { JSON2DDestinations json2DDestinationsWithLocation = new JSON2DDestinations(resolvedLocation, true); JSON2DDestinations json2DDestinationsWoLocation = new JSON2DDestinations(resolvedLocation, false); Assert.assertArrayEquals(new Double[]{8.681495, 49.41461}, json2DDestinationsWithLocation.getLocation()); Assert.assertArrayEquals(new Double[]{8.681495, 49.41461}, json2DDestinationsWoLocation.getLocation()); }
@Override public Double[] getLocation() { Double[] location2D = new Double[2]; location2D[0] = FormatUtility.roundToDecimals(location.x, COORDINATE_DECIMAL_PLACES); location2D[1] = FormatUtility.roundToDecimals(location.y, COORDINATE_DECIMAL_PLACES); return location2D; }
JSON2DDestinations extends JSONLocation { @Override public Double[] getLocation() { Double[] location2D = new Double[2]; location2D[0] = FormatUtility.roundToDecimals(location.x, COORDINATE_DECIMAL_PLACES); location2D[1] = FormatUtility.roundToDecimals(location.y, COORDINATE_DECIMAL_PLACES); return location2D; } }
JSON2DDestinations extends JSONLocation { @Override public Double[] getLocation() { Double[] location2D = new Double[2]; location2D[0] = FormatUtility.roundToDecimals(location.x, COORDINATE_DECIMAL_PLACES); location2D[1] = FormatUtility.roundToDecimals(location.y, COORDINATE_DECIMAL_PLACES); return location2D; } JSON2DDestinations(ResolvedLocation destination, boolean includeResolveLocations); }
JSON2DDestinations extends JSONLocation { @Override public Double[] getLocation() { Double[] location2D = new Double[2]; location2D[0] = FormatUtility.roundToDecimals(location.x, COORDINATE_DECIMAL_PLACES); location2D[1] = FormatUtility.roundToDecimals(location.y, COORDINATE_DECIMAL_PLACES); return location2D; } JSON2DDestinations(ResolvedLocation destination, boolean includeResolveLocations); @Override Double[] getLocation(); }
JSON2DDestinations extends JSONLocation { @Override public Double[] getLocation() { Double[] location2D = new Double[2]; location2D[0] = FormatUtility.roundToDecimals(location.x, COORDINATE_DECIMAL_PLACES); location2D[1] = FormatUtility.roundToDecimals(location.y, COORDINATE_DECIMAL_PLACES); return location2D; } JSON2DDestinations(ResolvedLocation destination, boolean includeResolveLocations); @Override Double[] getLocation(); }
@Test public void getLocation() { JSON2DSources json2DSourcesWithLocation = new JSON2DSources(resolvedLocation, true); JSON2DSources json2DSourcesWoLocation = new JSON2DSources(resolvedLocation, false); Assert.assertArrayEquals(new Double[]{8.681495, 49.41461}, json2DSourcesWithLocation.getLocation()); Assert.assertArrayEquals(new Double[]{8.681495, 49.41461}, json2DSourcesWoLocation.getLocation()); }
@Override public Double[] getLocation() { Double[] location2D = new Double[2]; location2D[0] = FormatUtility.roundToDecimals(location.x, COORDINATE_DECIMAL_PLACES); location2D[1] = FormatUtility.roundToDecimals(location.y, COORDINATE_DECIMAL_PLACES); return location2D; }
JSON2DSources extends JSONLocation { @Override public Double[] getLocation() { Double[] location2D = new Double[2]; location2D[0] = FormatUtility.roundToDecimals(location.x, COORDINATE_DECIMAL_PLACES); location2D[1] = FormatUtility.roundToDecimals(location.y, COORDINATE_DECIMAL_PLACES); return location2D; } }
JSON2DSources extends JSONLocation { @Override public Double[] getLocation() { Double[] location2D = new Double[2]; location2D[0] = FormatUtility.roundToDecimals(location.x, COORDINATE_DECIMAL_PLACES); location2D[1] = FormatUtility.roundToDecimals(location.y, COORDINATE_DECIMAL_PLACES); return location2D; } JSON2DSources(ResolvedLocation source, boolean includeResolveLocations); }
JSON2DSources extends JSONLocation { @Override public Double[] getLocation() { Double[] location2D = new Double[2]; location2D[0] = FormatUtility.roundToDecimals(location.x, COORDINATE_DECIMAL_PLACES); location2D[1] = FormatUtility.roundToDecimals(location.y, COORDINATE_DECIMAL_PLACES); return location2D; } JSON2DSources(ResolvedLocation source, boolean includeResolveLocations); @Override Double[] getLocation(); }
JSON2DSources extends JSONLocation { @Override public Double[] getLocation() { Double[] location2D = new Double[2]; location2D[0] = FormatUtility.roundToDecimals(location.x, COORDINATE_DECIMAL_PLACES); location2D[1] = FormatUtility.roundToDecimals(location.y, COORDINATE_DECIMAL_PLACES); return location2D; } JSON2DSources(ResolvedLocation source, boolean includeResolveLocations); @Override Double[] getLocation(); }
@Test public void getAttributionTest() { Assert.assertEquals(MatrixResponseInfo.class, responseInformation.getClass()); Assert.assertEquals(String.class, responseInformation.getAttribution().getClass()); }
public String getAttribution() { return attribution; }
MatrixResponseInfo { public String getAttribution() { return attribution; } }
MatrixResponseInfo { public String getAttribution() { return attribution; } MatrixResponseInfo(MatrixRequest request); }
MatrixResponseInfo { public String getAttribution() { return attribution; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); }
MatrixResponseInfo { public String getAttribution() { return attribution; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); }
@Test public void getServiceTest() { Assert.assertEquals("matrix", responseInformation.getService()); }
public String getService() { return service; }
MatrixResponseInfo { public String getService() { return service; } }
MatrixResponseInfo { public String getService() { return service; } MatrixResponseInfo(MatrixRequest request); }
MatrixResponseInfo { public String getService() { return service; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); }
MatrixResponseInfo { public String getService() { return service; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); }
@Test public void getTimeStampTest() { Assert.assertTrue(Long.toString(responseInformation.getTimeStamp()).length() > 0); }
public long getTimeStamp() { return timeStamp; }
MatrixResponseInfo { public long getTimeStamp() { return timeStamp; } }
MatrixResponseInfo { public long getTimeStamp() { return timeStamp; } MatrixResponseInfo(MatrixRequest request); }
MatrixResponseInfo { public long getTimeStamp() { return timeStamp; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); }
MatrixResponseInfo { public long getTimeStamp() { return timeStamp; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); }
@Test public void getRequestTest() { Assert.assertEquals(bareMatrixRequest, responseInformation.getRequest()); }
public MatrixRequest getRequest() { return request; }
MatrixResponseInfo { public MatrixRequest getRequest() { return request; } }
MatrixResponseInfo { public MatrixRequest getRequest() { return request; } MatrixResponseInfo(MatrixRequest request); }
MatrixResponseInfo { public MatrixRequest getRequest() { return request; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); }
MatrixResponseInfo { public MatrixRequest getRequest() { return request; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); }
@Test public void getEngineInfoTest() { Assert.assertNotNull(responseInformation.getEngineInfo()); }
public EngineInfo getEngineInfo() { return engineInfo; }
MatrixResponseInfo { public EngineInfo getEngineInfo() { return engineInfo; } }
MatrixResponseInfo { public EngineInfo getEngineInfo() { return engineInfo; } MatrixResponseInfo(MatrixRequest request); }
MatrixResponseInfo { public EngineInfo getEngineInfo() { return engineInfo; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); }
MatrixResponseInfo { public EngineInfo getEngineInfo() { return engineInfo; } MatrixResponseInfo(MatrixRequest request); void setGraphDate(String graphDate); String getAttribution(); String getOsmFileMD5Hash(); String getService(); long getTimeStamp(); MatrixRequest getRequest(); EngineInfo getEngineInfo(); }
@Test public void getResponseInformation() { }
public IsochronesResponseInfo getResponseInformation() { return responseInformation; }
IsochronesResponse { public IsochronesResponseInfo getResponseInformation() { return responseInformation; } }
IsochronesResponse { public IsochronesResponseInfo getResponseInformation() { return responseInformation; } IsochronesResponse(IsochronesRequest request); }
IsochronesResponse { public IsochronesResponseInfo getResponseInformation() { return responseInformation; } IsochronesResponse(IsochronesRequest request); IsochronesResponseInfo getResponseInformation(); BoundingBox getBbox(); }
IsochronesResponse { public IsochronesResponseInfo getResponseInformation() { return responseInformation; } IsochronesResponse(IsochronesRequest request); IsochronesResponseInfo getResponseInformation(); BoundingBox getBbox(); }
@Test public void TestAvoidNoBorders() { _searchParams.setAvoidBorders(BordersExtractor.Avoid.NONE); _searchParams.setAvoidCountries(new int[] {}); AvoidBordersEdgeFilter filter = new AvoidBordersEdgeFilter(_searchParams, _graphStorage); VirtualEdgeIteratorState ve1 = generateEdge(1); VirtualEdgeIteratorState ve2 = generateEdge(2); VirtualEdgeIteratorState ve3 = generateEdge(3); assertTrue(filter.accept(ve1)); assertTrue(filter.accept(ve2)); assertTrue(filter.accept(ve3)); }
@Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); }
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); } }
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); } AvoidBordersEdgeFilter(RouteSearchParameters searchParams, BordersGraphStorage extBorders); AvoidBordersEdgeFilter(RouteSearchParameters searchParams, GraphStorage graphStorage); }
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); } AvoidBordersEdgeFilter(RouteSearchParameters searchParams, BordersGraphStorage extBorders); AvoidBordersEdgeFilter(RouteSearchParameters searchParams, GraphStorage graphStorage); @Override final boolean accept(EdgeIteratorState iter); }
AvoidBordersEdgeFilter implements EdgeFilter { @Override public final boolean accept(EdgeIteratorState iter) { if (!isStorageBuilt) return true; if (avoidBorders != BordersExtractor.Avoid.NONE) { switch(avoidBorders) { case ALL: if(bordersExtractor.isBorder(iter.getEdge())) { return false; } break; case CONTROLLED: if(bordersExtractor.isControlledBorder(iter.getEdge())) { return false; } break; default: break; } } return !avoidCountries || !bordersExtractor.restrictedCountry(iter.getEdge()); } AvoidBordersEdgeFilter(RouteSearchParameters searchParams, BordersGraphStorage extBorders); AvoidBordersEdgeFilter(RouteSearchParameters searchParams, GraphStorage graphStorage); @Override final boolean accept(EdgeIteratorState iter); }
@Test public void resolve_orderByChild() { OrderByClause orderByClause = new OrderByClause(); orderByClause.setOrderByMode(OrderByMode.ORDER_BY_CHILD); orderByClause.setArgument("test_argument"); Query query = PowerMockito.mock(Query.class); ResolverQueryOrderBy resolver = new ResolverQueryOrderBy(); resolver.resolve(orderByClause, query); Mockito.verify(query, VerificationModeFactory.times(1)).orderByChild(Mockito.eq("test_argument")); }
@Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } @Override Query resolve(OrderByClause orderByClause, Query target); }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } @Override Query resolve(OrderByClause orderByClause, Query target); }
@Test public void signInWithToken() { Auth auth = new Auth(); Consumer consumer = Mockito.mock(Consumer.class); Mockito.when(task.isSuccessful()).thenReturn(true); Mockito.doReturn(task).when(firebaseAuth).signInWithCustomToken(Mockito.anyString()); auth.signInWithToken("token") .then(consumer); PowerMockito.verifyStatic(FirebaseAuth.class, VerificationModeFactory.times(2)); FirebaseAuth.getInstance(); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).signInWithCustomToken(Mockito.eq("token")); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).getCurrentUser(); Mockito.verify(task, VerificationModeFactory.times(1)).addOnCompleteListener(Mockito.any(OnCompleteListener.class)); Mockito.verify(consumer, VerificationModeFactory.times(1)).accept(Mockito.any(GdxFirebaseUser.class)); }
@Override public Promise<GdxFirebaseUser> signInWithToken(String token) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInWithCustomToken(token))); }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInWithToken(String token) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInWithCustomToken(token))); } }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInWithToken(String token) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInWithCustomToken(token))); } }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInWithToken(String token) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInWithCustomToken(token))); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInWithToken(String token) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInWithCustomToken(token))); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
@Test public void signInWithToken_fail() { Auth auth = new Auth(); BiConsumer biConsumer = Mockito.mock(BiConsumer.class); Mockito.when(task.isSuccessful()).thenReturn(false); Mockito.when(task.getException()).thenReturn(new Exception()); Mockito.doReturn(task).when(firebaseAuth).signInWithCustomToken(Mockito.anyString()); auth.signInWithToken("token") .fail(biConsumer); PowerMockito.verifyStatic(FirebaseAuth.class, VerificationModeFactory.times(1)); FirebaseAuth.getInstance(); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).signInWithCustomToken(Mockito.eq("token")); Mockito.verify(task, VerificationModeFactory.times(1)).addOnCompleteListener(Mockito.any(OnCompleteListener.class)); Mockito.verify(biConsumer, VerificationModeFactory.times(1)).accept(Mockito.nullable(String.class), Mockito.any(Exception.class)); }
@Override public Promise<GdxFirebaseUser> signInWithToken(String token) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInWithCustomToken(token))); }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInWithToken(String token) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInWithCustomToken(token))); } }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInWithToken(String token) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInWithCustomToken(token))); } }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInWithToken(String token) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInWithCustomToken(token))); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInWithToken(String token) { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInWithCustomToken(token))); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
@Test public void signInAnonymously() { Auth auth = new Auth(); Consumer consumer = Mockito.mock(Consumer.class); Mockito.when(task.isSuccessful()).thenReturn(true); Mockito.doReturn(task).when(firebaseAuth).signInAnonymously(); auth.signInAnonymously() .then(consumer); PowerMockito.verifyStatic(FirebaseAuth.class, VerificationModeFactory.times(2)); FirebaseAuth.getInstance(); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).signInAnonymously(); Mockito.verify(task, VerificationModeFactory.times(1)).addOnCompleteListener(Mockito.any(OnCompleteListener.class)); Mockito.verify(consumer, VerificationModeFactory.times(1)).accept(Mockito.any(GdxFirebaseUser.class)); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).getCurrentUser(); }
@Override public Promise<GdxFirebaseUser> signInAnonymously() { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInAnonymously())); }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInAnonymously() { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInAnonymously())); } }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInAnonymously() { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInAnonymously())); } }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInAnonymously() { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInAnonymously())); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInAnonymously() { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInAnonymously())); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
@Test public void signInAnonymously_fail() { Auth auth = new Auth(); BiConsumer biConsumer = Mockito.mock(BiConsumer.class); Mockito.when(task.isSuccessful()).thenReturn(false); Mockito.when(task.getException()).thenReturn(new Exception()); Mockito.doReturn(task).when(firebaseAuth).signInAnonymously(); auth.signInAnonymously() .fail(biConsumer); PowerMockito.verifyStatic(FirebaseAuth.class, VerificationModeFactory.times(1)); FirebaseAuth.getInstance(); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).signInAnonymously(); Mockito.verify(task, VerificationModeFactory.times(1)).addOnCompleteListener(Mockito.any(OnCompleteListener.class)); Mockito.verify(biConsumer, VerificationModeFactory.times(1)).accept(Mockito.nullable(String.class), Mockito.any(Exception.class)); }
@Override public Promise<GdxFirebaseUser> signInAnonymously() { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInAnonymously())); }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInAnonymously() { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInAnonymously())); } }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInAnonymously() { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInAnonymously())); } }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInAnonymously() { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInAnonymously())); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
Auth implements AuthDistribution { @Override public Promise<GdxFirebaseUser> signInAnonymously() { return FuturePromise.when(new AuthPromiseConsumer<>(FirebaseAuth.getInstance().signInAnonymously())); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
@Test public void signOut() { Auth auth = new Auth(); Consumer consumer = Mockito.mock(Consumer.class); auth.signOut().then(consumer); PowerMockito.verifyStatic(FirebaseAuth.class, VerificationModeFactory.times(1)); FirebaseAuth.getInstance(); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).signOut(); Mockito.verify(consumer, VerificationModeFactory.times(1)).accept(Mockito.any()); }
@Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); }
Auth implements AuthDistribution { @Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); } }
Auth implements AuthDistribution { @Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); } }
Auth implements AuthDistribution { @Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
Auth implements AuthDistribution { @Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
@Test public void signOut_fail() { Auth auth = new Auth(); BiConsumer biConsumer = Mockito.mock(BiConsumer.class); Mockito.doThrow(new RuntimeException()).when(firebaseAuth).signOut(); auth.signOut().fail(biConsumer); PowerMockito.verifyStatic(FirebaseAuth.class, VerificationModeFactory.times(1)); FirebaseAuth.getInstance(); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).signOut(); Mockito.verify(biConsumer, VerificationModeFactory.times(1)).accept(Mockito.nullable(String.class), Mockito.any(Exception.class)); }
@Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); }
Auth implements AuthDistribution { @Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); } }
Auth implements AuthDistribution { @Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); } }
Auth implements AuthDistribution { @Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
Auth implements AuthDistribution { @Override public Promise<Void> signOut() { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(FuturePromise<Void> promise) { try { FirebaseAuth.getInstance().signOut(); promise.doComplete(null); } catch (Exception e) { promise.doFail(e); } } }); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
@Test public void sendPasswordResetEmail() { Auth auth = new Auth(); Consumer consumer = Mockito.mock(Consumer.class); Mockito.when(task.isSuccessful()).thenReturn(true); Mockito.doReturn(task).when(firebaseAuth).sendPasswordResetEmail(Mockito.anyString()); String arg1 = "email"; auth.sendPasswordResetEmail(arg1).then(consumer); PowerMockito.verifyStatic(FirebaseAuth.class, VerificationModeFactory.times(1)); FirebaseAuth.getInstance(); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).sendPasswordResetEmail(Mockito.eq(arg1)); Mockito.verify(consumer, VerificationModeFactory.times(1)).accept(Mockito.any()); }
@Override public Promise<Void> sendPasswordResetEmail(final String email) { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(final FuturePromise<Void> promise) { FirebaseAuth.getInstance().sendPasswordResetEmail(email) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { promise.doComplete(null); } else { promise.doFail(task.getException()); } } }); } }); }
Auth implements AuthDistribution { @Override public Promise<Void> sendPasswordResetEmail(final String email) { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(final FuturePromise<Void> promise) { FirebaseAuth.getInstance().sendPasswordResetEmail(email) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { promise.doComplete(null); } else { promise.doFail(task.getException()); } } }); } }); } }
Auth implements AuthDistribution { @Override public Promise<Void> sendPasswordResetEmail(final String email) { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(final FuturePromise<Void> promise) { FirebaseAuth.getInstance().sendPasswordResetEmail(email) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { promise.doComplete(null); } else { promise.doFail(task.getException()); } } }); } }); } }
Auth implements AuthDistribution { @Override public Promise<Void> sendPasswordResetEmail(final String email) { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(final FuturePromise<Void> promise) { FirebaseAuth.getInstance().sendPasswordResetEmail(email) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { promise.doComplete(null); } else { promise.doFail(task.getException()); } } }); } }); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
Auth implements AuthDistribution { @Override public Promise<Void> sendPasswordResetEmail(final String email) { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(final FuturePromise<Void> promise) { FirebaseAuth.getInstance().sendPasswordResetEmail(email) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { promise.doComplete(null); } else { promise.doFail(task.getException()); } } }); } }); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
@Test public void sendPasswordResetEmail_fail() { Auth auth = new Auth(); BiConsumer biConsumer = Mockito.mock(BiConsumer.class); Mockito.when(task.isSuccessful()).thenReturn(false); Mockito.when(task.getException()).thenReturn(new Exception()); Mockito.doReturn(task).when(firebaseAuth).sendPasswordResetEmail(Mockito.anyString()); String arg1 = "email"; auth.sendPasswordResetEmail(arg1).fail(biConsumer); PowerMockito.verifyStatic(FirebaseAuth.class, VerificationModeFactory.times(1)); FirebaseAuth.getInstance(); Mockito.verify(firebaseAuth, VerificationModeFactory.times(1)).sendPasswordResetEmail(Mockito.eq(arg1)); Mockito.verify(biConsumer, VerificationModeFactory.times(1)).accept(Mockito.nullable(String.class), Mockito.any(Exception.class)); }
@Override public Promise<Void> sendPasswordResetEmail(final String email) { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(final FuturePromise<Void> promise) { FirebaseAuth.getInstance().sendPasswordResetEmail(email) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { promise.doComplete(null); } else { promise.doFail(task.getException()); } } }); } }); }
Auth implements AuthDistribution { @Override public Promise<Void> sendPasswordResetEmail(final String email) { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(final FuturePromise<Void> promise) { FirebaseAuth.getInstance().sendPasswordResetEmail(email) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { promise.doComplete(null); } else { promise.doFail(task.getException()); } } }); } }); } }
Auth implements AuthDistribution { @Override public Promise<Void> sendPasswordResetEmail(final String email) { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(final FuturePromise<Void> promise) { FirebaseAuth.getInstance().sendPasswordResetEmail(email) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { promise.doComplete(null); } else { promise.doFail(task.getException()); } } }); } }); } }
Auth implements AuthDistribution { @Override public Promise<Void> sendPasswordResetEmail(final String email) { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(final FuturePromise<Void> promise) { FirebaseAuth.getInstance().sendPasswordResetEmail(email) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { promise.doComplete(null); } else { promise.doFail(task.getException()); } } }); } }); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
Auth implements AuthDistribution { @Override public Promise<Void> sendPasswordResetEmail(final String email) { return FuturePromise.when(new Consumer<FuturePromise<Void>>() { @Override public void accept(final FuturePromise<Void> promise) { FirebaseAuth.getInstance().sendPasswordResetEmail(email) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { promise.doComplete(null); } else { promise.doFail(task.getException()); } } }); } }); } @Override GdxFirebaseUser getCurrentUser(); @Override Promise<GdxFirebaseUser> createUserWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithEmailAndPassword(String email, char[] password); @Override Promise<GdxFirebaseUser> signInWithToken(String token); @Override Promise<GdxFirebaseUser> signInAnonymously(); @Override Promise<Void> signOut(); @Override Promise<Void> sendPasswordResetEmail(final String email); }
@Test public void resolve_endAt() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.END_AT, query, "test"); Mockito.verify(query, VerificationModeFactory.times(1)).endAt(Mockito.eq("test")); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test public void resolve_endAt2() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.END_AT, query, 2.0); Mockito.verify(query, VerificationModeFactory.times(1)).endAt(Mockito.any(Double.class)); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test public void resolve_endAt3() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.END_AT, query, true); Mockito.verify(query, VerificationModeFactory.times(1)).endAt(Mockito.anyBoolean()); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test(expected = IllegalArgumentException.class) public void resolve_endAtWrongArgument() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.END_AT, query, 2); Assert.fail(); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test public void resolve_equalTo() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.EQUAL_TO, query, "test"); Mockito.verify(query, VerificationModeFactory.times(1)).equalTo(Mockito.eq("test")); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test public void resolve_equalTo2() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.EQUAL_TO, query, 10.0); Mockito.verify(query, VerificationModeFactory.times(1)).equalTo(Mockito.anyDouble()); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test public void resolve_equalTo3() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.EQUAL_TO, query, true); Mockito.verify(query, VerificationModeFactory.times(1)).equalTo(Mockito.anyBoolean()); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test(expected = IllegalArgumentException.class) public void resolve_equalToWrongArgument() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.EQUAL_TO, query, 10f); Assert.fail(); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test public void resolve_limitLast() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.LIMIT_LAST, query, 2); Mockito.verify(query, VerificationModeFactory.times(1)).limitToLast(Mockito.anyInt()); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test(expected = IllegalArgumentException.class) public void resolve_limitLastWrongArgument() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.LIMIT_LAST, query, "test"); Assert.fail(); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test(expected = IllegalArgumentException.class) public void resolve_orderByChild_withoutArgument() { OrderByClause orderByClause = new OrderByClause(); orderByClause.setOrderByMode(OrderByMode.ORDER_BY_CHILD); Query query = PowerMockito.mock(Query.class); ResolverQueryOrderBy resolver = new ResolverQueryOrderBy(); resolver.resolve(orderByClause, query); Mockito.verify(query, VerificationModeFactory.times(1)).orderByChild(Mockito.eq("test_argument")); }
@Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } @Override Query resolve(OrderByClause orderByClause, Query target); }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } @Override Query resolve(OrderByClause orderByClause, Query target); }
@Test public void resolve_startAt() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.START_AT, query, "test"); Mockito.verify(query, VerificationModeFactory.times(1)).startAt(Mockito.eq("test")); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test public void resolve_startAt2() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.START_AT, query, 10.0); Mockito.verify(query, VerificationModeFactory.times(1)).startAt(Mockito.anyDouble()); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test public void resolve_startAt3() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.START_AT, query, true); Mockito.verify(query, VerificationModeFactory.times(1)).startAt(Mockito.anyBoolean()); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test(expected = IllegalArgumentException.class) public void resolve_startAtWrongArgument() { ResolverQueryFilter resolver = new ResolverQueryFilter(); resolver.resolve(FilterType.START_AT, query, 10f); Assert.fail(); }
@Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
ResolverQueryFilter implements FilterResolver<Query, Query> { @Override public <V> Query resolve(FilterType filterType, Query target, V... filterArguments) { if (filterArguments.length == 0) throw new IllegalArgumentException(MISSING_FILTER_ARGUMENTS); switch (filterType) { case LIMIT_FIRST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToFirst((Integer) filterArguments[0]); case LIMIT_LAST: if (!(filterArguments[0] instanceof Integer)) throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE); return target.limitToLast((Integer) filterArguments[0]); case START_AT: if (filterArguments[0] instanceof Double) { return target.startAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.startAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.startAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case END_AT: if (filterArguments[0] instanceof Double) { return target.endAt((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.endAt((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.endAt((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } case EQUAL_TO: if (filterArguments[0] instanceof Double) { return target.equalTo((Double) filterArguments[0]); } else if (filterArguments[0] instanceof Boolean) { return target.equalTo((Boolean) filterArguments[0]); } else if (filterArguments[0] instanceof String) { return target.equalTo((String) filterArguments[0]); } else { throw new IllegalArgumentException(WRONG_ARGUMENT_TYPE2); } default: throw new IllegalStateException(); } } @Override Query resolve(FilterType filterType, Query target, V... filterArguments); }
@Test public void createFilterResolver() { ProviderQueryFiltering provider = new ProviderQueryFiltering(); Object result = provider.createFilterResolver(); Assert.assertNotNull(result); }
@Override public ResolverQueryFilter createFilterResolver() { return new ResolverQueryFilter(); }
ProviderQueryFiltering extends SortingFilteringProvider<Query, ResolverQueryFilter, ResolverQueryOrderBy> { @Override public ResolverQueryFilter createFilterResolver() { return new ResolverQueryFilter(); } }
ProviderQueryFiltering extends SortingFilteringProvider<Query, ResolverQueryFilter, ResolverQueryOrderBy> { @Override public ResolverQueryFilter createFilterResolver() { return new ResolverQueryFilter(); } }
ProviderQueryFiltering extends SortingFilteringProvider<Query, ResolverQueryFilter, ResolverQueryOrderBy> { @Override public ResolverQueryFilter createFilterResolver() { return new ResolverQueryFilter(); } @Override ResolverQueryFilter createFilterResolver(); @Override ResolverQueryOrderBy createOrderByResolver(); }
ProviderQueryFiltering extends SortingFilteringProvider<Query, ResolverQueryFilter, ResolverQueryOrderBy> { @Override public ResolverQueryFilter createFilterResolver() { return new ResolverQueryFilter(); } @Override ResolverQueryFilter createFilterResolver(); @Override ResolverQueryOrderBy createOrderByResolver(); }
@Test public void createOrderByResolver() { ProviderQueryFiltering provider = new ProviderQueryFiltering(); Object result = provider.createOrderByResolver(); Assert.assertNotNull(result); }
@Override public ResolverQueryOrderBy createOrderByResolver() { return new ResolverQueryOrderBy(); }
ProviderQueryFiltering extends SortingFilteringProvider<Query, ResolverQueryFilter, ResolverQueryOrderBy> { @Override public ResolverQueryOrderBy createOrderByResolver() { return new ResolverQueryOrderBy(); } }
ProviderQueryFiltering extends SortingFilteringProvider<Query, ResolverQueryFilter, ResolverQueryOrderBy> { @Override public ResolverQueryOrderBy createOrderByResolver() { return new ResolverQueryOrderBy(); } }
ProviderQueryFiltering extends SortingFilteringProvider<Query, ResolverQueryFilter, ResolverQueryOrderBy> { @Override public ResolverQueryOrderBy createOrderByResolver() { return new ResolverQueryOrderBy(); } @Override ResolverQueryFilter createFilterResolver(); @Override ResolverQueryOrderBy createOrderByResolver(); }
ProviderQueryFiltering extends SortingFilteringProvider<Query, ResolverQueryFilter, ResolverQueryOrderBy> { @Override public ResolverQueryOrderBy createOrderByResolver() { return new ResolverQueryOrderBy(); } @Override ResolverQueryFilter createFilterResolver(); @Override ResolverQueryOrderBy createOrderByResolver(); }
@Test public void onComplete_withoutError() { DatabaseError databaseError = null; DatabaseReference databaseReference = Mockito.mock(DatabaseReference.class); FuturePromise promise = Mockito.spy(FuturePromise.class); QueryCompletionListener listener = new QueryCompletionListener(promise); listener.onComplete(databaseError, databaseReference); Mockito.verify(promise, VerificationModeFactory.times(1)).doComplete(Mockito.any()); }
@Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } }
QueryCompletionListener implements DatabaseReference.CompletionListener { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } } }
QueryCompletionListener implements DatabaseReference.CompletionListener { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } } QueryCompletionListener(FuturePromise promise); }
QueryCompletionListener implements DatabaseReference.CompletionListener { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } } QueryCompletionListener(FuturePromise promise); @Override void onComplete(DatabaseError databaseError, DatabaseReference databaseReference); }
QueryCompletionListener implements DatabaseReference.CompletionListener { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } } QueryCompletionListener(FuturePromise promise); @Override void onComplete(DatabaseError databaseError, DatabaseReference databaseReference); }
@Test public void onComplete_error() { DatabaseError databaseError = Mockito.mock(DatabaseError.class); DatabaseReference databaseReference = Mockito.mock(DatabaseReference.class); FuturePromise promise = Mockito.spy(FuturePromise.class); promise.silentFail(); QueryCompletionListener listener = new QueryCompletionListener(promise); listener.onComplete(databaseError, databaseReference); Mockito.verify(promise, VerificationModeFactory.times(1)).doFail(Mockito.nullable(Exception.class)); }
@Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } }
QueryCompletionListener implements DatabaseReference.CompletionListener { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } } }
QueryCompletionListener implements DatabaseReference.CompletionListener { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } } QueryCompletionListener(FuturePromise promise); }
QueryCompletionListener implements DatabaseReference.CompletionListener { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } } QueryCompletionListener(FuturePromise promise); @Override void onComplete(DatabaseError databaseError, DatabaseReference databaseReference); }
QueryCompletionListener implements DatabaseReference.CompletionListener { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if (promise == null) return; if (databaseError != null) { promise.doFail(databaseError.toException()); } else { promise.doComplete(null); } } QueryCompletionListener(FuturePromise promise); @Override void onComplete(DatabaseError databaseError, DatabaseReference databaseReference); }
@Test public void resolve() { DataSnapshot dataSnapshot = Mockito.mock(DataSnapshot.class); DataSnapshot dataSnapshot2 = Mockito.mock(DataSnapshot.class); DataSnapshot dataSnapshot3 = Mockito.mock(DataSnapshot.class); ArrayList list = new ArrayList(); list.add(dataSnapshot2); list.add(dataSnapshot3); Mockito.when(dataSnapshot.getChildren()).thenReturn(list); Mockito.when(dataSnapshot.getValue()).thenReturn(list); List result = ResolverDataSnapshotList.resolve(dataSnapshot); Assert.assertEquals(2, result.size()); Mockito.verify(dataSnapshot2, VerificationModeFactory.times(1)).getValue(); Mockito.verify(dataSnapshot3, VerificationModeFactory.times(1)).getValue(); }
@SuppressWarnings("unchecked") static List resolve(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() == null) { throw new IllegalStateException(); } List result = new ArrayList<>(); Iterable<DataSnapshot> dataSnapshots; for (Object o : dataSnapshot.getChildren()) { if (o instanceof DataSnapshot) { result.add(((DataSnapshot) o).getValue()); } else { result.add(o); } } return result; }
ResolverDataSnapshotList { @SuppressWarnings("unchecked") static List resolve(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() == null) { throw new IllegalStateException(); } List result = new ArrayList<>(); Iterable<DataSnapshot> dataSnapshots; for (Object o : dataSnapshot.getChildren()) { if (o instanceof DataSnapshot) { result.add(((DataSnapshot) o).getValue()); } else { result.add(o); } } return result; } }
ResolverDataSnapshotList { @SuppressWarnings("unchecked") static List resolve(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() == null) { throw new IllegalStateException(); } List result = new ArrayList<>(); Iterable<DataSnapshot> dataSnapshots; for (Object o : dataSnapshot.getChildren()) { if (o instanceof DataSnapshot) { result.add(((DataSnapshot) o).getValue()); } else { result.add(o); } } return result; } private ResolverDataSnapshotList(); }
ResolverDataSnapshotList { @SuppressWarnings("unchecked") static List resolve(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() == null) { throw new IllegalStateException(); } List result = new ArrayList<>(); Iterable<DataSnapshot> dataSnapshots; for (Object o : dataSnapshot.getChildren()) { if (o instanceof DataSnapshot) { result.add(((DataSnapshot) o).getValue()); } else { result.add(o); } } return result; } private ResolverDataSnapshotList(); }
ResolverDataSnapshotList { @SuppressWarnings("unchecked") static List resolve(DataSnapshot dataSnapshot) { if (dataSnapshot.getValue() == null) { throw new IllegalStateException(); } List result = new ArrayList<>(); Iterable<DataSnapshot> dataSnapshots; for (Object o : dataSnapshot.getChildren()) { if (o instanceof DataSnapshot) { result.add(((DataSnapshot) o).getValue()); } else { result.add(o); } } return result; } private ResolverDataSnapshotList(); }
@Test public void shouldResolveOrderBy() { Class dataType = List.class; DataSnapshot dataSnapshot = Mockito.mock(DataSnapshot.class); Mockito.when(dataSnapshot.getChildrenCount()).thenReturn(1L); boolean should = ResolverDataSnapshotList.shouldResolveOrderBy(dataType, dataSnapshot); Assert.assertTrue(should); }
static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; }
ResolverDataSnapshotList { static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; } }
ResolverDataSnapshotList { static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; } private ResolverDataSnapshotList(); }
ResolverDataSnapshotList { static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; } private ResolverDataSnapshotList(); }
ResolverDataSnapshotList { static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; } private ResolverDataSnapshotList(); }
@Test public void resolve_orderByKey() { OrderByClause orderByClause = new OrderByClause(); orderByClause.setOrderByMode(OrderByMode.ORDER_BY_KEY); Query query = PowerMockito.mock(Query.class); ResolverQueryOrderBy resolver = new ResolverQueryOrderBy(); resolver.resolve(orderByClause, query); Mockito.verify(query, VerificationModeFactory.times(1)).orderByKey(); }
@Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } @Override Query resolve(OrderByClause orderByClause, Query target); }
ResolverQueryOrderBy implements OrderByResolver<Query, Query> { @Override public Query resolve(OrderByClause orderByClause, Query target) { switch (orderByClause.getOrderByMode()) { case ORDER_BY_CHILD: if (orderByClause.getArgument() == null) { throw new IllegalArgumentException(MISSING_ARGUMENT); } return target.orderByChild(orderByClause.getArgument()); case ORDER_BY_KEY: return target.orderByKey(); case ORDER_BY_VALUE: return target.orderByValue(); default: throw new IllegalStateException(); } } @Override Query resolve(OrderByClause orderByClause, Query target); }
@Test public void shouldResolveOrderBy3() { Class dataType = String.class; DataSnapshot dataSnapshot = Mockito.mock(DataSnapshot.class); Mockito.when(dataSnapshot.getChildrenCount()).thenReturn(1L); boolean should = ResolverDataSnapshotList.shouldResolveOrderBy(dataType, dataSnapshot); Assert.assertFalse(should); }
static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; }
ResolverDataSnapshotList { static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; } }
ResolverDataSnapshotList { static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; } private ResolverDataSnapshotList(); }
ResolverDataSnapshotList { static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; } private ResolverDataSnapshotList(); }
ResolverDataSnapshotList { static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; } private ResolverDataSnapshotList(); }
@Test public void shouldResolveOrderBy4() { Class dataType = String.class; DataSnapshot dataSnapshot = Mockito.mock(DataSnapshot.class); Mockito.when(dataSnapshot.getChildrenCount()).thenReturn(0L); boolean should = ResolverDataSnapshotList.shouldResolveOrderBy(dataType, dataSnapshot); Assert.assertFalse(should); }
static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; }
ResolverDataSnapshotList { static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; } }
ResolverDataSnapshotList { static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; } private ResolverDataSnapshotList(); }
ResolverDataSnapshotList { static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; } private ResolverDataSnapshotList(); }
ResolverDataSnapshotList { static boolean shouldResolveOrderBy(Class<?> dataType, DataSnapshot dataSnapshot) { return (ClassReflection.isAssignableFrom(List.class, dataType) || ClassReflection.isAssignableFrom(Map.class, dataType)) && dataSnapshot.getChildrenCount() > 0; } private ResolverDataSnapshotList(); }
@Test public void createArgumentsValidator() { Database databaseDistribution = Mockito.mock(Database.class); QueryOnDataChange queryOnDataChange = new QueryOnDataChange(databaseDistribution, "/test"); ArgumentsValidator argumentsValidator = queryOnDataChange.createArgumentsValidator(); Assert.assertNotNull(argumentsValidator); Assert.assertTrue(argumentsValidator instanceof OnDataValidator); }
@Override protected ArgumentsValidator createArgumentsValidator() { return new OnDataValidator(); }
QueryOnDataChange extends AndroidDatabaseQuery<R> { @Override protected ArgumentsValidator createArgumentsValidator() { return new OnDataValidator(); } }
QueryOnDataChange extends AndroidDatabaseQuery<R> { @Override protected ArgumentsValidator createArgumentsValidator() { return new OnDataValidator(); } QueryOnDataChange(Database databaseDistribution, String databasePath); }
QueryOnDataChange extends AndroidDatabaseQuery<R> { @Override protected ArgumentsValidator createArgumentsValidator() { return new OnDataValidator(); } QueryOnDataChange(Database databaseDistribution, String databasePath); }
QueryOnDataChange extends AndroidDatabaseQuery<R> { @Override protected ArgumentsValidator createArgumentsValidator() { return new OnDataValidator(); } QueryOnDataChange(Database databaseDistribution, String databasePath); }
@Test public void run() { final Database databaseDistribution = Mockito.spy(Database.class); final DatabaseReference databaseReference = Mockito.mock(DatabaseReference.class); Mockito.when(firebaseDatabase.getReference(Mockito.anyString())).thenReturn(databaseReference); Mockito.when(databaseDistribution.inReference(Mockito.anyString())).thenCallRealMethod(); final QueryOnDataChange queryOnDataChange = new QueryOnDataChange(databaseDistribution, "/test"); final ConverterPromise promise = Mockito.spy(ConverterPromise.class); databaseDistribution.inReference("/test"); queryOnDataChange.with(promise).withArgs(Map.class).execute(); Mockito.verify(databaseReference, VerificationModeFactory.times(1)).addValueEventListener(Mockito.any(ValueEventListener.class)); }
@Override @SuppressWarnings("unchecked") protected R run() { SnapshotValueListener dataChangeListener = new SnapshotValueListener((Class) arguments.get(0), (ConverterPromise) promise); filtersProvider.applyFiltering().addValueEventListener(dataChangeListener); ((FutureListenerPromise) promise).onCancel(new CancelListenerAction(dataChangeListener, query)); return null; }
QueryOnDataChange extends AndroidDatabaseQuery<R> { @Override @SuppressWarnings("unchecked") protected R run() { SnapshotValueListener dataChangeListener = new SnapshotValueListener((Class) arguments.get(0), (ConverterPromise) promise); filtersProvider.applyFiltering().addValueEventListener(dataChangeListener); ((FutureListenerPromise) promise).onCancel(new CancelListenerAction(dataChangeListener, query)); return null; } }
QueryOnDataChange extends AndroidDatabaseQuery<R> { @Override @SuppressWarnings("unchecked") protected R run() { SnapshotValueListener dataChangeListener = new SnapshotValueListener((Class) arguments.get(0), (ConverterPromise) promise); filtersProvider.applyFiltering().addValueEventListener(dataChangeListener); ((FutureListenerPromise) promise).onCancel(new CancelListenerAction(dataChangeListener, query)); return null; } QueryOnDataChange(Database databaseDistribution, String databasePath); }
QueryOnDataChange extends AndroidDatabaseQuery<R> { @Override @SuppressWarnings("unchecked") protected R run() { SnapshotValueListener dataChangeListener = new SnapshotValueListener((Class) arguments.get(0), (ConverterPromise) promise); filtersProvider.applyFiltering().addValueEventListener(dataChangeListener); ((FutureListenerPromise) promise).onCancel(new CancelListenerAction(dataChangeListener, query)); return null; } QueryOnDataChange(Database databaseDistribution, String databasePath); }
QueryOnDataChange extends AndroidDatabaseQuery<R> { @Override @SuppressWarnings("unchecked") protected R run() { SnapshotValueListener dataChangeListener = new SnapshotValueListener((Class) arguments.get(0), (ConverterPromise) promise); filtersProvider.applyFiltering().addValueEventListener(dataChangeListener); ((FutureListenerPromise) promise).onCancel(new CancelListenerAction(dataChangeListener, query)); return null; } QueryOnDataChange(Database databaseDistribution, String databasePath); }
@Test public void onConnect() throws Exception { PowerMockito.mockStatic(QueryConnectionStatus.class); Database database = new Database(); QueryConnectionStatus query = Mockito.spy(new QueryConnectionStatus(database, "/test")); PowerMockito.whenNew(QueryConnectionStatus.class).withAnyArguments().thenReturn(query); when(query.withArgs(Mockito.any())).thenReturn(query); database.onConnect().subscribe(); PowerMockito.verifyNew(QueryConnectionStatus.class); }
@Override public ListenerPromise<ConnectionStatus> onConnect() { return FutureListenerPromise.whenListener(new Consumer<FutureListenerPromise<ConnectionStatus>>() { @Override public void accept(FutureListenerPromise<ConnectionStatus> promise) { new QueryConnectionStatus(Database.this, getDatabasePath()) .with(promise) .execute(); } }); }
Database implements DatabaseDistribution, QueryProvider { @Override public ListenerPromise<ConnectionStatus> onConnect() { return FutureListenerPromise.whenListener(new Consumer<FutureListenerPromise<ConnectionStatus>>() { @Override public void accept(FutureListenerPromise<ConnectionStatus> promise) { new QueryConnectionStatus(Database.this, getDatabasePath()) .with(promise) .execute(); } }); } }
Database implements DatabaseDistribution, QueryProvider { @Override public ListenerPromise<ConnectionStatus> onConnect() { return FutureListenerPromise.whenListener(new Consumer<FutureListenerPromise<ConnectionStatus>>() { @Override public void accept(FutureListenerPromise<ConnectionStatus> promise) { new QueryConnectionStatus(Database.this, getDatabasePath()) .with(promise) .execute(); } }); } Database(); }
Database implements DatabaseDistribution, QueryProvider { @Override public ListenerPromise<ConnectionStatus> onConnect() { return FutureListenerPromise.whenListener(new Consumer<FutureListenerPromise<ConnectionStatus>>() { @Override public void accept(FutureListenerPromise<ConnectionStatus> promise) { new QueryConnectionStatus(Database.this, getDatabasePath()) .with(promise) .execute(); } }); } Database(); @Override ListenerPromise<ConnectionStatus> onConnect(); @Override DatabaseDistribution inReference(String databasePath); @Override Promise<Void> setValue(final Object value); @Override @SuppressWarnings("unchecked") Promise<E> readValue(final Class<T> dataType); @Override @SuppressWarnings("unchecked") ListenerPromise<R> onDataChange(final Class<T> dataType); @Override ListenerPromise<R> onChildChange(final Class<T> dataType, final ChildEventType... eventsType); @Override @SuppressWarnings("unchecked") DatabaseDistribution filter(FilterType filterType, V... filterArguments); @Override DatabaseDistribution orderBy(OrderByMode orderByMode, String argument); @Override DatabaseDistribution orderBy(OrderByMode orderByMode); @Override DatabaseDistribution push(); @Override Promise<Void> removeValue(); @Override Promise<Void> updateChildren(final Map<String, Object> data); @Override @SuppressWarnings("unchecked") Promise<Void> transaction(final Class<T> dataType, final Function<R, R> transaction); @Override void setPersistenceEnabled(boolean enabled); @Override void keepSynced(boolean synced); @Override String getReferencePath(); @Override Array<Filter> getFilters(); @Override OrderByClause getOrderByClause(); @Override void terminateOperation(); }
Database implements DatabaseDistribution, QueryProvider { @Override public ListenerPromise<ConnectionStatus> onConnect() { return FutureListenerPromise.whenListener(new Consumer<FutureListenerPromise<ConnectionStatus>>() { @Override public void accept(FutureListenerPromise<ConnectionStatus> promise) { new QueryConnectionStatus(Database.this, getDatabasePath()) .with(promise) .execute(); } }); } Database(); @Override ListenerPromise<ConnectionStatus> onConnect(); @Override DatabaseDistribution inReference(String databasePath); @Override Promise<Void> setValue(final Object value); @Override @SuppressWarnings("unchecked") Promise<E> readValue(final Class<T> dataType); @Override @SuppressWarnings("unchecked") ListenerPromise<R> onDataChange(final Class<T> dataType); @Override ListenerPromise<R> onChildChange(final Class<T> dataType, final ChildEventType... eventsType); @Override @SuppressWarnings("unchecked") DatabaseDistribution filter(FilterType filterType, V... filterArguments); @Override DatabaseDistribution orderBy(OrderByMode orderByMode, String argument); @Override DatabaseDistribution orderBy(OrderByMode orderByMode); @Override DatabaseDistribution push(); @Override Promise<Void> removeValue(); @Override Promise<Void> updateChildren(final Map<String, Object> data); @Override @SuppressWarnings("unchecked") Promise<Void> transaction(final Class<T> dataType, final Function<R, R> transaction); @Override void setPersistenceEnabled(boolean enabled); @Override void keepSynced(boolean synced); @Override String getReferencePath(); @Override Array<Filter> getFilters(); @Override OrderByClause getOrderByClause(); @Override void terminateOperation(); }
@Test public void inReference() { Database database = Mockito.spy(new Database()); database.inReference("test"); DatabaseReference reference = Whitebox.getInternalState(database, "databaseReference"); String path = Whitebox.getInternalState(database, "databasePath"); Assert.assertEquals("test", path); Assert.assertNotNull(reference); }
@Override public DatabaseDistribution inReference(String databasePath) { databaseReference = FirebaseDatabase.getInstance().getReference(databasePath); this.databasePath = databasePath; return this; }
Database implements DatabaseDistribution, QueryProvider { @Override public DatabaseDistribution inReference(String databasePath) { databaseReference = FirebaseDatabase.getInstance().getReference(databasePath); this.databasePath = databasePath; return this; } }
Database implements DatabaseDistribution, QueryProvider { @Override public DatabaseDistribution inReference(String databasePath) { databaseReference = FirebaseDatabase.getInstance().getReference(databasePath); this.databasePath = databasePath; return this; } Database(); }
Database implements DatabaseDistribution, QueryProvider { @Override public DatabaseDistribution inReference(String databasePath) { databaseReference = FirebaseDatabase.getInstance().getReference(databasePath); this.databasePath = databasePath; return this; } Database(); @Override ListenerPromise<ConnectionStatus> onConnect(); @Override DatabaseDistribution inReference(String databasePath); @Override Promise<Void> setValue(final Object value); @Override @SuppressWarnings("unchecked") Promise<E> readValue(final Class<T> dataType); @Override @SuppressWarnings("unchecked") ListenerPromise<R> onDataChange(final Class<T> dataType); @Override ListenerPromise<R> onChildChange(final Class<T> dataType, final ChildEventType... eventsType); @Override @SuppressWarnings("unchecked") DatabaseDistribution filter(FilterType filterType, V... filterArguments); @Override DatabaseDistribution orderBy(OrderByMode orderByMode, String argument); @Override DatabaseDistribution orderBy(OrderByMode orderByMode); @Override DatabaseDistribution push(); @Override Promise<Void> removeValue(); @Override Promise<Void> updateChildren(final Map<String, Object> data); @Override @SuppressWarnings("unchecked") Promise<Void> transaction(final Class<T> dataType, final Function<R, R> transaction); @Override void setPersistenceEnabled(boolean enabled); @Override void keepSynced(boolean synced); @Override String getReferencePath(); @Override Array<Filter> getFilters(); @Override OrderByClause getOrderByClause(); @Override void terminateOperation(); }
Database implements DatabaseDistribution, QueryProvider { @Override public DatabaseDistribution inReference(String databasePath) { databaseReference = FirebaseDatabase.getInstance().getReference(databasePath); this.databasePath = databasePath; return this; } Database(); @Override ListenerPromise<ConnectionStatus> onConnect(); @Override DatabaseDistribution inReference(String databasePath); @Override Promise<Void> setValue(final Object value); @Override @SuppressWarnings("unchecked") Promise<E> readValue(final Class<T> dataType); @Override @SuppressWarnings("unchecked") ListenerPromise<R> onDataChange(final Class<T> dataType); @Override ListenerPromise<R> onChildChange(final Class<T> dataType, final ChildEventType... eventsType); @Override @SuppressWarnings("unchecked") DatabaseDistribution filter(FilterType filterType, V... filterArguments); @Override DatabaseDistribution orderBy(OrderByMode orderByMode, String argument); @Override DatabaseDistribution orderBy(OrderByMode orderByMode); @Override DatabaseDistribution push(); @Override Promise<Void> removeValue(); @Override Promise<Void> updateChildren(final Map<String, Object> data); @Override @SuppressWarnings("unchecked") Promise<Void> transaction(final Class<T> dataType, final Function<R, R> transaction); @Override void setPersistenceEnabled(boolean enabled); @Override void keepSynced(boolean synced); @Override String getReferencePath(); @Override Array<Filter> getFilters(); @Override OrderByClause getOrderByClause(); @Override void terminateOperation(); }
@Test public void setValue() throws Exception { PowerMockito.mockStatic(QuerySetValue.class); Database database = new Database(); QuerySetValue query = PowerMockito.spy(new QuerySetValue(database, "/test")); PowerMockito.whenNew(QuerySetValue.class).withAnyArguments().thenReturn(query); when(query.withArgs(Mockito.any())).thenReturn(query); Promise promise = Mockito.spy(database.inReference("/test").setValue("").subscribe()); PowerMockito.verifyNew(QuerySetValue.class); }
@Override public Promise<Void> setValue(final Object value) { checkDatabaseReference(); return FuturePromise.when(new DatabaseConsumer<FuturePromise<Void>>(this) { @Override public void accept(FuturePromise<Void> voidFuturePromise) { new QuerySetValue(Database.this, getDatabasePath()) .withArgs(value) .with(voidFuturePromise) .execute(); } }); }
Database implements DatabaseDistribution, QueryProvider { @Override public Promise<Void> setValue(final Object value) { checkDatabaseReference(); return FuturePromise.when(new DatabaseConsumer<FuturePromise<Void>>(this) { @Override public void accept(FuturePromise<Void> voidFuturePromise) { new QuerySetValue(Database.this, getDatabasePath()) .withArgs(value) .with(voidFuturePromise) .execute(); } }); } }
Database implements DatabaseDistribution, QueryProvider { @Override public Promise<Void> setValue(final Object value) { checkDatabaseReference(); return FuturePromise.when(new DatabaseConsumer<FuturePromise<Void>>(this) { @Override public void accept(FuturePromise<Void> voidFuturePromise) { new QuerySetValue(Database.this, getDatabasePath()) .withArgs(value) .with(voidFuturePromise) .execute(); } }); } Database(); }
Database implements DatabaseDistribution, QueryProvider { @Override public Promise<Void> setValue(final Object value) { checkDatabaseReference(); return FuturePromise.when(new DatabaseConsumer<FuturePromise<Void>>(this) { @Override public void accept(FuturePromise<Void> voidFuturePromise) { new QuerySetValue(Database.this, getDatabasePath()) .withArgs(value) .with(voidFuturePromise) .execute(); } }); } Database(); @Override ListenerPromise<ConnectionStatus> onConnect(); @Override DatabaseDistribution inReference(String databasePath); @Override Promise<Void> setValue(final Object value); @Override @SuppressWarnings("unchecked") Promise<E> readValue(final Class<T> dataType); @Override @SuppressWarnings("unchecked") ListenerPromise<R> onDataChange(final Class<T> dataType); @Override ListenerPromise<R> onChildChange(final Class<T> dataType, final ChildEventType... eventsType); @Override @SuppressWarnings("unchecked") DatabaseDistribution filter(FilterType filterType, V... filterArguments); @Override DatabaseDistribution orderBy(OrderByMode orderByMode, String argument); @Override DatabaseDistribution orderBy(OrderByMode orderByMode); @Override DatabaseDistribution push(); @Override Promise<Void> removeValue(); @Override Promise<Void> updateChildren(final Map<String, Object> data); @Override @SuppressWarnings("unchecked") Promise<Void> transaction(final Class<T> dataType, final Function<R, R> transaction); @Override void setPersistenceEnabled(boolean enabled); @Override void keepSynced(boolean synced); @Override String getReferencePath(); @Override Array<Filter> getFilters(); @Override OrderByClause getOrderByClause(); @Override void terminateOperation(); }
Database implements DatabaseDistribution, QueryProvider { @Override public Promise<Void> setValue(final Object value) { checkDatabaseReference(); return FuturePromise.when(new DatabaseConsumer<FuturePromise<Void>>(this) { @Override public void accept(FuturePromise<Void> voidFuturePromise) { new QuerySetValue(Database.this, getDatabasePath()) .withArgs(value) .with(voidFuturePromise) .execute(); } }); } Database(); @Override ListenerPromise<ConnectionStatus> onConnect(); @Override DatabaseDistribution inReference(String databasePath); @Override Promise<Void> setValue(final Object value); @Override @SuppressWarnings("unchecked") Promise<E> readValue(final Class<T> dataType); @Override @SuppressWarnings("unchecked") ListenerPromise<R> onDataChange(final Class<T> dataType); @Override ListenerPromise<R> onChildChange(final Class<T> dataType, final ChildEventType... eventsType); @Override @SuppressWarnings("unchecked") DatabaseDistribution filter(FilterType filterType, V... filterArguments); @Override DatabaseDistribution orderBy(OrderByMode orderByMode, String argument); @Override DatabaseDistribution orderBy(OrderByMode orderByMode); @Override DatabaseDistribution push(); @Override Promise<Void> removeValue(); @Override Promise<Void> updateChildren(final Map<String, Object> data); @Override @SuppressWarnings("unchecked") Promise<Void> transaction(final Class<T> dataType, final Function<R, R> transaction); @Override void setPersistenceEnabled(boolean enabled); @Override void keepSynced(boolean synced); @Override String getReferencePath(); @Override Array<Filter> getFilters(); @Override OrderByClause getOrderByClause(); @Override void terminateOperation(); }