1   package org.wcb.e6b.vo;
2   
3   /**
4    * Created by IntelliJ IDEA.
5    * User: wbogaardt
6    * Date: Aug 25, 2005
7    * Time: 12:05:50 PM
8    * To change this template use File | Settings | File Templates.
9    */
10  
11  public class WeightLineItem {
12  
13      /**
14       * Weight and balance weight calculation.
15       * @return long value of the weight
16       */
17      public long getWeight() {
18          return weight;
19      }
20  
21      /**
22       * Allows seting of the weight value for weight and balance
23       * calculations.
24       * @param wt The weight of an item
25       */
26      public void setWeight(long wt) {
27          this.weight = wt;
28      }
29  
30      /**
31       * The arm length of the item from the center of gravity.
32       * @return arm length
33       */
34      public double getArm() {
35          return arm;
36      }
37  
38      /**
39       * The arm length to set.
40       * @param darm arm from center of gravity
41       */
42      public void setArm(double darm) {
43          this.arm = darm;
44      }
45  
46      /**
47       * The moment or torque on the fulcrum.
48       * @return gets the item moment
49       */
50      public double getMoment() {
51          return moment;
52      }
53  
54      /**
55       * Set the momement or torque value on the fulcrum.
56       * @param mmnt The moment value
57       */
58      public void setMoment(double mmnt) {
59          this.moment = mmnt;
60      }
61  
62      /**
63       * Calculate the item either moment value or
64       * arm value based on what as set for weight and one of
65       * the other values.
66       */
67      public void calculate() {
68          if (arm > 0)
69          {
70              moment = weight * arm;
71          }
72          else
73          {
74              arm = moment / weight;
75          }
76      }
77  
78      private long weight;
79      private double arm;
80      private double moment;
81  }