Java Code Examples for org.apache.commons.configuration.Configuration#getFloat()
The following examples show how to use
org.apache.commons.configuration.Configuration#getFloat() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DriftAnalysis.java From AisAbnormal with GNU Lesser General Public License v3.0 | 6 votes |
@Inject public DriftAnalysis(Configuration configuration, AppStatisticsService statisticsService, EventEmittingTracker trackingService, EventRepository eventRepository) { super(eventRepository, trackingService, null); this.statisticsService = statisticsService; setTrackPredictionTimeMax(configuration.getInteger(CONFKEY_ANALYSIS_DRIFT_PREDICTIONTIME_MAX, -1)); SPEED_HIGH_MARK = configuration.getFloat(CONFKEY_ANALYSIS_DRIFT_SOG_MAX, 5.0f); SPEED_LOW_MARK = configuration.getFloat(CONFKEY_ANALYSIS_DRIFT_SOG_MIN, 1.0f); MIN_HDG_COG_DEVIATION_DEGREES = configuration.getFloat(CONFKEY_ANALYSIS_DRIFT_COGHDG, 45f); OBSERVATION_PERIOD_MINUTES = configuration.getInt(CONFKEY_ANALYSIS_DRIFT_PERIOD, 10); OBSERVATION_DISTANCE_METERS = configuration.getFloat(CONFKEY_ANALYSIS_DRIFT_DISTANCE, 500f); SHIP_LENGTH_MIN = configuration.getInt(CONFKEY_ANALYSIS_DRIFT_SHIPLENGTH_MIN, 50); LOG.info(this.getClass().getSimpleName() + " created (" + this + ")."); }
Example 2
Source File: Parallelized.java From es6draft with MIT License | 5 votes |
protected int numberOfThreads(Class<?> klass) { Concurrency concurrency = klass.getAnnotation(Concurrency.class); int threads; int maxThreads; float factor; if (concurrency != null) { threads = concurrency.threads(); maxThreads = concurrency.maxThreads(); factor = concurrency.factor(); } else { threads = getDefaultValue(Concurrency.class, "threads", Integer.class); maxThreads = getDefaultValue(Concurrency.class, "maxThreads", Integer.class); factor = getDefaultValue(Concurrency.class, "factor", Float.class); } TestConfiguration testConfiguration = klass.getAnnotation(TestConfiguration.class); if (testConfiguration != null) { Configuration configuration = Resources.loadConfiguration(testConfiguration); int configThreads = configuration.getInt("concurrency.threads", -1); if (configThreads > 0) { threads = configThreads; } int configMaxThreads = configuration.getInt("concurrency.maxThreads", -1); if (configMaxThreads > 0) { factor = configMaxThreads; } float configFactor = configuration.getFloat("concurrency.factor", -1f); if (configFactor > 0) { factor = configFactor; } } threads = threads > 0 ? threads : Runtime.getRuntime().availableProcessors(); maxThreads = Math.max(maxThreads, 1); factor = Math.max(factor, 0); return Math.min(Math.max((int) Math.round(threads * factor), 1), maxThreads); }
Example 3
Source File: AbnormalAnalyzerAppModule.java From AisAbnormal with GNU Lesser General Public License v3.0 | 5 votes |
@Provides LocationFilter provideLocationFilter() { Configuration configuration = getConfiguration(); Float north = configuration.getFloat(CONFKEY_FILTER_LOCATION_BBOX_NORTH, null); Float south = configuration.getFloat(CONFKEY_FILTER_LOCATION_BBOX_SOUTH, null); Float east = configuration.getFloat(CONFKEY_FILTER_LOCATION_BBOX_EAST, null); Float west = configuration.getFloat(CONFKEY_FILTER_LOCATION_BBOX_WEST, null); BoundingBox tmpBbox = null; if (north != null && south != null && east != null && west != null) { tmpBbox = BoundingBox.create(Position.create(north, west), Position.create(south, east), CoordinateSystem.CARTESIAN); LOG.info("Area: " + tmpBbox); } else { LOG.warn("No location-based pre-filtering of messages."); } LocationFilter filter = new LocationFilter(); if (tmpBbox == null) { filter.addFilterGeometry(e -> true); } else { final BoundingBox bbox = tmpBbox; filter.addFilterGeometry(position -> { if (position == null) { return false; } return bbox.contains(position); }); } return filter; }
Example 4
Source File: SpeedOverGroundAnalysis.java From AisAbnormal with GNU Lesser General Public License v3.0 | 5 votes |
@Inject public SpeedOverGroundAnalysis(Configuration configuration, AppStatisticsService statisticsService, StatisticDataRepository statisticsRepository, EventEmittingTracker trackingService, EventRepository eventRepository, BehaviourManager behaviourManager) { super(eventRepository, statisticsRepository, trackingService, behaviourManager); this.statisticsService = statisticsService; setTrackPredictionTimeMax(configuration.getInteger(CONFKEY_ANALYSIS_SOG_PREDICTIONTIME_MAX, -1)); TOTAL_SHIP_COUNT_THRESHOLD = configuration.getInt(CONFKEY_ANALYSIS_SOG_CELL_SHIPCOUNT_MIN, 1000); PD = configuration.getFloat(CONFKEY_ANALYSIS_SOG_PD, 0.001f); SHIP_LENGTH_MIN = configuration.getInt(CONFKEY_ANALYSIS_SOG_SHIPLENGTH_MIN, 50); USE_AGGREGATED_STATS = configuration.getBoolean(CONFKEY_ANALYSIS_SOG_USE_AGGREGATED_STATS, false); LOG.info(getAnalysisName() + " created (" + this + ")."); }
Example 5
Source File: CloseEncounterAnalysis.java From AisAbnormal with GNU Lesser General Public License v3.0 | 5 votes |
@Inject public CloseEncounterAnalysis(Configuration configuration, AppStatisticsService statisticsService, EventEmittingTracker trackingService, EventRepository eventRepository, SafetyZoneService safetyZoneService) { super(eventRepository, trackingService, null); this.statisticsService = statisticsService; this.safetyZoneService = safetyZoneService; this.sogMin = configuration.getFloat(CONFKEY_ANALYSIS_CLOSEENCOUNTER_SOG_MIN, 5.0f); setTrackPredictionTimeMax(configuration.getInteger(CONFKEY_ANALYSIS_CLOSEENCOUNTER_PREDICTIONTIME_MAX, -1)); setAnalysisPeriodMillis(configuration.getInt(CONFKEY_ANALYSIS_CLOSEENCOUNTER_RUN_PERIOD, 30000) * 1000); LOG.info(this.getClass().getSimpleName() + " created (" + this + ")."); }
Example 6
Source File: CourseOverGroundAnalysis.java From AisAbnormal with GNU Lesser General Public License v3.0 | 5 votes |
@Inject public CourseOverGroundAnalysis(Configuration configuration, AppStatisticsService statisticsService, StatisticDataRepository statisticsRepository, EventEmittingTracker trackingService, EventRepository eventRepository, BehaviourManager behaviourManager) { super(eventRepository, statisticsRepository, trackingService, behaviourManager); this.statisticsService = statisticsService; setTrackPredictionTimeMax(configuration.getInteger(CONFKEY_ANALYSIS_COG_PREDICTIONTIME_MAX, -1)); TOTAL_SHIP_COUNT_THRESHOLD = configuration.getInt(CONFKEY_ANALYSIS_COG_CELL_SHIPCOUNT_MIN, 1000); PD = configuration.getFloat(CONFKEY_ANALYSIS_COG_PD, 0.001f); SHIP_LENGTH_MIN = configuration.getInt(CONFKEY_ANALYSIS_COG_SHIPLENGTH_MIN, 50); USE_AGGREGATED_STATS = configuration.getBoolean(CONFKEY_ANALYSIS_COG_USE_AGGREGATED_STATS, false); LOG.info(getAnalysisName() + " created (" + this + ")."); }
Example 7
Source File: SuddenSpeedChangeAnalysis.java From AisAbnormal with GNU Lesser General Public License v3.0 | 5 votes |
@Inject public SuddenSpeedChangeAnalysis(Configuration configuration, AppStatisticsService statisticsService, EventEmittingTracker trackingService, EventRepository eventRepository) { super(eventRepository, trackingService, null); this.statisticsService = statisticsService; setTrackPredictionTimeMax(configuration.getInteger(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_PREDICTIONTIME_MAX, -1)); SPEED_HIGH_MARK = configuration.getFloat(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_SOG_HIGHMARK, 7f); SPEED_LOW_MARK = configuration.getFloat(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_SOG_LOWMARK, 1f); SPEED_DECAY_SECS = configuration.getInt(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_DROP_DECAY, 30); SPEED_SUSTAIN_SECS = configuration.getInt(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_DROP_SUSTAIN, 60); SHIP_LENGTH_MIN = configuration.getInt(CONFKEY_ANALYSIS_SUDDENSPEEDCHANGE_SHIPLENGTH_MIN, 50); LOG.info(getAnalysisName() + " created (" + this + ")."); }
Example 8
Source File: ShipTypeAndSizeAnalysis.java From AisAbnormal with GNU Lesser General Public License v3.0 | 5 votes |
@Inject public ShipTypeAndSizeAnalysis(Configuration configuration, AppStatisticsService statisticsService, StatisticDataRepository statisticsRepository, EventEmittingTracker trackingService, EventRepository eventRepository, BehaviourManager behaviourManager) { super(eventRepository, statisticsRepository, trackingService, behaviourManager); this.statisticsService = statisticsService; setTrackPredictionTimeMax(configuration.getInteger(CONFKEY_ANALYSIS_TYPESIZE_PREDICTIONTIME_MAX, -1)); TOTAL_SHIP_COUNT_THRESHOLD = configuration.getInt(CONFKEY_ANALYSIS_TYPESIZE_CELL_SHIPCOUNT_MIN, 1000); PD = configuration.getFloat(CONFKEY_ANALYSIS_TYPESIZE_PD, 0.001f); SHIP_LENGTH_MIN = configuration.getInt(CONFKEY_ANALYSIS_TYPESIZE_SHIPLENGTH_MIN, 50); LOG.info(getAnalysisName() + " created (" + this + ")."); }
Example 9
Source File: FreeFlowAnalysis.java From AisAbnormal with GNU Lesser General Public License v3.0 | 5 votes |
@Inject public FreeFlowAnalysis(Configuration configuration, AppStatisticsService statisticsService, EventEmittingTracker trackingService, EventRepository eventRepository) { super(eventRepository, trackingService, null); this.statisticsService = statisticsService; this.xL = configuration.getInt(CONFKEY_ANALYSIS_FREEFLOW_XL, 8); this.xB = configuration.getInt(CONFKEY_ANALYSIS_FREEFLOW_XB, 8); this.dCog = configuration.getFloat(CONFKEY_ANALYSIS_FREEFLOW_DCOG, 15f); this.minReportingIntervalMillis = configuration.getInt(CONFKEY_ANALYSIS_FREEFLOW_MIN_REPORTING_PERIOD_MINUTES, 60) * 60 * 1000; String csvFileNameTmp = configuration.getString(CONFKEY_ANALYSIS_FREEFLOW_CSVFILE, null); if (csvFileNameTmp == null || isBlank(csvFileNameTmp)) { this.csvFileName = null; LOG.warn("Writing of free flow events to CSV file is disabled"); } else { this.csvFileName = csvFileNameTmp.trim(); LOG.info("Free flow events are appended to CSV file: " + this.csvFileName); } List<Object> bboxConfig = configuration.getList(CONFKEY_ANALYSIS_FREEFLOW_BBOX); if (bboxConfig != null) { final double n = Double.valueOf(bboxConfig.get(0).toString()); final double e = Double.valueOf(bboxConfig.get(1).toString()); final double s = Double.valueOf(bboxConfig.get(2).toString()); final double w = Double.valueOf(bboxConfig.get(3).toString()); this.areaToBeAnalysed = BoundingBox.create(Position.create(n, e), Position.create(s, w), CoordinateSystem.CARTESIAN); } setTrackPredictionTimeMax(configuration.getInteger(CONFKEY_ANALYSIS_FREEFLOW_PREDICTIONTIME_MAX, -1)); setAnalysisPeriodMillis(configuration.getInt(CONFKEY_ANALYSIS_FREEFLOW_RUN_PERIOD, 30000) * 1000); LOG.info(this.getClass().getSimpleName() + " created (" + this + ")."); }