Example usage for org.apache.commons.lang3.mutable MutableDouble MutableDouble

List of usage examples for org.apache.commons.lang3.mutable MutableDouble MutableDouble

Introduction

In this page you can find the example usage for org.apache.commons.lang3.mutable MutableDouble MutableDouble.

Prototype

public MutableDouble(final String value) throws NumberFormatException 

Source Link

Document

Constructs a new MutableDouble parsing the given string.

Usage

From source file:com.quinsoft.zencas.lTrnscpt_Object.java

public int olTrnscpt_dAttemptedCredits(View lTrnscpt, String InternalEntityStructure,
        String InternalAttribStructure, Integer GetOrSetFlag) {
    zVIEW lTrnscptT = new zVIEW();
    //:DECIMAL TotalCredits
    double TotalCredits = 0.0;
    int RESULT = 0;

    //:CASE GetOrSetFlag
    switch (GetOrSetFlag) {
    //:OF  zDERIVED_GET:
    case zDERIVED_GET:

        //:CreateViewFromView( lTrnscptT, lTrnscpt )
        CreateViewFromView(lTrnscptT, lTrnscpt);
        //:SET CURSOR LAST lTrnscptT.PrintGroup 
        //:       WHERE lTrnscptT.PrintGroup.CumulativeAttemptedCredits != ""
        RESULT = lTrnscptT.cursor("PrintGroup").setLast().toInt();
        ;/*from w  ww .  ja v  a  2  s. c o m*/
        if (RESULT > zCURSOR_UNCHANGED) {
            while (RESULT > zCURSOR_UNCHANGED && (CompareAttributeToString(lTrnscptT, "PrintGroup",
                    "CumulativeAttemptedCredits", "") == 0)) {
                RESULT = lTrnscptT.cursor("PrintGroup").setPrevContinue().toInt();
            }

        }

        //:IF RESULT >= zCURSOR_SET
        if (RESULT >= zCURSOR_SET) {
            //:TotalCredits = lTrnscptT.PrintGroup.CumulativeAttemptedCredits  
            {
                MutableDouble md_TotalCredits = new MutableDouble(TotalCredits);
                GetDecimalFromAttribute(md_TotalCredits, lTrnscptT, "PrintGroup", "CumulativeAttemptedCredits");
                TotalCredits = md_TotalCredits.doubleValue();
            }
            //:ELSE
        } else {
            //:TotalCredits = 0
            TotalCredits = 0;
        }

        //:END
        //:DropView( lTrnscptT )
        DropView(lTrnscptT);
        //:StoreValueInRecord ( lTrnscpt,
        //:                  InternalEntityStructure, InternalAttribStructure, TotalCredits, 0 )
        StoreValueInRecord(lTrnscpt, InternalEntityStructure, InternalAttribStructure, TotalCredits, 0);
        break;

    //:  /* end zDERIVED_GET */
    //:OF   zDERIVED_SET:
    case zDERIVED_SET:
        break;
    }

    //:     /* end zDERIVED_SET */
    //:END  /* case */
    return (0);
    // END
}

From source file:com.quinsoft.zencas.wWebXfer_Object.java

public int owWebXfer_dTotalRequestedAmount(View wWebXfer, String InternalEntityStructure,
        String InternalAttribStructure, Integer GetOrSetFlag) {
    zVIEW mGLCCURLST = new zVIEW();
    //:VIEW mGLCCURT    BASED ON LOD mGLCCUR
    zVIEW mGLCCURT = new zVIEW();
    //:DECIMAL dTotalAmount
    double dTotalAmount = 0.0;
    int RESULT = 0;
    double dTempDecimal_0 = 0.0;

    //:CASE GetOrSetFlag
    switch (GetOrSetFlag) {
    //:OF   zDERIVED_GET:
    case zDERIVED_GET:

        //:// Compute total amounts for PO's listed in lPOList.
        //:GET VIEW mGLCCURLST NAMED "mGLCCURLST"
        RESULT = GetViewByName(mGLCCURLST, "mGLCCURLST", wWebXfer, zLEVEL_TASK);
        //:IF RESULT >= 0
        if (RESULT >= 0) {
            //:CreateViewFromView( mGLCCURT, mGLCCURLST )
            CreateViewFromView(mGLCCURT, mGLCCURLST);
            //:dTotalAmount = 0
            dTotalAmount = 0;//from  w  w w  . j ava 2 s . c  o m
            //:FOR EACH mGLCCURT.GLCostCenter  
            RESULT = SetCursorFirstEntity(mGLCCURT, "GLCostCenter", "");
            while (RESULT > zCURSOR_UNCHANGED) {
                //:dTotalAmount = dTotalAmount + mGLCCURT.GLCostCenter.dTotalRequestedAmount  
                {
                    MutableDouble md_dTempDecimal_0 = new MutableDouble(dTempDecimal_0);
                    GetDecimalFromAttribute(md_dTempDecimal_0, mGLCCURT, "GLCostCenter",
                            "dTotalRequestedAmount");
                    dTempDecimal_0 = md_dTempDecimal_0.doubleValue();
                }
                dTotalAmount = dTotalAmount + dTempDecimal_0;
                RESULT = SetCursorNextEntity(mGLCCURT, "GLCostCenter", "");
            }

            //:END
            //:DropView( mGLCCURT )
            DropView(mGLCCURT);

            //:StoreValueInRecord( wWebXfer, InternalEntityStructure, 
            //:                 InternalAttribStructure, dTotalAmount, 0)
            StoreValueInRecord(wWebXfer, InternalEntityStructure, InternalAttribStructure, dTotalAmount, 0);

            //:ELSE
        } else {
            //:// No Purchase Order list exists.
            //:StoreStringInRecord( wWebXfer,
            //:                  InternalEntityStructure,
            //:                  InternalAttribStructure,
            //:                  "" )
            StoreStringInRecord(wWebXfer, InternalEntityStructure, InternalAttribStructure, "");
        }

        //:END
        break;

    //:  /* end zDERIVED_GET */
    //:OF   zDERIVED_SET:
    case zDERIVED_SET:
        break;
    }

    //:     /* end zDERIVED_SET */
    //:END  /* case */
    return (0);
    // END
}

