rand.asset_forfeiture
Class GCalc

java.lang.Object
  extended by rand.asset_forfeiture.GCalc
All Implemented Interfaces:
ProfitCalculator
Direct Known Subclasses:
Benchmark, KFixed, KVariable

public abstract class GCalc
extends java.lang.Object
implements ProfitCalculator

This class contains lots of the common functionality for KFixed, KVariable, and Benchmark. It is not meant to be implemented.


Constructor Summary
GCalc()
          The only constructor just initializes variableData
 
Method Summary
protected  java.lang.Double alpha()
          Accessor for alpha \returns the calculated alpha based on input values
protected  java.lang.String alphaString()
          User-readable formula for alpha \returns a string with the formula used to calculate alpha
protected  java.lang.Double beta()
          Accessor for beta \returns the calculated beta based on input values
protected  java.lang.String betaString()
          User-readable formula for beta \returns a string with the formula used to calculate beta
 void calculateBase(javax.swing.JTextArea forDebuggers)
          Does the calculations for the world as described, determining the values of any parameters needed for the excursion to a legals-only framework.
 void calculateExcursion(javax.swing.JTextArea forDebuggers)
          Does the calculations for the world without illegal immigrants, including what the profits of the firm would be, how many workers of each type would be hired, etc.
protected  java.lang.Double delta()
          Accessor for delta \returns the calculated value of delta based on input values
protected  java.lang.String deltaString()
          User-readable formula for delta \returns a string with the formula used to calculate delta
protected  java.lang.Double epsilon()
          Accessor for epsilon \returns the calculated value of epsilon based on input values
protected  java.lang.Double gamma()
          Accessor for gamma \returns the calculated value of gamma based on input values
protected  java.lang.String gammaString()
          User-readable formula for gamma \returns a string with the formula used to calculate gamma
abstract  java.lang.String getName()
          The name of this particular ProfitCalculator.
 java.util.HashMap<variables,java.lang.Double> getOptimal()
          While calculateExcursion does the calculations, this method returns the results, so you don't have to do both simultaneously.
 java.lang.String getTitle()
          A nice header for printing out the results
protected  java.lang.Double K()
          Accessor for K \returns the calculated K based on input values
protected abstract  java.lang.Double KOpt()
          Accessor for optimal K \returns the optimized value of K
protected abstract  java.lang.String KOptString()
          User-readable formula for optimal K \returns a string with the formula used to optimize K
protected  java.lang.String KString()
          User-readable formula for K \returns a string with the formula used to calculate K
abstract  java.lang.Boolean needsVar(variables v)
          Determines whether this implementation of ProfitCalculator requires a particular variable for its calculations.
protected  java.lang.Double omega()
          Accessor for omega \return the calculated value of omega
protected  java.lang.String omegaString()
          User-readable formula for omega \returns a string with the formula for omega
protected abstract  java.lang.Double phi3()
          Accessor for optimal phi3 \returns the optimized value of phi3
protected abstract  java.lang.String phi3String()
          User-readable formula for optimal phi3 \returns a string with the formula used to optimize phi3
protected  java.lang.Double pi()
          Accessor for pi \returns pi
protected  java.lang.Double piOpt()
          Accessor for the optimal pi \returns the optimal value of pi
protected  java.lang.String piOptString()
          User-readable formula for the optimal pi \returns a string containing the formula used to optimize pi
protected  java.lang.Double PL1()
          Accessor for PL1 \returns PL1
protected  java.lang.Double PL2()
          Accessor for PL2 \returns PL2
protected  java.lang.Double PL3()
          Accessor for PL3 \returns PL3
protected  java.lang.Double PL4()
          Accessor for PL4 \returns newPL3
protected  java.lang.Double Pq()
          Accessor for Pq \returns the calculated value of Pq based on input values
protected  java.lang.String PqString()
          User-readable formula for Pq \returns a string with the formula used to calculate Pq
