View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   package cz.cuni.amis.pogamut.usar2004.samples.AirScanner;
6   
7   /**
8    * List risk levels. By the risk level robot determines its reactive behaviour
9    * when facing some obstacles.
10   *
11   * @author vejmanm
12   */
13  public enum RiskLevel
14  {
15      HIGHRISK(2),
16      LOWRISK(1),
17      NORISK(0);
18      private int intRisk;
19  
20      RiskLevel(int risk)
21      {
22          this.intRisk = risk;
23      }
24  
25      public static RiskLevel getGreaterRisk(RiskLevel lvlA, RiskLevel lvlB)
26      {
27          return (lvlA.intRisk > lvlB.intRisk)?lvlA:lvlB;
28      }
29  
30      public boolean isGreaterRisk(RiskLevel than)
31      {
32          return this.intRisk > than.intRisk;
33      }
34      public boolean isGreaterOrEqualRisk(RiskLevel than)
35      {
36          return this.intRisk >= than.intRisk;
37      }
38  }