123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. /**
  2. * Created by dan on 6/14/17.
  3. */
  4. public class MathUtilities {
  5. /**
  6. * @param baseValue starting value
  7. * @param difference value to add to starting value
  8. * @return sum of `baseValue` and `difference`
  9. */
  10. public Integer add(int baseValue, int difference) {
  11. return baseValue + difference;
  12. }
  13. /**
  14. * @param baseValue starting value
  15. * @param difference value to add to starting value
  16. * @return sum of `baseValue` and `difference`
  17. */
  18. public Long add(long baseValue, long difference) {
  19. return baseValue + difference;
  20. }
  21. /**
  22. * @param baseValue starting value
  23. * @param difference value to add to starting value
  24. * @return sum of `baseValue` and `difference`
  25. */
  26. public Short add(short baseValue, short difference) {
  27. return (short)(baseValue + difference);
  28. }
  29. /**
  30. * @param baseValue starting value
  31. * @param difference value to add to starting value
  32. * @return sum of `baseValue` and `difference`
  33. */
  34. public Byte add(byte baseValue, byte difference) {
  35. return (byte)(baseValue + difference);
  36. }
  37. /**
  38. * @param baseValue starting value
  39. * @param difference value to add to starting value
  40. * @return sum of `baseValue` and `difference`
  41. */
  42. public Float add(float baseValue, float difference) {
  43. return baseValue + difference;
  44. }
  45. /**
  46. * @param baseValue starting value
  47. * @param difference value to add to starting value
  48. * @return sum of `baseValue` and `difference`
  49. */
  50. public Double add(double baseValue, double difference) {
  51. return baseValue + difference;
  52. }
  53. /**
  54. * @param baseValue starting value
  55. * @param difference value to subtract from starting value
  56. * @return difference between `baseValue` and `difference`
  57. */
  58. public Integer subtract(int baseValue, int difference) {
  59. return baseValue - difference;
  60. }
  61. /**
  62. * @param baseValue starting value
  63. * @param difference value to subtract from starting value
  64. * @return difference between `baseValue` and `difference`
  65. */
  66. public Long subtract(long baseValue, long difference) {
  67. return baseValue - difference;
  68. }
  69. /**
  70. * @param baseValue starting value
  71. * @param difference value to subtract from starting value
  72. * @return difference between `baseValue` and `difference`
  73. */
  74. public Short subtract(short baseValue, short difference) {
  75. return (short)(baseValue - difference);
  76. }
  77. /**
  78. * @param baseValue starting value
  79. * @param difference value to subtract from starting value
  80. * @return difference between `baseValue` and `difference`
  81. */
  82. public Byte subtract(byte baseValue, byte difference) {
  83. return (byte)(baseValue - difference);
  84. }
  85. /**
  86. * @param baseValue starting value
  87. * @param difference value to subtract from starting value
  88. * @return difference between `baseValue` and `difference`
  89. */
  90. public Float subtract(float baseValue, float difference) {
  91. return baseValue - difference;
  92. }
  93. /**
  94. * @param baseValue starting value
  95. * @param difference value to subtract from starting value
  96. * @return difference between `baseValue` and `difference`
  97. */
  98. public Double subtract(double baseValue, double difference) {
  99. return baseValue - difference;
  100. }
  101. /**
  102. * @param dividend value to be divided
  103. * @param divisor value to divide by
  104. * @return division of `dividend` by `divisor
  105. */
  106. public Integer divide(int dividend, int divisor) {
  107. return dividend / divisor;
  108. }
  109. /**
  110. * @param dividend value to be divided
  111. * @param divisor value to divide by
  112. * @return division of `dividend` by `divisor
  113. */
  114. public Long divide(long dividend, long divisor) {
  115. return dividend / divisor;
  116. }
  117. /**
  118. * @param dividend value to be divided
  119. * @param divisor value to divide by
  120. * @return division of `dividend` by `divisor
  121. */
  122. public Short divide(short dividend, short divisor) {
  123. return (short)(dividend / divisor);
  124. }
  125. /**
  126. * @param dividend value to be divided
  127. * @param divisor value to divide by
  128. * @return division of `dividend` by `divisor
  129. */
  130. public Byte divide(byte dividend, byte divisor) {
  131. return (byte)(dividend / divisor);
  132. }
  133. /**
  134. * @param dividend value to be divided
  135. * @param divisor value to divide by
  136. * @return division of `dividend` by `divisor
  137. */
  138. public Float divide(float dividend, float divisor) {
  139. return dividend / divisor;
  140. }
  141. /**
  142. * @param dividend value to be divided
  143. * @param divisor value to divide by
  144. * @return division of `dividend` by `divisor
  145. */
  146. public Double divide(double dividend, double divisor) {
  147. return dividend / divisor;
  148. }
  149. /**
  150. * @param multiplicand value to be multiplied
  151. * @param multiplier value to multiply by
  152. * @return product of `multiplicand` by `multiplier`
  153. */
  154. public Integer multiply(int multiplicand, int multiplier) {
  155. return multiplicand * multiplier;
  156. }
  157. /**
  158. * @param multiplicand value to be multiplied
  159. * @param multiplier value to multiply by
  160. * @return product of `multiplicand` by `multiplier`
  161. */
  162. public Long multiply(long multiplicand, long multiplier) {
  163. return multiplicand * multiplier;
  164. }
  165. /**
  166. * @param multiplicand value to be multiplied
  167. * @param multiplier value to multiply by
  168. * @return product of `multiplicand` by `multiplier`
  169. */
  170. public Short multiply(short multiplicand, short multiplier) {
  171. return (short)(multiplicand * multiplier);
  172. }
  173. /**
  174. * @param multiplicand value to be multiplied
  175. * @param multiplier value to multiply by
  176. * @return product of `multiplicand` by `multiplier`
  177. */
  178. public Byte multiply(byte multiplicand, byte multiplier) {
  179. return (byte)(multiplicand * multiplier);
  180. }
  181. /**
  182. * @param multiplicand value to be multiplied
  183. * @param multiplier value to multiply by
  184. * @return product of `multiplicand` by `multiplier`
  185. */
  186. public Float multiply(float multiplicand, float multiplier) {
  187. return multiplicand * multiplier;
  188. }
  189. /**
  190. * @param multiplicand value to be multiplied
  191. * @param multiplier value to multiply by
  192. * @return product of `multiplicand` by `multiplier`
  193. */
  194. public Double multiply(double multiplicand, double multiplier) {
  195. return multiplicand * multiplier;
  196. }
  197. /**
  198. * @return true
  199. */
  200. public Boolean returnTrue() {
  201. return true;
  202. }
  203. /**
  204. * @return false
  205. */
  206. public Boolean returnFalse() {
  207. return false;
  208. }
  209. }