static java.lang.String print(java.lang.Double d)
          An alternative to print(Double, Boolean) that assumes d is not a currency.
static java.lang.String print(java.lang.Double d, java.lang.Boolean currency)
          A method to standardize the look and feel of doubles in the DisplayPanel as well as the text outputs.
protected  java.lang.Double Q()
          Accessor for Q \returns the calculated Q based on input values
protected  java.lang.Double QOpt()
          Accessor for optimal Q \returns the optimized value of Q
protected  java.lang.String QOptString()
          User-readable formula for the optimal Q \returns a string containing the formula used to optimize Q
protected  java.lang.String QString()
          User-readable formula for Q \returns a string with the formula used to calculate Q
protected  java.lang.Double R()
          Accessor for R \returns R
protected  java.lang.Double rho()
          Accessor for rho \returns rho
protected  java.lang.Double rhoOpt()
          Accessor for optimal rho \returns the optimal value of rho
protected  java.lang.String rhoOptString()
          User-readable formula for rho \returns a string containing the formula used to optimize rho
protected  java.lang.Double ROpt()
          Accessor for the optimal R \returns the optimized value of R
 void setNewPL3(double p)
          Mutator to set an alternative value for PL3 based on BLS or domain knowledge.
 java.lang.Boolean setVals(java.util.HashMap<variables,java.lang.Double> vals)
          This method will provide the inputs to the calculation in the form of a HashMap mapping an available variable to its value.
 java.lang.Boolean validate()
          This method runs any input validation available for the ProfitCalculator.
protected  java.lang.Boolean validRange(java.lang.Boolean displayBox)
          Tests for valid ranges of the technology parameters.
protected  java.lang.Double X1()
          Accessor for X1 \returns L1 + 1 to avoid problems of having no L1 workers
protected  java.lang.Double X1Opt()
          Accessor for optimal X1 \returns the optimal value of X1, unless that optimum is less than 1, in which case it returns 1 (real labor = X1 - 1)
protected  java.lang.String X1OptString()
          User-readable formula for optimal X1 \returns a string containing the formula used to optimize X1
protected  java.lang.Double X2()
          Accessor for X2 \returns L2 + 1 to avoid problems of having no L2 workers
protected  java.lang.Double X3()
          Accessor for X3 \returns L3 + 1 to avoid problems of having no L3 workers
protected abstract  java.lang.Double X3Opt()
          Accessor for optimal X3 \returns the optimized value of X3, unless X3 < 1, in which case it returns one, since real labor = X3-1
protected abstract  java.lang.String X3OptString()
          User-readable formula for optimal X3 \returns a string with the formula used to optimize X3
protected  java.lang.Double X4Opt()
          Accessor for X4 \returns the optimal value of X4, unless that optimum is less than 1, in which case it returns 1 (real labor = X1 - 1)
protected  java.lang.String X4OptString()
          User-readable formula for X4 \returns a string containing the formula used to optimize X4
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GCalc

public GCalc()
The only constructor just initializes variableData

Method Detail

needsVar

public abstract java.lang.Boolean needsVar(variables v)
Description copied from interface: ProfitCalculator
Determines whether this implementation of ProfitCalculator requires a particular variable for its calculations. \param v the variable in question \returns true if the variable is required; false if it is not

Specified by:
needsVar in interface ProfitCalculator

getName

public abstract java.lang.String getName()
Description copied from interface: ProfitCalculator
The name of this particular ProfitCalculator. \returns a string with the name of the calculator. Does not have to be unique.

Specified by:
getName in interface ProfitCalculator

getTitle

public java.lang.String getTitle()
A nice header for printing out the results


validate

public java.lang.Boolean validate()
Description copied from interface: ProfitCalculator
This method runs any input validation available for the ProfitCalculator. This method should check things such as all the required variables being present, values being within predetermined ranges (e.g. wages >= 0), etc. \returns true if the ProfitCalculator is in a valid state, false otherwise.

