code
stringlengths
10
174k
nl
stringlengths
3
129k
Expression compileFunction(int opPos) throws TransformerException { int endFunc=opPos + getOp(opPos + 1) - 1; opPos=getFirstChildPos(opPos); int funcID=getOp(opPos); opPos++; if (-1 != funcID) { Function func=m_functionTable.getFunction(funcID); if (func instanceof FuncExtFunctionAvailable) ((FuncExtFunctionAvailable)func).setFunctionTable(m_functionTable); func.postCompileStep(this); try { int i=0; for (int p=opPos; p < endFunc; p=getNextOpPos(p), i++) { func.setArg(compile(p),i); } func.checkNumberArgs(i); } catch ( WrongNumberArgsException wnae) { java.lang.String name=m_functionTable.getFunctionName(funcID); m_errorHandler.fatalError(new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_ONLY_ALLOWS,new Object[]{name,wnae.getMessage()}),m_locator)); } return func; } else { error(XPATHErrorResources.ER_FUNCTION_TOKEN_NOT_FOUND,null); return null; } }
Compile a built-in XPath function.
public byte[] serialise(final Object object) throws SerialisationException { return serialise(object,false); }
Serialises an object.
public DeleteResponseMessage(DeleteResponseMessage other){ __isset_bitfield=other.__isset_bitfield; if (other.isSetHeader()) { this.header=new AsyncMessageHeader(other.header); } this.deleted=other.deleted; }
Performs a deep copy on <i>other</i>.
public void createPackageContents(){ if (isCreated) return; isCreated=true; docletEClass=createEClass(DOCLET); createEReference(docletEClass,DOCLET__LINE_TAGS); createEOperation(docletEClass,DOCLET___HAS_LINE_TAG__STRING); createEOperation(docletEClass,DOCLET___LINE_TAGS__STRING); docletElementEClass=createEClass(DOCLET_ELEMENT); createEAttribute(docletElementEClass,DOCLET_ELEMENT__BEGIN); createEAttribute(docletElementEClass,DOCLET_ELEMENT__END); createEOperation(docletElementEClass,DOCLET_ELEMENT___SET_RANGE__INT_INT); createEOperation(docletElementEClass,DOCLET_ELEMENT___COVERS__INT); compositeEClass=createEClass(COMPOSITE); createEReference(compositeEClass,COMPOSITE__CONTENTS); jsDocNodeEClass=createEClass(JS_DOC_NODE); createEReference(jsDocNodeEClass,JS_DOC_NODE__MARKERS); createEOperation(jsDocNodeEClass,JS_DOC_NODE___GET_MARKER_VALUE__STRING); createEOperation(jsDocNodeEClass,JS_DOC_NODE___SET_MARKER__STRING_STRING); createEOperation(jsDocNodeEClass,JS_DOC_NODE___IS_MARKED_AS__STRING_STRING); createEOperation(jsDocNodeEClass,JS_DOC_NODE___TO_STRING); contentNodeEClass=createEClass(CONTENT_NODE); createEReference(contentNodeEClass,CONTENT_NODE__OWNER); tagEClass=createEClass(TAG); createEReference(tagEClass,TAG__TITLE); createEReference(tagEClass,TAG__VALUES); createEAttribute(tagEClass,TAG__TAG_DEFINITION); createEOperation(tagEClass,TAG___GET_VALUE_BY_KEY__STRING); createEOperation(tagEClass,TAG___TO_STRING); tagValueEClass=createEClass(TAG_VALUE); createEAttribute(tagValueEClass,TAG_VALUE__KEY); tagTitleEClass=createEClass(TAG_TITLE); createEReference(tagTitleEClass,TAG_TITLE__TAG); createEAttribute(tagTitleEClass,TAG_TITLE__TITLE); createEAttribute(tagTitleEClass,TAG_TITLE__ACTUAL_TITLE); lineTagEClass=createEClass(LINE_TAG); createEReference(lineTagEClass,LINE_TAG__DOCLET); inlineTagEClass=createEClass(INLINE_TAG); textEClass=createEClass(TEXT); createEAttribute(textEClass,TEXT__TEXT); simpleTypeReferenceEClass=createEClass(SIMPLE_TYPE_REFERENCE); createEAttribute(simpleTypeReferenceEClass,SIMPLE_TYPE_REFERENCE__TYPE_NAME); createEOperation(simpleTypeReferenceEClass,SIMPLE_TYPE_REFERENCE___TYPE_NAME_SET); createEOperation(simpleTypeReferenceEClass,SIMPLE_TYPE_REFERENCE___TO_STRING); fullTypeReferenceEClass=createEClass(FULL_TYPE_REFERENCE); createEAttribute(fullTypeReferenceEClass,FULL_TYPE_REFERENCE__MODULE_NAME); createEOperation(fullTypeReferenceEClass,FULL_TYPE_REFERENCE___MODULE_NAME_SET); createEOperation(fullTypeReferenceEClass,FULL_TYPE_REFERENCE___TO_STRING); createEOperation(fullTypeReferenceEClass,FULL_TYPE_REFERENCE___FULL_TYPE_NAME); fullMemberReferenceEClass=createEClass(FULL_MEMBER_REFERENCE); createEAttribute(fullMemberReferenceEClass,FULL_MEMBER_REFERENCE__MEMBER_NAME); createEAttribute(fullMemberReferenceEClass,FULL_MEMBER_REFERENCE__STATIC_MEMBER); createEOperation(fullMemberReferenceEClass,FULL_MEMBER_REFERENCE___MEMBER_NAME_SET); createEOperation(fullMemberReferenceEClass,FULL_MEMBER_REFERENCE___TO_STRING); variableReferenceEClass=createEClass(VARIABLE_REFERENCE); createEAttribute(variableReferenceEClass,VARIABLE_REFERENCE__VARIABLE_NAME); genericReferenceEClass=createEClass(GENERIC_REFERENCE); literalEClass=createEClass(LITERAL); createEAttribute(literalEClass,LITERAL__VALUE); createEAttribute(literalEClass,LITERAL__NAME); markerEClass=createEClass(MARKER); createEAttribute(markerEClass,MARKER__KEY); createEAttribute(markerEClass,MARKER__VALUE); composedContentEClass=createEClass(COMPOSED_CONTENT); structuredTextEClass=createEClass(STRUCTURED_TEXT); createEReference(structuredTextEClass,STRUCTURED_TEXT__ROOT_ELEMENT); tagDefinitionEDataType=createEDataType(TAG_DEFINITION); }
Creates the meta-model objects for the package. This method is guarded to have no affect on any invocation but its first. <!-- begin-user-doc --> <!-- end-user-doc -->
private void generateIntersectionSchema() throws DataFlowException { List<Attribute> innerAttributes=innerOperator.getOutputSchema().getAttributes(); List<Attribute> outerAttributes=outerOperator.getOutputSchema().getAttributes(); List<Attribute> intersectionAttributes=innerAttributes.stream().filter(null).collect(Collectors.toList()); if (intersectionAttributes.isEmpty()) { throw new DataFlowException("inner operator and outer operator don't share any common attributes"); } else if (!intersectionAttributes.contains(joinPredicate.getJoinAttribute())) { throw new DataFlowException("inner operator or outer operator doesn't contain join attribute"); } else if (!intersectionAttributes.contains(joinPredicate.getIDAttribute())) { throw new DataFlowException("inner operator or outer operator doesn't contain ID attribute"); } else if (!intersectionAttributes.contains(SchemaConstants.SPAN_LIST_ATTRIBUTE)) { throw new DataFlowException("inner operator or outer operator doesn't contain spanList attribute"); } outputSchema=new Schema(intersectionAttributes.stream().toArray(null)); }
Create outputSchema, which is the intersection of innerOperator's schema and outerOperator's schema. The attributes have to be exactly the same (name and type) to be intersected. InnerOperator's attributes and outerOperator's attributes must: both contain the attributes to be joined. both contain "ID" attribute. (ID attribute that user specifies in joinPredicate) both contain "spanList" attribute.
public void update(Graphics a,JComponent b){ for (int i=0; i < uis.size(); i++) { ((ComponentUI)(uis.elementAt(i))).update(a,b); } }
Invokes the <code>update</code> method on each UI handled by this object.
private void parseAllow(Attributes attributes){ if (md.actions != null) { md.modeUsage=getModeUsage(attributes); md.actions.addNoResultAction(new AllowAction(md.modeUsage)); } else md.modeUsage=null; }
Parse an allow action.
public SparseDoubleMatrix3D(int slices,int rows,int columns){ this(slices,rows,columns,slices * rows * (columns / 1000),0.2,0.5); }
Constructs a matrix with a given number of slices, rows and columns and default memory usage. All entries are initially <tt>0</tt>.
public static void checkArgument(boolean expression){ if (!expression) { throw new IllegalArgumentException(); } }
Ensures the truth of an expression involving one or more parameters to the calling method.
public TriggerProcessStatusException(String message,ApplicationExceptionBean bean){ super(message,bean); }
Constructs a new exception with the specified detail message and bean for JAX-WS exception serialization.
public void onWifiConnectivityChanged(boolean connected,final String networkSsid){ LOGD(TAG,"WIFI connectivity changed to " + (connected ? "enabled" : "disabled")); if (connected && !mWifiConnectivity) { mWifiConnectivity=true; if (mCastManager.isFeatureEnabled(BaseCastManager.FEATURE_WIFI_RECONNECT)) { mCastManager.startCastDiscovery(); mCastManager.reconnectSessionIfPossible(RECONNECTION_ATTEMPT_PERIOD_S,networkSsid); } } else { mWifiConnectivity=connected; } }
Since framework calls this method twice when a change happens, we are guarding against that by caching the state the first time and avoiding the second call if it is the same status.
public static boolean isGraphQLScratchFile(Project project,VirtualFile file){ if (file.getFileType() instanceof ScratchFileType) { final PsiManager psiManager=PsiManager.getInstance(project); final PsiFile psiFile=psiManager.findFile(file); if (psiFile != null && psiFile.getFileType() == JSGraphQLSchemaFileType.INSTANCE) { return true; } } return false; }
Scratch virtual files don't return their actual file type, so we need to find the PsiFile to determine whether it's a GraphQL schema scratch file
public DoubleMatrix2D multOuter(DoubleMatrix1D x,DoubleMatrix1D y,DoubleMatrix2D A){ int rows=x.size(); int columns=y.size(); if (A == null) A=x.like2D(rows,columns); if (A.rows() != rows || A.columns() != columns) throw new IllegalArgumentException(); for (int row=rows; --row >= 0; ) A.viewRow(row).assign(y); for (int column=columns; --column >= 0; ) A.viewColumn(column).assign(x,cern.jet.math.Functions.mult); return A; }
Outer product of two vectors; Sets <tt>A[i,j] = x[i] * y[j]</tt>.
@Override protected void initData(){ this.presenter=new MainPresenter(); this.presenter.attachView(this); this.gankType=GankType.daily; this.mainAdapter=new MainAdapter(this,this.gankType); this.mainAdapter.setListener(this); this.mainRv.setAdapter(this.mainAdapter); this.refreshData(this.gankType); }
Initialize the Activity data
public final AlertDialog initiateScan(){ return initiateScan(ALL_CODE_TYPES,-1); }
Initiates a scan for all known barcode types with the default camera.
public Builder withLockedInVersionId(long versionId){ if ((lockMap == null) || (this.versionId != null)) { throw new IllegalStateException(); } this.versionId=versionId; return this; }
Associates the given locked-in version ID with this request. You may not call this method multiple times.
public void didNotThrottle(int tenantClass){ super.startedAndFinished(Operation.READ,tenantClass,0,0); }
If no throttling was required for the tenant to pass through the throttling point
public MultisigSignatureTransaction createSignature(){ return this.createSignature(Utils.generateRandomAccount()); }
Creates a default (compatible) signature transaction.
public synchronized void clearAnnotations(){ mAnnotations.clear(); mStringXY.clear(); }
Removes all the existing annotations from the series.
public boolean isSet(_Fields field){ if (field == null) { throw new IllegalArgumentException(); } switch (field) { case STRING_THING: return isSetString_thing(); case CHANGED: return isSetChanged(); case I32_THING: return isSetI32_thing(); case I64_THING: return isSetI64_thing(); } throw new IllegalStateException(); }
Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise
protected boolean hasHistory(){ return false; }
Has History
public static NodesInfoRequest nodesInfoRequest(String... nodesIds){ return new NodesInfoRequest(nodesIds); }
Creates a nodes info request against one or more nodes. Pass <tt>null</tt> or an empty array for all nodes.
private void handleEnvSelectButtonSelected(){ Map<String,EnvironmentVariable> envVariables=getNativeEnvironment(); for ( String varName : getFieldValue().envVars.keySet()) { envVariables.remove(varName); } NativeEnvironmentSelectionDialog dialog=new NativeEnvironmentSelectionDialog(getShell(),envVariables); dialog.setTitle(LaunchConfigurationsMessages.EnvironmentTab_20); int button=dialog.open(); if (button == Window.OK) { Object[] selected=dialog.getResult(); for (int i=0; i < selected.length; i++) { EnvironmentVariable envVar=(EnvironmentVariable)selected[i]; getFieldValue().envVars.put(envVar.getName(),envVar.getValue()); } } notifyFieldChanged(); }
Displays a dialog that allows user to select native environment variables to add to the table.
public static byte[] parseMemoryString(final String memoryString){ final byte[] memoryData=new byte[memoryString.length() / 2]; for (int i=0, j=0; i < memoryString.length(); i+=2, j++) { memoryData[j]=(byte)(lookup1[memoryString.charAt(i)] + lookup2[memoryString.charAt(i + 1)]); } return memoryData; }
Parses a memory string into a byte array.
private ZKLogMetadataForReader(URI uri,String logName,String logIdentifier){ super(uri,logName,logIdentifier); }
metadata representation of a log
static public NodeModel parse(InputSource is) throws SAXException, IOException, ParserConfigurationException { return parse(is,true,true); }
Create a NodeModel from an XML input source. By default, all comments and processing instruction nodes are stripped from the tree.
public final void lazySet(int index,short value){ this.set(index,value); }
Sets an element to the given value, but the update may not happen immediately
public synchronized void flush(){ super.flush(); }
Writes test information from the started reporters to their output view <ul> <li>ExtentHtmlReporter - creates or appends to an HTML file</li> <li>ExtentXReporter - updates database</li> <li>ExtentEmailReporter - creates or appends to an HTML file</li> <li>ExtentLogger - no action taken</li> </ul>
public TypeCheckerBuilder usageWarnings(boolean usageWarnings){ this.assertionVisitor.includeUsageWarnings(usageWarnings); return this; }
Enables or disables output of the warning messages about unused declarations.
public boolean isUsernameIndex(String[] args,int index){ return index == 0; }
Return whether the specified command parameter index is a username parameter.
public static Object max(Collection coll){ Iterator i=coll.iterator(); Comparable candidate=(Comparable)(i.next()); while (i.hasNext()) { Comparable next=(Comparable)(i.next()); if (next.compareTo(candidate) > 0) candidate=next; } return candidate; }
Returns the maximum element of the given collection, according to the <i>natural ordering</i> of its elements. All elements in the collection must implement the <tt>Comparable</tt> interface. Furthermore, all elements in the collection must be <i>mutually comparable</i> (that is, <tt>e1.compareTo(e2)</tt> must not throw a <tt>ClassCastException</tt> for any elements <tt>e1</tt> and <tt>e2</tt> in the collection).<p> This method iterates over the entire collection, hence it requires time proportional to the size of the collection.
private boolean isSizeConsistent(){ return isSizeConsistent(root); }
Checks if size is consistent.
@Deprecated public void fullscreen() throws IllegalStateException { setFullscreen(!fullscreen); }
Toggles view to fullscreen mode It saves currentState and calls pause() method. When fullscreen is finished, it calls the saved currentState before pause() In practice, it only affects STARTED state. If currenteState was STARTED when fullscreen() is called, it calls start() method after fullscreen() has ended.
@Override public Object invoke(final Object proxy,final Method method,final Object[] parameters) throws Throwable { if (eventTypes.isEmpty() || eventTypes.contains(method.getName())) { if (hasMatchingParametersMethod(method)) { return MethodUtils.invokeMethod(target,methodName,parameters); } return MethodUtils.invokeMethod(target,methodName); } return null; }
Handles a method invocation on the proxy object.
@Override public boolean budgetaryCheckForBill(final Map<String,Object> paramMap){ String cashbasedbudgetType=EMPTY_STRING, txnType=EMPTY_STRING; BigDecimal debitAmt=null; BigDecimal creditAmt=null; BigDecimal txnAmt=null; String glCode=""; Date asondate=null; Date fromdate=null; try { String budgetCheckConfig=budgetCheckConfigService.getConfigValue(); if (budgetCheckConfig.equals(BudgetControlType.BudgetCheckOption.NONE.toString())) { if (LOGGER.isDebugEnabled()) LOGGER.debug("Application Level budget check disabled skipping budget check."); return true; } if (paramMap.get("mis.budgetcheckreq") != null && ((Boolean)paramMap.get("mis.budgetcheckreq")).equals(false)) { if (LOGGER.isDebugEnabled()) LOGGER.debug("voucher Level budget check disabled so skipping budget check."); return true; } if (paramMap.get("debitAmt") != null) debitAmt=(BigDecimal)paramMap.get("debitAmt"); if (paramMap.get("creditAmt") != null) creditAmt=(BigDecimal)paramMap.get("creditAmt"); if (debitAmt == null && creditAmt == null) throw new ValidationException(EMPTY_STRING,"Both Debit and Credit amount is null"); if (debitAmt != null && debitAmt.compareTo(BigDecimal.ZERO) == 0 && creditAmt != null && creditAmt.compareTo(BigDecimal.ZERO) == 0) throw new ValidationException(EMPTY_STRING,"Both Debit and Credit amount is zero"); if (debitAmt != null && debitAmt.compareTo(BigDecimal.ZERO) > 0 && creditAmt != null && creditAmt.compareTo(BigDecimal.ZERO) > 0) throw new ValidationException(EMPTY_STRING,"Both Debit and Credit amount is greater than zero"); List<AppConfigValues> list=appConfigValuesService.getConfigValuesByModuleAndKey(EGF,"budgetaryCheck_budgettype_cashbased"); if (list.isEmpty()) throw new ValidationException(EMPTY_STRING,"budgetaryCheck_budgettype_cashbased is not defined in AppConfig"); cashbasedbudgetType=list.get(0).getValue(); if (cashbasedbudgetType.equalsIgnoreCase("Y")) { if (LOGGER.isDebugEnabled()) LOGGER.debug("cashbasedbudgetType==" + cashbasedbudgetType); } else { if (debitAmt != null && debitAmt.compareTo(BigDecimal.ZERO) > 0) { txnType="debit"; txnAmt=debitAmt; } else { txnType="credit"; txnAmt=creditAmt; } if (paramMap.get("glcode") != null) glCode=paramMap.get("glcode").toString(); if (paramMap.get(Constants.ASONDATE) != null) asondate=(Date)paramMap.get(Constants.ASONDATE); if (glCode == null) throw new ValidationException(EMPTY_STRING,"glcode is null"); if (txnAmt == null) throw new ValidationException(EMPTY_STRING,"txnAmt is null"); if (txnType == null) throw new ValidationException(EMPTY_STRING,"txnType is null"); if (asondate == null) throw new ValidationException(EMPTY_STRING,"As On Date is null"); final CChartOfAccounts coa=chartOfAccountsHibernateDAO.getCChartOfAccountsByGlCode(glCode); if (coa.getBudgetCheckReq() != null && coa.getBudgetCheckReq()) { final List<BudgetGroup> budgetHeadListByGlcode=getBudgetHeadByGlcode(coa); if (!isBudgetCheckingRequiredForType(txnType,budgetHeadListByGlcode.get(0).getBudgetingType().toString())) { if (LOGGER.isDebugEnabled()) LOGGER.debug("No need to check budget for :" + glCode + " as the transaction type is "+ txnType+ "so skipping budget check"); return true; } final CFinancialYear finyear=financialYearHibDAO.getFinancialYearByDate(asondate); final SimpleDateFormat sdf=new SimpleDateFormat("dd-MMM-yyyy",Constants.LOCALE); if (finyear == null) throw new ValidationException(EMPTY_STRING,"Financial year is not defined for this date [" + sdf.format(asondate) + "]"); fromdate=finyear.getStartingDate(); paramMap.put("financialyearid",Long.valueOf(finyear.getId())); paramMap.put(BUDGETHEADID,budgetHeadListByGlcode); paramMap.put("fromdate",fromdate); paramMap.put(Constants.ASONDATE,finyear.getEndingDate()); paramMap.put(GLCODEID,coa.getId()); if (LOGGER.isDebugEnabled()) LOGGER.debug("************ BudgetCheck Details For bill *********************"); final BigDecimal budgetedAmt=getBudgetedAmtForYear(paramMap); if (LOGGER.isDebugEnabled()) LOGGER.debug(".................Budgeted amount......................" + budgetedAmt); if (budgetCheckConfigService.getConfigValue().equalsIgnoreCase(BudgetControlType.BudgetCheckOption.MANDATORY.toString())) if (budgetedAmt.compareTo(BigDecimal.ZERO) == 0) { if (LOGGER.isDebugEnabled()) LOGGER.debug("Budget check failed Because of Budgeted not allocated for the combination"); return false; } final BigDecimal actualAmt=getActualBudgetUtilizedForBudgetaryCheck(paramMap); if (LOGGER.isDebugEnabled()) LOGGER.debug("..................Voucher Actual amount......................." + actualAmt); BigDecimal billAmt=getBillAmountForBudgetCheck(paramMap); EgBillregister bill=null; if (paramMap.get("bill") != null) bill=(EgBillregister)paramMap.get("bill"); if (bill != null && bill.getEgBillregistermis().getBudgetaryAppnumber() != null) { if (LOGGER.isDebugEnabled()) LOGGER.debug(".............Found BillId so subtracting txn amount......................" + txnAmt); billAmt=billAmt.subtract(txnAmt); } if (LOGGER.isDebugEnabled()) LOGGER.debug("........................Bill Actual amount ........................" + billAmt); final BigDecimal diff=budgetedAmt.subtract(actualAmt).subtract(billAmt); if (LOGGER.isDebugEnabled()) { LOGGER.debug("......................diff amount......................" + diff); } if (LOGGER.isDebugEnabled()) LOGGER.debug("************ BudgetCheck Details For bill End *********************"); if (budgetCheckConfigService.getConfigValue().equalsIgnoreCase(BudgetControlType.BudgetCheckOption.MANDATORY.toString())) { if (txnAmt.compareTo(diff) <= 0) { if (paramMap.get("bill") != null) getAppNumberForBill(paramMap); return true; } else return false; } if (budgetCheckConfigService.getConfigValue().equalsIgnoreCase(BudgetControlType.BudgetCheckOption.ANTICIPATORY.toString())) { getAppNumberForBill(paramMap); return true; } } else return true; } } catch ( final ValidationException v) { LOGGER.error("Exp in budgetary check API()=" + v.getErrors()); throw v; } catch ( final Exception e) { LOGGER.error("Exp in budgetary check API()=" + e.getMessage()); throw e; } return true; }
This API is handling the budget checking
protected boolean isTestOffHeap(){ return false; }
Override as needed in subclass.
public void drawVerticalItem(Graphics2D g2,Rectangle2D dataArea,PlotRenderingInfo info,XYPlot plot,ValueAxis domainAxis,ValueAxis rangeAxis,XYDataset dataset,int series,int item,CrosshairState crosshairState,int pass){ EntityCollection entities=null; if (info != null) { entities=info.getOwner().getEntityCollection(); } BoxAndWhiskerXYDataset boxAndWhiskerData=(BoxAndWhiskerXYDataset)dataset; Number x=boxAndWhiskerData.getX(series,item); Number yMax=boxAndWhiskerData.getMaxRegularValue(series,item); Number yMin=boxAndWhiskerData.getMinRegularValue(series,item); Number yMedian=boxAndWhiskerData.getMedianValue(series,item); Number yAverage=boxAndWhiskerData.getMeanValue(series,item); Number yQ1Median=boxAndWhiskerData.getQ1Value(series,item); Number yQ3Median=boxAndWhiskerData.getQ3Value(series,item); List yOutliers=boxAndWhiskerData.getOutliers(series,item); if (yOutliers == null) { yOutliers=Collections.EMPTY_LIST; } double xx=domainAxis.valueToJava2D(x.doubleValue(),dataArea,plot.getDomainAxisEdge()); RectangleEdge location=plot.getRangeAxisEdge(); double yyMax=rangeAxis.valueToJava2D(yMax.doubleValue(),dataArea,location); double yyMin=rangeAxis.valueToJava2D(yMin.doubleValue(),dataArea,location); double yyMedian=rangeAxis.valueToJava2D(yMedian.doubleValue(),dataArea,location); double yyAverage=0.0; if (yAverage != null) { yyAverage=rangeAxis.valueToJava2D(yAverage.doubleValue(),dataArea,location); } double yyQ1Median=rangeAxis.valueToJava2D(yQ1Median.doubleValue(),dataArea,location); double yyQ3Median=rangeAxis.valueToJava2D(yQ3Median.doubleValue(),dataArea,location); double yyOutlier; double exactBoxWidth=getBoxWidth(); double width=exactBoxWidth; double dataAreaX=dataArea.getMaxX() - dataArea.getMinX(); double maxBoxPercent=0.1; double maxBoxWidth=dataAreaX * maxBoxPercent; if (exactBoxWidth <= 0.0) { int itemCount=boxAndWhiskerData.getItemCount(series); exactBoxWidth=dataAreaX / itemCount * 4.5 / 7; if (exactBoxWidth < 3) { width=3; } else if (exactBoxWidth > maxBoxWidth) { width=maxBoxWidth; } else { width=exactBoxWidth; } } g2.setPaint(getItemPaint(series,item)); Stroke s=getItemStroke(series,item); g2.setStroke(s); g2.draw(new Line2D.Double(xx,yyMax,xx,yyQ3Median)); g2.draw(new Line2D.Double(xx - width / 2,yyMax,xx + width / 2,yyMax)); g2.draw(new Line2D.Double(xx,yyMin,xx,yyQ1Median)); g2.draw(new Line2D.Double(xx - width / 2,yyMin,xx + width / 2,yyMin)); Shape box; if (yyQ1Median > yyQ3Median) { box=new Rectangle2D.Double(xx - width / 2,yyQ3Median,width,yyQ1Median - yyQ3Median); } else { box=new Rectangle2D.Double(xx - width / 2,yyQ1Median,width,yyQ3Median - yyQ1Median); } if (this.fillBox) { g2.setPaint(lookupBoxPaint(series,item)); g2.fill(box); } g2.setStroke(getItemOutlineStroke(series,item)); g2.setPaint(getItemOutlinePaint(series,item)); g2.draw(box); g2.setPaint(getArtifactPaint()); g2.draw(new Line2D.Double(xx - width / 2,yyMedian,xx + width / 2,yyMedian)); double aRadius=0; double oRadius=width / 3; if (yAverage != null) { aRadius=width / 4; if ((yyAverage > (dataArea.getMinY() - aRadius)) && (yyAverage < (dataArea.getMaxY() + aRadius))) { Ellipse2D.Double avgEllipse=new Ellipse2D.Double(xx - aRadius,yyAverage - aRadius,aRadius * 2,aRadius * 2); g2.fill(avgEllipse); g2.draw(avgEllipse); } } List outliers=new ArrayList(); OutlierListCollection outlierListCollection=new OutlierListCollection(); for (int i=0; i < yOutliers.size(); i++) { double outlier=((Number)yOutliers.get(i)).doubleValue(); if (outlier > boxAndWhiskerData.getMaxOutlier(series,item).doubleValue()) { outlierListCollection.setHighFarOut(true); } else if (outlier < boxAndWhiskerData.getMinOutlier(series,item).doubleValue()) { outlierListCollection.setLowFarOut(true); } else if (outlier > boxAndWhiskerData.getMaxRegularValue(series,item).doubleValue()) { yyOutlier=rangeAxis.valueToJava2D(outlier,dataArea,location); outliers.add(new Outlier(xx,yyOutlier,oRadius)); } else if (outlier < boxAndWhiskerData.getMinRegularValue(series,item).doubleValue()) { yyOutlier=rangeAxis.valueToJava2D(outlier,dataArea,location); outliers.add(new Outlier(xx,yyOutlier,oRadius)); } Collections.sort(outliers); } for (Iterator iterator=outliers.iterator(); iterator.hasNext(); ) { Outlier outlier=(Outlier)iterator.next(); outlierListCollection.add(outlier); } double maxAxisValue=rangeAxis.valueToJava2D(rangeAxis.getUpperBound(),dataArea,location) + aRadius; double minAxisValue=rangeAxis.valueToJava2D(rangeAxis.getLowerBound(),dataArea,location) - aRadius; for (Iterator iterator=outlierListCollection.iterator(); iterator.hasNext(); ) { OutlierList list=(OutlierList)iterator.next(); Outlier outlier=list.getAveragedOutlier(); Point2D point=outlier.getPoint(); if (list.isMultiple()) { drawMultipleEllipse(point,width,oRadius,g2); } else { drawEllipse(point,oRadius,g2); } } if (outlierListCollection.isHighFarOut()) { drawHighFarOut(aRadius,g2,xx,maxAxisValue); } if (outlierListCollection.isLowFarOut()) { drawLowFarOut(aRadius,g2,xx,minAxisValue); } if (entities != null && box.intersects(dataArea)) { addEntity(entities,box,dataset,series,item,xx,yyAverage); } }
Draws the visual representation of a single data item.
public void expandToInclude(Envelope other){ if (other.isNull()) { return; } if (isNull()) { minx=other.getMinX(); maxx=other.getMaxX(); miny=other.getMinY(); maxy=other.getMaxY(); } else { if (other.minx < minx) { minx=other.minx; } if (other.maxx > maxx) { maxx=other.maxx; } if (other.miny < miny) { miny=other.miny; } if (other.maxy > maxy) { maxy=other.maxy; } } }
Enlarges this <code>Envelope</code> so that it contains the <code>other</code> Envelope. Has no effect if <code>other</code> is wholly on or within the envelope.
public Boolean isDvPortOperationSupported(){ return dvPortOperationSupported; }
Gets the value of the dvPortOperationSupported property.
public void removeAttribute(String name){ attributes.remove(name); }
Remove any configuration attribute associated with the specified name. If there is no such attribute, no action is taken.
@DSSource({DSSourceKind.LOCATION}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:31:09.191 -0500",hash_original_method="62C2C1B6F0249A81DF96D887CDE57892",hash_generated_method="807BC3E63A8EC7B7CD4EFA3978F6E0B1") static public Allocation createCubemapFromCubeFaces(RenderScript rs,Bitmap xpos,Bitmap xneg,Bitmap ypos,Bitmap yneg,Bitmap zpos,Bitmap zneg){ return createCubemapFromCubeFaces(rs,xpos,xneg,ypos,yneg,zpos,zneg,MipmapControl.MIPMAP_NONE,USAGE_GRAPHICS_TEXTURE); }
Creates a non-mipmapped cubemap allocation for use as a graphics texture from 6 bitmaps containing the cube faces. All the faces must be the same size and power of 2
@Override public NotificationChain eInverseAdd(InternalEObject otherEnd,int featureID,NotificationChain msgs){ switch (featureID) { case N4JSPackage.N4_MEMBER_ANNOTATION_LIST__OWNER: if (eInternalContainer() != null) msgs=eBasicRemoveFromContainer(msgs); return basicSetOwner((N4ClassifierDefinition)otherEnd,msgs); } return super.eInverseAdd(otherEnd,featureID,msgs); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public void logEvent(StoredException storedException,Callback<Object> callback){ sendLogEvent(storedException.threadName,storedException.stackTrace,callback); }
Send stored exception (i.e., crashes) to UDP endpoint
@Transactional(readOnly=true) public List<Cheque> attentionChequesByDelay(){ return chequeRepository.findWithDelay(OffsetDateTime.now().minusDays(7).toString()); }
Method attentionChequesByDelay return list of cheque, that has delay in diagnostic Use for engineers
public Constraint_ createConstraint_(){ Constraint_Impl constraint_=new Constraint_Impl(); return constraint_; }
<!-- begin-user-doc --> <!-- end-user-doc -->
private static byte CallNonvirtualByteMethod(JNIEnvironment env,int objJREF,int classJREF,int methodID) throws Exception { if (VM.VerifyAssertions) { VM._assert(VM.BuildForPowerPC,ERROR_MSG_WRONG_IMPLEMENTATION); } if (traceJNI) VM.sysWrite("JNI called: CallNonvirtualByteMethod \n"); RuntimeEntrypoints.checkJNICountDownToGC(); try { Object obj=env.getJNIRef(objJREF); Object returnObj=JNIHelpers.invokeWithDotDotVarArg(obj,methodID,TypeReference.Byte,true); return Reflection.unwrapByte(returnObj); } catch ( Throwable unexpected) { if (traceJNI) unexpected.printStackTrace(System.err); env.recordException(unexpected); return 0; } }
CallNonvirtualByteMethod: invoke a virtual method that returns a byte value arguments passed using the vararg ... style NOTE: the vararg's are not visible in the method signature here; they are saved in the caller frame and the glue frame <p> <strong>NOTE: This implementation is NOT used for IA32. On IA32, it is overwritten with a C implementation in the bootloader when the VM starts.</strong>
@ParameterizedRobolectricTestRunner.Parameters(name="Missing parameter = {0}") public static Collection<Object[]> data(){ return Arrays.asList(new Object[][]{{RegistrationResponse.PARAM_CLIENT_SECRET_EXPIRES_AT},{RegistrationResponse.PARAM_REGISTRATION_ACCESS_TOKEN},{RegistrationResponse.PARAM_REGISTRATION_CLIENT_URI}}); }
TODO .
public boolean isMalformed(){ return this.type == TYPE_MALFORMED_INPUT; }
Returns true if this result represents a malformed-input error.
@Override public void run(){ amIActive=true; String inputHeader=null; String outputHeader=null; int row, col; int numCols; int numRows; double z; double noData; float progress; int i; int numReclassRanges; int numReclassRangesMinusOne; String[] reclassRangeStr=null; double[][] reclassRange; boolean blnAssignMode=false; if (args.length <= 0) { showFeedback("Plugin parameters have not been set."); return; } for (i=0; i < args.length; i++) { if (i == 0) { inputHeader=args[i]; } else if (i == 1) { outputHeader=args[i]; } else if (i == 2) { reclassRangeStr=args[i].split("\t"); if (reclassRangeStr[2].toLowerCase().equals("not specified")) { blnAssignMode=true; } } } if ((inputHeader == null) || (outputHeader == null)) { showFeedback("One or more of the input parameters have not been set properly."); return; } try { WhiteboxRaster image=new WhiteboxRaster(inputHeader,"r"); int rows=image.getNumberRows(); int cols=image.getNumberColumns(); double[] data; noData=image.getNoDataValue(); numReclassRanges=reclassRangeStr.length / 3; numReclassRangesMinusOne=numReclassRanges - 1; reclassRange=new double[3][numReclassRanges]; i=0; for (int b=0; b < reclassRangeStr.length; b++) { if (!reclassRangeStr[b].toLowerCase().equals("not specified")) { if (!reclassRangeStr[b].toLowerCase().equals("nodata")) { reclassRange[i][b / 3]=Double.parseDouble(reclassRangeStr[b]); } else { reclassRange[i][b / 3]=noData; } } else { reclassRange[i][b / 3]=0; } i++; if (i == 3) { i=0; } } if (numReclassRanges == 0) { showFeedback("There is an error with the reclass ranges."); return; } WhiteboxRaster output=new WhiteboxRaster(outputHeader,"rw",inputHeader,WhiteboxRaster.DataType.FLOAT,noData); output.setPreferredPalette(image.getPreferredPalette()); if (blnAssignMode) { for (row=0; row < rows; row++) { data=image.getRowValues(row); for (col=0; col < cols; col++) { for (i=0; i < numReclassRanges; i++) { if (data[col] == reclassRange[1][i]) { output.setValue(row,col,reclassRange[0][i]); break; } if (i == numReclassRangesMinusOne) { output.setValue(row,col,data[col]); } } } if (cancelOp) { cancelOperation(); return; } progress=(float)(100f * row / (rows - 1)); updateProgress((int)progress); } } else { for (row=0; row < rows; row++) { data=image.getRowValues(row); for (col=0; col < cols; col++) { for (i=0; i < numReclassRanges; i++) { if (data[col] >= reclassRange[1][i] && data[col] < reclassRange[2][i]) { output.setValue(row,col,reclassRange[0][i]); break; } if (i == numReclassRangesMinusOne) { output.setValue(row,col,data[col]); } } } if (cancelOp) { cancelOperation(); return; } progress=(float)(100f * row / (rows - 1)); updateProgress((int)progress); } } image.close(); output.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); output.addMetadataEntry("Created on " + new Date()); output.close(); returnData(outputHeader); } catch ( OutOfMemoryError oe) { myHost.showFeedback("An out-of-memory error has occurred during operation."); } catch ( Exception e) { myHost.showFeedback("An error has occurred during operation. See log file for details."); myHost.logException("Error in " + getDescriptiveName(),e); } finally { updateProgress("Progress: ",0); amIActive=false; myHost.pluginComplete(); } }
Used to execute this plugin tool.
@Override public synchronized void invalidate(String key,boolean fullExpire){ Entry entry=get(key); if (entry != null) { entry.softTtl=0; if (fullExpire) { entry.ttl=0; } put(key,entry); } }
Invalidates an entry in the cache.
public boolean isGradleSdkHome(String gradleHomePath){ return isGradleSdkHome(new File(gradleHomePath)); }
Allows to answer if given virtual file points to the gradle installation root.
private static void deleteFilesByDirectory(File directory){ if (directory != null && directory.exists() && directory.isDirectory()) for ( File item : directory.listFiles()) item.delete(); }
Delete all files in given directory
public StrBuilder trim(){ if (size == 0) { return this; } int len=size; final char[] buf=buffer; int pos=0; while (pos < len && buf[pos] <= ' ') { pos++; } while (pos < len && buf[len - 1] <= ' ') { len--; } if (len < size) { delete(len,size); } if (pos > 0) { delete(0,pos); } return this; }
Trims the builder by removing characters less than or equal to a space from the beginning and end.
static void predictLeafIndex(Predictor predictor,List<SimpleEntry<Integer,FVec>> data){ int count=0; for ( SimpleEntry<Integer,FVec> pair : data) { int[] leafIndexes=predictor.predictLeaf(pair.getValue()); System.out.printf("leafIndexes[%d]: %s%s",count++,Arrays.toString(leafIndexes),System.lineSeparator()); } }
Predicts leaf index of each tree.
public static Graph replaceNodes(Graph originalGraph,List<Node> newVariables){ Graph reference=new EdgeListGraph(newVariables); Graph convertedGraph=new EdgeListGraph(newVariables); for ( Edge edge : originalGraph.getEdges()) { Node node1=reference.getNode(edge.getNode1().getName()); Node node2=reference.getNode(edge.getNode2().getName()); if (node1 == null) { node1=edge.getNode1(); if (!convertedGraph.containsNode(node1)) { convertedGraph.addNode(node1); } } if (node2 == null) { node2=edge.getNode2(); if (!convertedGraph.containsNode(node2)) { convertedGraph.addNode(node2); } } if (!convertedGraph.containsNode(node1)) { convertedGraph.addNode(node1); } if (!convertedGraph.containsNode(node2)) { convertedGraph.addNode(node2); } if (node1 == null) { throw new IllegalArgumentException("Couldn't find a node by the name " + edge.getNode1().getName() + " among the new variables for the converted graph ("+ newVariables+ ")."); } if (node2 == null) { throw new IllegalArgumentException("Couldn't find a node by the name " + edge.getNode2().getName() + " among the new variables for the converted graph ("+ newVariables+ ")."); } Endpoint endpoint1=edge.getEndpoint1(); Endpoint endpoint2=edge.getEndpoint2(); Edge newEdge=new Edge(node1,node2,endpoint1,endpoint2); convertedGraph.addEdge(newEdge); } for ( Triple triple : originalGraph.getUnderLines()) { convertedGraph.addUnderlineTriple(convertedGraph.getNode(triple.getX().getName()),convertedGraph.getNode(triple.getY().getName()),convertedGraph.getNode(triple.getZ().getName())); } for ( Triple triple : originalGraph.getDottedUnderlines()) { convertedGraph.addDottedUnderlineTriple(convertedGraph.getNode(triple.getX().getName()),convertedGraph.getNode(triple.getY().getName()),convertedGraph.getNode(triple.getZ().getName())); } for ( Triple triple : originalGraph.getAmbiguousTriples()) { convertedGraph.addAmbiguousTriple(convertedGraph.getNode(triple.getX().getName()),convertedGraph.getNode(triple.getY().getName()),convertedGraph.getNode(triple.getZ().getName())); } return convertedGraph; }
Converts the given graph, <code>originalGraph</code>, to use the new variables (with the same names as the old).
public FBCachedBlob(byte[] data){ blobData=data; }
Create an instance using the cached data.
@Override public void emitTuples(){ final int TUPLE_SIZE_COPY=tupleSize; final boolean EMIT_SAME_TUPLE_COPY=emitSameTuple; if (firstTime) { if (EMIT_SAME_TUPLE_COPY) { for (int i=count--; i-- > 0; ) { output.emit(sameTupleArray); } } else { for (int i=count--; i-- > 0; ) { output.emit(new byte[TUPLE_SIZE_COPY]); } } firstTime=false; } else { if (EMIT_SAME_TUPLE_COPY) { output.emit(sameTupleArray); } else { output.emit(new byte[TUPLE_SIZE_COPY]); } count++; } }
Emits byte array of specified size. Emits either the same byte array or creates new byte array every time depending on the value of emitSameTuple property. Local copies of tupleSize and emitSameTuple are made to improve the performance.
public void updateBandwidth(){ try { String sDown=GUIUtils.rate2speed(GUIMediator.instance().getBTDownloadMediator().getDownloadsBandwidth()); String sUp=GUIUtils.rate2speed(GUIMediator.instance().getBTDownloadMediator().getUploadsBandwidth()); int downloads=GUIMediator.instance().getCurrentDownloads(); int uploads=GUIMediator.instance().getCurrentUploads(); _bandwidthUsageDown.setText(downloads + " @ " + sDown); _bandwidthUsageUp.setText(uploads + " @ " + sUp); } catch ( Throwable ignored) { } }
Updates the bandwidth statistics.
public int iterativeSize(){ IntList p=this; int size=0; while (p != null) { size+=1; p=p.tail; } return size; }
Returns the size of this IntList.
private static void shutdown() throws Exception { try (IDiagnosticsContextScope diagCtxt=DiagnosticsContextFactory.createContext("IDM Shutdown","")){ logger.info("Stopping IDM Server..."); if (registry != null) { logger.debug("Unbinding the registry..."); registry.unbind(IDENTITY_MANAGER_BIND_NAME); } stopHeartbeat(); logger.info("IDM Server has stopped"); } catch ( Throwable t) { logger.error(VmEvent.SERVER_ERROR,"IDM Server failed to stop",t); throw t; } }
Shutdown the IDM service.
public InstantiatedType instantiate(ReferenceType... typeArguments){ if (typeArguments.length != this.getTypeParameters().size()) { throw new IllegalArgumentException("number of arguments and parameters must match"); } Substitution<ReferenceType> substitution=Substitution.forArgs(this.getTypeParameters(),typeArguments); for (int i=0; i < parameters.size(); i++) { if (!parameters.get(i).getUpperTypeBound().isUpperBound(typeArguments[i],substitution)) { throw new IllegalArgumentException("type argument " + typeArguments[i] + " does not match parameter bound "+ parameters.get(i).getUpperTypeBound()); } } return this.apply(substitution); }
Creates a type substitution using the given type arguments and applies it to this type.
public MoreLikeThisQueryBuilder unlike(Item... unlikeItems){ this.unlikeItems=new ArrayList<>(); return addUnlikeItem(unlikeItems); }
Sets the documents from which the terms should not be selected from.
public static void validateUTF8(byte[] utf8,int start,int len) throws MalformedInputException { int count=start; int leadByte=0; int length=0; int state=LEAD_BYTE; while (count < start + len) { int aByte=utf8[count] & 0xFF; switch (state) { case LEAD_BYTE: leadByte=aByte; length=bytesFromUTF8[aByte]; switch (length) { case 0: if (leadByte > 0x7F) { throw new MalformedInputException(count); } break; case 1: if (leadByte < 0xC2 || leadByte > 0xDF) { throw new MalformedInputException(count); } state=TRAIL_BYTE_1; break; case 2: if (leadByte < 0xE0 || leadByte > 0xEF) { throw new MalformedInputException(count); } state=TRAIL_BYTE_1; break; case 3: if (leadByte < 0xF0 || leadByte > 0xF4) { throw new MalformedInputException(count); } state=TRAIL_BYTE_1; break; default : throw new MalformedInputException(count); } break; case TRAIL_BYTE_1: if (leadByte == 0xF0 && aByte < 0x90) { throw new MalformedInputException(count); } if (leadByte == 0xF4 && aByte > 0x8F) { throw new MalformedInputException(count); } if (leadByte == 0xE0 && aByte < 0xA0) { throw new MalformedInputException(count); } if (leadByte == 0xED && aByte > 0x9F) { throw new MalformedInputException(count); } case TRAIL_BYTE: if (aByte < 0x80 || aByte > 0xBF) { throw new MalformedInputException(count); } if (--length == 0) { state=LEAD_BYTE; } else { state=TRAIL_BYTE; } break; default : break; } count++; } }
Check to see if a byte array is valid utf-8
protected POInfo initPO(Properties ctx){ POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName()); return poi; }
Load Meta Data
public Header(ByteProvider byteProvider) throws IOException { MXFPropertyPopulator.populateField(byteProvider,this,"numberOfElements"); MXFPropertyPopulator.populateField(byteProvider,this,"sizeOfElement"); }
Instantiates a new collection Header.
public void testConsumeQueue() throws Exception { MessageProducer producer=createProducer(0); consumerDestination=session.createQueue(getConsumerSubject()); producerDestination=session.createQueue(getProducerSubject()); MessageConsumer consumer=createConsumer(); connection.start(); for (int i=0; i < data.length; i++) { Message message=session.createTextMessage(data[i]); message.setStringProperty("stringProperty",data[i]); message.setIntProperty("intProperty",i); if (verbose) { if (LOG.isDebugEnabled()) { LOG.debug("About to send a queue message: " + message + " with text: "+ data[i]); } } producer.send(producerDestination,message); } assertNotNull(consumer.receive(1000)); }
Sends and consumes the messages to a queue destination.
public ThisTypeRefNominal createThisTypeRefNominal(){ ThisTypeRefNominalImpl thisTypeRefNominal=new ThisTypeRefNominalImpl(); return thisTypeRefNominal; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public static String stringArrayToIndentedString(String[] A,int indent){ if (A.length == 0) { return A[0]; } String result=A[0]; for (int i=1; i < A.length; i++) { result=result + "\n" + StringHelper.copyString(" ",indent)+ A[i]; } return result; }
Returns the array of strings as a single string, where the first line is inserted at column indent (Java numbering, columns starting at 0).
public WebBasketLine add(int M_Product_ID,String Name,BigDecimal Qty,BigDecimal Price){ for (int i=0; i < m_lines.size(); i++) { WebBasketLine wbl=(WebBasketLine)m_lines.get(i); if (wbl.getM_Product_ID() == M_Product_ID) { wbl.addQuantity(Qty); getTotal(true); return wbl; } } WebBasketLine wbl=new WebBasketLine(M_Product_ID,Name,Qty,Price); return add(wbl); }
Add Line. Adds qty to the line, if same product
public Instances resampleWithWeights(Random random,double[] weights,boolean[] sampled,boolean representUsingWeights){ if (weights.length != numInstances()) { throw new IllegalArgumentException("weights.length != numInstances."); } Instances newData=new Instances(this,numInstances()); if (numInstances() == 0) { return newData; } double[] P=new double[weights.length]; System.arraycopy(weights,0,P,0,weights.length); Utils.normalize(P); double[] Q=new double[weights.length]; int[] A=new int[weights.length]; int[] W=new int[weights.length]; int M=weights.length; int NN=-1; int NP=M; for (int I=0; I < M; I++) { if (P[I] < 0) { throw new IllegalArgumentException("Weights have to be positive."); } Q[I]=M * P[I]; if (Q[I] < 1.0) { W[++NN]=I; } else { W[--NP]=I; } } if (NN > -1 && NP < M) { for (int S=0; S < M - 1; S++) { int I=W[S]; int J=W[NP]; A[I]=J; Q[J]+=Q[I] - 1.0; if (Q[J] < 1.0) { NP++; } if (NP >= M) { break; } } } for (int I=0; I < M; I++) { Q[I]+=I; } int[] counts=null; if (representUsingWeights) { counts=new int[M]; } for (int i=0; i < numInstances(); i++) { int ALRV; double U=M * random.nextDouble(); int I=(int)U; if (U < Q[I]) { ALRV=I; } else { ALRV=A[I]; } if (representUsingWeights) { counts[ALRV]++; } else { newData.add(instance(ALRV)); } if (sampled != null) { sampled[ALRV]=true; } if (!representUsingWeights) { newData.instance(newData.numInstances() - 1).setWeight(1); } } if (representUsingWeights) { for (int i=0; i < counts.length; i++) { if (counts[i] > 0) { newData.add(instance(i)); newData.instance(newData.numInstances() - 1).setWeight(counts[i]); } } } return newData; }
Creates a new dataset of the same size using random sampling with replacement according to the given weight vector. The weights of the instances in the new dataset are set to one. The length of the weight vector has to be the same as the number of instances in the dataset, and all weights have to be positive. Uses Walker's method, see pp. 232 of "Stochastic Simulation" by B.D. Ripley (1987).
public void writeBorders(){ write(this.linenum,0,this.linenum + 1,0); write(this.linenum,this.chars_per_line + 1,this.linenum + 1,this.chars_per_line + 1); }
Print vertical borders on the current line at the left and right sides of the page at character positions 0 and chars_per_line + 1. Border lines are one text line in height <P> This was not in the original class, but was added afterwards by Dennis Miller.
public synchronized boolean repeatRequest(boolean showRationale){ if (messageSent) { return false; } try { Message msg=Message.obtain(); msg.what=PermissiveHandler.REPEAT_REQUEST; msg.arg1=showRationale ? 1 : 0; messenger.send(msg); messageSent=true; return true; } catch ( RemoteException e) { if (DEBUG) { Log.w(TAG,e); } return false; } }
Sends a message to repeat current request. <p>It's also possible to re-enable rationale display when user refuses request again.</p>
public void disableCGCopy(FunctionalAPIImpl impl,ConsistencyGroupCopyUID cgCopy) throws RecoverPointException { String cgName=null; String cgCopyName=null; try { cgCopyName=impl.getGroupCopyName(cgCopy); cgName=impl.getGroupName(cgCopy.getGroupUID()); boolean startTransfer=true; logger.info(String.format("Attempting to disable the image for copy %s in consistency group %s",cgCopyName,cgName)); try { impl.disableImageAccess(cgCopy,startTransfer); } catch ( FunctionalAPIActionFailedException_Exception e) { logger.info(String.format("Disable the image failed for copy %s in consistency group %s. Try again",cgCopyName,cgName)); try { Thread.sleep(Long.valueOf(disableRetrySleepTimeSeconds * numMillisInSecond)); } catch ( InterruptedException e1) { } impl.disableImageAccess(cgCopy,startTransfer); } waitForCGCopyState(impl,cgCopy,StorageAccessState.NO_ACCESS); logger.info(String.format("Successfully disabled image for copy %s in consistency group %s",cgCopyName,cgName)); } catch ( FunctionalAPIActionFailedException_Exception|FunctionalAPIInternalError_Exception|InterruptedException e) { throw RecoverPointException.exceptions.failedToDisableCopy(cgCopyName,cgName,e); } }
Perform a disable image access on a CG copy
private byte[] generateChallenge(List<String> realms,String qopStr,String cipherStr) throws UnsupportedEncodingException, IOException { ByteArrayOutputStream out=new ByteArrayOutputStream(); for (int i=0; realms != null && i < realms.size(); i++) { out.write("realm=\"".getBytes(encoding)); writeQuotedStringValue(out,realms.get(i).getBytes(encoding)); out.write('"'); out.write(','); } out.write(("nonce=\"").getBytes(encoding)); nonce=generateNonce(); writeQuotedStringValue(out,nonce); out.write('"'); out.write(','); if (qopStr != null) { out.write(("qop=\"").getBytes(encoding)); writeQuotedStringValue(out,qopStr.getBytes(encoding)); out.write('"'); out.write(','); } if (recvMaxBufSize != DEFAULT_MAXBUF) { out.write(("maxbuf=\"" + recvMaxBufSize + "\",").getBytes(encoding)); } if (useUTF8) { out.write(UTF8_DIRECTIVE.getBytes(encoding)); } if (cipherStr != null) { out.write("cipher=\"".getBytes(encoding)); writeQuotedStringValue(out,cipherStr.getBytes(encoding)); out.write('"'); out.write(','); } out.write(ALGORITHM_DIRECTIVE.getBytes(encoding)); return out.toByteArray(); }
Generates challenge to be sent to client. digest-challenge = 1#( realm | nonce | qop-options | stale | maxbuf | charset algorithm | cipher-opts | auth-param ) realm = "realm" "=" <"> realm-value <"> realm-value = qdstr-val nonce = "nonce" "=" <"> nonce-value <"> nonce-value = qdstr-val qop-options = "qop" "=" <"> qop-list <"> qop-list = 1#qop-value qop-value = "auth" | "auth-int" | "auth-conf" | token stale = "stale" "=" "true" maxbuf = "maxbuf" "=" maxbuf-value maxbuf-value = 1*DIGIT charset = "charset" "=" "utf-8" algorithm = "algorithm" "=" "md5-sess" cipher-opts = "cipher" "=" <"> 1#cipher-value <"> cipher-value = "3des" | "des" | "rc4-40" | "rc4" | "rc4-56" | token auth-param = token "=" ( token | quoted-string )
public final Vertex dest(){ return sym().orig(); }
Gets the vertex for the edge's destination
public FilePath append(FilePath subPath){ return append(subPath.elements()); }
Appends another path to end of this one.
private CharsToNameCanonicalizer(){ _canonicalize=true; _intern=true; _dirty=true; _hashSeed=0; _longestCollisionList=0; initTables(DEFAULT_TABLE_SIZE); }
Main method for constructing a master symbol table instance.
public Bitmap toBitmap(){ if (mSize == -1) { this.actionBarSize(); } final Bitmap bitmap=Bitmap.createBitmap(this.getIntrinsicWidth(),this.getIntrinsicHeight(),Bitmap.Config.ARGB_8888); this.style(Paint.Style.FILL); final Canvas canvas=new Canvas(bitmap); this.setBounds(0,0,canvas.getWidth(),canvas.getHeight()); this.draw(canvas); return bitmap; }
Creates a BitMap to use in Widgets or anywhere else
public void addListener(ConnectableDeviceListener listener){ if (!listeners.contains(listener)) { listeners.add(listener); } }
Adds the ConnectableDeviceListener to the list of listeners for this ConnectableDevice to receive certain events.
private void interpretJcc(final ReilInstruction instruction,final String programCounter){ final Pair<Boolean,BigInteger> firstValue=loadLongValue(instruction.getFirstOperand()); if (!firstValue.second().equals(BigInteger.ZERO) && (instruction.getThirdOperand().getType() == OperandType.SUB_ADDRESS)) { final String[] parts=instruction.getThirdOperand().getValue().split("\\."); assert parts.length == 2; setRegister(programCounter,new BigInteger(parts[0]),OperandSize.DWORD,ReilRegisterStatus.DEFINED); setRegister(SUB_PC,new BigInteger(parts[1]),OperandSize.DWORD,ReilRegisterStatus.DEFINED); } else if (!firstValue.second().equals(BigInteger.ZERO)) { final Pair<Boolean,BigInteger> secondValue=loadLongValue(instruction.getThirdOperand()); setRegister(programCounter,secondValue.second(),OperandSize.DWORD,ReilRegisterStatus.DEFINED); } }
Interprets a JCC instruction.
@Override public String toString(){ if (eIsProxy()) return super.toString(); StringBuffer result=new StringBuffer(super.toString()); result.append(" (character: "); result.append(character); result.append(", sequence: "); result.append(sequence); result.append(')'); return result.toString(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
private int checkInterruptWhileWaiting(Node node){ return Thread.interrupted() ? (transferAfterCancelledWait(node) ? THROW_IE : REINTERRUPT) : 0; }
Checks for interrupt, returning THROW_IE if interrupted before signalled, REINTERRUPT if after signalled, or 0 if not interrupted.
private Name lambdaName(){ return names.lambda.append(names.fromString(enclosingMethodName() + "$" + lambdaCount++)); }
For a non-serializable lambda, generate a simple method.
public static byte[] generatePrivateID(AsymmetricCipherKeyPair id){ return encodeDHPrivateKey((DHPrivateKeyParameters)id.getPrivate()); }
Generates a private ID for the purposes of long term storage.
public static void writeStaticField(final Class<?> cls,final String fieldName,final Object value,final boolean forceAccess) throws IllegalAccessException { Field field=FieldUtils.getField(cls,fieldName,forceAccess); if (field == null) { throw new IllegalArgumentException("Cannot locate field " + fieldName + " on "+ cls); } FieldUtils.writeStaticField(field,value); }
Write a named static Field. Superclasses will be considered.
public ShoppingCartItem findCartItem(int index){ if (cartLines.size() <= index) { return null; } return cartLines.get(index); }
Get a ShoppingCartItem from the cart object.
public SingletonTask(ScheduledExecutorService ses,Runnable task){ super(); this.task=task; this.ses=ses; }
Construct a new SingletonTask for the given runnable. The context is used to manage the state of the task execution and can be shared by more than one instance of the runnable.
public void append(byte[] src){ append(src,0,src.length); }
Appends the income data to be read by handshake protocol. The attempts to overflow the buffer by means of this methods seem to be futile because of: 1. The SSL protocol specifies the maximum size of the record and record protocol does not pass huge messages. (see TLS v1 specification http://www.ietf.org/rfc/rfc2246.txt , p 6.2) 2. After each call of this method, handshake protocol should start (and starts) the operations on received data and recognize the fake data if such was provided (to check the size of certificate for example).
public String readPersistentString(String key){ try { if (checkService()) { byte[] bytes=sService.readPersistentBytes(key); if (bytes != null) { return new String(bytes,"UTF-8"); } } } catch ( RemoteException e) { } catch ( UnsupportedEncodingException e) { Log.e(TAG,e.getMessage(),e); } return null; }
Read a string from persistent storage
static int parse(String c){ try { int skipInitial, skipBetween; if (c.charAt(0) == '#') { skipInitial=1; skipBetween=0; } else if (c.startsWith("rgb:")) { skipInitial=4; skipBetween=1; } else { return 0; } int charsForColors=c.length() - skipInitial - 2 * skipBetween; if (charsForColors % 3 != 0) return 0; int componentLength=charsForColors / 3; double mult=255 / (Math.pow(2,componentLength * 4) - 1); int currentPosition=skipInitial; String rString=c.substring(currentPosition,currentPosition + componentLength); currentPosition+=componentLength + skipBetween; String gString=c.substring(currentPosition,currentPosition + componentLength); currentPosition+=componentLength + skipBetween; String bString=c.substring(currentPosition,currentPosition + componentLength); int r=(int)(Integer.parseInt(rString,16) * mult); int g=(int)(Integer.parseInt(gString,16) * mult); int b=(int)(Integer.parseInt(bString,16) * mult); return 0xFF << 24 | r << 16 | g << 8 | b; } catch ( NumberFormatException|IndexOutOfBoundsException e) { return 0; } }
Parse color according to http://manpages.ubuntu.com/manpages/intrepid/man3/XQueryColor.3.html <p/> Highest bit is set if successful, so return value is 0xFF${R}${G}${B}. Return 0 if failed.
public void onLineChange(Context cx,int lineno){ this.lineNumber=lineno; if (!breakpoints[lineno] && !dim.breakFlag) { boolean lineBreak=contextData.breakNextLine; if (lineBreak && contextData.stopAtFrameDepth >= 0) { lineBreak=(contextData.frameCount() <= contextData.stopAtFrameDepth); } if (!lineBreak) { return; } contextData.stopAtFrameDepth=-1; contextData.breakNextLine=false; } dim.handleBreakpointHit(this,cx); }
Called when the current position has changed.
public void testListFilesPathDoesNotExist() throws Exception { Collection<IgfsFile> paths=null; try { paths=igfs.listFiles(SUBDIR); } catch ( IgniteException ignore) { } assert paths == null || paths.isEmpty(); }
Test list files routine when the path doesn't exist remotely.
public static double clamp(double value,double min,double max){ return value > max ? max : (value < min ? min : value); }
Restricts a value to the range [min, max] degrees, clamping values outside the range. Values less than min are returned as min, and values greater than max are returned as max. Values within the range are returned unmodified. <p/> The result of this method is undefined if min is greater than max.
static final int hash(Object key){ int h; return (key == null) ? 0 : (h=key.hashCode()) ^ (h >>> 16); }
Computes key.hashCode() and spreads (XORs) higher bits of hash to lower. Because the table uses power-of-two masking, sets of hashes that vary only in bits above the current mask will always collide. (Among known examples are sets of Float keys holding consecutive whole numbers in small tables.) So we apply a transform that spreads the impact of higher bits downward. There is a tradeoff between speed, utility, and quality of bit-spreading. Because many common sets of hashes are already reasonably distributed (so don't benefit from spreading), and because we use trees to handle large sets of collisions in bins, we just XOR some shifted bits in the cheapest possible way to reduce systematic lossage, as well as to incorporate impact of the highest bits that would otherwise never be used in index calculations because of table bounds.
public static double deriv(double pred,double y,double c){ double x=pred - y; if (Math.abs(x) <= c) return x; else return c * Math.signum(x); }
Computes the first derivative of the HuberLoss loss
public IsilonList<IsilonSmartQuota> listQuotas(String resumeToken) throws IsilonException { return list(_baseUrl.resolve(URI_QUOTAS),"quotas",IsilonSmartQuota.class,resumeToken); }
List all smartquotas
public void opc_checkcast(short classIndex){ emitByte(opc_checkcast); emitShort(classIndex); }
Assumes the checkcast succeeds
@HLEFunction(nid=0x2C8E6AB3,version=150,checkInsideInterrupt=true) public int __sceSasGetPauseFlag(int sasCore){ checkSasHandleGood(sasCore); int pauseFlag=0; for (int i=0; i < voices.length; i++) { if (voices[i].isPaused()) { pauseFlag|=(1 << i); } } return pauseFlag; }
Get the pause flag for all the voices.
public static void main(String[] args){ String jVersion=System.getProperty("java.version"); if (!(jVersion.startsWith("1.5"))) { JOptionPane.showMessageDialog(null,"Require Java Version 1.5 or up - Not " + jVersion,"AdempierePLAF - Version Conflict",JOptionPane.ERROR_MESSAGE); System.exit(1); } Ini.loadProperties(true); setPLAF(); if (args.length == 0) { return; } String className=args[0]; Class<?> startClass=null; try { startClass=Class.forName(className); } catch ( Exception e) { log.severe("Did not find: " + className); e.printStackTrace(); System.exit(1); } try { Method[] methods=startClass.getMethods(); for (int i=0; i < methods.length; i++) { if (Modifier.isStatic(methods[i].getModifiers()) && methods[i].getName().equals("main")) { String[] startArgs=new String[args.length - 1]; for (int ii=1; ii < args.length; ii++) startArgs[ii - i]=args[ii]; methods[i].invoke(null,new Object[]{startArgs}); } return; } } catch ( Exception ee) { log.severe("Problems invoking main"); ee.printStackTrace(); } try { startClass.newInstance(); } catch ( Exception e) { log.severe("Cannot start: " + className); e.printStackTrace(); System.exit(1); } }
Start Class With Adempiere Look
public static void writeElement(final XMLStreamWriter writer,final String elementName,final int value) throws XMLStreamException { writer.writeStartElement(elementName); writer.writeCharacters(XMLConvert.toString(value)); writer.writeEndElement(); }
Writes an element.