ProbabilityOfCollision.java

  1. /* Copyright 2002-2025 CS GROUP
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.ssa.metrics;

  18. import org.hipparchus.util.MathUtils;
  19. import org.orekit.ssa.collision.shorttermencounter.probability.twod.Alfriend1999Max;
  20. import org.orekit.ssa.collision.shorttermencounter.probability.twod.Laas2015;

  21. /**
  22.  * Container for values relative to the probability of collision :
  23.  * <ul>
  24.  *     <li>Value of the probability of collision.</li>
  25.  *     <li>Name of the method with which it was computed.</li>
  26.  *     <li>Upper and lower limit of the value if the method provides them (such as {@link Laas2015} for example).</li>
  27.  *     <li>Flag defining if the probability was maximized in any way (such as {@link Alfriend1999Max} for example).</li>
  28.  * </ul>
  29.  *
  30.  * @author Vincent Cucchietti
  31.  * @since 12.0
  32.  */
  33. public class ProbabilityOfCollision {

  34.     /** Value of the probability of collision. */
  35.     private final double value;

  36.     /**
  37.      * Lower limit of the probability of collision.
  38.      * <p>
  39.      * 0 by default.
  40.      */
  41.     private final double lowerLimit;

  42.     /**
  43.      * Upper limit of the probability of collision.
  44.      * <p>
  45.      * 0 by default.
  46.      */
  47.     private final double upperLimit;

  48.     /** Name of the probability computing method with which this probability was calculated. */
  49.     private final String probabilityOfCollisionMethodName;

  50.     /**
  51.      * Defines if this probability of collision can be considered a maximum probability of collision.
  52.      * <p>
  53.      * It depends on what method was used to compute this probability.
  54.      * <p>
  55.      * False by default.
  56.      */
  57.     private final boolean isMaxProbability;

  58.     /**
  59.      * Constructor with default values of 0 for the upper/lower limits and default false flag for maximum probability.
  60.      *
  61.      * @param value value of the probability of collision
  62.      * @param probabilityOfCollisionMethodName name of the probability computing method with which this probability was
  63.      * computed
  64.      */
  65.     public ProbabilityOfCollision(final double value, final String probabilityOfCollisionMethodName) {
  66.         this(value, 0., 0., probabilityOfCollisionMethodName, false);
  67.     }

  68.     /**
  69.      * Constructor with default values of 0 for the upper and lower limits.
  70.      *
  71.      * @param value value of the probability of collision
  72.      * @param probabilityOfCollisionMethodName name of the probability computing method with which this probability was
  73.      * computed
  74.      * @param isMaxProbability flag defining if it has been computed using a maximum probability of collision method
  75.      */
  76.     public ProbabilityOfCollision(final double value, final String probabilityOfCollisionMethodName,
  77.                                   final boolean isMaxProbability) {
  78.         this(value, 0., 0., probabilityOfCollisionMethodName, isMaxProbability);
  79.     }

  80.     /**
  81.      * Constructor.
  82.      *
  83.      * @param value value of the probability of collision
  84.      * @param lowerLimit lower limit of the probability of collision
  85.      * @param upperLimit upper limit of the probability of collision
  86.      * @param probabilityOfCollisionMethodName name of the probability computing method with which this probability was
  87.      * computed
  88.      * @param isMaxProbability flag indicating if this method computes a maximum probability of collision
  89.      */
  90.     public ProbabilityOfCollision(final double value, final double lowerLimit, final double upperLimit,
  91.                                   final String probabilityOfCollisionMethodName, final boolean isMaxProbability) {

  92.         // Check that inputs are valid
  93.         MathUtils.checkRangeInclusive(value, 0, 1);
  94.         MathUtils.checkRangeInclusive(lowerLimit, 0, 1);
  95.         MathUtils.checkRangeInclusive(upperLimit, 0, 1);

  96.         // initialization
  97.         this.value                            = value;
  98.         this.lowerLimit                       = lowerLimit;
  99.         this.upperLimit                       = upperLimit;
  100.         this.probabilityOfCollisionMethodName = probabilityOfCollisionMethodName;
  101.         this.isMaxProbability                 = isMaxProbability;
  102.     }

  103.     /** Get value of the probability of collision.
  104.      * @return value of the probability of collision
  105.      */
  106.     public double getValue() {
  107.         return value;
  108.     }

  109.     /** Get lower limit of the probability of collision value.
  110.      * @return lower limit of the probability of collision value, 0 by default
  111.      */
  112.     public double getLowerLimit() {
  113.         return lowerLimit;
  114.     }

  115.     /** Get upper limit of the probability of collision value.
  116.      * @return upper limit of the probability of collision value, 0 by default
  117.      */
  118.     public double getUpperLimit() {
  119.         return upperLimit;
  120.     }

  121.     /** Get name of the probability computing method with which this probability was computed.
  122.      * @return name of the probability computing method with which this probability was computed
  123.      */
  124.     public String getProbabilityOfCollisionMethodName() {
  125.         return probabilityOfCollisionMethodName;
  126.     }

  127.     /** Get flag that defines if this probability of collision can be considered a maximum probability of collision.
  128.      * @return flag that defines if this probability of collision can be considered a maximum probability of collision
  129.      */
  130.     public boolean isMaxProbability() {
  131.         return isMaxProbability;
  132.     }

  133. }