From source file:com.quinsoft.zencas.lTrnscpt_Object.java

public int olTrnscpt_dDivisorCredits(View lTrnscpt, String InternalEntityStructure,
        String InternalAttribStructure, Integer GetOrSetFlag) {
    zVIEW lTrnscptT = new zVIEW();
    //:DECIMAL TotalCredits
    double TotalCredits = 0.0;
    int RESULT = 0;

    //:CASE GetOrSetFlag
    switch (GetOrSetFlag) {
    //:OF  zDERIVED_GET:
    case zDERIVED_GET:

        //:CreateViewFromView( lTrnscptT, lTrnscpt )
        CreateViewFromView(lTrnscptT, lTrnscpt);
        //:SET CURSOR LAST lTrnscptT.PrintGroup 
        //:       WHERE lTrnscptT.PrintGroup.CumulativeEarnedCredits != ""
        RESULT = lTrnscptT.cursor("PrintGroup").setLast().toInt();
        ;//  w w w .  jav a  2s . c  o m
        if (RESULT > zCURSOR_UNCHANGED) {
            while (RESULT > zCURSOR_UNCHANGED && (CompareAttributeToString(lTrnscptT, "PrintGroup",
                    "CumulativeEarnedCredits", "") == 0)) {
                RESULT = lTrnscptT.cursor("PrintGroup").setPrevContinue().toInt();
            }

        }

        //:IF RESULT >= zCURSOR_SET
        if (RESULT >= zCURSOR_SET) {
            //:TotalCredits = lTrnscptT.PrintGroup.CumulativeGPA_Divisor 
            {
                MutableDouble md_TotalCredits = new MutableDouble(TotalCredits);
                GetDecimalFromAttribute(md_TotalCredits, lTrnscptT, "PrintGroup", "CumulativeGPA_Divisor");
                TotalCredits = md_TotalCredits.doubleValue();
            }
            //:ELSE
        } else {
            //:TotalCredits = 0
            TotalCredits = 0;
        }

        //:END
        //:DropView( lTrnscptT )
        DropView(lTrnscptT);
        //:StoreValueInRecord ( lTrnscpt,
        //:                  InternalEntityStructure, InternalAttribStructure, TotalCredits, 0 )
        StoreValueInRecord(lTrnscpt, InternalEntityStructure, InternalAttribStructure, TotalCredits, 0);
        break;

    //:  /* end zDERIVED_GET */
    //:OF   zDERIVED_SET:
    case zDERIVED_SET:
        break;
    }

    //:     /* end zDERIVED_SET */
    //:END  /* case */
    return (0);
    // END
}

From source file:com.quinsoft.zencas.sHost_Object.java

public int osHost_dBudgetVarAccountPct(View sHost, String InternalEntityStructure,
        String InternalAttribStructure, Integer GetOrSetFlag) {
    double dPct = 0.0;
    double dTempDecimal_0 = 0.0;

    //:CASE GetOrSetFlag
    switch (GetOrSetFlag) {
    //:OF   zDERIVED_GET:
    case zDERIVED_GET:

    //:dPct = sHost.Host.BudgetVarianceAccountPercent * 100
    {//  www. ja  v a 2 s. c  om
        MutableDouble md_dTempDecimal_0 = new MutableDouble(dTempDecimal_0);
        GetDecimalFromAttribute(md_dTempDecimal_0, sHost, "Host", "BudgetVarianceAccountPercent");
        dTempDecimal_0 = md_dTempDecimal_0.doubleValue();
    }
        dPct = dTempDecimal_0 * 100;

        //:StoreValueInRecord ( sHost,
        //:                  InternalEntityStructure, InternalAttribStructure, dPct, 0 )
        StoreValueInRecord(sHost, InternalEntityStructure, InternalAttribStructure, dPct, 0);
        break;

    //:  /* end zDERIVED_GET */
    //:OF   zDERIVED_SET:
    case zDERIVED_SET:
        break;
    }

    //:     /* end zDERIVED_SET */
    //:END  /* case */
    return (0);
    // END
}

From source file:com.quinsoft.zencas.mEmploy_Object.java

