Coverage Report - org.jscsi.target.settings.NumericalResultFunction
 
Classes in this File Line Coverage Branch Coverage Complexity
NumericalResultFunction
0%
0/5
0%
0/2
3
 
 1  
 package org.jscsi.target.settings;
 2  
 
 3  
 
 4  
 import org.jscsi.target.settings.entry.NumericalEntry;
 5  
 
 6  
 
 7  
 /**
 8  
  * A result function used by the {@link NumericalEntry} class to determine the outcome of integer parameter
 9  
  * negotiations.
 10  
  * <p>
 11  
  * The behavior of this enumeration is described in the {@link #getResult(int, int)} method.
 12  
  * 
 13  
  * @author Andreas Ergenzinger
 14  
  */
 15  0
 public enum NumericalResultFunction {
 16  
     /**
 17  
      * The {@link #getResult(int, int)} method will return the smaller one of the two parameters.
 18  
      */
 19  0
     MIN,
 20  
     /**
 21  
      * The {@link #getResult(int, int)} method will return the larger one of the two parameters.
 22  
      */
 23  0
     MAX;
 24  
 
 25  
     /**
 26  
      * Returns either the value of the first or the second parameter, depending of the value of this enumeration.
 27  
      * 
 28  
      * @param a the first value
 29  
      * @param b the second value
 30  
      * @return either <i>a</i> or <i>b</i>
 31  
      */
 32  
     public int getResult (final int a, final int b) {
 33  0
         if (this == MIN) return Math.min(a, b);
 34  0
         return Math.max(a, b);
 35  
     }
 36  
 }