List of usage examples for org.apache.commons.lang3.mutable MutableDouble MutableDouble
public MutableDouble(final String value) throws NumberFormatException
From source file:eu.project.ttc.models.CrossTable.java
private MutableDouble getScoreFromMap(Map<Term, MutableDouble> aScoreMap, Term key) { if (aScoreMap.get(key) == null) aScoreMap.put(key, new MutableDouble(0)); return aScoreMap.get(key); }
From source file:com.github.igor_kudryashov.utils.notes.NotesDocument.java
/** * As lotus.domino.Document.replaceItemValue() method modifies the value of the document Lotus * Notes, but only if the new value is different from existing * * @param item//from w ww.j a va2 s. c om * - the lotus.Domino.Item object. * @param value * - the new value of Notes item. * @return <code>true</code> if the value has been updated, <code>false</code> otherwise. * @throws NotesException */ @SuppressWarnings("unchecked") public static boolean updateItemValue(Item item, Object value) throws NotesException { Vector<Object> vec = item.getValues(); if (value.getClass().getName().contains("Vector")) { if (vec.equals(value)) { return false; } else { item.setValues((Vector<Object>) value); } } else { if (vec.size() == 1) { if (vec.firstElement() instanceof Number) { // because lotus.docmino.Item.getValues() alvays return java.util.Vector with // Double elements for Numeric items, // value parameter must be converted to Double MutableDouble md = new MutableDouble((Number) value); if (Double.compare((Double) vec.firstElement(), md.getValue()) == 0) { return false; } } else if (vec.firstElement() instanceof String) { if (vec.firstElement().equals((String) value)) { return false; } } else { if (vec.firstElement().equals(value)) { return false; } } } vec = new Vector<Object>(); vec.add(value); item.setValues(vec); } return true; }
From source file:com.quinsoft.zencas.sHost_Object.java
public int osHost_dBudgetVarCC_Pct(View sHost, String InternalEntityStructure, String InternalAttribStructure, Integer GetOrSetFlag) {//from ww w .ja v a 2s. c o m double dPct = 0.0; double dTempDecimal_0 = 0.0; //:CASE GetOrSetFlag switch (GetOrSetFlag) { //:OF zDERIVED_GET: case zDERIVED_GET: //:dPct = sHost.Host.BudgetVarianceCC_Percent * 100 { MutableDouble md_dTempDecimal_0 = new MutableDouble(dTempDecimal_0); GetDecimalFromAttribute(md_dTempDecimal_0, sHost, "Host", "BudgetVarianceCC_Percent"); 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.wWebXfer_Object.java
public int owWebXfer_dTotalBudgetedAmount(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.dTotalBudgetedAmount { MutableDouble md_dTempDecimal_0 = new MutableDouble(dTempDecimal_0); GetDecimalFromAttribute(md_dTempDecimal_0, mGLCCURT, "GLCostCenter", "dTotalBudgetedAmount"); 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.hfi.cheetah.mRasta_Object.java
public int omRasta_dTotalCharges(View mRasta, String InternalEntityStructure, String InternalAttribStructure, Integer GetOrSetFlag) {//from w w w. ja v a2 s . co m double dValue = 0.0; int lTempInteger_0 = 0; int RESULT = 0; double dTempDecimal_0 = 0.0; //:CASE GetOrSetFlag switch (GetOrSetFlag) { //:OF zDERIVED_GET: case zDERIVED_GET: //:dValue = 0 dValue = 0; //:IF mRasta.ApplicantVisit EXISTS lTempInteger_0 = CheckExistenceOfEntity(mRasta, "ApplicantVisit"); if (lTempInteger_0 == 0) { //:FOR EACH mRasta.ApplicantVisit RESULT = SetCursorFirstEntity(mRasta, "ApplicantVisit", ""); while (RESULT > zCURSOR_UNCHANGED) { //:FOR EACH mRasta.VisitBillingLine RESULT = SetCursorFirstEntity(mRasta, "VisitBillingLine", ""); while (RESULT > zCURSOR_UNCHANGED) { //:IF mRasta.VisitBillingLine.TotalCharges != "" if (CompareAttributeToString(mRasta, "VisitBillingLine", "TotalCharges", "") != 0) { //:dValue = dValue + mRasta.VisitBillingLine.TotalCharges { MutableDouble md_dTempDecimal_0 = new MutableDouble(dTempDecimal_0); GetDecimalFromAttribute(md_dTempDecimal_0, mRasta, "VisitBillingLine", "TotalCharges"); dTempDecimal_0 = md_dTempDecimal_0.doubleValue(); } dValue = dValue + dTempDecimal_0; } RESULT = SetCursorNextEntity(mRasta, "VisitBillingLine", ""); //:END } RESULT = SetCursorNextEntity(mRasta, "ApplicantVisit", ""); //:END } //:END } //:END //:StoreValueInRecord( mRasta, InternalEntityStructure, //: InternalAttribStructure, dValue ,0 ) StoreValueInRecord(mRasta, InternalEntityStructure, InternalAttribStructure, dValue, 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.lTrnscpt_Object.java
public int olTrnscpt_dGradePointAverage(View lTrnscpt, String InternalEntityStructure, String InternalAttribStructure, Integer GetOrSetFlag) { zVIEW lTrnscptT = new zVIEW(); //:DECIMAL dGPA double dGPA = 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(); ;//ww w . j a v a 2s . co 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) { //:dGPA = lTrnscptT.PrintGroup.CumulativeGPA { MutableDouble md_dGPA = new MutableDouble(dGPA); GetDecimalFromAttribute(md_dGPA, lTrnscptT, "PrintGroup", "CumulativeGPA"); dGPA = md_dGPA.doubleValue(); } //:StoreValueInRecord ( lTrnscpt, //: InternalEntityStructure, InternalAttribStructure, dGPA, 0 ) StoreValueInRecord(lTrnscpt, InternalEntityStructure, InternalAttribStructure, dGPA, 0); //:ELSE } else { //:StoreStringInRecord ( lTrnscpt, //: InternalEntityStructure, InternalAttribStructure, "" ) StoreStringInRecord(lTrnscpt, InternalEntityStructure, InternalAttribStructure, ""); } //:END //:DropView( lTrnscptT ) DropView(lTrnscptT); 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_dWorkersCompBenefit(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;//from w w w .ja v a 2 s. c o m //: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 if (RESULT >= zCURSOR_SET) { //:SalaryAmount = mEmploy.HistoricalContract.dTotalSalaryAmount { MutableDouble md_SalaryAmount = new MutableDouble(SalaryAmount); GetDecimalFromAttribute(md_SalaryAmount, mEmploy, "HistoricalContract", "dTotalSalaryAmount"); SalaryAmount = md_SalaryAmount.doubleValue(); } //:BenefitAmount = ( SalaryAmount * mStdSalLST.StandardSalaryData.WorkersCompensationRate ) / 100 { MutableDouble md_dTempDecimal_0 = new MutableDouble(dTempDecimal_0); GetDecimalFromAttribute(md_dTempDecimal_0, mStdSalLST, "StandardSalaryData", "WorkersCompensationRate"); dTempDecimal_0 = md_dTempDecimal_0.doubleValue(); } BenefitAmount = (SalaryAmount * dTempDecimal_0) / 100; //: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.lTrnscpt_Object.java
public int olTrnscpt_dEarnedCredits(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(); ;//from www.ja v 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.CumulativeEarnedCredits { MutableDouble md_TotalCredits = new MutableDouble(TotalCredits); GetDecimalFromAttribute(md_TotalCredits, lTrnscptT, "PrintGroup", "CumulativeEarnedCredits"); 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:edu.byu.nlp.dataset.BasicSparseFeatureVector.java
@Override public Double getValue(final int targetIndex) { final MutableDouble retval = new MutableDouble(Double.NaN); visitSparseEntries(new EntryVisitor() { @Override//w w w .j ava 2s . c om public void visitEntry(int index, double value) { if (index == targetIndex) { retval.setValue(value); return; } } }); return (Double.isNaN(retval.getValue())) ? null : retval.getValue(); }
From source file:com.quinsoft.zencas.wWebXfer_Object.java
public int owWebXfer_dTotalListedPO_Amounts(View wWebXfer, String InternalEntityStructure, String InternalAttribStructure, Integer GetOrSetFlag) { zVIEW lPOList = new zVIEW(); //:VIEW lPOListT BASED ON LOD lPOList zVIEW lPOListT = 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 lPOList NAMED "lPOList" RESULT = GetViewByName(lPOList, "lPOList", wWebXfer, zLEVEL_TASK); //:IF RESULT >= 0 if (RESULT >= 0) { //:CreateViewFromView( lPOListT, lPOList ) CreateViewFromView(lPOListT, lPOList); //:dTotalAmount = 0 dTotalAmount = 0;//from w ww . ja v a 2 s .c o m //:FOR EACH lPOListT.PurchaseOrder RESULT = SetCursorFirstEntity(lPOListT, "PurchaseOrder", ""); while (RESULT > zCURSOR_UNCHANGED) { //:dTotalAmount = dTotalAmount + lPOListT.PurchaseOrder.TotalAmount { MutableDouble md_dTempDecimal_0 = new MutableDouble(dTempDecimal_0); GetDecimalFromAttribute(md_dTempDecimal_0, lPOListT, "PurchaseOrder", "TotalAmount"); dTempDecimal_0 = md_dTempDecimal_0.doubleValue(); } dTotalAmount = dTotalAmount + dTempDecimal_0; RESULT = SetCursorNextEntity(lPOListT, "PurchaseOrder", ""); } //:END //:DropView( lPOListT ) DropView(lPOListT); //: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 }