public int omEmploy_dTIAA_RetiremntBenefit(View mEmployOrig, String InternalEntityStructure,
        String InternalAttribStructure, Integer GetOrSetFlag) {
    zVIEW mEmploy = new zVIEW();
    //:VIEW mStdSalLST BASED ON LOD mStdSal
    zVIEW mStdSalLST = new zVIEW();
    //:DECIMAL BenefitAmount
    double BenefitAmount = 0.0;
    //:DECIMAL SalaryAmount
    double SalaryAmount = 0.0;
    //:STRING ( 32 ) szEntityName
    String szEntityName = null;//ww  w.  j av a2 s .com
    //:STRING ( 1 )  szSkipFlag
    String szSkipFlag = null;
    int RESULT = 0;
    int lTempInteger_0 = 0;
    double dTempDecimal_0 = 0.0;

    //:CASE GetOrSetFlag
    switch (GetOrSetFlag) {
    //:OF   zDERIVED_GET:
    case zDERIVED_GET:

        //:GET VIEW mStdSalLST NAMED "mStdSalLST"
        RESULT = GetViewByName(mStdSalLST, "mStdSalLST", mEmployOrig, zLEVEL_TASK);
        //:IF RESULT < 0
        if (RESULT < 0) {
            //:ACTIVATE mStdSalLST RootOnlyMultiple
            RESULT = ActivateObjectInstance(mStdSalLST, "mStdSal", mEmployOrig, 0, zACTIVATE_ROOTONLY_MULTIPLE);
            //:NAME VIEW mStdSalLST "mStdSalLST"
            SetNameForView(mStdSalLST, "mStdSalLST", null, zLEVEL_TASK);
        }

        //:END

        //:// If the attribute is on the root then the request is for Active Contract. Otherwise the request is for HistoricalContract.
        //:CreateViewFromView( mEmploy, mEmployOrig )
        CreateViewFromView(mEmploy, mEmployOrig);
    //:GetEntityNameFromStructure( InternalEntityStructure, szEntityName )
    {
        ZGLOBAL1_Operation m_ZGLOBAL1_Operation = new ZGLOBAL1_Operation(mEmployOrig);
        {
            StringBuilder sb_szEntityName;
            if (szEntityName == null)
                sb_szEntityName = new StringBuilder(32);
            else
                sb_szEntityName = new StringBuilder(szEntityName);
            m_ZGLOBAL1_Operation.GetEntityNameFromStructure(InternalEntityStructure, sb_szEntityName);
            szEntityName = sb_szEntityName.toString();
        }
        // m_ZGLOBAL1_Operation = null;  // permit gc  (unnecessary)
    }
        //:IF szEntityName = "Employee"
        if (ZeidonStringCompare(szEntityName, 1, 0, "Employee", 1, 0, 33) == 0) {
            //:SET CURSOR FIRST mEmploy.HistoricalContract WHERE mEmploy.HistoricalContract.Status = "A"
            RESULT = SetCursorFirstEntityByString(mEmploy, "HistoricalContract", "Status", "A", "");
            //:IF RESULT < zCURSOR_SET
            if (RESULT < zCURSOR_SET) {
                //:szSkipFlag = "Y"
                {
                    StringBuilder sb_szSkipFlag;
                    if (szSkipFlag == null)
                        sb_szSkipFlag = new StringBuilder(32);
                    else
                        sb_szSkipFlag = new StringBuilder(szSkipFlag);
                    ZeidonStringCopy(sb_szSkipFlag, 1, 0, "Y", 1, 0, 2);
                    szSkipFlag = sb_szSkipFlag.toString();
                }
                //:ELSE
            } else {
                //:// "Contracted Employee" contracts don't have any benefits.
                //:IF mEmploy.HistoricalContract.EmployeeClassification = "C"
                if (CompareAttributeToString(mEmploy, "HistoricalContract", "EmployeeClassification",
                        "C") == 0) {
                    //:szSkipFlag = "Y"
                    {
                        StringBuilder sb_szSkipFlag;
                        if (szSkipFlag == null)
                            sb_szSkipFlag = new StringBuilder(32);
                        else
                            sb_szSkipFlag = new StringBuilder(szSkipFlag);
                        ZeidonStringCopy(sb_szSkipFlag, 1, 0, "Y", 1, 0, 2);
                        szSkipFlag = sb_szSkipFlag.toString();
                    }
                }

                //:END
            }

            //:END
        }

        //:END

        //:IF szSkipFlag = ""
        if (ZeidonStringCompare(szSkipFlag, 1, 0, "", 1, 0, 2) == 0) {
            //:SET CURSOR FIRST mStdSalLST.StandardSalaryData WHERE mStdSalLST.StandardSalaryData.ID = mEmploy.HistContractStandardSalaryData.ID 
            {
                MutableInt mi_lTempInteger_0 = new MutableInt(lTempInteger_0);
                GetIntegerFromAttribute(mi_lTempInteger_0, mEmploy, "HistContractStandardSalaryData", "ID");
                lTempInteger_0 = mi_lTempInteger_0.intValue();
            }
            RESULT = SetCursorFirstEntityByInteger(mStdSalLST, "StandardSalaryData", "ID", lTempInteger_0, "");
            //:IF RESULT >= zCURSOR_SET AND 
            //:mEmploy.HistoricalContract.RetirementBenefitsType != "" AND 
            //:mEmploy.HistoricalContract.RetirementBenefitsType != "None"
            if (RESULT >= zCURSOR_SET
                    && CompareAttributeToString(mEmploy, "HistoricalContract", "RetirementBenefitsType",
                            "") != 0
                    && CompareAttributeToString(mEmploy, "HistoricalContract", "RetirementBenefitsType",
                            "None") != 0) {

                //:SalaryAmount = mEmploy.HistoricalContract.dTotalSalaryAmount
                {
                    MutableDouble md_SalaryAmount = new MutableDouble(SalaryAmount);
                    GetDecimalFromAttribute(md_SalaryAmount, mEmploy, "HistoricalContract",
                            "dTotalSalaryAmount");
                    SalaryAmount = md_SalaryAmount.doubleValue();
                }
                //:BenefitAmount = SalaryAmount * mStdSalLST.StandardSalaryData.WithholdingRetirementRate 
                {
                    MutableDouble md_dTempDecimal_0 = new MutableDouble(dTempDecimal_0);
                    GetDecimalFromAttribute(md_dTempDecimal_0, mStdSalLST, "StandardSalaryData",
                            "WithholdingRetirementRate");
                    dTempDecimal_0 = md_dTempDecimal_0.doubleValue();
                }
                BenefitAmount = SalaryAmount * dTempDecimal_0;
                //:StoreValueInRecord( mEmploy,InternalEntityStructure, InternalAttribStructure, BenefitAmount, 0 )
                StoreValueInRecord(mEmploy, InternalEntityStructure, InternalAttribStructure, BenefitAmount, 0);
                //:ELSE
            } else {
                //:StoreStringInRecord ( mEmploy,
                //:                   InternalEntityStructure, InternalAttribStructure, "" )
                StoreStringInRecord(mEmploy, InternalEntityStructure, InternalAttribStructure, "");
            }

            //:END
            //:ELSE
        } else {
            //:StoreStringInRecord ( mEmploy,
            //:                   InternalEntityStructure, InternalAttribStructure, "" )
            StoreStringInRecord(mEmploy, InternalEntityStructure, InternalAttribStructure, "");
        }

        //:END
        //:DropView( mEmploy )
        DropView(mEmploy);
        break;

    //:  /* end zDERIVED_GET */
    //:OF   zDERIVED_SET:
    case zDERIVED_SET:
        break;
    }

    //:     /* end zDERIVED_SET */
    //:END  /* case */
    return (0);
    // END
}