Specified by:
validate in interface ProfitCalculator

validRange

protected java.lang.Boolean validRange(java.lang.Boolean displayBox)
Tests for valid ranges of the technology parameters. These depend upon the initial inputs, but not upon the optimization. \param displayBox if true, an error box will pop up if the parameters do not have valid ranges \returns true if the inputs are valid; false otherwise


setVals

public java.lang.Boolean setVals(java.util.HashMap<variables,java.lang.Double> vals)
Description copied from interface: ProfitCalculator
This method will provide the inputs to the calculation in the form of a HashMap mapping an available variable to its value. In general, variables not specified are missing, not assumed to be zero. This is to allow flexibility in allowing some calculations to use only a subset of the available variables. \param vals the HashMap containing the variable-value mappings \returns true if the inputs are valid for this particular calculator

Specified by:
setVals in interface ProfitCalculator

getOptimal

public java.util.HashMap<variables,java.lang.Double> getOptimal()
Description copied from interface: ProfitCalculator
While calculateExcursion does the calculations, this method returns the results, so you don't have to do both simultaneously. \returns a HashMap with the optimal values of the relevant variables

Specified by:
getOptimal in interface ProfitCalculator

X1

protected java.lang.Double X1()
Accessor for X1 \returns L1 + 1 to avoid problems of having no L1 workers


X2

protected java.lang.Double X2()
Accessor for X2 \returns L2 + 1 to avoid problems of having no L2 workers


X3

protected java.lang.Double X3()
Accessor for X3 \returns L3 + 1 to avoid problems of having no L3 workers


PL1

protected java.lang.Double PL1()
Accessor for PL1 \returns PL1


PL2

protected java.lang.Double PL2()
Accessor for PL2 \returns PL2


PL3

protected java.lang.Double PL3()
Accessor for PL3 \returns PL3


PL4

protected java.lang.Double PL4()
Accessor for PL4 \returns newPL3


pi

protected java.lang.Double pi()
Accessor for pi \returns pi


R

protected java.lang.Double R()
Accessor for R \returns R


rho

protected java.lang.Double rho()
Accessor for rho \returns rho


Q

protected java.lang.Double Q()
Accessor for Q \returns the calculated Q based on input values


QString

protected java.lang.String QString()
User-readable formula for Q \returns a string with the formula used to calculate Q


K

protected java.lang.Double K()
Accessor for K \returns the calculated K based on input values


KString

protected java.lang.String KString()
User-readable formula for K \returns a string with the formula used to calculate K


alpha

protected java.lang.Double alpha()
Accessor for alpha \returns the calculated alpha based on input values


alphaString

protected java.lang.String alphaString()
User-readable formula for alpha \returns a string with the formula used to calculate alpha


beta

protected java.lang.Double beta()
Accessor for beta \returns the calculated beta based on input values


betaString

protected java.lang.String betaString()
User-readable formula for beta \returns a string with the formula used to calculate beta


gamma

protected java.lang.Double gamma()
Accessor for gamma \returns the calculated value of gamma based on input values


gammaString

protected java.lang.String gammaString()
User-readable formula for gamma \returns a string with the formula used to calculate gamma


delta

protected java.lang.Double delta()
Accessor for delta \returns the calculated value of delta based on input values


deltaString

protected java.lang.String deltaString()
User-readable formula for delta \returns a string with the formula used to calculate delta


epsilon

protected java.lang.Double epsilon()
Accessor for epsilon \returns the calculated value of epsilon based on input values


Pq

protected java.lang.Double Pq()
Accessor for Pq \returns the calculated value of Pq based on input values


PqString

protected java.lang.String PqString()
User-readable formula for Pq \returns a string with the formula used to calculate Pq


KOpt

protected abstract java.lang.Double KOpt()
Accessor for optimal K \returns the optimized value of K


KOptString

protected abstract java.lang.String KOptString()
User-readable formula for optimal K \returns a string with the formula used to optimize K


