code
stringlengths
10
174k
nl
stringlengths
3
129k
public InputStream openConfig(String name) throws IOException { return openResource(name); }
Opens a config resource by its name. Override this method to customize loading config resources.
public Iterator<E> tailIterator(E from){ return new BinarySearchTreeIterator<E>(this.root,from,null); }
Returns the in-order (ascending) iterator starting from the given node.
public void readScratchData(ScratchBank bank,Callback<ScratchData> callback){ addCallback(BeanMessageID.BT_GET_SCRATCH,callback); Buffer buffer=new Buffer(); buffer.writeByte(intToByte(bank.getRawValue())); sendMessage(BeanMessageID.BT_GET_SCRATCH,buffer); }
Request a scratch bank data value.
private void initLayout(){ setAttribute(Window.MODE_KEY,Window.MODE_EMBEDDED); setBorder("none"); setWidth("100%"); setHeight("100%"); setStyle("position: absolute"); miniTable.setAttribute("zk_component_ID","Lookup_Data_SearchResults"); miniTable.setVflex(true); Rows rows=new Rows(); Row row=new Row(); rows.appendChild(row); row.setSpans("1, 1, 1, 1"); row.appendChild(labelAcctSchema.rightAlign()); row.appendChild(fieldAcctSchema.getComponent()); row.appendChild(labelBPartner.rightAlign()); row.appendChild(fieldBPartner.getComponent()); row=new Row(); rows.appendChild(row); row.setSpans("1, 1, 1, 1"); row.appendChild(labelOrg.rightAlign()); row.appendChild(fieldOrg.getComponent()); row.appendChild(labelProduct.rightAlign()); row.appendChild(fieldProduct.getComponent()); row=new Row(); rows.appendChild(row); row.setSpans("1, 1, 1, 1"); row.appendChild(labelAccount.rightAlign()); row.appendChild(fieldAccount.getComponent()); row.appendChild(new Space()); row.appendChild(isReconciled); row=new Row(); rows.appendChild(row); row.setSpans("1, 1, 1, 1"); row.appendChild(labelDateAcct.rightAlign()); Hbox hbox=new Hbox(); hbox.appendChild(fieldDateAcct); hbox.appendChild(labelDateAcct2); hbox.appendChild(fieldDateAcct2); row.appendChild(hbox); parameterGrid.appendChild(rows); Center center=new Center(); center.setBorder("0"); center.appendChild(parameterGrid); Hbox btnBox=new Hbox(); btnBox.setStyle("border-top: 2px; border-bottom: 2px; padding: 4px"); btnBox.appendChild(bRefresh); btnBox.setHeight("100%"); West west=new West(); west.setBorder("0"); west.appendChild(btnBox); parameterPanel.appendChild(center); parameterPanel.appendChild(west); parameterPanel.setHeight("100px"); North north=new North(); north.appendChild(parameterPanel); mainPanel.appendChild(north); center=new Center(); center.appendChild(miniTable); mainPanel.appendChild(center); pnlBtnLeft=new Panel(); pnlBtnLeft.setAlign("left"); pnlBtnLeft.setStyle("border-top: 2px; border-bottom: 2px; padding: 4px"); pnlBtnLeft.appendChild(bZoom); pnlBtnRight=new Panel(); pnlBtnRight.setAlign("right"); pnlBtnRight.setStyle("border-top: 2px; border-bottom: 2px; padding: 4px"); pnlBtnRight.appendChild(bGenerate); pnlBtnRight.appendChild(bReset); pnlBtnRight.appendChild(bCancel); pnlTextCenter=new Panel(); pnlTextCenter.setStyle("border-top: 2px; border-bottom: 2px; padding: 4px"); pnlTextCenter.setAlign("center"); pnlTextCenter.appendChild(differenceLabel); pnlTextCenter.appendChild(differenceField); hboxBtnRight=new Hbox(); hboxBtnRight.appendChild(pnlBtnRight); hboxBtnRight.setWidth("100%"); hboxBtnRight.setStyle("text-align:right"); hboxBtnLeft=new Hbox(); hboxBtnLeft.appendChild(pnlBtnLeft); hboxBtnLeft.setWidth("100%"); hboxBtnLeft.setStyle("text-align:left"); hboxTextCenter=new Hbox(); hboxTextCenter.appendChild(pnlTextCenter); hboxTextCenter.setWidth("100%"); hboxTextCenter.setHeight("100%"); hboxTextCenter.setPack("center"); hboxTextCenter.setStyle("text-align:Center"); commandPane=new Hbox(); commandPane.appendChild(hboxBtnLeft); commandPane.appendChild(hboxTextCenter); commandPane.appendChild(hboxBtnRight); commandPane.setWidth("100%"); commandPane.setPack("center"); commandPanel.setHeight("70px"); commandPanel.setStyle("border-top: 2px; border-bottom: 2px; padding: 4px"); commandPanel.setWidth("100%"); center=new Center(); center.appendChild(commandPane); center.setBorder("0"); commandPanel.appendChild(center); South south=new South(); south.appendChild(statusBar); south.setBorder("0"); commandPanel.appendChild(south); south=new South(); south.appendChild(commandPanel); south.setBorder("0"); mainPanel.appendChild(south); this.appendChild(mainPanel); }
Initialize the form structure - Load Bank Info - Load BPartner - Load Document Type - Init Table
public TourStep(Placement placement,Widget... targets){ peer=StepPeer.newInstance(); peer.setPlacement(placement.getValue()); JsArrayString values=JsArrayString.createArray().cast(); for ( Widget el : targets) { values.push(getOrCreateId(el.getElement())); } peer.setTarget(values); }
Creates a new tour step
public void cancel(){ BaseProducerContext.callOnCancellationRequested(cancelNoCallbacks()); }
Cancels the request processing and calls appropriate callbacks.
public UserRoleAssignmentException(){ }
Constructs a new exception with <code>null</code> as its detail message. The cause is not initialized.
public DefaultRequest txTax(Double value){ setDouble(TRANSACTION_TAX,value); return this; }
<div class="ind"> <p> Optional. </p> <p>Specifies the total tax of the transaction.</p> <table border="1"> <tbody> <tr> <th>Parameter</th> <th>Value Type</th> <th>Default Value</th> <th>Max Length</th> <th>Supported Hit Types</th> </tr> <tr> <td><code>tt</code></td> <td>currency</td> <td><code>0</code> </td> <td><span class="none">None</span> </td> <td>transaction</td> </tr> </tbody> </table> <div> Example value: <code>11.20</code><br> Example usage: <code>tt=11.20</code> </div> </div>
public void resetMoves(){ List<Track> tracks=getTrackList(); for ( Track track : tracks) { track.setMoves(0); } }
Reset the move count for all tracks at this location
public Collection<Range<Token>> tokenRanges(){ return this.tokenRanges; }
The associated cassandra token range
private void doUpdateWithQuery(final HttpServletRequest req,final HttpServletResponse resp) throws IOException { final String baseURI=req.getRequestURL().toString(); final String namespace=getNamespace(req); final String queryStr=req.getParameter(QueryServlet.ATTR_QUERY); final boolean suppressTruthMaintenance=getBooleanValue(req,QueryServlet.ATTR_TRUTH_MAINTENANCE,false); if (queryStr == null) buildAndCommitResponse(resp,HTTP_BADREQUEST,MIME_TEXT_PLAIN,"Required parameter not found: " + QueryServlet.ATTR_QUERY); final Map<String,Value> bindings=parseBindings(req,resp); if (bindings == null) { return; } final String contentType=req.getContentType(); if (log.isInfoEnabled()) log.info("Request body: " + contentType); final RDFFormat requestBodyFormat=RDFFormat.forMIMEType(new MiniMime(contentType).getMimeType()); if (requestBodyFormat == null) { buildAndCommitResponse(resp,HTTP_BADREQUEST,MIME_TEXT_PLAIN,"Content-Type not recognized as RDF: " + contentType); return; } final RDFParserFactory rdfParserFactory=RDFParserRegistry.getInstance().get(requestBodyFormat); if (rdfParserFactory == null) { buildAndCommitResponse(resp,HTTP_INTERNALERROR,MIME_TEXT_PLAIN,"Parser factory not found: Content-Type=" + contentType + ", format="+ requestBodyFormat); return; } final Resource[] defaultContextInsert; { final String[] s=req.getParameterValues("context-uri-insert"); if (s != null && s.length > 0) { try { defaultContextInsert=toURIs(s); } catch ( IllegalArgumentException ex) { buildAndCommitResponse(resp,HTTP_INTERNALERROR,MIME_TEXT_PLAIN,ex.getLocalizedMessage()); return; } } else { defaultContextInsert=null; } } final Resource[] defaultContextDelete; { final String[] s=req.getParameterValues("context-uri-delete"); if (s != null && s.length > 0) { try { defaultContextDelete=toURIs(s); } catch ( IllegalArgumentException ex) { buildAndCommitResponse(resp,HTTP_INTERNALERROR,MIME_TEXT_PLAIN,ex.getLocalizedMessage()); return; } } else { defaultContextDelete=null; } } try { if (getIndexManager().isGroupCommit()) { submitApiTask(new UpdateWithQueryMaterializedTask(req,resp,namespace,ITx.UNISOLATED,queryStr,baseURI,suppressTruthMaintenance,bindings,rdfParserFactory,defaultContextDelete,defaultContextInsert)).get(); } else { submitApiTask(new UpdateWithQueryStreamingTask(req,resp,namespace,ITx.UNISOLATED,queryStr,baseURI,suppressTruthMaintenance,bindings,rdfParserFactory,defaultContextDelete,defaultContextInsert)).get(); } } catch ( Throwable t) { launderThrowable(t,resp,"UPDATE-WITH-QUERY" + ": queryStr=" + queryStr + ", baseURI="+ baseURI+ (defaultContextInsert == null ? "" : ",context-uri-insert=" + Arrays.toString(defaultContextInsert))+ (defaultContextDelete == null ? "" : ",context-uri-delete=" + Arrays.toString(defaultContextDelete))); } }
Delete all statements materialized by a DESCRIBE or CONSTRUCT query and then insert all statements in the request body. <p> Note: To avoid materializing the statements, this runs the query against the last commit time and uses a pipe to connect the query directly to the process deleting the statements. This is done while it is holding the unisolated connection which prevents concurrent modifications. Therefore the entire <code>SELECT + DELETE</code> operation is ACID.
public static Object compare(Object obj1,Object obj2,int compOp) throws TypeMismatchException { if (obj1 == null || obj2 == null) { Boolean result=nullCompare(obj1,obj2,compOp); if (result == null) return QueryService.UNDEFINED; return result; } if (obj1 == QueryService.UNDEFINED || obj2 == QueryService.UNDEFINED) { if (compOp == TOK_NE && !(obj1 == QueryService.UNDEFINED && obj2 == QueryService.UNDEFINED)) { return true; } else if (compOp == TOK_EQ && obj1.equals(obj2)) { return true; } else { return QueryService.UNDEFINED; } } if (obj1 instanceof PdxInstanceEnumInfo && obj2 instanceof Enum) { obj2=new PdxInstanceEnum((Enum<?>)obj2); } else if (obj1 instanceof Enum && obj2 instanceof PdxInstanceEnumInfo) { obj1=new PdxInstanceEnum((Enum<?>)obj1); } if (obj1 instanceof PdxString && obj2 instanceof String) { obj2=new PdxString((String)obj2); } else if (obj1 instanceof String && obj2 instanceof PdxString) { obj1=new PdxString((String)obj1); } try { int r; if (obj1 instanceof java.util.Date && obj2 instanceof java.util.Date) r=getTemporalComparator().compare(obj1,obj2); else if (obj1.getClass() != obj2.getClass() && (obj1 instanceof Number && obj2 instanceof Number)) { r=getNumericComparator().compare(obj1,obj2); } else if (obj1 instanceof Boolean || obj2 instanceof Boolean) return Boolean.valueOf(booleanCompare(obj1,obj2,compOp)); else if (obj1 instanceof Comparable && obj2 instanceof Comparable) r=((Comparable)obj1).compareTo(obj2); else if (compOp == TOK_EQ) return Boolean.valueOf(obj1.equals(obj2)); else if (compOp == TOK_NE) return Boolean.valueOf(!obj1.equals(obj2)); else throw new TypeMismatchException(LocalizedStrings.TypeUtils_UNABLE_TO_USE_A_RELATIONAL_COMPARISON_OPERATOR_TO_COMPARE_AN_INSTANCE_OF_CLASS_0_WITH_AN_INSTANCE_OF_1.toLocalizedString(new Object[]{obj1.getClass().getName(),obj2.getClass().getName()})); switch (compOp) { case TOK_EQ: return Boolean.valueOf(r == 0); case TOK_LT: return Boolean.valueOf(r < 0); case TOK_LE: return Boolean.valueOf(r <= 0); case TOK_GT: return Boolean.valueOf(r > 0); case TOK_GE: return Boolean.valueOf(r >= 0); case TOK_NE: return Boolean.valueOf(r != 0); default : throw new IllegalArgumentException(LocalizedStrings.TypeUtils_UNKNOWN_OPERATOR_0.toLocalizedString(Integer.valueOf(compOp))); } } catch (ClassCastException e) { if (compOp == TOK_EQ) return Boolean.FALSE; if (compOp == TOK_NE) return Boolean.TRUE; throw new TypeMismatchException(LocalizedStrings.TypeUtils_UNABLE_TO_COMPARE_OBJECT_OF_TYPE_0_WITH_OBJECT_OF_TYPE_1.toLocalizedString(new Object[]{obj1.getClass().getName(),obj2.getClass().getName()}),e); } catch (TypeMismatchException e) { if (compOp == TOK_EQ) return Boolean.FALSE; if (compOp == TOK_NE) return Boolean.TRUE; throw e; } }
Compares two objects using the operator
private double CADRG_x_pix_constant(double adrgscale,int zone){ double x_pix=(double)adrgscale * CADRG_ARC_A[zone - 1] / 512.0; x_pix=Math.ceil(x_pix); x_pix*=1.33333; x_pix=Math.round(x_pix); return x_pix * 256.0; }
Figures out the number of pixels around the earth, for 360 degrees. <p>
public void sendStringSync(String text){ if (text == null) { return; } KeyCharacterMap keyCharacterMap=KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD); KeyEvent[] events=keyCharacterMap.getEvents(text.toCharArray()); if (events != null) { for (int i=0; i < events.length; i++) { sendKeySync(KeyEvent.changeTimeRepeat(events[i],SystemClock.uptimeMillis(),0)); } } }
Sends the key events corresponding to the text to the app being instrumented.
public static String createWalletInfoFilename(String walletFilename){ if (walletFilename == null) { return INFO_FILE_EXTENSION; } String walletInfoFilename=walletFilename; if (walletFilename.endsWith(BitcoinModel.WALLET_FILE_EXTENSION)) { walletInfoFilename=walletInfoFilename.substring(0,walletFilename.length() - BitcoinModel.WALLET_FILE_EXTENSION.length() - 1); walletInfoFilename=walletInfoFilename + "." + INFO_FILE_EXTENSION; } else { walletInfoFilename=walletInfoFilename + "." + INFO_FILE_EXTENSION; } return walletInfoFilename; }
Create wallet info filename.
public ArrayPadding createArrayPadding(){ ArrayPaddingImpl arrayPadding=new ArrayPaddingImpl(); return arrayPadding; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public GridCacheContext<K,V> cacheContext(int cacheId){ return ctxMap.get(cacheId); }
Gets cache context by cache ID.
@Override public void eUnset(int featureID){ switch (featureID) { case RegularExpressionPackage.GROUP__NON_CAPTURING: setNonCapturing(NON_CAPTURING_EDEFAULT); return; case RegularExpressionPackage.GROUP__PATTERN: setPattern((Pattern)null); return; } super.eUnset(featureID); }
<!-- begin-user-doc --> <!-- end-user-doc -->
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){ switch (featureID) { case UmplePackage.ANONYMOUS_METHOD_BODY_2__POSTCONDITION_1: return getPostcondition_1(); } return super.eGet(featureID,resolve,coreType); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public static KeyStore create(KeyStoreType keyStoreType) throws CryptoException, IOException { if (!keyStoreType.isFileBased()) { throw new CryptoException(MessageFormat.format(res.getString("NoCreateKeyStoreNotFile.exception.message"),keyStoreType.jce())); } KeyStore keyStore=getKeyStoreInstance(keyStoreType); try { keyStore.load(null,null); } catch ( CertificateException ex) { throw new CryptoException(MessageFormat.format(res.getString("NoLoadKeyStoreType.exception.message"),keyStoreType),ex); } catch ( NoSuchAlgorithmException ex) { throw new CryptoException(MessageFormat.format(res.getString("NoLoadKeyStoreType.exception.message"),keyStoreType),ex); } return keyStore; }
Create a new, empty KeyStore.
public ConnectionDetachedPacketCollector(){ this(SmackConfiguration.getPacketCollectorSize()); }
Creates a new packet collector. If the packet filter is <tt>null</tt>, then all packets will match this collector.
public void initFromCameraParameters(Camera camera){ Camera.Parameters parameters=camera.getParameters(); previewFormat=parameters.getPreviewFormat(); previewFormatString=parameters.get("preview-format"); Log.d(TAG,"Default preview format: " + previewFormat + '/'+ previewFormatString); WindowManager manager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE); Display display=manager.getDefaultDisplay(); screenResolution=new Point(display.getWidth(),display.getHeight()); Log.d(TAG,"Screen resolution: " + screenResolution); Point screenResolutionForCamera=new Point(); screenResolutionForCamera.x=screenResolution.x; screenResolutionForCamera.y=screenResolution.y; if (screenResolution.x < screenResolution.y) { screenResolutionForCamera.x=screenResolution.y; screenResolutionForCamera.y=screenResolution.x; } cameraResolution=getCameraResolution(parameters,screenResolutionForCamera); Log.d(TAG,"Camera resolution: " + cameraResolution); }
Reads, one time, values from the camera that are needed by the app.
public IconicsDrawable paddingDp(int iconPadding){ return paddingPx(Utils.convertDpToPx(mContext,iconPadding)); }
Set the padding in dp for the drawable
public byte toOrdinal(){ return this.ordinal; }
Returns the ordinal for this interest type.
public ConcurrentUpdateSolrServer(String solrServerUrl,HttpClient client,int queueSize,int threadCount,ExecutorService es){ this(solrServerUrl,client,queueSize,threadCount,es,false); }
Uses the supplied HttpClient to send documents to the Solr server.
private void refreshParentId(int parentId,int newParentId) throws Exception { FolderTokenDividers divs=null; int i; FolderTokenDivider div=null; divs=getChildren(parentId,true); for (i=0; i < divs.count(); i++) { div=divs.get(i); div.changeParentId(newParentId); } }
Cambia los nodos hijos de un nodo a otro.
public void putNull() throws IOException { write(DerValue.tag_Null); putLength(0); }
Marshals a DER "null" value on the output stream. These are often used to indicate optional values which have been omitted.
public void mousePressed(MouseEvent evt){ if (evt.isPopupTrigger()) { createPopup(evt.getPoint()); } }
Method mousePressed.
private void interpretStr(final ReilInstruction instruction){ final Pair<Boolean,BigInteger> firstValue=loadLongValue(instruction.getFirstOperand()); if (firstValue.first()) { final BigInteger result=firstValue.second(); final String targetRegister=instruction.getThirdOperand().getValue(); final OperandSize targetSize=instruction.getThirdOperand().getSize(); setRegister(targetRegister,result,targetSize,ReilRegisterStatus.DEFINED); } else { assert false; } }
Interprets a STR instruction.
public void testClearBitPositiveInside3(){ byte aBytes[]={1,-128,56,100,-2,-76,89,45,91,3,-15,35,26}; int aSign=1; int number=45; byte rBytes[]={1,-128,56,100,-2,-76,89,13,91,3,-15,35,26}; BigInteger aNumber=new BigInteger(aSign,aBytes); BigInteger result=aNumber.clearBit(number); byte resBytes[]=new byte[rBytes.length]; resBytes=result.toByteArray(); for (int i=0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals("incorrect sign",1,result.signum()); }
clearBit(int n) inside a positive number
public void testRun(){ System.out.println("run"); Date date=new Date(); DateFactory mockDateFactory=createMock(DateFactory.class); expect(mockDateFactory.createDate()).andReturn(date).times(8); ContentDataService mockContentDataService=createMock(ContentDataService.class); WebResourceDataService mockWebResourceDataService=createMock(WebResourceDataService.class); Page mockPage1=createMock(Page.class); expect(mockWebResourceDataService.createPage(ROOT_PAGE_URL)).andReturn(mockPage1).once(); expect(mockWebResourceDataService.saveOrUpdate(mockPage1)).andReturn(mockPage1).once(); Page mockPage2=createMock(Page.class); expect(mockWebResourceDataService.createPage(PAGE_ACCESS_FORBIDDEN_URL)).andReturn(mockPage2).once(); expect(mockWebResourceDataService.saveOrUpdate(mockPage2)).andReturn(mockPage2).once(); Page mockPage3=createMock(Page.class); expect(mockWebResourceDataService.createPage(ROOT_PAGE_URL)).andReturn(mockPage3).once(); expect(mockWebResourceDataService.saveOrUpdate(mockPage3)).andReturn(mockPage3).once(); Page mockPage4=createMock(Page.class); expect(mockWebResourceDataService.createPage(PAGE_1_URL)).andReturn(mockPage4).once(); expect(mockWebResourceDataService.saveOrUpdate(mockPage4)).andReturn(mockPage4).once(); Page mockPage5=createMock(Page.class); expect(mockWebResourceDataService.createPage(PAGE_ACCESS_FORBIDDEN_URL)).andReturn(mockPage5).once(); expect(mockWebResourceDataService.saveOrUpdate(mockPage5)).andReturn(mockPage5).once(); Page mockPage6=createMock(Page.class); expect(mockWebResourceDataService.createPage(PAGE_1_URL)).andReturn(mockPage6).once(); expect(mockWebResourceDataService.saveOrUpdate(mockPage6)).andReturn(mockPage6).once(); Page mockPage7=createMock(Page.class); expect(mockWebResourceDataService.createPage(PAGE_2_URL)).andReturn(mockPage7).once(); expect(mockWebResourceDataService.saveOrUpdate(mockPage7)).andReturn(mockPage7).once(); Page mockPage8=createMock(Page.class); expect(mockWebResourceDataService.createPage(PAGE_ACCESS_FORBIDDEN_URL)).andReturn(mockPage8).once(); expect(mockWebResourceDataService.saveOrUpdate(mockPage8)).andReturn(mockPage8).once(); SSP ssp1=createMock(SSP.class); expect(mockContentDataService.getSSP(date,ROOT_PAGE_URL,pageMap.get(ROOT_PAGE_URL),null,HttpStatus.SC_OK)).andReturn(ssp1).once(); expect(ssp1.getHttpStatusCode()).andReturn(HttpStatus.SC_OK).once(); expect(ssp1.getURI()).andReturn(ROOT_PAGE_URL).once(); ssp1.setDOM(readFile("htmlFiles/root-page_1.html",false)); ssp1.setPage(mockPage1); expect(mockContentDataService.saveOrUpdate(ssp1)).andReturn(ssp1).once(); SSP ssp2=createMock(SSP.class); expect(mockContentDataService.getSSP(date,PAGE_ACCESS_FORBIDDEN_URL,pageMap.get(PAGE_ACCESS_FORBIDDEN_URL),null,HttpStatus.SC_OK)).andReturn(ssp2).once(); expect(ssp2.getHttpStatusCode()).andReturn(HttpStatus.SC_OK).once(); expect(ssp2.getURI()).andReturn(PAGE_ACCESS_FORBIDDEN_URL).once(); ssp2.setDOM(readFile("htmlFiles/page-access-forbidden_1.html",false)); ssp2.setPage(mockPage2); expect(mockContentDataService.saveOrUpdate(ssp2)).andReturn(ssp2).once(); SSP ssp3=createMock(SSP.class); expect(mockContentDataService.getSSP(date,ROOT_PAGE_URL,pageMap.get(ROOT_PAGE_URL),null,HttpStatus.SC_OK)).andReturn(ssp3).once(); expect(ssp3.getHttpStatusCode()).andReturn(HttpStatus.SC_OK).once(); expect(ssp3.getURI()).andReturn(ROOT_PAGE_URL).once(); ssp3.setDOM(readFile("htmlFiles/root-page_1.html",false)); ssp3.setPage(mockPage3); expect(mockContentDataService.saveOrUpdate(ssp3)).andReturn(ssp3).once(); SSP ssp4=createMock(SSP.class); expect(mockContentDataService.getSSP(date,PAGE_1_URL,pageMap.get(PAGE_1_URL),null,HttpStatus.SC_OK)).andReturn(ssp4).once(); expect(ssp4.getHttpStatusCode()).andReturn(HttpStatus.SC_OK).once(); expect(ssp4.getURI()).andReturn(PAGE_1_URL).once(); ssp4.setDOM(readFile("htmlFiles/page-1_1.html",false)); ssp4.setPage(mockPage4); expect(mockContentDataService.saveOrUpdate(ssp4)).andReturn(ssp4).once(); SSP ssp5=createMock(SSP.class); expect(mockContentDataService.getSSP(date,PAGE_ACCESS_FORBIDDEN_URL,pageMap.get(PAGE_ACCESS_FORBIDDEN_URL),null,HttpStatus.SC_OK)).andReturn(ssp5).once(); expect(ssp5.getHttpStatusCode()).andReturn(HttpStatus.SC_OK).once(); expect(ssp5.getURI()).andReturn(PAGE_ACCESS_FORBIDDEN_URL).once(); ssp5.setDOM(readFile("htmlFiles/page-access-forbidden_1.html",false)); ssp5.setPage(mockPage5); expect(mockContentDataService.saveOrUpdate(ssp5)).andReturn(ssp5).once(); SSP ssp6=createMock(SSP.class); expect(mockContentDataService.getSSP(date,PAGE_1_URL,pageMap.get(PAGE_1_URL),null,HttpStatus.SC_OK)).andReturn(ssp6).once(); expect(ssp6.getHttpStatusCode()).andReturn(HttpStatus.SC_OK).once(); expect(ssp6.getURI()).andReturn(PAGE_1_URL).once(); ssp6.setDOM(readFile("htmlFiles/page-1_1.html",false)); ssp6.setPage(mockPage6); expect(mockContentDataService.saveOrUpdate(ssp6)).andReturn(ssp6).once(); SSP ssp7=createMock(SSP.class); expect(mockContentDataService.getSSP(date,PAGE_2_URL,pageMap.get(PAGE_2_URL),null,HttpStatus.SC_OK)).andReturn(ssp7).once(); expect(ssp7.getHttpStatusCode()).andReturn(HttpStatus.SC_OK).once(); expect(ssp7.getURI()).andReturn(PAGE_2_URL).once(); ssp7.setDOM(readFile("htmlFiles/page-2_1.html",false)); ssp7.setPage(mockPage7); expect(mockContentDataService.saveOrUpdate(ssp7)).andReturn(ssp7).once(); SSP ssp8=createMock(SSP.class); expect(mockContentDataService.getSSP(date,PAGE_ACCESS_FORBIDDEN_URL,pageMap.get(PAGE_ACCESS_FORBIDDEN_URL),null,HttpStatus.SC_OK)).andReturn(ssp8).once(); expect(ssp8.getHttpStatusCode()).andReturn(HttpStatus.SC_OK).once(); expect(ssp8.getURI()).andReturn(PAGE_ACCESS_FORBIDDEN_URL).once(); ssp8.setDOM(readFile("htmlFiles/page-access-forbidden_1.html",false)); ssp8.setPage(mockPage8); expect(mockContentDataService.saveOrUpdate(ssp8)).andReturn(ssp8).once(); Site mockSite=createMock(Site.class); mockSite.addChild(mockPage1); expectLastCall().once(); mockSite.addChild(mockPage2); expectLastCall().once(); mockSite.addChild(mockPage3); expectLastCall().once(); mockSite.addChild(mockPage4); expectLastCall().once(); mockSite.addChild(mockPage5); expectLastCall().once(); mockSite.addChild(mockPage6); expectLastCall().once(); mockSite.addChild(mockPage7); expectLastCall().once(); mockSite.addChild(mockPage8); expectLastCall().once(); expect(mockSite.getURL()).andReturn(ROOT_PAGE_URL).once(); replay(mockPage1); replay(mockPage2); replay(mockPage3); replay(mockPage4); replay(mockPage5); replay(mockPage6); replay(mockPage7); replay(mockPage8); replay(mockSite); replay(mockWebResourceDataService); replay(mockDateFactory); replay(mockContentDataService); replay(ssp1); replay(ssp2); replay(ssp3); replay(ssp4); replay(ssp5); replay(ssp6); replay(ssp7); replay(ssp8); verify(mockPage1); verify(mockPage2); verify(mockPage3); verify(mockPage4); verify(mockPage5); verify(mockPage6); verify(mockPage7); verify(mockPage8); verify(mockSite); verify(mockWebResourceDataService); verify(mockDateFactory); verify(mockContentDataService); verify(ssp1); verify(ssp2); verify(ssp3); verify(ssp4); verify(ssp5); verify(ssp6); verify(ssp7); verify(ssp8); }
For this test, we use the pages hosted at http://site.tgqa.org/. The sequence is : - get the page "http://site.tgqa.org/." - click on "This page won't be crawled due to the robots.txt restrictrion" link - get the page "http://site.tgqa.org/page-access-forbidden-for-robots.html" - click on "Back" button - get the page "http://site.tgqa.org/." - click on "This page will be crawled" link - get the page "http://site.tgqa.org/page-1.html" - click on "This page won't be crawled due to the robots.txt restrictrion" link - get the page "http://site.tgqa.org/page-access-forbidden-for-robots.html" - click on "Back" button - get the page "http://site.tgqa.org/page-1.html" - click on "This page will be crawled" link - get the page "http://site.tgqa.org/page-2.html" - click on "This page won't be crawled due to the robots.txt restrictrion" link - get the page "http://site.tgqa.org/page-access-forbidden-for-robots.html" For each retrieved page, a webResource is created and added to the parent WebResource and a SSP is created that handles the source code of the page. In this test, we don't mock the HarFileContentLoaderFactory and the ProfileFactory This test is a Functionnal test Test of run method, of class ScenarioLoaderImpl.
protected void transmitAtEndOfTask(final Task<Revision> task,final Task<Diff> result) throws TimeoutException { this.processingTimeDiff+=System.currentTimeMillis() - startTime; if (task.getTaskType() == TaskTypes.TASK_FULL || task.getTaskType() == TaskTypes.TASK_PARTIAL_LAST) { diffedSize+=result.byteSize(); ArticleInformation info=result.getHeader(); info.setRevisionCounter(revisionCounter); info.setIgnoredRevisionsCounter(ignoredRevisionsCounter); info.setDiffedSize(diffedSize); info.setDiffPartCounter(diffPartCounter); info.setProcessingTimeRead(task.getHeader().getProcessingTimeRead()); info.setProcessingTimeDiff(processingTimeDiff); } super.transmitAtEndOfTask(task,result); }
Transmits the DiffTask at the end of the RevisionTask processing.
@Override public void createOrAddVolumesToExportMask(URI arrayURI,URI exportGroupURI,URI exportMaskURI,Map<URI,Integer> volumeMap,List<URI> initiatorURIs2,TaskCompleter completer,String stepId){ try { WorkflowStepCompleter.stepExecuting(stepId); StorageSystem array=_dbClient.queryObject(StorageSystem.class,arrayURI); ExportMask exportMask=_dbClient.queryObject(ExportMask.class,exportMaskURI); if (exportMask == null || exportMask.getInactive()) { _log.info(String.format("ExportMask %s deleted or inactive, failing",exportMaskURI)); ServiceError svcerr=VPlexApiException.errors.createBackendExportMaskDeleted(exportMaskURI.toString(),arrayURI.toString()); WorkflowStepCompleter.stepFailed(stepId,svcerr); return; } List<String> lockKeys=ControllerLockingUtil.getHostStorageLockKeys(_dbClient,ExportGroupType.Host,StringSetUtil.stringSetToUriList(exportMask.getInitiators()),arrayURI); getWorkflowService().acquireWorkflowStepLocks(stepId,lockKeys,LockTimeoutValue.get(LockType.VPLEX_BACKEND_EXPORT)); BlockStorageDevice device=_blockController.getDevice(array.getSystemType()); exportMask=refreshExportMask(array,device,exportMask); if (!exportMask.hasAnyVolumes()) { List<URI> initiatorURIs=new ArrayList<URI>(); List<Initiator> initiators=new ArrayList<Initiator>(); for ( String initiatorId : exportMask.getInitiators()) { Initiator initiator=_dbClient.queryObject(Initiator.class,URI.create(initiatorId)); if (initiator != null) { initiators.add(initiator); initiatorURIs.add(initiator.getId()); } } List<URI> targets=new ArrayList<URI>(); for ( String targetId : exportMask.getStoragePorts()) { targets.add(URI.create(targetId)); } completer=new ExportMaskCreateCompleter(exportGroupURI,exportMaskURI,initiatorURIs,volumeMap,stepId); device.doExportCreate(array,exportMask,volumeMap,initiators,targets,completer); } else { List<URI> initiatorURIs=new ArrayList<URI>(); List<Initiator> initiators=new ArrayList<Initiator>(); for ( String initiatorId : exportMask.getInitiators()) { Initiator initiator=_dbClient.queryObject(Initiator.class,URI.create(initiatorId)); if (initiator != null) { initiators.add(initiator); initiatorURIs.add(initiator.getId()); } } device.doExportAddVolumes(array,exportMask,initiators,volumeMap,completer); } } catch ( Exception ex) { _log.error("Failed to create or add volumes to export mask for vmax: ",ex); VPlexApiException vplexex=DeviceControllerExceptions.vplex.addStepsForCreateVolumesFailed(ex); WorkflowStepCompleter.stepFailed(stepId,vplexex); } }
Create an ExportMask on the VMAX if it does not exist. Otherwise, just add the indicated volumes to the ExportMask.
public void run(ExecutorService executor,Runnable task){ if (executor == null || task == null) { throw new IllegalStateException("Valid executor/task must be provided"); } if (executor.isShutdown()) { throw new IllegalStateException("Stopped"); } OperationContext origContext=OperationContext.getOperationContext(); executor.execute(null); }
Executes the task using provided executor
public static String repeat(String str,int count){ final StringBuilder result=new StringBuilder(str.length() * count); for (int i=0; i < count; i++) { result.append(str); } return result.toString(); }
Repeats the specified substring a number of times.
public final Vec2D minSelf(ReadonlyVec2D v){ x=MathUtils.min(x,v.x()); y=MathUtils.min(y,v.y()); return this; }
Adjusts the vector components to the minimum values of both vectors
public void runTest() throws Throwable { Document doc; NodeList elementList; Element testAddr; Attr addrAttr; String localName; doc=(Document)load("staffNS",false); elementList=doc.getElementsByTagName("emp:address"); testAddr=(Element)elementList.item(0); assertNotNull("empAddrNotNull",testAddr); addrAttr=testAddr.getAttributeNode("emp:domestic"); localName=addrAttr.getLocalName(); assertEquals("localName","domestic",localName); }
Runs the test case.
public static WhereBuilder b(String columnName,String op,Object value){ WhereBuilder result=new WhereBuilder(); result.appendCondition(null,columnName,op,value); return result; }
create new instance
@DSSafe(DSCat.SAFE_OTHERS) public AccessibilityNodeInfo focusSearch(int direction){ enforceSealed(); if (!canPerformRequestOverConnection(mSourceNodeId)) { return null; } AccessibilityNodeInfo node=new AccessibilityNodeInfo(DSOnlyType.DONTCARE); node.addTaint(getTaint()); node.addTaint(direction); return node; }
Searches for the nearest view in the specified direction that can take the input focus.
public BlobStore openBlobStore(String url,Map<String,String> parameters) throws IOException { Map<String,String> key=new HashMap<String,String>(); if (parameters != null) { key.putAll(parameters); } key.put(URL_KEY,url); synchronized (stores) { Iterator<WeakReference<BlobStore>> iter=stores.values().iterator(); while (iter.hasNext()) { if (iter.next().get() == null) { iter.remove(); } } WeakReference<BlobStore> ref=stores.get(key); if (ref != null) { BlobStore store=ref.get(); if (store != null) return store; } } BlobStore store=getBlobStoreProvider(url,parameters); if (store == null) throw new IllegalArgumentException("No blob store provider is available for: " + url); synchronized (stores) { stores.put(key,new WeakReference<BlobStore>(store)); } return store; }
Create or retrieve a BlobStore at this location.
public static MouseListener add(MouseListener a,MouseListener b){ return (MouseListener)addInternal(a,b); }
Adds mouse-listener-a with mouse-listener-b and returns the resulting multicast listener.
public ListNode deleteDuplicates(ListNode head){ ListNode cur=head; while (cur != null) { while (cur.next != null && cur.val == cur.next.val) { cur.next=cur.next.next; } cur=cur.next; } return head; }
nested while loop, skip next node
public String toString(){ return time + "\t:" + count; }
Reasonable toString method.
public void testExpandingEntityReferencesOffDoesNotImpactPredefinedEntities() throws Exception { String xml="<foo>abc&amp;def</foo>"; DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance(); factory.setExpandEntityReferences(false); document=factory.newDocumentBuilder().parse(new InputSource(new StringReader(xml))); Element documentElement=document.getDocumentElement(); Text text=(Text)documentElement.getFirstChild(); assertEquals("abc&def",text.getTextContent()); assertNull(text.getNextSibling()); }
Predefined entities should always be expanded. https://code.google.com/p/android/issues/detail?id=225
public static PlatformContext platformContext(Ignite grid){ return platformProcessor(grid).context(); }
Gets interop context for the grid.
protected void onDismiss(){ }
On dismiss
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception { sessionContext.checkPermission(Right.BuildingList); DistanceMetric.Ellipsoid ellipsoid=DistanceMetric.Ellipsoid.valueOf(ApplicationProperty.DistanceEllipsoid.value()); WebTable webTable=new WebTable(5,null,"buildingList.do?ord=%%",new String[]{"Abbreviation","Name","External ID",ellipsoid.getFirstCoordinateName(),ellipsoid.getSecondCoordinateName()},new String[]{"left","left","left","right","right"},new boolean[]{true,true,true,true,true}); WebTable.setOrder(sessionContext,"BuildingList.ord",request.getParameter("ord"),1); DecimalFormat df5=new DecimalFormat("####0.######"); for ( Building b : Building.findAll(sessionContext.getUser().getCurrentAcademicSessionId())) { webTable.addLine("onClick=\"document.location='buildingEdit.do?op=Edit&id=" + b.getUniqueId() + "';\"",new String[]{b.getAbbreviation(),b.getName(),b.getExternalUniqueId() == null ? "<i>N/A</i>" : b.getExternalUniqueId().toString(),(b.getCoordinateX() == null ? "" : df5.format(b.getCoordinateX())),(b.getCoordinateY() == null ? "" : df5.format(b.getCoordinateY()))},new Comparable[]{b.getAbbreviation(),b.getName(),b.getExternalUniqueId() == null ? "" : b.getExternalUniqueId().toString(),b.getCoordinateX(),b.getCoordinateY()}); } request.setAttribute("table",webTable.printTable(WebTable.getOrder(sessionContext,"BuildingList.ord"))); return mapping.findForward("showBuildingList"); }
Method execute
public static int hashCode(byte[] b){ int h=0; for ( byte c : b) h=31 * h + (c & 0xFF); return h; }
compute a hash code that is equal to the hash computation of String()
public static String createRedactedDescription(SamlToken token){ return String.format("%s [subject=%s, groups=%s, delegactionChain=%s, startTime=%s, " + "expirationTime=%s, renewable=%s, delegable=%s, isSolution=%s," + "confirmationType=%s]",token.getClass().getSimpleName(),getTokenSubjectForLog(token),token.getGroupList(),token.getDelegationChain(),token.getStartTime(),token.getExpirationTime(),token.isRenewable(),token.isDelegable(),token.isSolution(),token.getConfirmationType()); }
Creates a description of the token without any private information
@Override protected void finalize() throws Throwable { mType=null; mSequence=null; super.finalize(); }
dealloc methods
@Override public int eBaseStructuralFeatureID(int derivedFeatureID,Class<?> baseClass){ if (baseClass == MappedElement.class) { switch (derivedFeatureID) { case SexecPackage.EXECUTION_FLOW__SOURCE_ELEMENT: return SexecPackage.MAPPED_ELEMENT__SOURCE_ELEMENT; default : return -1; } } if (baseClass == NamedElement.class) { switch (derivedFeatureID) { case SexecPackage.EXECUTION_FLOW__NAME: return BasePackage.NAMED_ELEMENT__NAME; default : return -1; } } if (baseClass == ExecutionScope.class) { switch (derivedFeatureID) { case SexecPackage.EXECUTION_FLOW__STATE_VECTOR: return SexecPackage.EXECUTION_SCOPE__STATE_VECTOR; case SexecPackage.EXECUTION_FLOW__SUB_SCOPES: return SexecPackage.EXECUTION_SCOPE__SUB_SCOPES; case SexecPackage.EXECUTION_FLOW__SUPER_SCOPE: return SexecPackage.EXECUTION_SCOPE__SUPER_SCOPE; case SexecPackage.EXECUTION_FLOW__ENTER_SEQUENCES: return SexecPackage.EXECUTION_SCOPE__ENTER_SEQUENCES; case SexecPackage.EXECUTION_FLOW__EXIT_SEQUENCE: return SexecPackage.EXECUTION_SCOPE__EXIT_SEQUENCE; case SexecPackage.EXECUTION_FLOW__INIT_SEQUENCE: return SexecPackage.EXECUTION_SCOPE__INIT_SEQUENCE; default : return -1; } } if (baseClass == ExecutionNode.class) { switch (derivedFeatureID) { case SexecPackage.EXECUTION_FLOW__REACTIONS: return SexecPackage.EXECUTION_NODE__REACTIONS; case SexecPackage.EXECUTION_FLOW__SIMPLE_NAME: return SexecPackage.EXECUTION_NODE__SIMPLE_NAME; case SexecPackage.EXECUTION_FLOW__REACT_SEQUENCE: return SexecPackage.EXECUTION_NODE__REACT_SEQUENCE; default : return -1; } } return super.eBaseStructuralFeatureID(derivedFeatureID,baseClass); }
<!-- begin-user-doc --> <!-- end-user-doc -->
@Override public String toString(){ StringBuffer buffer=new StringBuffer("CellConstraints"); buffer.append("[x="); buffer.append(gridX); buffer.append("; y="); buffer.append(gridY); buffer.append("; w="); buffer.append(gridWidth); buffer.append("; h="); buffer.append(gridHeight); buffer.append("; hAlign="); buffer.append(hAlign); buffer.append("; vAlign="); buffer.append(vAlign); if (!EMPTY_INSETS.equals(insets)) { buffer.append("; insets="); buffer.append(insets); } buffer.append("; honorsVisibility="); buffer.append(honorsVisibility); buffer.append(']'); return buffer.toString(); }
Constructs and returns a string representation of this constraints object.
public ReadStream openRead() throws IOException { if (_isDone) return null; else if (_readStream == null) _readStream=new ReadStream(this); else if (!_isPartDone) { int len; while ((len=read(_dummyBuffer,0,_dummyBuffer.length)) >= 0) { } if (_isDone) return null; } _readStream.init(this); _isPartDone=false; if (scanHeaders()) { String contentType=(String)getAttribute("content-type"); String charset=getAttributePart(contentType,"charset"); return _readStream; } else { _isDone=true; _readStream.close(); return null; } }
Opens the next part of the multipart/mime stream for reading. Returns null when the last section is read.
private void addToken(int start,int end,int tokenType){ int so=start + offsetShift; addToken(zzBuffer,start,end,tokenType,so); }
Adds the token specified to the current linked list of tokens.
String formatParameterObject(Object object){ if (object == null) { return "NULL"; } else { if (object instanceof String) { return "'" + escapeString((String)object) + "'"; } else if (object instanceof Date) { return "'" + new SimpleDateFormat(dateFormat).format(object) + "'"; } else if (object instanceof Boolean) { return DriverSpy.DumpBooleanAsTrueFalse ? ((Boolean)object).booleanValue() ? "true" : "false" : ((Boolean)object).booleanValue() ? "1" : "0"; } else { return object.toString(); } } }
Format an Object that is being bound to a PreparedStatement parameter, for display. The goal is to reformat the object in a format that can be re-run against the native SQL client of the particular Rdbms being used. This class should be extended to provide formatting instances that format objects correctly for different RDBMS types.
private void updateProgress(String progressLabel,int progress){ if (myHost != null && ((progress != previousProgress) || (!progressLabel.equals(previousProgressLabel)))) { myHost.updateProgress(progressLabel,progress); } previousProgress=progress; previousProgressLabel=progressLabel; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
public synchronized void ensureCapacity(int minimumCapacity){ if (elementData.length < minimumCapacity) { int next=(capacityIncrement <= 0 ? elementData.length : capacityIncrement) + elementData.length; grow(minimumCapacity > next ? minimumCapacity : next); } }
Ensures that this vector can hold the specified number of elements without growing.
private synchronized boolean shouldGarbageCollectPeer(Peer peer){ Date lastSeen=peer.getLastSeen(); Date now=new Date(); long msSinceSeen=now.getTime() - lastSeen.getTime(); return msSinceSeen > PEER_TIMEOUT; }
Check whether a peer is considered old enough to consider it unlikely to return.
public static void assertNotEquals(boolean notExpected,boolean actual){ try { Verify.assertNotEquals("boolean",notExpected,actual); } catch ( AssertionError e) { Verify.throwMangledException(e); } }
Asserts that two booleans are not equal.
public static SourceArtifactCreator makeSourceArtifactCreator(RepositoryManager repoManager,Iterable<? extends File> sourcePaths,String moduleName,String moduleVersion,boolean verbose,Logger log) throws IOException { return new SourceArtifactCreatorImpl(repoManager,sourcePaths,moduleName,moduleVersion,verbose,log); }
Create and return a new SourceArchiveCreator.
@Override public boolean isPostOperation(){ return false; }
True if the context is for post-operation.
public CCWavesTiles3D(int wav,float amp,ccGridSize gridSize,float d){ super(gridSize,d); waves=wav; amplitude=amp; amplitudeRate=1.0f; }
initializes the action with a number of waves, the waves amplitude, the grid size and the duration
public static SyntaxScheme loadFromString(String string){ SyntaxScheme scheme=new SyntaxScheme(true); try { if (string != null) { String[] tokens=string.split(",",-1); if (tokens.length == 0 || !VERSION.equals(tokens[0])) { return scheme; } int tokenTypeCount=Token.NUM_TOKEN_TYPES; int tokenCount=tokenTypeCount * 7 + 1; if (tokens.length != tokenCount) { throw new Exception("Not enough tokens in packed color scheme: expected " + tokenCount + ", found "+ tokens.length); } for (int i=0; i < tokenTypeCount; i++) { int pos=i * 7 + 1; int integer=Integer.parseInt(tokens[pos]); if (integer != i) throw new Exception("Expected " + i + ", found "+ integer); Color fg=null; String temp=tokens[pos + 1]; if (!"-".equals(temp)) { fg=stringToColor(temp); } Color bg=null; temp=tokens[pos + 2]; if (!"-".equals(temp)) { bg=stringToColor(temp); } temp=tokens[pos + 3]; if (!"t".equals(temp) && !"f".equals(temp)) throw new Exception("Expected 't' or 'f', found " + temp); boolean underline="t".equals(temp); Font font=null; String family=tokens[pos + 4]; if (!"-".equals(family)) { font=new Font(family,Integer.parseInt(tokens[pos + 5]),Integer.parseInt(tokens[pos + 6])); } scheme.styles[i]=new Style(fg,bg,font,underline); } } } catch ( Exception e) { e.printStackTrace(); } return scheme; }
Loads a syntax highlighting color scheme from a string created from <code>toCommaSeparatedString</code>. This method is useful for saving and restoring color schemes.
private void modifyLocalVariable(){ int count=0; }
Method to test the local variable's effective final state.
public static DialogOption showYesNoMessage(final String message,final String title,final int msgType){ return MessageService.instance().showYesNoMessage(message,title,msgType); }
Acts as a proxy for the <tt>MessageService</tt> class. Displays a locale-specific message to the user in the form of a yes or no question.
private Sprite buildOutfit(int code,final OutfitColor color){ final int bodycode=(code % 100); code/=100; final int dresscode=(code % 100); code/=100; final int headcode=(code % 100); code/=100; final int haircode=(code % 100); code/=100; final int detailcode=(code % 100); Sprite layer=getBodySprite(bodycode,color); if (layer == null) { throw new IllegalArgumentException("No body image found for outfit: " + bodycode); } final ImageSprite sprite=new ImageSprite(layer); final Graphics g=sprite.getGraphics(); layer=getDressSprite(dresscode,color); layer.draw(g,0,0); layer=getHeadSprite(headcode,color); layer.draw(g,0,0); layer=getHairSprite(haircode,color); layer.draw(g,0,0); layer=getDetailSprite(detailcode,color); layer.draw(g,0,0); return sprite; }
Build an outfit sprite. The outfit is described by an "outfit code". It is an 8-digit integer of the form TTRRHHDDBB where TT is the number of the detail graphics (optional) RR is the number of the hair graphics (optional), HH for the head, DD for the dress, and BB for the body.
public void invokeInterface(final Type owner,final Method method){ invokeInsn(Opcodes.INVOKEINTERFACE,owner,method,true); }
Generates the instruction to invoke an interface method.
protected void flush(){ HibernateTemplate hibernateTemplate=new HibernateTemplate((SessionFactory)applicationContext.getBean("sessionFactory")); hibernateTemplate.flush(); hibernateTemplate.clear(); }
Create a HibernateTemplate from the SessionFactory and call flush() and clear() on it. Designed to be used after "save" methods in tests: http://issues.appfuse.org/browse/APF-178.
public RedisStateMachineContextRepository(RedisConnectionFactory redisConnectionFactory){ redisOperations=createDefaultTemplate(redisConnectionFactory); }
Instantiates a new redis state machine context repository.
public void writeChars(String s) throws IOException { int length=s.length(); for (int i=0; i < length; i++) { int c=s.charAt(i); out.write(c & 0xFF); out.write((c >>> 8) & 0xFF); } written+=length * 2; }
Writes a string to the underlying output stream as a sequence of characters. Each character is written to the data output stream as if by the <code>writeChar</code> method.
public UsageServer(int port,File usageDir,int threads) throws IOException { if (!Charset.isSupported(UTF_8)) { throw new IOException("UTF-8 character encoding not supported"); } System.setProperty("sun.net.httpserver.maxReqTime","30"); System.setProperty("sun.net.httpserver.maxRspTime","30"); mUsageDir=usageDir; mPort=port; mThreadPoolExecutor=new ThreadPoolExecutor(threads,threads,0,TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>(),new UsageServerThreadFactory()); }
Constructs and obtains lock on usage file for current month.
public void childrenRemoved(BeanContextMembershipEvent bcme){ Iterator it=bcme.iterator(); while (it.hasNext()) { findAndUndo(it.next()); } }
BeanContextMembershipListener method. Called when a new object is removed from the BeanContext of this object. For the Layer, this method doesn't do anything. If your layer does something with the childrenAdded method, or findAndInit, you should take steps in this method to unhook the layer from the object used in those methods.
public int recordObject(CollectionId id,Document object,long timestamp) throws InterruptedException { final Struct sourceValue=source.lastOffsetStruct(replicaSetName,id); final Map<String,?> offset=source.lastOffset(replicaSetName); String objId=objectIdLiteralFrom(object); return createRecords(sourceValue,offset,Operation.READ,objId,object,timestamp); }
Generate and record one or more source records to describe the given object.
ProposalSorterHandle(IConfigurationElement element) throws InvalidRegistryObjectException, CoreException { Assert.isLegal(element != null); fElement=element; fId=element.getAttribute(ID); checkNotNull(fId,ID); String name=element.getAttribute(NAME); if (name == null) fName=fId; else fName=name; fClass=element.getAttribute(CLASS); checkNotNull(fClass,CLASS); }
Creates a new descriptor.
private static double[] computeLabels(final double start,final double end,final int approxNumLabels){ if (Math.abs(start - end) < 0.0000001f) { return new double[]{start,start,0}; } double s=start; double e=end; boolean switched=false; if (s > e) { switched=true; double tmp=s; s=e; e=tmp; } double xStep=roundUp(Math.abs(s - e) / approxNumLabels); double xStart=xStep * Math.ceil(s / xStep); double xEnd=xStep * Math.floor(e / xStep); if (switched) { return new double[]{xEnd,xStart,-1.0 * xStep}; } return new double[]{xStart,xEnd,xStep}; }
Computes a reasonable number of labels for a data range.
public EnumComboBoxCellRenderer(String key){ this.i18nKeyPrefix=key; }
Creates a Enumeration ComboBox cell renderer.
protected String apply(String source){ String result=source; String match=m_matchS; if (m_ignoreCase) { result=result.toLowerCase(); match=match.toLowerCase(); } if (result != null && result.length() > 0) { if (m_regex) { result=m_regexPattern.matcher(result).replaceAll(m_replaceS); } else { result=result.replace(match,m_replaceS); } } return result; }
Apply this rule to the supplied string
public ShapeWriter(){ }
Creates a new ShapeWriter with the default (identity) point transformation.
protected void clearCurrentText(){ this.currentText.delete(0,this.currentText.length()); }
Removes all text from the textbuffer at the end of a CDATA section.
public void clear(){ if (arrayTable != null) { arrayTable.clear(); } }
Removes all the mappings from this <code>InputMap</code>.
public Coord4D step(ForgeDirection side){ return translate(side.offsetX,side.offsetY,side.offsetZ); }
Steps this Coord4D in the defined side's offset without creating a new value.
public String optString(int index){ return optString(index,""); }
Get the optional string value associated with an index. It returns an empty string if there is no value at that index. If the value is not a string and is not null, then it is coverted to a string.
public RuleSet[] split(int[] points,RuleSet[] sets){ for (int i=0; i < (points.length > 0 ? points[0] : rules.length); i++) sets[0].addRule((Rule)(rules[i].clone())); if (points.length > 0) { for (int p=1; p < points.length; p++) for (int i=points[p - 1]; i < points[p]; i++) sets[p].addRule((Rule)(rules[i].clone())); for (int i=points[points.length - 1]; i < rules.length; i++) sets[points.length].addRule((Rule)(rules[i].clone())); } return sets; }
Splits the rule set into n pieces, according to points, which *must* be sorted. The rules in each piece are cloned and added to the equivalent set. Sets must be already allocated. sets.length must be 1+ points.length. Comment: This function appends the split rulesets to the existing rulesets already in <i>sets</i>.
public void updateBlob(String columnLabel,InputStream inputStream) throws SQLException { throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); }
Updates the designated column using the given input stream. When a very large ASCII value is input to a <code>LONGVARCHAR</code> parameter, it may be more practical to send it via a <code>java.io.InputStream</code>. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format. <P><B>Note:</B> This stream object can either be a standard Java stream object or your own subclass that implements the standard interface. <P><B>Note:</B> Consult your JDBC driver documentation to determine if it might be more efficient to use a version of <code>updateBlob</code> which takes a length parameter. <p> The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database.
public double num(){ return toDouble(); }
Cast result object to a number.
public IncompatibleComparatorException(String message,Throwable cause){ super(message,cause); }
Create a new IncompatibleComparatorException.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:31.658 -0500",hash_original_method="9FCBFE264C415F40E8FC1E843482D494",hash_generated_method="D1C00D2D9C7C9C5095A0BFA12F667944") public javax.sip.address.Address createAddress(String address) throws java.text.ParseException { if (address == null) throw new NullPointerException("null address"); if (address.equals("*")) { AddressImpl addressImpl=new AddressImpl(); addressImpl.setAddressType(AddressImpl.WILD_CARD); SipURI uri=new SipUri(); uri.setUser("*"); addressImpl.setURI(uri); return addressImpl; } else { StringMsgParser smp=new StringMsgParser(); return smp.parseAddress(address); } }
Creates an Address with the new address string value. The address string is parsed in order to create the new Address instance. Create with a String value of "*" creates a wildcard address. The wildcard can be determined if <code>((SipURI)Address.getURI).getUser() == *;</code>.
void memberEnter(List<? extends JCTree> trees,Env<AttrContext> env){ for (List<? extends JCTree> l=trees; l.nonEmpty(); l=l.tail) memberEnter(l.head,env); }
Enter members from a list of trees.
public void testGetPropertyNames(){ ArbitraryPropertySupport instance=(new UnboundBeanImpl()).aps(); Set<String> expResult=new HashSet<>(6); expResult.add(CLASS); expResult.add(PROPERTY_NAMES); expResult.add(STRING_PROPERTY); expResult.add(INDEXED_PROPERTY); expResult.add(MAPPED_STRING); expResult.add(MAPPED_INDEXED); Set<String> result=instance.getPropertyNames(); assertEquals(expResult,result); }
Test of getPropertyNames method, of class UnboundBean.
public static boolean isStandardLanguage(Locale locale){ if (Locale.ENGLISH.equals(locale) || Locale.GERMAN.equals(locale) || Locale.JAPANESE.equals(locale)) { return true; } return false; }
check if the locale is standard language
public CutSubsessionAction(){ super("Cut"); }
Constucts an action for loading the session in the given '.tet' file into the desktop.
@RequestProcessing(value="/member/{userName}/following/articles",method=HTTPRequestMethod.GET) @Before(adviceClass={StopwatchStartAdvice.class,AnonymousViewCheck.class,UserBlockCheck.class}) @After(adviceClass=StopwatchEndAdvice.class) public void showHomeFollowingArticles(final HTTPRequestContext context,final HttpServletRequest request,final HttpServletResponse response,final String userName) throws Exception { final JSONObject user=(JSONObject)request.getAttribute(User.USER); request.setAttribute(Keys.TEMAPLTE_DIR_NAME,Symphonys.get("skinDirName")); final AbstractFreeMarkerRenderer renderer=new SkinRenderer(); context.setRenderer(renderer); renderer.setTemplateName("/home/following-articles.ftl"); final Map<String,Object> dataModel=renderer.getDataModel(); filler.fillHeaderAndFooter(request,response,dataModel); String pageNumStr=request.getParameter("p"); if (Strings.isEmptyOrNull(pageNumStr) || !Strings.isNumeric(pageNumStr)) { pageNumStr="1"; } final int pageNum=Integer.valueOf(pageNumStr); final int pageSize=Symphonys.getInt("userHomeFollowingArticlesCnt"); final int windowSize=Symphonys.getInt("userHomeFollowingArticlesWindowSize"); fillHomeUser(dataModel,user); final String followingId=user.optString(Keys.OBJECT_ID); dataModel.put(Follow.FOLLOWING_ID,followingId); avatarQueryService.fillUserAvatarURL(user); final JSONObject followingArticlesResult=followQueryService.getFollowingArticles(followingId,pageNum,pageSize); final List<JSONObject> followingArticles=(List<JSONObject>)followingArticlesResult.opt(Keys.RESULTS); dataModel.put(Common.USER_HOME_FOLLOWING_ARTICLES,followingArticles); final boolean isLoggedIn=(Boolean)dataModel.get(Common.IS_LOGGED_IN); if (isLoggedIn) { final JSONObject currentUser=(JSONObject)dataModel.get(Common.CURRENT_USER); final String followerId=currentUser.optString(Keys.OBJECT_ID); final boolean isFollowing=followQueryService.isFollowing(followerId,followingId); dataModel.put(Common.IS_FOLLOWING,isFollowing); for ( final JSONObject followingArticle : followingArticles) { final String homeUserFollowingArticleId=followingArticle.optString(Keys.OBJECT_ID); followingArticle.put(Common.IS_FOLLOWING,followQueryService.isFollowing(followerId,homeUserFollowingArticleId)); } } user.put(UserExt.USER_T_CREATE_TIME,new Date(user.getLong(Keys.OBJECT_ID))); final int followingArticleCnt=followingArticlesResult.optInt(Pagination.PAGINATION_RECORD_COUNT); final int pageCount=(int)Math.ceil(followingArticleCnt / (double)pageSize); final List<Integer> pageNums=Paginator.paginate(pageNum,pageSize,pageCount,windowSize); if (!pageNums.isEmpty()) { dataModel.put(Pagination.PAGINATION_FIRST_PAGE_NUM,pageNums.get(0)); dataModel.put(Pagination.PAGINATION_LAST_PAGE_NUM,pageNums.get(pageNums.size() - 1)); } dataModel.put(Pagination.PAGINATION_CURRENT_PAGE_NUM,pageNum); dataModel.put(Pagination.PAGINATION_PAGE_COUNT,pageCount); dataModel.put(Pagination.PAGINATION_PAGE_NUMS,pageNums); }
Shows user home following articles page.
protected void handlePointsForOuterRing(Geo g1,Geo g2,Geo g3,double dist,OMAreaList ret){ int bend=bends(g1,g2,g3); Geo gret=g3; RibbonIterator leg1=new RibbonIterator(g1,g2,dist); OMPoly poly1=getHalfPoly(leg1,Ribbon.LEFT,false); RibbonIterator leg2=new RibbonIterator(g2,g3,dist); OMPoly poly2=getHalfPoly(leg2,Ribbon.LEFT,true); if (poly1 == null || poly2 == null) { return; } if (bend == STRAIGHT || g2.equals(g3)) { ret.add(poly1); ret.add(poly2); } else { if (bend == BENDS_LEFT) { double dg12=g1.distance(g2); double dg23=g2.distance(g3); double legTestDist=dist * 2; if (dg12 < legTestDist || dg23 < legTestDist) { addShortLegPolyForIntersection(g1,g2,g3,Ribbon.LEFT,dist,ret); } else { addPolyForIntersection(poly1,poly2,dist,ret); } } else { OMGraphic omp=getPushbackPoly(poly1,dist); if (omp != null) { ret.add(omp); } OMGraphic oma=getArc(g2,poly1,poly2); if (oma != null) { ret.add(oma); } omp=getPushbackPoly(poly2,dist); if (omp != null) { ret.add(omp); } } } }
Takes a corner represented by the three geos, and adds OMGraphics to the OMAreaList depending on which way the corner bends - for right turns, it'll add an OMLine, OMArc and OMLine. The OMLines will go from half the distance of the legs to the rounded corner. The left turn will have a polygon added.
private void updateProgress(int progress){ if (myHost != null && progress != previousProgress) { myHost.updateProgress(progress); } previousProgress=progress; }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
@Override public JPopupMenu createMenu(final long offset){ final JPopupMenu menu=new JPopupMenu(); final IDebugger debugger=m_debugger.getCurrentSelectedDebugger(); if (debugger == null) { return null; } menu.add(CActionProxy.proxy(new CSearchAction(m_parent,m_debugger,m_memoryView))); menu.add(CActionProxy.proxy(new CGotoAction(m_parent,m_memoryView,m_debugger))); if (canReadDword(debugger.getProcessManager().getMemoryMap(),offset)) { final byte[] data=debugger.getProcessManager().getMemory().getData(offset,4); final IAddress dword=new CAddress(ByteHelpers.readDwordLittleEndian(data,0)); if (canReadDword(debugger.getProcessManager().getMemoryMap(),dword.toLong())) { menu.add(CActionProxy.proxy(new CFollowDumpAction(m_debugger,dword))); } } menu.addSeparator(); final long firstOffset=m_memoryView.getHexView().getBaseAddress(); final int size=m_memoryView.getHexView().getData().getDataLength(); menu.add(new CLoadAllAction(m_parent,debugger,new CAddress(firstOffset),size)); final JMenu dumpMenu=new JMenu("Dump to file"); dumpMenu.add(CActionProxy.proxy(new CDumpMemoryRangeAction(m_parent,debugger,m_memoryView.getHexView().getData(),new CAddress(firstOffset),size))); menu.add(dumpMenu); menu.addSeparator(); final BookmarkManager manager=debugger.getBookmarkManager(); final CBookmark bookmark=manager.getBookmark(new CAddress(offset)); if (bookmark == null) { menu.add(new JMenuItem(CActionProxy.proxy(new CCreateBookmarkAction(manager,new CAddress(offset))))); } else { menu.add(new JMenuItem(CActionProxy.proxy(new CDeleteBookmarkAction(manager,bookmark)))); } if (manager.getNumberOfBookmarks() != 0) { menu.addSeparator(); final JMenu bookmarksItem=new JMenu("Bookmarks"); for (int i=0; i < manager.getNumberOfBookmarks(); i++) { bookmarksItem.add(CActionProxy.proxy(new CGotoBookmarkAction(m_debugger,manager.getBookmark(i)))); } menu.add(bookmarksItem); } menu.addSeparator(); menu.add(HexViewOptionsMenu.createHexViewOptionsMenu(m_memoryView.getHexView())); return menu; }
Creates the context menu of a memory viewer component.
public void test(String problem,String algorithm1,String algorithm2,AlgorithmFactory factory){ test(problem,algorithm1,algorithm2,false,factory); }
Tests if two algorithms are statistically indifferent.
public synchronized void add(Date x,double y){ super.add(x.getTime(),y); }
Adds a new value to the series.
void mutateField(Local left,String field){ Iterator it=locals.get(left).iterator(); while (it.hasNext()) { PurityNode n=(PurityNode)it.next(); if (!n.isInside()) mutated.put(n,field); } if (doCheck) sanityCheck(); }
Store a primitive type into a non-static field left.field = v
public LayerStatusEvent(Layer source,int status){ super(source); this.status=status; }
Construct a LayerStatusEvent with a status.
public Node close() throws IOException { if (xml) { return close(false); } return close(isSimpleEndTagForHTML()); }
Close the open element.