From source file:de.biomedical_imaging.ij.steger.Width.java

public void compute_line_width(float[] dx, float[] dy, int width, int height, double sigma, int mode,
        boolean correct_pos, ArrayList<Line> contours, MutableInt num_contours) {
    float[] grad;
    int i, j, k;//from  w w w. ja  v  a 2  s .co m
    int r, c, l;
    int x, y, dir;
    Offset[] line;
    int max_line, num_line = 0;
    double length;
    Line cont;
    int num_points, max_num_points;
    double[] width_r, width_l;
    double[] grad_r, grad_l;
    double[] pos_x, pos_y, correct, asymm, contrast;
    double d, dr, dc, drr, drc, dcc;
    double i1, i2, i3, i4, i5, i6, i7, i8, i9;
    double t1, t2, t3, t4, t5, t6;
    double[] eigval = new double[2];
    double[][] eigvec = new double[2][2];
    double a, b, t = 0;
    int num = 0;
    double nx, ny;
    double n1, n2;
    double p1, p2;
    double val;
    double px, py;
    Position p = new Position();
    max_num_points = 0;
    for (i = 0; i < num_contours.getValue(); i++) {
        num_points = contours.get(i).num;
        if (num_points > max_num_points)
            max_num_points = num_points;
    }

    width_l = new double[max_num_points];
    width_r = new double[max_num_points];
    grad_l = new double[max_num_points];
    grad_r = new double[max_num_points];
    pos_x = new double[max_num_points];
    pos_y = new double[max_num_points];
    correct = new double[max_num_points];
    contrast = new double[max_num_points];
    asymm = new double[max_num_points];

    grad = new float[(width * height)];

    length = 2.5 * sigma;
    max_line = (int) Math.ceil(length * 3);
    line = new Offset[max_line];
    for (int o = 0; o < line.length; o++) {
        line[o] = new Offset();
    }

    /* Compute the gradient image. */
    for (r = 0; r < height; r++) {
        for (c = 0; c < width; c++) {
            l = LinesUtil.LINCOOR(r, c, width);
            grad[l] = (float) Math.sqrt(dx[l] * dx[l] + dy[l] * dy[l]);
        }
    }

    for (i = 0; i < num_contours.getValue(); i++) {
        cont = contours.get(i);
        num_points = cont.num;

        for (j = 0; j < num_points; j++) {
            px = cont.row[j];
            py = cont.col[j];
            pos_x[j] = px;
            pos_y[j] = py;
            r = (int) Math.floor(px + 0.5);
            c = (int) Math.floor(py + 0.5);
            nx = Math.cos(cont.angle[j]);
            ny = Math.sin(cont.angle[j]);
            /* Compute the search line. */
            MutableInt num_lineh = new MutableInt(num_line);
            bresenham(nx, ny, 0.0, 0.0, length, line, num_lineh);
            num_line = num_lineh.intValue();
            width_r[j] = width_l[j] = 0;
            /* Look on both sides of the line. */
            for (dir = -1; dir <= 1; dir += 2) {
                for (k = 0; k < num_line; k++) {
                    x = LinesUtil.BR(r + dir * line[k].x, height);
                    y = LinesUtil.BC(c + dir * line[k].y, width);
                    i1 = grad[LinesUtil.LINCOOR(LinesUtil.BR(x - 1, height), LinesUtil.BC(y - 1, width),
                            width)];
                    i2 = grad[LinesUtil.LINCOOR(LinesUtil.BR(x - 1, height), y, width)];
                    i3 = grad[LinesUtil.LINCOOR(LinesUtil.BR(x - 1, height), LinesUtil.BC(y + 1, width),
                            width)];
                    i4 = grad[LinesUtil.LINCOOR(x, LinesUtil.BC(y - 1, width), width)];
                    i5 = grad[LinesUtil.LINCOOR(x, y, width)];
                    i6 = grad[LinesUtil.LINCOOR(x, LinesUtil.BC(y + 1, width), width)];
                    i7 = grad[LinesUtil.LINCOOR(LinesUtil.BR(x + 1, height), LinesUtil.BC(y - 1, width),
                            width)];
                    i8 = grad[LinesUtil.LINCOOR(LinesUtil.BR(x + 1, height), y, width)];
                    i9 = grad[LinesUtil.LINCOOR(LinesUtil.BR(x + 1, height), LinesUtil.BC(y + 1, width),
                            width)];
                    t1 = i1 + i2 + i3;
                    t2 = i4 + i5 + i6;
                    t3 = i7 + i8 + i9;
                    t4 = i1 + i4 + i7;
                    t5 = i2 + i5 + i8;
                    t6 = i3 + i6 + i9;
                    dr = (t3 - t1) / 6;
                    dc = (t6 - t4) / 6;
                    drr = (t1 - 2 * t2 + t3) / 6;
                    dcc = (t4 - 2 * t5 + t6) / 6;
                    drc = (i1 - i3 - i7 + i9) / 4;
                    p.compute_eigenvals(2 * drr, drc, 2 * dcc, eigval, eigvec);
                    val = -eigval[0];
                    if (val > 0.0) {
                        n1 = eigvec[0][0];
                        n2 = eigvec[0][1];
                        a = 2.0 * (drr * n1 * n1 + drc * n1 * n2 + dcc * n2 * n2);
                        b = dr * n1 + dc * n2;
                        MutableDouble th = new MutableDouble(t);
                        MutableInt numh = new MutableInt(num);
                        p.solve_linear(a, b, th, numh);
                        t = th.getValue();
                        num = numh.getValue();
                        if (num != 0) {
                            p1 = t * n1;
                            p2 = t * n2;
                            if (Math.abs(p1) <= 0.5 && Math.abs(p2) <= 0.5) {
                                /* Project the maximum point position perpendicularly onto the
                                   search line. */
                                a = 1;
                                b = nx * (px - (r + dir * line[k].x + p1))
                                        + ny * (py - (c + dir * line[k].y + p2));
                                th = new MutableDouble(t);
                                numh = new MutableInt(num);
                                p.solve_linear(a, b, th, numh);
                                t = th.getValue();
                                num = numh.getValue();
                                d = (-i1 + 2 * i2 - i3 + 2 * i4 + 5 * i5 + 2 * i6 - i7 + 2 * i8 - i9) / 9;
                                if (dir == 1) {
                                    grad_r[j] = d + p1 * dr + p2 * dc + p1 * p1 * drr + p1 * p2 * drc
                                            + p2 * p2 * dcc;
                                    width_r[j] = Math.abs(t);
                                } else {
                                    grad_l[j] = d + p1 * dr + p2 * dc + p1 * p1 * drr + p1 * p2 * drc
                                            + p2 * p2 * dcc;
                                    width_l[j] = Math.abs(t);
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }

        fix_locations(width_l, width_r, grad_l, grad_r, pos_x, pos_y, correct, contrast, asymm, sigma, mode,
                correct_pos, cont);
    }
}

From source file:de.sanandrew.mods.claysoldiers.entity.EntityClayMan.java

public double getLookRangeRad() {
    MutableDouble radiusMT = new MutableDouble(8.0D);

    for (SoldierUpgradeInst upg : this.p_upgrades.values()) {
        upg.getUpgrade().getLookRange(this, upg, radiusMT);
    }//w  w  w.j  av a2  s  . c  om

    return radiusMT.getValue();
}

From source file:com.quinsoft.zencas.mEmploy_Object.java

public int omEmploy_dLifeDisabilityBenefit(View mEmployOrig, String InternalEntityStructure,
        String InternalAttribStructure, Integer GetOrSetFlag) {
    zVIEW mEmploy = new zVIEW();
    //:VIEW mStdSalLST BASED ON LOD mStdSal
    zVIEW mStdSalLST = new zVIEW();
    //:VIEW wXferO REGISTERED AS wXferO
    zVIEW wXferO = new zVIEW();
    int RESULT = 0;
    //:DECIMAL BenefitAmount
    double BenefitAmount = 0.0;
    //:STRING ( 32 ) szEntityName
    String szEntityName = null;//from  www  . j  av  a 2s  .  co m
    //:STRING ( 1 )  szSkipFlag
    String szSkipFlag = null;
    //:STRING ( 20 ) szDecimal
    String szDecimal = null;
    int lTempInteger_0 = 0;
    double dTempDecimal_0 = 0.0;
    double dTempDecimal_1 = 0.0;
    double dTempDecimal_2 = 0.0;

    RESULT = GetViewByName(wXferO, "wXferO", mEmployOrig, zLEVEL_TASK);

    //:CASE GetOrSetFlag
    switch (GetOrSetFlag) {
    //:OF   zDERIVED_GET:
    case zDERIVED_GET:

        //:GET VIEW mStdSalLST NAMED "mStdSalLST"
        RESULT = GetViewByName(mStdSalLST, "mStdSalLST", mEmployOrig, zLEVEL_TASK);
        //:IF RESULT < 0
        if (RESULT < 0) {
            //:ACTIVATE mStdSalLST RootOnlyMultiple
            RESULT = ActivateObjectInstance(mStdSalLST, "mStdSal", mEmployOrig, 0, zACTIVATE_ROOTONLY_MULTIPLE);
            //:NAME VIEW mStdSalLST "mStdSalLST"
            SetNameForView(mStdSalLST, "mStdSalLST", null, zLEVEL_TASK);
        }

        //:END

        //:// If the attribute is on the root then the request is for Active Contract. Otherwise the request is for HistoricalContract.
        //:CreateViewFromView( mEmploy, mEmployOrig )
        CreateViewFromView(mEmploy, mEmployOrig);
        //:NAME VIEW mEmploy "mEmployDisability"
        SetNameForView(mEmploy, "mEmployDisability", null, zLEVEL_TASK);
    //:GetEntityNameFromStructure( InternalEntityStructure, szEntityName )
    {
        ZGLOBAL1_Operation m_ZGLOBAL1_Operation = new ZGLOBAL1_Operation(mEmployOrig);
        {
            StringBuilder sb_szEntityName;
            if (szEntityName == null)
                sb_szEntityName = new StringBuilder(32);
            else
                sb_szEntityName = new StringBuilder(szEntityName);
            m_ZGLOBAL1_Operation.GetEntityNameFromStructure(InternalEntityStructure, sb_szEntityName);
            szEntityName = sb_szEntityName.toString();
        }
        // m_ZGLOBAL1_Operation = null;  // permit gc  (unnecessary)
    }
        //:IF szEntityName = "Employee"
        if (ZeidonStringCompare(szEntityName, 1, 0, "Employee", 1, 0, 33) == 0) {
            //:SET CURSOR FIRST mEmploy.HistoricalContract WHERE mEmploy.HistoricalContract.Status = "A"
            RESULT = SetCursorFirstEntityByString(mEmploy, "HistoricalContract", "Status", "A", "");
            //:IF RESULT < zCURSOR_SET
            if (RESULT < zCURSOR_SET) {
                //:szSkipFlag = "Y"
                {
                    StringBuilder sb_szSkipFlag;
                    if (szSkipFlag == null)
                        sb_szSkipFlag = new StringBuilder(32);
                    else
                        sb_szSkipFlag = new StringBuilder(szSkipFlag);
                    ZeidonStringCopy(sb_szSkipFlag, 1, 0, "Y", 1, 0, 2);
                    szSkipFlag = sb_szSkipFlag.toString();
                }
                //:ELSE
            } else {
                //:// "Contracted Employee" contracts don't have any benefits.
                //:IF mEmploy.HistoricalContract.EmployeeClassification = "C"
                if (CompareAttributeToString(mEmploy, "HistoricalContract", "EmployeeClassification",
                        "C") == 0) {
                    //:szSkipFlag = "Y"
                    {
                        StringBuilder sb_szSkipFlag;
                        if (szSkipFlag == null)
                            sb_szSkipFlag = new StringBuilder(32);
                        else
                            sb_szSkipFlag = new StringBuilder(szSkipFlag);
                        ZeidonStringCopy(sb_szSkipFlag, 1, 0, "Y", 1, 0, 2);
                        szSkipFlag = sb_szSkipFlag.toString();
                    }
                }

                //:END
            }

            //:END
        }

        //:END

        //:IF szSkipFlag = ""
        if (ZeidonStringCompare(szSkipFlag, 1, 0, "", 1, 0, 2) == 0) {
            //:SET CURSOR FIRST mStdSalLST.StandardSalaryData WHERE mStdSalLST.StandardSalaryData.ID = mEmploy.HistContractStandardSalaryData.ID 
            {
                MutableInt mi_lTempInteger_0 = new MutableInt(lTempInteger_0);
                GetIntegerFromAttribute(mi_lTempInteger_0, mEmploy, "HistContractStandardSalaryData", "ID");
                lTempInteger_0 = mi_lTempInteger_0.intValue();
            }
            RESULT = SetCursorFirstEntityByInteger(mStdSalLST, "StandardSalaryData", "ID", lTempInteger_0, "");
            //:IF RESULT >= zCURSOR_SET AND mEmploy.HistoricalContract.FullPartTimeFlag = "F"
            if (RESULT >= zCURSOR_SET
                    && CompareAttributeToString(mEmploy, "HistoricalContract", "FullPartTimeFlag", "F") == 0) {
                //:BenefitAmount = mEmploy.HistoricalContract.dTotalSalaryAmount *
                //:             ( mStdSalLST.StandardSalaryData.DisabilityInsuranceRate / 100 ) +
                //:               mStdSalLST.StandardSalaryData.LifeInsuranceAmount 
                {
                    MutableDouble md_dTempDecimal_0 = new MutableDouble(dTempDecimal_0);
                    GetDecimalFromAttribute(md_dTempDecimal_0, mStdSalLST, "StandardSalaryData",
                            "DisabilityInsuranceRate");
                    dTempDecimal_0 = md_dTempDecimal_0.doubleValue();
                }
                {
                    MutableDouble md_dTempDecimal_1 = new MutableDouble(dTempDecimal_1);
                    GetDecimalFromAttribute(md_dTempDecimal_1, mEmploy, "HistoricalContract",
                            "dTotalSalaryAmount");
                    dTempDecimal_1 = md_dTempDecimal_1.doubleValue();
                }
                {
                    MutableDouble md_dTempDecimal_2 = new MutableDouble(dTempDecimal_2);
                    GetDecimalFromAttribute(md_dTempDecimal_2, mStdSalLST, "StandardSalaryData",
                            "LifeInsuranceAmount");
                    dTempDecimal_2 = md_dTempDecimal_2.doubleValue();
                }
                BenefitAmount = dTempDecimal_1 * (dTempDecimal_0 / 100) + dTempDecimal_2;
                //:StoreValueInRecord( mEmploy,InternalEntityStructure, InternalAttribStructure, BenefitAmount, 0 )
                StoreValueInRecord(mEmploy, InternalEntityStructure, InternalAttribStructure, BenefitAmount, 0);
                //:ELSE
            } else {
                //:StoreStringInRecord ( mEmploy,
                //:                   InternalEntityStructure, InternalAttribStructure, "" )
                StoreStringInRecord(mEmploy, InternalEntityStructure, InternalAttribStructure, "");
            }

            //:END
        }

        //:END
        //:DropView( mEmploy )
        DropView(mEmploy);
        break;

    //:  /* end zDERIVED_GET */
    //:OF   zDERIVED_SET:
    case zDERIVED_SET:
        break;
    }

    //:     /* end zDERIVED_SET */
    //:END  /* case */
    return (0);
    // END
}

From source file:com.quinsoft.zencas.mEmploy_Object.java

public int omEmploy_dMedPlanCostBenefit(View mEmployOrig, String InternalEntityStructure,
        String InternalAttribStructure, Integer GetOrSetFlag) {
    zVIEW mEmploy = new zVIEW();
    //:VIEW mMedCodeLST BASED ON LOD mMedCode
    zVIEW mMedCodeLST = new zVIEW();
    //:DECIMAL BenefitAmount
    double BenefitAmount = 0.0;
    //:STRING ( 32 ) szEntityName
    String szEntityName = null;// w  w  w .  j  ava2 s.c o m
    //:STRING ( 1 )  szSkipFlag
    String szSkipFlag = null;
    //:STRING ( 4 )  szCurrentMedicalYear
    String szCurrentMedicalYear = null;
    //:STRING ( 9 )  szFiscalYearLabel
    String szFiscalYearLabel = null;
    int RESULT = 0;
    zVIEW vTempViewVar_0 = new zVIEW();
    int lTempInteger_0 = 0;

    //:CASE GetOrSetFlag
    switch (GetOrSetFlag) {
    //:OF   zDERIVED_GET:
    case zDERIVED_GET:

        //:GET VIEW mMedCodeLST NAMED "mAllMedCodeLST"
        RESULT = GetViewByName(mMedCodeLST, "mAllMedCodeLST", mEmployOrig, zLEVEL_TASK);
        //:IF RESULT < 0
        if (RESULT < 0) {
            //:ACTIVATE mMedCodeLST RootOnlyMultiple WHERE mMedCodeLST.MedicalCode.FunctionalAreaFlag = ""
            omEmploy_fnLocalBuildQual_0(mEmployOrig, vTempViewVar_0);
            RESULT = ActivateObjectInstance(mMedCodeLST, "mMedCode", mEmployOrig, vTempViewVar_0,
                    zACTIVATE_ROOTONLY_MULTIPLE);
            DropView(vTempViewVar_0);
            //:NAME VIEW mMedCodeLST "mAllMedCodeLST"
            SetNameForView(mMedCodeLST, "mAllMedCodeLST", null, zLEVEL_TASK);
        }

        //:END

        //:// If the attribute is on the root then the request is for Active Contract. Otherwise the request is for HistoricalContract.
        //:CreateViewFromView( mEmploy, mEmployOrig )
        CreateViewFromView(mEmploy, mEmployOrig);
    //:GetEntityNameFromStructure( InternalEntityStructure, szEntityName )
    {
        ZGLOBAL1_Operation m_ZGLOBAL1_Operation = new ZGLOBAL1_Operation(mEmployOrig);
        {
            StringBuilder sb_szEntityName;
            if (szEntityName == null)
                sb_szEntityName = new StringBuilder(32);
            else
                sb_szEntityName = new StringBuilder(szEntityName);
            m_ZGLOBAL1_Operation.GetEntityNameFromStructure(InternalEntityStructure, sb_szEntityName);
            szEntityName = sb_szEntityName.toString();
        }
        // m_ZGLOBAL1_Operation = null;  // permit gc  (unnecessary)
    }
        //:IF szEntityName = "Employee"
        if (ZeidonStringCompare(szEntityName, 1, 0, "Employee", 1, 0, 33) == 0) {
            //:SET CURSOR FIRST mEmploy.HistoricalContract WHERE mEmploy.HistoricalContract.Status = "A"
            RESULT = SetCursorFirstEntityByString(mEmploy, "HistoricalContract", "Status", "A", "");
            //:IF RESULT < zCURSOR_SET
            if (RESULT < zCURSOR_SET) {
                //:szSkipFlag = "Y"
                {
                    StringBuilder sb_szSkipFlag;
                    if (szSkipFlag == null)
                        sb_szSkipFlag = new StringBuilder(32);
                    else
                        sb_szSkipFlag = new StringBuilder(szSkipFlag);
                    ZeidonStringCopy(sb_szSkipFlag, 1, 0, "Y", 1, 0, 2);
                    szSkipFlag = sb_szSkipFlag.toString();
                }
                //:ELSE
            } else {
                //:// "Contracted Employee" contracts don't have any benefits.
                //:IF mEmploy.HistoricalContract.EmployeeClassification = "C"
                if (CompareAttributeToString(mEmploy, "HistoricalContract", "EmployeeClassification",
                        "C") == 0) {
                    //:szSkipFlag = "Y"
                    {
                        StringBuilder sb_szSkipFlag;
                        if (szSkipFlag == null)
                            sb_szSkipFlag = new StringBuilder(32);
                        else
                            sb_szSkipFlag = new StringBuilder(szSkipFlag);
                        ZeidonStringCopy(sb_szSkipFlag, 1, 0, "Y", 1, 0, 2);
                        szSkipFlag = sb_szSkipFlag.toString();
                    }
                }

                //:END
            }

            //:END
        }

        //:END

        //:IF szSkipFlag = ""
        if (ZeidonStringCompare(szSkipFlag, 1, 0, "", 1, 0, 2) == 0) {
            //:IF mEmploy.HistoricalContract.MedicalCode != ""
            if (CompareAttributeToString(mEmploy, "HistoricalContract", "MedicalCode", "") != 0) {
                //:// Changed by DonC on 4/23/2010 to use last 4 characters of label.
                //:szFiscalYearLabel = mEmploy.HistoricalContractGLFiscalYear.FiscalYearLabel
                {
                    MutableInt mi_lTempInteger_0 = new MutableInt(lTempInteger_0);
                    StringBuilder sb_szFiscalYearLabel;
                    if (szFiscalYearLabel == null)
                        sb_szFiscalYearLabel = new StringBuilder(32);
                    else
                        sb_szFiscalYearLabel = new StringBuilder(szFiscalYearLabel);
                    GetVariableFromAttribute(sb_szFiscalYearLabel, mi_lTempInteger_0, 'S', 10, mEmploy,
                            "HistoricalContractGLFiscalYear", "FiscalYearLabel", "", 0);
                    lTempInteger_0 = mi_lTempInteger_0.intValue();
                    szFiscalYearLabel = sb_szFiscalYearLabel.toString();
                }
                //:szCurrentMedicalYear = szFiscalYearLabel[6:4]
                {
                    StringBuilder sb_szCurrentMedicalYear;
                    if (szCurrentMedicalYear == null)
                        sb_szCurrentMedicalYear = new StringBuilder(32);
                    else
                        sb_szCurrentMedicalYear = new StringBuilder(szCurrentMedicalYear);
                    ZeidonStringCopy(sb_szCurrentMedicalYear, 1, 0, szFiscalYearLabel, 6, 4, 5);
                    szCurrentMedicalYear = sb_szCurrentMedicalYear.toString();
                }
                //://szCurrentYear = mEmploy.HistoricalContractGLFiscalYear.FiscalYearLabel   // The MedicalCode.Year is the first 4 chars of FiscalYearLabel 
                //:SET CURSOR FIRST mMedCodeLST.MedicalCode 
                //:        WHERE mMedCodeLST.MedicalCode.Year = szCurrentMedicalYear
                //:          AND mMedCodeLST.MedicalCode.Code = mEmploy.HistoricalContract.MedicalCode
                RESULT = SetCursorFirstEntity(mMedCodeLST, "MedicalCode", "");
                if (RESULT > zCURSOR_UNCHANGED) {
                    while (RESULT > zCURSOR_UNCHANGED && (CompareAttributeToString(mMedCodeLST, "MedicalCode",
                            "Year", szCurrentMedicalYear) != 0
                            || CompareAttributeToAttribute(mMedCodeLST, "MedicalCode", "Code", mEmploy,
                                    "HistoricalContract", "MedicalCode") != 0)) {
                        RESULT = SetCursorNextEntity(mMedCodeLST, "MedicalCode", "");
                    }

                }

                //:IF RESULT >= zCURSOR_SET
                if (RESULT >= zCURSOR_SET) {
                    //:BenefitAmount = mMedCodeLST.MedicalCode.MedicalPlanCost
                    {
                        MutableDouble md_BenefitAmount = new MutableDouble(BenefitAmount);
                        GetDecimalFromAttribute(md_BenefitAmount, mMedCodeLST, "MedicalCode",
                                "MedicalPlanCost");
                        BenefitAmount = md_BenefitAmount.doubleValue();
                    }
                    //:StoreValueInRecord( mEmploy,InternalEntityStructure, InternalAttribStructure, BenefitAmount, 0 )
                    StoreValueInRecord(mEmploy, InternalEntityStructure, InternalAttribStructure, BenefitAmount,
                            0);
                    //:ELSE
                } else {
                    //:StoreStringInRecord ( mEmploy,
                    //:                   InternalEntityStructure, InternalAttribStructure, "" )
                    StoreStringInRecord(mEmploy, InternalEntityStructure, InternalAttribStructure, "");
                }

                //:END
                //:ELSE
            } else {
                //:StoreStringInRecord ( mEmploy,
                //:                   InternalEntityStructure, InternalAttribStructure, "" )
                StoreStringInRecord(mEmploy, InternalEntityStructure, InternalAttribStructure, "");
            }

            //:END
            //:ELSE
        } else {
            //:StoreStringInRecord ( mEmploy,
            //:                   InternalEntityStructure, InternalAttribStructure, "" )
            StoreStringInRecord(mEmploy, InternalEntityStructure, InternalAttribStructure, "");
        }

        //:END
        //:DropView( mEmploy )
        DropView(mEmploy);
        break;

    //:  /* end zDERIVED_GET */
    //:OF   zDERIVED_SET:
    case zDERIVED_SET:
        break;
    }

    //:     /* end zDERIVED_SET */
    //:END  /* case */
    return (0);
    // END
}

From source file:com.arksoft.epamms.ZGlobal1_Operation.java

public Double SetDecimalPrecisionRounded(Double pdDecimalValue, int ulNumberOfDecimals) {
    StringBuilder sb = new StringBuilder(ulNumberOfDecimals > 0 ? ulNumberOfDecimals + 5 : 25);

    SysConvertDecimalToString(pdDecimalValue, sb, (int) ulNumberOfDecimals);
    MutableDouble d = new MutableDouble(pdDecimalValue);
    SysConvertStringToDecimal(sb.toString(), d);
    return d.toDouble();

}