phi3

protected abstract java.lang.Double phi3()
Accessor for optimal phi3 \returns the optimized value of phi3


phi3String

protected abstract java.lang.String phi3String()
User-readable formula for optimal phi3 \returns a string with the formula used to optimize phi3


X3Opt

protected abstract java.lang.Double X3Opt()
Accessor for optimal X3 \returns the optimized value of X3, unless X3 < 1, in which case it returns one, since real labor = X3-1


X3OptString

protected abstract java.lang.String X3OptString()
User-readable formula for optimal X3 \returns a string with the formula used to optimize X3


omega

protected java.lang.Double omega()
Accessor for omega \return the calculated value of omega


omegaString

protected java.lang.String omegaString()
User-readable formula for omega \returns a string with the formula for omega


X1Opt

protected java.lang.Double X1Opt()
Accessor for optimal X1 \returns the optimal value of X1, unless that optimum is less than 1, in which case it returns 1 (real labor = X1 - 1)


X1OptString

protected java.lang.String X1OptString()
User-readable formula for optimal X1 \returns a string containing the formula used to optimize X1


X4Opt

protected java.lang.Double X4Opt()
Accessor for X4 \returns the optimal value of X4, unless that optimum is less than 1, in which case it returns 1 (real labor = X1 - 1)


X4OptString

protected java.lang.String X4OptString()
User-readable formula for X4 \returns a string containing the formula used to optimize X4


rhoOpt

protected java.lang.Double rhoOpt()
Accessor for optimal rho \returns the optimal value of rho


rhoOptString

protected java.lang.String rhoOptString()
User-readable formula for rho \returns a string containing the formula used to optimize rho


QOpt

protected java.lang.Double QOpt()
Accessor for optimal Q \returns the optimized value of Q


QOptString

protected java.lang.String QOptString()
User-readable formula for the optimal Q \returns a string containing the formula used to optimize Q


piOpt

protected java.lang.Double piOpt()
Accessor for the optimal pi \returns the optimal value of pi


piOptString

protected java.lang.String piOptString()
User-readable formula for the optimal pi \returns a string containing the formula used to optimize pi


ROpt

protected java.lang.Double ROpt()
Accessor for the optimal R \returns the optimized value of R


setNewPL3

public void setNewPL3(double p)
Mutator to set an alternative value for PL3 based on BLS or domain knowledge. \param p the alternate PL3

Specified by:
setNewPL3 in interface ProfitCalculator

print

public static java.lang.String print(java.lang.Double d,
                                     java.lang.Boolean currency)
A method to standardize the look and feel of doubles in the DisplayPanel as well as the text outputs. \param d the Double to be formatted \param currency setting this to true will treat d as a dollar value instead of a raw number \returns a string that represents d in a standard fasion. If currency is true, then the string will have a dollar sign in front and be limited to two decimal places. If currency is false, then d will be formatted using the standard C notation as "%,8.4f".


print

public static java.lang.String print(java.lang.Double d)
An alternative to print(Double, Boolean) that assumes d is not a currency. \param d the number to be formatted \returns a string representing d as above.


calculateBase

public void calculateBase(javax.swing.JTextArea forDebuggers)
Description copied from interface: ProfitCalculator
Does the calculations for the world as described, determining the values of any parameters needed for the excursion to a legals-only framework. \param forDebuggers append any relevant debugging output to this JTextArea for user-level debugging and understanding.

Specified by:
calculateBase in interface ProfitCalculator

calculateExcursion

public void calculateExcursion(javax.swing.JTextArea forDebuggers)
Description copied from interface: ProfitCalculator
Does the calculations for the world without illegal immigrants, including what the profits of the firm would be, how many workers of each type would be hired, etc. \param forDebuggers append any relevant debugging output to this JTextArea for user-level debugging and understanding.

Specified by:
calculateExcursion in interface ProfitCalculator