code
stringlengths
10
174k
nl
stringlengths
3
129k
private void processOutputWsList(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { EventPublisher ep=new EventPublisher(); try { ep.setSsAuthSubToken((String)request.getSession().getAttribute(SESSION_ATTR_SS_AUTH_TOKEN),false); request.setAttribute("token",ep.getSsAuthSubToken()); request.setAttribute("wsList",ep.getWsList((String)request.getParameter("wsFeed"))); } catch ( EPAuthenticationException e) { System.err.println("Authentication exception: " + e.getMessage()); } RequestDispatcher dispatcher=getServletContext().getRequestDispatcher("/WEB-INF/jsp/outputWsList.jsp"); dispatcher.forward(request,response); }
Output list of worksheets in chosen spreadsheet
public Job createJob(String activitiXmlClasspathResourceName) throws Exception { jobDefinitionServiceTestHelper.createJobDefinition(activitiXmlClasspathResourceName); return jobService.createAndStartJob(createJobCreateRequest(AbstractServiceTest.TEST_ACTIVITI_NAMESPACE_CD,AbstractServiceTest.TEST_ACTIVITI_JOB_NAME)); }
Creates a job based on the specified Activiti XML classpath resource location.
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.
ScreenController(GameScreen screen){ this.screen=screen; }
Create a new ScreenController.
@Override @Transient public boolean isFullTextSearchable(){ return true; }
Override the gisFeature value.<br> Default to true;<br> If this field is set to false, then the object won't be synchronized with the fullText search engine
public static Set<String> parseSpaceSeparatedTokens(String attr){ Set<String> tokens=new HashSet<>(); if (attr != null && !attr.trim().isEmpty()) { String[] items=attr.trim().split(CommonPattern.SPACES.pattern()); Collections.addAll(tokens,items); } return tokens; }
Parses a space separated tokens attribute value (see http://www.w3.org/TR/html5/infrastructure.html#space-separated-tokens). Eventual duplicates are removed.
public static void waitForProcessOutput(Process self,Appendable output,Appendable error){ Thread tout=consumeProcessOutputStream(self,output); Thread terr=consumeProcessErrorStream(self,error); try { tout.join(); } catch ( InterruptedException ignore) { } try { terr.join(); } catch ( InterruptedException ignore) { } try { self.waitFor(); } catch ( InterruptedException ignore) { } closeStreams(self); }
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer. The processed stream data is appended to the supplied Appendable. For this, two Threads are started, but join()ed, so we wait. As implied by the waitFor... name, we also wait until we finish as well. Finally, the input, output and error streams are closed.
private void cmd_newEdit(){ boolean rw=cbNewEdit.isChecked(); log.config("R/W=" + rw + " "+ m_masi); fieldLotString.setReadonly(!(rw && m_masi.getM_Lot_ID() == 0)); if (fieldLot != null) fieldLot.setEnabled(rw); bLot.setEnabled(rw); fieldSerNo.setReadonly(!rw); bSerNo.setEnabled(rw); fieldGuaranteeDate.setReadonly(!rw); for (int i=0; i < m_editors.size(); i++) { HtmlBasedComponent editor=m_editors.get(i); if (editor instanceof InputElement) ((InputElement)editor).setReadonly(!rw); else if (editor instanceof Listbox) ((Listbox)editor).setEnabled(rw); else if (editor instanceof NumberBox) ((NumberBox)editor).setEnabled(rw); } }
Instance New/Edit
public static final Parameter base(){ return new Parameter(P_SIMPLE); }
Returns the default base.
public void pauseAll(){ List<Integer> list=mThreadPool.getAllExactRunningDownloadIds(); if (FileDownloadLog.NEED_LOG) { FileDownloadLog.d(this,"pause all tasks %d",list.size()); } for ( Integer id : list) { pause(id); } }
Pause all running task
public td addElement(String hashcode,Element element){ addElementToRegistry(hashcode,element); return (this); }
Adds an Element to the element.
@Override public void receiveChangeCipherSpec(){ if (isResuming) { if (serverHello == null) { unexpectedMessage(); } } else if (clientFinished == null) { unexpectedMessage(); } changeCipherSpecReceived=true; }
Processes ChangeCipherSpec message
public boolean cgDeleteRollbackStep(URI rpSystem,Set<URI> volumeIDs,String token) throws WorkflowException { WorkflowStepCompleter.stepExecuting(token); _log.info("cgDeleteStep rollback is a no-op"); WorkflowStepCompleter.stepSucceded(token); return true; }
The step that rolls back the delete of the CG from the RecoverPoint appliance. It is a no-op.
public PaintScaleLegend(PaintScale scale,ValueAxis axis){ ParamChecks.nullNotPermitted(axis,"axis"); this.scale=scale; this.axis=axis; this.axis.addChangeListener(this); this.axisLocation=AxisLocation.BOTTOM_OR_LEFT; this.axisOffset=0.0; this.axis.setRange(scale.getLowerBound(),scale.getUpperBound()); this.stripWidth=15.0; this.stripOutlineVisible=true; this.stripOutlinePaint=Color.gray; this.stripOutlineStroke=new BasicStroke(0.5f); this.backgroundPaint=Color.white; this.subdivisions=100; }
Creates a new instance.
public Object runSafely(Catbert.FastStack stack) throws Exception { try { return new Integer(sage.locator.LocatorLookupClient.haveLocatorPingID(getString(stack))); } catch ( Exception e) { return new Integer(-1); } }
Connects to the SageTV Locator server and submits the specified Locator ID for a 'ping'. The Locator server will then attempt to connect to the IP for that GUID and report back the status. The return code is an integer as follows: -1 - Unable to connect to the locator server (internet connection is down or locator server is down) 0 - The locator server did not have an IP address registered for this GUID 1 - The locator server could not connect to the IP address registered for the GUID 2 - The locator server can connect to the IP address registered for the GUID, but not to the Placeshifter port 3 - The locator server can connect to the IP address/port for the GUID, but the server that is there is not the Placeshifter 10 - The ping was successful. External connections to the Placeshifter should work correctly.
public void add(String re,Object ret) throws REException { add(re,ret,false); }
Add a regular expression to the pool of regular expressions.
public boolean isSetType(){ return this.type != null; }
Returns true if field type is set (has been assigned a value) and false otherwise
@DSComment("Package priviledge") @DSBan(DSCat.DEFAULT_MODIFIER) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:33:57.477 -0500",hash_original_method="F29A79C31A2CA4FED1ACCEFFCCC8C171",hash_generated_method="ED094E0A84AEB6D086FD82573B890E67") static void cancelThumbnailRequest(ContentResolver cr,long origId,Uri baseUri,long groupId){ Uri cancelUri=baseUri.buildUpon().appendQueryParameter("cancel","1").appendQueryParameter("orig_id",String.valueOf(origId)).appendQueryParameter("group_id",String.valueOf(groupId)).build(); Cursor c=null; try { c=cr.query(cancelUri,PROJECTION,null,null,null); } finally { if (c != null) c.close(); } }
This method cancels the thumbnail request so clients waiting for getThumbnail will be interrupted and return immediately. Only the original process which made the getThumbnail requests can cancel their own requests.
public static boolean isStaticInit(SootMethod method){ return "void <clinit>()".equals(method.getSubSignature()); }
Return true if the method is a static init
public void propertyChange(PropertyChangeEvent evt){ log.info(evt.toString()); if (evt.getPropertyName().equals(org.compiere.model.GridField.PROPERTY)) setValue(evt.getNewValue()); }
Property Change
@Override protected void doAction(){ deleteSelectedEntry(); }
Do action.
public String toString(){ StringBuffer buffer=new StringBuffer(); buffer.append("ValidationFormat ver["); buffer.append(ver); buffer.append("] fdrvldmacroid ["); buffer.append(fdrvldmacroid); buffer.append("] numreqflds ["); buffer.append(numreqflds); buffer.append("] reqfldid ["); for (Iterator it=reqfldid.iterator(); it.hasNext(); ) { buffer.append(it.next()); } buffer.append("] numfldvlds ["); buffer.append(numfldvlds); buffer.append("] fldvlddefs ["); Integer key=null; for (Iterator it=fldvlddefs.keySet().iterator(); it.hasNext(); ) { key=(Integer)it.next(); buffer.append("\n\t"); buffer.append(key); buffer.append(" "); buffer.append(fldvlddefs.get(key)); } buffer.append("\n]"); return buffer.toString(); }
Public methods
public void testMomentWithNoTypeErrorHandling(){ String xml=""; xml+=createStartMissionXml("start","Name"); xml+="<moment " + "id='start' >"; xml+=createNextMomentXml("start"); xml+=createLengthMinutesXml(0.25); xml+=createEndMomentXml(); xml+=createEndMissionXml(); InputStream momentInputStream=new ByteArrayInputStream(xml.getBytes()); mMission=new Mission(mMissionData); boolean didMissionParseFail=false; try { mMission.readMoments(momentInputStream); } catch ( MissionParseException e) { didMissionParseFail=true; } Assert.assertEquals(true,didMissionParseFail); }
Test for correct error handling with a moment has no 'type' attribute.
private void readObject(ObjectInputStream in) throws IOException { throw new NotSerializableException(); }
This method always throws a <code>NotSerializableException</code>, because this object cannot be serialized,
public final void yybegin(int newState){ zzLexicalState=newState; }
Enters a new lexical state
@Override public void run(){ amIActive=true; String sourceHeader=null; String outputHeader=null; String backLinkHeader=null; WhiteboxRaster sourceImage; WhiteboxRaster output; WhiteboxRaster backLink; int cols, rows; double z, flowDir; float progress=0; int[] dX=new int[]{1,1,1,0,-1,-1,-1,0}; int[] dY=new int[]{-1,0,1,1,1,0,-1,-1}; double lnOf2=0.693147180559945; double gridRes; int col, row, a; int c; int x, y, i; boolean flag=false; if (args.length <= 0) { showFeedback("Plugin parameters have not been set."); return; } for (i=0; i < args.length; i++) { if (i == 0) { sourceHeader=args[i]; } else if (i == 1) { backLinkHeader=args[i]; } else if (i == 2) { outputHeader=args[i]; } } if ((sourceHeader == null) || (backLinkHeader == null) || (outputHeader == null)) { showFeedback("One or more of the input parameters have not been set properly."); return; } try { sourceImage=new WhiteboxRaster(sourceHeader,"r"); rows=sourceImage.getNumberRows(); cols=sourceImage.getNumberColumns(); double noData=sourceImage.getNoDataValue(); gridRes=(sourceImage.getCellSizeX() + sourceImage.getCellSizeY()) / 2; backLink=new WhiteboxRaster(backLinkHeader,"r"); if (backLink.getNumberColumns() != cols || backLink.getNumberRows() != rows) { showFeedback("Input images must have the same dimensions"); return; } output=new WhiteboxRaster(outputHeader,"rw",sourceHeader,WhiteboxRaster.DataType.FLOAT,noData); output.setPreferredPalette(sourceImage.getPreferredPalette()); updateProgress("Loop 1 of 2:",0); double[] data; for (row=0; row < rows; row++) { data=sourceImage.getRowValues(row); for (col=0; col < cols; col++) { if (data[col] > 0) { output.setValue(row,col,data[col]); } } if (cancelOp) { cancelOperation(); return; } progress=(float)(100f * row / (rows - 1)); updateProgress("Loop 1 of 2:",(int)progress); } updateProgress("Loop 2 of 2:",0); for (row=0; row < rows; row++) { for (col=0; col < cols; col++) { if (backLink.getValue(row,col) != noData && output.getValue(row,col) == noData) { x=col; y=row; z=noData; flag=true; do { flowDir=backLink.getValue(y,x); if (flowDir > 0) { c=(int)(Math.log(flowDir) / lnOf2); x+=dX[c]; y+=dY[c]; if (output.getValue(y,x) > 0) { z=output.getValue(y,x); flag=false; } } else { z=output.getValue(y,x); flag=false; } } while (flag); x=col; y=row; flag=true; do { output.setValue(y,x,z); flowDir=backLink.getValue(y,x); if (flowDir > 0) { c=(int)(Math.log(flowDir) / lnOf2); x+=dX[c]; y+=dY[c]; if (output.getValue(y,x) > 0) { flag=false; } } else { flag=false; } } while (flag); } } if (cancelOp) { cancelOperation(); return; } progress=(float)(100f * row / (rows - 1)); updateProgress("Loop 2 of 2:",(int)progress); } output.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); output.addMetadataEntry("Created on " + new Date()); sourceImage.close(); backLink.close(); 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.
public byte[] generateSignature(){ if (!forSigning) { throw new IllegalStateException("DSADigestSigner not initialised for signature generation."); } byte[] hash=new byte[digest.getDigestSize()]; digest.doFinal(hash,0); BigInteger[] sig=dsaSigner.generateSignature(hash); try { return derEncode(sig[0],sig[1]); } catch ( IOException e) { throw new IllegalStateException("unable to encode signature"); } }
Generate a signature for the message we've been loaded with using the key we were initialised with.
protected int timedRead(byte[] b,int off,int len) throws IOException { return (in.read(b,off,len)); }
Override this method to time all read I/O operations
public static String toJSONStringSubset(ResultList rs,QueryParameters qps,int status,String message,String[] subset){ HashSet<String> ms=new HashSet<String>(); if (subset != null) for (int i=0; i < subset.length; i++) ms.add(subset[i]); boolean filter=ms.size() > 0; StringBuilder sb=new StringBuilder(); sb.append("{\"resp\":{\"status\":").append(status); if (rs != null && rs.getTotalResponseTime() > 0) { sb.append(",\"totalTime\":\"").append(rs.getTotalResponseTime()).append("ms\""); sb.append(",\"execTime\":\"").append(rs.getTotalExecutionTime()).append("ms\""); sb.append(",\"fetchTime\":\"").append(rs.getTotalFetchTime()).append("ms\""); } sb.append(",\"message\":\"").append(escapeJson(message)).append("\""); if (qps != null) { sb.append(",\"request\":{"); sb.append("\"group\":\"").append(qps.getGroup()).append("\""); sb.append(",\"host\":\"").append(qps.getHost()).append("\""); sb.append(",\"sql\":\"").append(qps.getSql()).append("\""); for ( Map.Entry<String,String> e : qps.getSqlParams().entrySet()) { sb.append(",\"").append(e.getKey()).append("\":\"").append(e.getValue()).append("\""); } sb.append("}\r\n"); } if (rs != null) { List<ColumnInfo> cols=rs.getColumnDescriptor().getColumns(); sb.append(",\"results\":{"); sb.append("\"total\":\"").append(rs.getRows().size()).append("\","); sb.append("\"columns\":["); { boolean first=true; for (int i=0; i < cols.size(); i++) { if (filter && !ms.contains(cols.get(i).getName())) continue; if (!first) sb.append(","); first=false; sb.append("\"").append(cols.get(i).getName().toUpperCase() + "\""); } } sb.append("],\r\n"); boolean firstRow=true; sb.append("\"results\":["); for ( ResultRow row : rs.getRows()) { if (!firstRow) sb.append(","); int len=row.getColumns().size(); boolean first=true; sb.append("{"); for (int i=0; i < len; i++) { if (filter && !ms.contains(cols.get(i).getName())) continue; if (!first) sb.append(","); sb.append("\"").append(escapeJson(cols.get(i).getName().toUpperCase())).append("\":"); if (cols.get(i).isNumberType()) { if (row.getColumns().get(i) == null || row.getColumns().get(i).trim().length() == 0) sb.append("\"\""); else sb.append(escapeJson(row.getColumns().get(i))); } else sb.append("\"").append(escapeJson(row.getColumns().get(i))).append("\""); first=false; } sb.append("}\r\n"); firstRow=false; } sb.append("]}"); } sb.append("}}"); return sb.toString(); }
We will filter data by the provided columns. Also make all column names in uppercase. If no filter provided, only make column names uppercase
protected void resumeAutomaticRunning(){ if ((_activeTrain.getStatus() == ActiveTrain.WORKING) || (_activeTrain.getStatus() == ActiveTrain.READY)) { _autoTrainAction.cancelDoneSensor(); if (initialize()) { _resumingAutomatic=true; } else { log.error("Failed to initialize throttle when resuming automatic mode."); } } }
Resumes automatic running after a working session using an external throttle This method is triggered by the dispatcher hitting the "Resume Auto Running" button A new throttle is acquired to allow automatic running to resume
public static void temporarilyForConnector(String connectorType,String connectorName,String contextName,Runnable operation){ if (connectorType == null) throw new IllegalArgumentException("The MDC value for the connector type may not be null"); if (connectorName == null) throw new IllegalArgumentException("The MDC value for the connector name may not be null"); if (contextName == null) throw new IllegalArgumentException("The MDC value for the connector context may not be null"); if (operation == null) throw new IllegalArgumentException("The operation may not be null"); PreviousContext previous=new PreviousContext(); try { forConnector(connectorType,connectorName,contextName); operation.run(); } finally { previous.restore(); } }
Run the supplied function in the temporary connector MDC context, and when complete always return the MDC context to its state before this method was called.
public java.lang.StringBuffer insert(int offset,char c){ internal.insert(offset,c); return this; }
Inserts the string representation of the char argument into this string buffer. The second argument is inserted into the contents of this string buffer at the position indicated by offset. The length of this string buffer increases by one. The overall effect is exactly as if the argument were converted to a string by the method String.valueOf(char) and the character in that string were then inserted into this StringBuffer object at the position indicated by offset. The offset argument must be greater than or equal to 0, and less than or equal to the length of this string buffer.
public void parse(String filename) throws IOException { parse(new InputSource(filename)); }
Parses a hyphenation pattern file.
public void openPlayer(View view){ Intent intent=new Intent(this,URLMediaPlayerActivity.class); intent.putExtra(AUDIO_URL,"https://dl.dropboxusercontent.com/u/2763264/RSS%20MP3%20Player/prova1.mp3"); intent.putExtra(IMG_URL,"https://dl.dropboxusercontent.com/u/2763264/RSS%20MP3%20Player/img3.jpg"); startActivity(intent); }
open player
public JSONTokener(String s){ this(new StringReader(s)); }
Construct a JSONTokener from a string.
public synchronized boolean addAll(Collection c){ modCount++; Object[] a=c.toArray(); int numNew=a.length; ensureCapacityHelper(elementCount + numNew); System.arraycopy(a,0,elementData,elementCount,numNew); elementCount+=numNew; return numNew != 0; }
Appends all of the elements in the specified Collection to the end of this Vector, in the order that they are returned by the specified Collection's Iterator. The behavior of this operation is undefined if the specified Collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified Collection is this Vector, and this Vector is nonempty.)
public Set<String> upload(final String localFileName){ final Set<String> before=getAllArtifactIds(); get(String.format("/channel/%s/add",this.id)); final WebElement link=this.context.findElement(By.linkText("Upload")); Assert.assertTrue(link.findElement(By.xpath("..")).getAttribute("class").contains("active")); ; final File input=this.context.getTestFile(localFileName); { final WebElement ele=this.context.findElement(By.id("file")); Assert.assertNotNull(ele); ele.sendKeys(input.toString()); ele.submit(); } final Set<String> after=getAllArtifactIds(); after.removeAll(before); return after; }
Upload a file to the channel
public boolean offerLast(E e){ addLast(e); return true; }
Inserts the specified element at the end of this deque.
public AuthPolicyFile(){ String prop=System.getProperty(AUTH_POLICY); if (prop == null) { prop=System.getProperty(SECURITY_MANAGER); } if (prop != null) { init(); } }
Initializes the Policy object and reads the default policy configuration file(s) into the Policy object.
public Subscription(String jid,String nodeId,String subscriptionId,State state,boolean configRequired){ super(PubSubElementType.SUBSCRIPTION,nodeId); this.jid=jid; id=subscriptionId; this.state=state; this.configRequired=configRequired; }
Constructs a representation of a subscription reply to the specified node and JID. The server will have supplied the subscription id and current state and whether the subscription need to be configured.
public double sampleFromCDF(){ Double d=null; double rnd=MatsimRandom.getRandom().nextDouble(); int index=1; while (d == null && index <= this.getNumBins()) { if (this.ys[index] > rnd) { d=this.xs[index - 1] + (this.xs[index] - this.xs[index - 1]) / 2; } else { index++; } } assert (d != null) : "Could not draw from the cumulative distribution function"; return d; }
Draws a single sample from the cumulative distribution function.
protected boolean removeEldestEntry(Map.Entry<K,V> eldest){ return false; }
This method is queried from the put and putAll methods to check if the eldest member of the map should be deleted before adding the new member. If this map was created with accessOrder = true, then the result of removeEldestEntry is assumed to be false.
private void checkTelephonySupport(){ final TelephonyManager telephony=(TelephonyManager)getSystemService(TELEPHONY_SERVICE); final int phoneType=telephony.getPhoneType(); if (phoneType != TelephonyManager.PHONE_TYPE_NONE) { return; } final PreferenceGroup category=(PreferenceGroup)findPreferenceByResId(R.string.pref_category_when_to_speak_key); final Preference prefCallerId=findPreferenceByResId(R.string.pref_caller_id_key); if (prefCallerId != null) { category.removePreference(prefCallerId); } }
Ensure that telephony-related settings do not appear on devices without telephony.
public void addRow(Sensor sensor){ data.add(sensor); }
Add a row.
public Object runSafely(Catbert.FastStack stack) throws Exception { UIManager uiMgr=stack.getUIMgr(); if (uiMgr == null) return new Float(0); else return new Float((1.0f - (uiMgr.getOverscanOffsetY() * 1.0f / (uiMgr.getRootPanel().getHeight())) - uiMgr.getOverscanScaleHeight()) / uiMgr.getOverscanScaleHeight()); }
Returns a floating point value which specifies the percent of the UI that is taken up by overscan on the bottom Equivalent to (1.0 - (GetOverscanOffsetY() * 1.0 / GetFullUIHeight()) - GetOverscanScaleHeight())/GetOverscanScaleHeight()
private void updateThumbnailMatrix(){ if (mThumbnail == null) return; if (mImageMatrix == null) mImageMatrix=new Matrix(); float widthScale=(float)getMeasuredWidth() / mThumbnail.getWidth(); float heightScale=(float)getMeasuredHeight() / mThumbnail.getHeight(); float scale=Math.max(widthScale,heightScale); mImageMatrix.setScale(scale,scale); setImageMatrix(mImageMatrix); }
Updates the matrix used to scale the thumbnail when drawing it. This needs to be called whenever the thumbnail changes or this view's size changes. This matrix ensures that the thumbnail is anchored at the top left corner of this view and is scaled as small as possible while still covering the entire view. Surprisingly, there's no way to get this behavior using the other ImageView.ScaleTypes.
@Override public boolean eIsSet(int featureID){ switch (featureID) { case StextPackage.ENTRY_POINT_SPEC__ENTRYPOINT: return ENTRYPOINT_EDEFAULT == null ? entrypoint != null : !ENTRYPOINT_EDEFAULT.equals(entrypoint); } return super.eIsSet(featureID); }
<!-- begin-user-doc --> <!-- end-user-doc -->
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){ switch (featureID) { case OrientedPackage.COMPONENT__INPUT_COMPONET_REFS: return getInputComponetRefs(); case OrientedPackage.COMPONENT__OUTPUT_COMPONET_REFS: return getOutputComponetRefs(); case OrientedPackage.COMPONENT__INPUT_PORT_REFS: return getInputPortRefs(); case OrientedPackage.COMPONENT__OUTPUT_PORT_REFS: return getOutputPortRefs(); case OrientedPackage.COMPONENT__ID: return getId(); case OrientedPackage.COMPONENT__INPUT_CNT: return getInputCnt(); case OrientedPackage.COMPONENT__OUTPUT_CNT: return getOutputCnt(); } return null; }
<!-- begin-user-doc --> <!-- end-user-doc -->
private com.google.security.zynamics.binnavi.debug.models.trace.TraceLogger createLogger(){ return new com.google.security.zynamics.binnavi.debug.models.trace.TraceLogger(project == null ? new ModuleTraceProvider(module.getNative()) : new ProjectTraceProvider(project.getNative()),debugger.getNative()); }
Creates a new internal trace logger object.
@SuppressWarnings({"varargs","unchecked"}) public static <A>List<A> of(A x1,A x2,A x3,A... rest){ return new List<A>(x1,new List<A>(x2,new List<A>(x3,from(rest)))); }
Construct a list consisting of given elements.
public boolean visit(IfStatement node){ return true; }
Visits the given type-specific AST node. <p> The default implementation does nothing and return true. Subclasses may reimplement. </p>
protected void report(Exception e,boolean child){ println(e.getMessage()); stacktrace(e,false); }
For Exception.
public static void stepInto(final JFrame parent,final IDebugger debugger){ checkArguments(parent,debugger); if (!debugger.isConnected()) { return; } final TargetProcessThread activeThread=debugger.getProcessManager().getActiveThread(); try { debugger.getProcessManager().setActiveThread(null); debugger.singleStep(); } catch ( final DebugExceptionWrapper e) { CUtilityFunctions.logException(e); debugger.getProcessManager().setActiveThread(activeThread); final String innerMessage="E00192: " + "Could not send single step command to the debug client"; final String innerDescription=CUtilityFunctions.createDescription("BinNavi could not send the single step command to the debug client.",new String[]{"There was a problem with the connection to the debug client."},new String[]{"The state of the debugged process remains unchanged."}); NaviErrorDialog.show(parent,innerMessage,innerDescription,e); } }
Lets the debugger execute a single step.
public static GroupLifecycleManager onCreate(ObservableManager observableManager,LifecycleResubscription resubscription,@Nullable Bundle savedState,@Nullable Object target){ boolean shouldResubscribe=target != null && savedState != null; ObservableGroup group; if (savedState != null) { State state=savedState.getParcelable(KEY_STATE); Preconditions.checkState(state != null,"Must call onSaveInstanceState() first"); if (state.managerId != observableManager.id()) { group=observableManager.newGroup(); } else { group=observableManager.getGroup(state.groupId); } } else { group=observableManager.newGroup(); } group.lock(); GroupLifecycleManager manager=new GroupLifecycleManager(observableManager,group,resubscription); if (shouldResubscribe) { manager.subscribe(target); } return manager; }
Call this method from your Activity or Fragment's onCreate method
private void animateProperty(int constantName,float toValue){ float fromValue=getValue(constantName); float deltaValue=toValue - fromValue; animatePropertyBy(constantName,fromValue,deltaValue); }
Utility function, called by the various x(), y(), etc. methods. This stores the constant name for the property along with the from/delta values that will be used to calculate and set the property during the animation. This structure is added to the pending animations, awaiting the eventual start() of the underlying animator. A Runnable is posted to start the animation, and any pending such Runnable is canceled (which enables us to end up starting just one animator for all of the properties specified at one time).
@Override public final boolean add(final E e){ if (collection.contains(e)) return false; if (collection.size() - 1 == SMALL_CAPACITY && capacity <= SMALL_CAPACITY) { LinkedHashSet<E> newCollection=new LinkedHashSet<E>(LARGE_CAPACITY); newCollection.addAll(collection); collection=newCollection; capacity=LARGE_CAPACITY; conversions++; } return collection.add(e); }
Adds an element to the set.
protected void addChildListeners(){ }
Add child listeners to catch and propagate sub-expression updates.
public static String mergePath(String current,String realPath) throws MalformedURLException { String currDir; if (current == null || current.indexOf('/') == -1) currDir="/"; else if (current.endsWith("/")) currDir=current; else currDir=current.substring(0,current.lastIndexOf('/') + 1); String path; if (realPath.startsWith("./")) path=currDir + realPath.substring(2); else if (realPath.startsWith("/")) path=realPath; else if (!realPath.startsWith("../")) path=currDir + realPath; else { while (realPath.startsWith("../") || currDir.length() == 0) { realPath=realPath.substring(3); currDir=currDir.substring(0,currDir.length() - 1); int index=currDir.lastIndexOf('/'); if (index == -1) throw new MalformedURLException("invalid realpath definition for URL"); currDir=currDir.substring(0,index + 1); } path=currDir + realPath; } return path; }
merge to pathes to one
public void updateCalorie(double calorie){ tripStatistics.setCalorie(calorie); currentSegment.setCalorie(0); }
Updates the calorie value;
public void menuSelectionChanged(boolean isIncluded){ if (DEBUG) { System.out.println("In JMenu.menuSelectionChanged to " + isIncluded); } setSelected(isIncluded); }
Messaged when the menubar selection changes to activate or deactivate this menu. Overrides <code>JMenuItem.menuSelectionChanged</code>.
public void writeGraphics(Vector list,SColor lineColor,SColor fillColor) throws IOException { SRect sr=new SRect(new LLPoint((float)y,(float)x),(short)-1,(short)-1,(short)1,(short)1); sr.color(lineColor); sr.fillColor(fillColor); list.addElement(sr); }
Generates OMGraphics and adds them to the given list.
public static InternetAddress parseEmail(Object value){ String str=Caster.toString(value,""); if (str.indexOf('@') > -1) { try { InternetAddress addr=new InternetAddress(str); fixIDN(addr); return addr; } catch ( AddressException ex) { } } return null; }
returns an InternetAddress object or null if the parsing fails. to be be used in multiple places.
public boolean isCustomProcName(){ return customProcName; }
Custom process name as the output EXE file name.
public static void assertUpdateTolerantAddErrors(String assertionMsgPrefix,UpdateResponse response,String... errorIdsExpected){ ExpectedErr[] expected=new ExpectedErr[errorIdsExpected.length]; for (int i=0; i < expected.length; i++) { expected[i]=addErr(errorIdsExpected[i]); } assertUpdateTolerantErrors(assertionMsgPrefix,response,expected); }
convinience method when the only type of errors you expect are 'add' errors
@Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); }
Initialize instance variables with data from bundle
public static String toHex(byte[] val,int start,int len){ StringBuilder buf=new StringBuilder(); for (int i=0; i < len; i++) { byte b=val[start + i]; buf.append(DEC2HEX[(b & 0xf0) >> 4]); buf.append(DEC2HEX[b & 0x0f]); } return buf.toString(); }
Can be used to encode values that contain invalid XML characters. At SAX parser end must be used pair method to get original value.
@Override protected void loadChars(jmri.jmrix.AbstractMRReply msg,java.io.DataInputStream istream) throws java.io.IOException { int i, char1; i=0; try { while (i < msg.maxSize()) { char1=istream.read(); if (char1 < 0) { ((XnTcpAdapter)controller).xnTcpError(); throw new java.io.EOFException("Lost communication with XnTcp interface"); } msg.setElement(i++,(byte)char1 & 0xFF); log.debug("XnTcpNetPacketizer: received " + Integer.toHexString(char1 & 0xff)); if (endOfMessage(msg)) { break; } } ((XnTcpAdapter)controller).xnTcpSetPendingPackets(-1); log.debug("XnTcpNetPacketizer: received end of packet"); } catch ( java.io.IOException ex) { ((XnTcpAdapter)controller).xnTcpError(); throw ex; } }
Get characters from the input source, and fill a message. <P> Returns only when the message is complete. <P> Only used in the Receive thread.
public ConfigurationException(final Throwable cause){ super(cause); }
Ctor - just an inner exception.
public void updateWriteStats(OFMessage ofm){ switch (ofm.getType()) { case BARRIER_REPLY: ctrWriteBarrierReply.increment(); break; case BARRIER_REQUEST: ctrWriteBarrierRequest.increment(); break; case ECHO_REPLY: ctrWriteEchoReply.increment(); break; case ECHO_REQUEST: ctrWriteEchoRequest.increment(); break; case ERROR: ctrWriteError.increment(); break; case EXPERIMENTER: ctrWriteExperimenter.increment(); break; case FEATURES_REPLY: ctrWriteFeaturesReply.increment(); break; case FEATURES_REQUEST: ctrWriteFeaturesRequest.increment(); break; case FLOW_MOD: ctrWriteFlowMod.increment(); break; case FLOW_REMOVED: ctrWriteFlowRemoved.increment(); break; case GET_ASYNC_REPLY: ctrWriteGetAsyncReply.increment(); break; case GET_ASYNC_REQUEST: ctrWriteGetAsyncRequest.increment(); break; case GET_CONFIG_REPLY: ctrWriteGetConfigReply.increment(); break; case GET_CONFIG_REQUEST: ctrWriteGetConfigRequest.increment(); break; case GROUP_MOD: ctrWriteGroupMod.increment(); break; case HELLO: ctrWriteHello.increment(); break; case METER_MOD: ctrWriteMeterMod.increment(); break; case PACKET_IN: ctrWritePacketIn.increment(); break; case PACKET_OUT: ctrWritePacketOut.increment(); break; case PORT_MOD: ctrWritePortMod.increment(); break; case PORT_STATUS: ctrWritePortStatus.increment(); break; case QUEUE_GET_CONFIG_REPLY: ctrWriteQueueGetConfigReply.increment(); break; case QUEUE_GET_CONFIG_REQUEST: ctrWriteQueueGetConfigRequest.increment(); break; case ROLE_REPLY: ctrWriteRoleReply.increment(); break; case ROLE_REQUEST: ctrWriteRoleRequest.increment(); break; case SET_ASYNC: ctrWriteSetAsync.increment(); break; case SET_CONFIG: ctrWriteSetConfig.increment(); break; case STATS_REPLY: ctrWriteStatsReply.increment(); break; case STATS_REQUEST: ctrWriteStatsRequest.increment(); break; case TABLE_MOD: ctrWriteTableMod.increment(); break; case BUNDLE_ADD_MESSAGE: ctrWriteBundleAdd.increment(); break; case BUNDLE_CONTROL: ctrWriteBundleControl.increment(); break; case REQUESTFORWARD: ctrWriteRequestForward.increment(); break; case ROLE_STATUS: ctrWriteRoleStatus.increment(); break; case TABLE_STATUS: ctrWriteTableStatus.increment(); break; default : logger.warn(ofm.getType().toString() + ": Invalid OpenFlow Messaqe!"); break; } }
Update Write Counters for Open flow messages
public Image(double lat,double lon,int radius){ super(lat,lon,radius); }
Create an OMPoint at a lat/lon position, with the specified radius.
public boolean isCapacityExceeded(LicenseInfoExt licenseInfo){ return false; }
Verify if storage capacity currently used has exceeded the licensed capacity from the license file.
public static CommandResult execCommand(String[] commands,boolean isRoot){ return execCommand(commands,isRoot,true); }
execute shell commands, default return result msg
@Override public void stop(boolean cancel){ for ( HadoopShuffleJob job : jobs.values()) { try { job.close(); } catch ( IgniteCheckedException e) { U.error(log,"Failed to close job.",e); } } jobs.clear(); }
Stops shuffle.
public void initializeLogging(){ LogWrapper logWrapper=new LogWrapper(); Log.setLogNode(logWrapper); Log.i(TAG,"Ready"); }
Set up targets to receive log data
private void updateProgress(String progressLabel,int progress){ if (myHost != null) { myHost.updateProgress(progressLabel,progress); } else { System.out.println(progressLabel + " " + progress+ "%"); } }
Used to communicate a progress update between a plugin tool and the main Whitebox user interface.
public RouteScripted(final Territory terr){ super(terr); }
Shameless cheating. Making a fake route, so as to handle battles properly without breaking battleTracker protected status or duplicating a zillion lines of code. The End will return the Start, and the Length will be 1.
public GapStatistic(){ this(new HamerlyKMeans()); }
Creates a new Gap clusterer using k-means as the base clustering algorithm
@Override protected void doPost(HttpServletRequest request,HttpServletResponse response){ processGetRequest(request,response); }
Handles the HTTP <code>POST</code> method.
@Override public boolean isUpdatable(){ Iterator<Model> i=models.iterator(); while (i.hasNext()) { if (!i.next().isUpdatable()) { return false; } } return true; }
Returns true if all inner models return true.
public static void add(final ArrayList objects){ copiedObjects=objects; fireClipboardChanged(); }
Add objects to the clipboard. This happens with cut and copy.
public String paramString(){ String typeStr; switch (id) { case INVOCATION_DEFAULT: typeStr="INVOCATION_DEFAULT"; break; default : typeStr="unknown type"; } return typeStr + ",runnable=" + runnable+ ",notifier="+ notifier+ ",catchExceptions="+ catchExceptions+ ",when="+ when; }
Returns a parameter string identifying this event. This method is useful for event-logging and for debugging.
public void close(){ }
Closes this class path.
public PubsubFuture<Void> acknowledge(final String canonicalSubscriptionName,final List<String> ackIds){ final String path=canonicalSubscriptionName + ":acknowledge"; final AcknowledgeRequest req=AcknowledgeRequest.builder().ackIds(ackIds).build(); return post("acknowledge",path,req,Void.class); }
Acknowledge a batch of received messages.
public static <NodeType extends IGraphNode<NodeType> & ISelectableNode>void selectSuccessorsOfSelection(final ISelectableGraph<NodeType> graph){ graph.selectNodes(getSuccessorsOfSelection(graph),true); }
Selects all successors of the selected nodes.
public static double perimeter(SpatialComparable box){ final int dim=box.getDimensionality(); double perimeter=0.; for (int i=0; i < dim; i++) { perimeter+=box.getMax(i) - box.getMin(i); } return perimeter; }
Computes the perimeter of this SpatialComparable.
public int dec(Object key){ int hash=key == null ? 0 : key.hashCode() & 0x7FFFFFFF; int index=hash % table.length; for (Entry e=table[index]; e != null; e=e.next) { if (e.hash == hash && (e.key == null && key == null || e.key != null && e.key.equals(key))) { return e.value--; } } int len=table.length; if (count++ >= (len - (len >> 2))) { rehash(); index=hash % table.length; } table[index]=new Entry(hash,key,-1,table[index]); return 0; }
Decrements the value associated with the given key.
public void writeByteArray(int bits,byte[] arr) throws AccessException { for (int i=0; i < arr.length; i++) { int increment=Math.min(8,bits - (i << 3)); if (increment > 0) { write(increment,(byte)(arr[i] >>> (8 - increment))); } } }
Write data in bulk from a byte array and increment the current position.
@Override public AgentAppController createController(){ return new EightPuzzleController(); }
Returns a <code>EightPuzzleController</code> instance.
public InvalidHeaderValueException(){ super(); }
Constructs an InvalidHeaderValueException with no detailed message.
public boolean hasInvalidBehavior(){ return checks != null && checks.hasInvalidBehavior(); }
Indicate whether there are any invalid checks.
public DefaultClientConnectionOperator(SchemeRegistry schemes){ if (schemes == null) { throw new IllegalArgumentException("Scheme registry must not be null."); } schemeRegistry=schemes; }
Creates a new client connection operator for the given scheme registry.
void extractFromRoadLinks(GeomVectorField roadLinks){ Bag geoms=roadLinks.getGeometries(); Envelope e=roadLinks.getMBR(); double xmin=e.getMinX(), ymin=e.getMinY(), xmax=e.getMaxX(), ymax=e.getMaxY(); int xcols=gridWidth - 1, ycols=gridHeight - 1; for ( Object o : geoms) { MasonGeometry gm=(MasonGeometry)o; if (gm.getGeometry() instanceof LineString) { readLineString((LineString)gm.getGeometry(),xcols,ycols,xmin,ymin,xmax,ymax); } else if (gm.getGeometry() instanceof MultiLineString) { MultiLineString mls=(MultiLineString)gm.getGeometry(); for (int i=0; i < mls.getNumGeometries(); i++) { readLineString((LineString)mls.getGeometryN(i),xcols,ycols,xmin,ymin,xmax,ymax); } } } }
Converts information extracted from the shapefile into links determined by LineString subsequences
@Override public void endElement(String namespaceURI,String localName,String qName) throws SAXException { if (qName.equals(VALUE_TAG)) { Number value; try { value=Double.valueOf(this.currentText.toString()); if (((Double)value).isNaN()) { value=null; } } catch ( NumberFormatException e1) { value=null; } this.itemHandler.setValue(value); this.rootHandler.popSubHandler(); } else { throw new SAXException("Expecting </Value> but found " + qName); } }
The end of an element.
public EPPreparedQueryResult execute(ContextPartitionSelector[] contextPartitionSelectors){ try { int numStreams=processors.length; if (contextPartitionSelectors != null && contextPartitionSelectors.length != numStreams) { throw new IllegalArgumentException("Number of context partition selectors does not match the number of named windows in the from-clause"); } if (statementSpec.getOptionalContextName() == null) { Collection<EventBean>[] snapshots=new Collection[numStreams]; for (int i=0; i < numStreams; i++) { ContextPartitionSelector selector=contextPartitionSelectors == null ? null : contextPartitionSelectors[i]; snapshots[i]=getStreamFilterSnapshot(i,selector); } resultSetProcessor.clear(); return process(snapshots); } List<ContextPartitionResult> contextPartitionResults=new ArrayList<ContextPartitionResult>(); ContextPartitionSelector singleSelector=contextPartitionSelectors != null && contextPartitionSelectors.length > 0 ? contextPartitionSelectors[0] : null; Collection<Integer> agentInstanceIds=EPPreparedExecuteMethodHelper.getAgentInstanceIds(processors[0],singleSelector,services.getContextManagementService(),statementSpec.getOptionalContextName()); for ( int agentInstanceId : agentInstanceIds) { FireAndForgetInstance processorInstance=processors[0].getProcessorInstanceContextById(agentInstanceId); if (processorInstance != null) { EPPreparedExecuteTableHelper.assignTableAccessStrategies(services,statementSpec.getTableNodes(),processorInstance.getAgentInstanceContext()); Collection<EventBean> coll=processorInstance.snapshotBestEffort(this,filters[0],statementSpec.getAnnotations()); contextPartitionResults.add(new ContextPartitionResult(coll,processorInstance.getAgentInstanceContext())); } } ArrayDeque<EventBean[]> events=new ArrayDeque<EventBean[]>(); for ( ContextPartitionResult contextPartitionResult : contextPartitionResults) { Collection<EventBean> snapshot=contextPartitionResult.getEvents(); if (statementSpec.getFilterRootNode() != null) { snapshot=getFiltered(snapshot,Collections.singletonList(statementSpec.getFilterRootNode())); } EventBean[] rows=snapshot.toArray(new EventBean[snapshot.size()]); resultSetProcessor.setAgentInstanceContext(contextPartitionResult.getContext()); UniformPair<EventBean[]> results=resultSetProcessor.processViewResult(rows,null,true); if (results != null && results.getFirst() != null && results.getFirst().length > 0) { events.add(results.getFirst()); } } return new EPPreparedQueryResult(resultSetProcessor.getResultEventType(),EventBeanUtility.flatten(events)); } finally { if (hasTableAccess) { services.getTableService().getTableExprEvaluatorContext().releaseAcquiredLocks(); } } }
Executes the prepared query.
public boolean isDirectory(){ return isDirectory; }
Tests if the shortcut points to a directory.
public EventStoreBuilder tcpNoDelayDisabled(){ tcpSettingsBuilder.tcpNoDelay(false); return this; }
Disables socket no-delay option (Nagle's algorithm will be used).
public void clearListeners(){ listeners=new ArrayList<T>(); }
Clear all listeners
protected boolean filterHeader(int index){ if (this.headerName == null) return true; final String name=((Header)this.allHeaders.get(index)).getName(); return this.headerName.equalsIgnoreCase(name); }
Checks whether a header is part of the iteration.
private BillingResult initBillingResult(BillingInput billingInput) throws ObjectNotFoundException, NonUniqueBusinessKeyException { BillingResult result=createBillingResult(billingInput); long chargingOrgKey=bdr.loadChargingOrgKeyForSubscription(billingInput.getSubscriptionKey()); long vendorKey=bdr.loadVendorKeyForSubscription(billingInput.getSubscriptionKey()); result.setChargingOrgKey(chargingOrgKey); result.setVendorKey(vendorKey); result.setCurrency(bdr.loadSupportedCurrency(billingInput.getCurrencyIsoCode())); if (billingInput.isStoreBillingResult()) { bdr.persistBillingResult(result); } return result; }
Initializes a new billing result. An empty billing result may be persisted already.
public void encode(DerOutputStream out) throws IOException { out.putInteger(serialNum); }
Encode the SerialNumber in DER form to the stream.