View Javadoc
1   /*
2    * MoneyWise: Finance Application
3    * Copyright 2012-2026. Tony Washer
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License.  You may obtain a copy
7    * 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, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
14   * License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  package io.github.tonywasher.joceanus.moneywise.lethe.data.analysis.values;
18  
19  import io.github.tonywasher.joceanus.metis.data.MetisDataType;
20  import io.github.tonywasher.joceanus.moneywise.lethe.data.analysis.base.MoneyWiseAnalysisAttribute;
21  
22  /**
23   * SecurityAttribute enumeration.
24   */
25  public enum MoneyWiseAnalysisSecurityAttr implements MoneyWiseAnalysisAttribute {
26      /**
27       * Units.
28       */
29      UNITS,
30  
31      /**
32       * Valuation.
33       */
34      VALUATION,
35  
36      /**
37       * Foreign Valuation.
38       */
39      FOREIGNVALUE,
40  
41      /**
42       * Valuation Delta.
43       */
44      VALUEDELTA,
45  
46      /**
47       * Foreign Valuation Delta.
48       */
49      FOREIGNVALUEDELTA,
50  
51      /**
52       * Exchange Rate.
53       */
54      EXCHANGERATE,
55  
56      /**
57       * Residual Cost.
58       */
59      RESIDUALCOST,
60  
61      /**
62       * Realised Gains.
63       */
64      REALISEDGAINS,
65  
66      /**
67       * GrowthAdjust.
68       */
69      GROWTHADJUST,
70  
71      /**
72       * Invested.
73       */
74      INVESTED,
75  
76      /**
77       * Foreign Invested Amount.
78       */
79      FOREIGNINVESTED,
80  
81      /**
82       * Dividend.
83       */
84      DIVIDEND,
85  
86      /**
87       * MarketGrowth.
88       */
89      MARKETGROWTH,
90  
91      /**
92       * ForeignMarketGrowth.
93       */
94      FOREIGNMARKETGROWTH,
95  
96      /**
97       * LocalMarketGrowth.
98       */
99      LOCALMARKETGROWTH,
100 
101     /**
102      * Currency Fluctuation.
103      */
104     CURRENCYFLUCT,
105 
106     /**
107      * Profit.
108      */
109     PROFIT,
110 
111     /**
112      * Profit.
113      */
114     MARKETPROFIT,
115 
116     /**
117      * CashInvested.
118      */
119     CASHINVESTED,
120 
121     /**
122      * Consideration.
123      */
124     CONSIDERATION,
125 
126     /**
127      * CashConsideration (returned cash).
128      */
129     RETURNEDCASH,
130 
131     /**
132      * StockConsideration (transferred value).
133      */
134     XFERREDVALUE,
135 
136     /**
137      * CostDilution.
138      */
139     COSTDILUTION,
140 
141     /**
142      * Capital Gain.
143      */
144     CAPITALGAIN,
145 
146     /**
147      * AllowedCost.
148      */
149     ALLOWEDCOST,
150 
151     /**
152      * XferredCost.
153      */
154     XFERREDCOST,
155 
156     /**
157      * Price.
158      */
159     PRICE,
160 
161     /**
162      * CashType.
163      */
164     CASHTYPE;
165 
166     /**
167      * The String name.
168      */
169     private String theName;
170 
171     @Override
172     public String toString() {
173         /* If we have not yet loaded the name */
174         if (theName == null) {
175             /* Load the name */
176             theName = MoneyWiseAnalysisValuesResource.getKeyForSecurityAttr(this).getValue();
177         }
178 
179         /* return the name */
180         return theName;
181     }
182 
183     @Override
184     public boolean isCounter() {
185         switch (this) {
186             case UNITS:
187             case RESIDUALCOST:
188             case REALISEDGAINS:
189             case GROWTHADJUST:
190             case DIVIDEND:
191             case INVESTED:
192             case FOREIGNINVESTED:
193                 return true;
194             case MARKETGROWTH:
195             case FOREIGNMARKETGROWTH:
196             case LOCALMARKETGROWTH:
197             case CURRENCYFLUCT:
198             case PROFIT:
199             case MARKETPROFIT:
200             case VALUATION:
201             case FOREIGNVALUE:
202             case EXCHANGERATE:
203             case PRICE:
204             case VALUEDELTA:
205             case FOREIGNVALUEDELTA:
206             case XFERREDCOST:
207             case COSTDILUTION:
208             case CONSIDERATION:
209             case RETURNEDCASH:
210             case XFERREDVALUE:
211             case CASHINVESTED:
212             case CAPITALGAIN:
213             case ALLOWEDCOST:
214             case CASHTYPE:
215             default:
216                 return false;
217         }
218     }
219 
220     @Override
221     public MetisDataType getDataType() {
222         switch (this) {
223             case UNITS:
224                 return MetisDataType.UNITS;
225             case PRICE:
226                 return MetisDataType.PRICE;
227             case EXCHANGERATE:
228             case COSTDILUTION:
229                 return MetisDataType.RATIO;
230             case CASHTYPE:
231                 return MetisDataType.ENUM;
232             case VALUATION:
233             case FOREIGNVALUE:
234             case VALUEDELTA:
235             case FOREIGNVALUEDELTA:
236             case RESIDUALCOST:
237             case REALISEDGAINS:
238             case GROWTHADJUST:
239             case INVESTED:
240             case FOREIGNINVESTED:
241             case DIVIDEND:
242             case MARKETGROWTH:
243             case FOREIGNMARKETGROWTH:
244             case LOCALMARKETGROWTH:
245             case CURRENCYFLUCT:
246             case MARKETPROFIT:
247             case PROFIT:
248             case CONSIDERATION:
249             case RETURNEDCASH:
250             case XFERREDVALUE:
251             case XFERREDCOST:
252             case ALLOWEDCOST:
253             case CASHINVESTED:
254             case CAPITALGAIN:
255             default:
256                 return MetisDataType.MONEY;
257         }
258     }
259 }