code
stringlengths
10
174k
nl
stringlengths
3
129k
private static boolean isPollingPageFar(GraalHotSpotVMConfig config){ final long pollingPageAddress=config.safepointPollingAddress; return !NumUtil.isSignedNbit(21,pollingPageAddress - config.codeCacheLowBound) || !NumUtil.isSignedNbit(21,pollingPageAddress - config.codeCacheHighBound); }
Conservatively checks whether we can load the safepoint polling address with a single ldr instruction or not.
protected void shiftBuffer(int offset){ fStart=offset; fEnd=fStart + fBufferSize; if (fEnd > fDocumentLength) fEnd=fDocumentLength; try { String content=fDocument.get(fStart,fEnd - fStart); content.getChars(0,fEnd - fStart,fBuffer,0); } catch ( BadLocationException x) { } }
Shifts the buffer so that the buffer starts at the given document offset.
public XML addClass(Class<?> aClass,Attribute[] attributes){ checksClassAbsence(aClass); XmlClass xmlClass=new XmlClass(); xmlClass.name=aClass.getName(); xmlClass.attributes=new ArrayList<XmlAttribute>(); xmlJmapper.classes.add(xmlClass); addAttributes(aClass,attributes); return this; }
This method adds aClass with the attributes given as input to XML configuration file.<br> It's mandatory define at least one attribute.
public boolean add(Solution newSolution){ return super.forceAddWithoutCheck(newSolution); }
Enables a performance hack to avoid performing non-dominance checks on solutions already known to be non-dominated.
public Map<Integer,HadoopProcessDescriptor> reducersAddresses(){ return reducersAddrs; }
Gets reducers addresses for external execution.
private void initialiseDrawables(){ leftDrawable=ContextCompat.getDrawable(TestButtonConfig.this,R.drawable.introbutton_behaviour_first); rightDrawable=ContextCompat.getDrawable(TestButtonConfig.this,R.drawable.introbutton_behaviour_previous); finalDrawable=ContextCompat.getDrawable(TestButtonConfig.this,R.drawable.introbutton_behaviour_progress); }
Initialise the drawables to display in the navigation buttons after the appearance/behaviour change is triggered.
public boolean isLocalName(){ Scope scope=getDefiningScope(); return scope != null && scope.getParentScope() != null; }
Return true if this node is known to be defined as a symbol in a lexical scope other than the top-level (global) scope.
public void configureOption3(String value){ super.configureOption3(value); log.debug("configureOption3: " + value); setTurnoutHandling(value); }
Set the third port option. Only to be used after construction, but before the openPort call
private TMember findMemberInSubScope(IScope subScope,String name){ final IEObjectDescription currElem=subScope.getSingleElement(QualifiedName.create(name)); if (currElem != null) { final EObject objOrProxy=currElem.getEObjectOrProxy(); if (objOrProxy != null && !objOrProxy.eIsProxy() && objOrProxy instanceof TMember) { final TMember currM=(TMember)objOrProxy; if (hasCorrectAccess(currM,writeAccess) || (currM instanceof TField && hasCorrectAccess(currM,!writeAccess))) { return currM; } else { return createErrorPlaceholder(name); } } } return null; }
Searches for a member of the given name and for the given access in the sub-scope with index 'subScopeIdx'.
public static void main(String[] args){ String[] a=StdIn.readAllStrings(); Knuth.shuffle(a); for (int i=0; i < a.length; i++) StdOut.println(a[i]); }
Reads in a sequence of strings from standard input, shuffles them, and prints out the results.
public boolean match(TextElement node,Object other){ if (!(other instanceof TextElement)) { return false; } TextElement o=(TextElement)other; return safeEquals(node.getText(),o.getText()); }
Returns whether the given node and the other object match. <p> The default implementation provided by this class tests whether the other object is a node of the same type with structurally isomorphic child subtrees. Subclasses may override this method as needed. </p>
public Builder address(String host,int port){ return address(new InetSocketAddress(host,port)); }
Sets server address.
public SerializableInstance(){ super(0); }
Instantiates a new serializable instance.
public boolean isCharged(){ return status == BATTERY_STATUS_FULL || level >= 100; }
Whether or not the device is charged. Note that some devices never return 100% for battery level, so this allows either battery level or status to determine if the battery is charged.
public ECKey maybeDecrypt(@Nullable KeyParameter aesKey) throws KeyCrypterException { return isEncrypted() && aesKey != null ? decrypt(aesKey) : this; }
Creates decrypted private key if needed.
public String calculateHours(Properties ctx,int WindowNo,GridTab mTab,GridField mField,Object value){ if (isCalloutActive() || value == null) return ""; I_HR_WorkShift workShift=GridTabWrapper.create(mTab,I_HR_WorkShift.class); Timestamp fromTime=workShift.getShiftFromTime(); Timestamp toTime=workShift.getShiftToTime(); if (fromTime == null || toTime == null) return ""; else if (fromTime.after(toTime)) { GregorianCalendar gre=(GregorianCalendar)Calendar.getInstance(); gre.setTimeInMillis(toTime.getTime()); gre.add(Calendar.DAY_OF_MONTH,1); toTime=new Timestamp(gre.getTimeInMillis()); } long difference=toTime.getTime() - fromTime.getTime(); if (difference > 3600000) { long hoursBetween=difference / 3600000; workShift.setNoOfHours(new BigDecimal(hoursBetween)); } return ""; }
Calculates The Number Of Hours Between Given Time
public static List<TvShowEpisode> parseNFO(MediaFile episodeFile){ List<TvShowEpisode> episodes=new ArrayList<>(1); episodes.addAll(TvShowEpisodeToXbmcNfoConnector.getData(episodeFile.getFile())); return episodes; }
Parses the nfo.
public Vector3 normalize(){ return Vector3.normalize(this); }
returns the vector with a length of 1
public void update(double x_[]){ update(new double[][]{x_}); }
Update - On raw data (with no bias column)
public String date(String format,double time){ Calendar d=Calendar.getInstance(); d.setTime(new Date((long)(time * 1000))); if (format.startsWith("!")) { time-=timeZoneOffset(d); d.setTime(new Date((long)(time * 1000))); format=format.substring(1); } byte[] fmt=format.getBytes(); final int n=fmt.length; Buffer result=new Buffer(n); byte c; for (int i=0; i < n; ) { switch (c=fmt[i++]) { case '\n': result.append("\n"); break; default : result.append(c); break; case '%': if (i >= n) break; switch (c=fmt[i++]) { default : LuaValue.argerror(1,"invalid conversion specifier '%" + c + "'"); break; case '%': result.append((byte)'%'); break; case 'a': result.append(WeekdayNameAbbrev[d.get(Calendar.DAY_OF_WEEK) - 1]); break; case 'A': result.append(WeekdayName[d.get(Calendar.DAY_OF_WEEK) - 1]); break; case 'b': result.append(MonthNameAbbrev[d.get(Calendar.MONTH)]); break; case 'B': result.append(MonthName[d.get(Calendar.MONTH)]); break; case 'c': result.append(date("%a %b %d %H:%M:%S %Y",time)); break; case 'd': result.append(String.valueOf(100 + d.get(Calendar.DAY_OF_MONTH)).substring(1)); break; case 'H': result.append(String.valueOf(100 + d.get(Calendar.HOUR_OF_DAY)).substring(1)); break; case 'I': result.append(String.valueOf(100 + (d.get(Calendar.HOUR_OF_DAY) % 12)).substring(1)); break; case 'j': { Calendar y0=beginningOfYear(d); int dayOfYear=(int)((d.getTime().getTime() - y0.getTime().getTime()) / (24 * 3600L * 1000L)); result.append(String.valueOf(1001 + dayOfYear).substring(1)); break; } case 'm': result.append(String.valueOf(101 + d.get(Calendar.MONTH)).substring(1)); break; case 'M': result.append(String.valueOf(100 + d.get(Calendar.MINUTE)).substring(1)); break; case 'p': result.append(d.get(Calendar.HOUR_OF_DAY) < 12 ? "AM" : "PM"); break; case 'S': result.append(String.valueOf(100 + d.get(Calendar.SECOND)).substring(1)); break; case 'U': result.append(String.valueOf(weekNumber(d,0))); break; case 'w': result.append(String.valueOf((d.get(Calendar.DAY_OF_WEEK) + 6) % 7)); break; case 'W': result.append(String.valueOf(weekNumber(d,1))); break; case 'x': result.append(date("%m/%d/%y",time)); break; case 'X': result.append(date("%H:%M:%S",time)); break; case 'y': result.append(String.valueOf(d.get(Calendar.YEAR)).substring(2)); break; case 'Y': result.append(String.valueOf(d.get(Calendar.YEAR))); break; case 'z': { final int tzo=timeZoneOffset(d) / 60; final int a=Math.abs(tzo); final String h=String.valueOf(100 + a / 60).substring(1); final String m=String.valueOf(100 + a % 60).substring(1); result.append((tzo >= 0 ? "+" : "-") + h + m); break; } } } } return result.tojstring(); }
If the time argument is present, this is the time to be formatted (see the os.time function for a description of this value). Otherwise, date formats the current time. Date returns the date as a string, formatted according to the same rules as ANSII strftime, but without support for %g, %G, or %V. When called without arguments, date returns a reasonable date and time representation that depends on the host system and on the current locale (that is, os.date() is equivalent to os.date("%c")).
public void transform(Source xmlSource,Result outputTarget,boolean shouldRelease) throws TransformerException { synchronized (m_reentryGuard) { SerializationHandler xoh=createSerializationHandler(outputTarget); this.setSerializationHandler(xoh); m_outputTarget=outputTarget; transform(xmlSource,shouldRelease); } }
Process the source tree to the output result.
public static Uri formatURL(String url){ if (url.startsWith("//")) { url="https:" + url; } if (url.startsWith("/")) { url="https://reddit.com" + url; } if (!url.contains("://")) { url="http://" + url; } Uri uri=Uri.parse(url); return uri.normalizeScheme(); }
Corrects mistakes users might make when typing URLs, e.g. case sensitivity in the scheme and converts to Uri
protected void addAgent() throws Exception { if (agent != null && agent.isDone()) { env.removeAgent(agent); agent=null; } if (agent == null) { int pSel=frame.getSelection().getIndex(NQueensFrame.PROBLEM_SEL); int sSel=frame.getSelection().getIndex(NQueensFrame.SEARCH_SEL); ActionsFunction af; if (pSel == 0) af=NQueensFunctionFactory.getIActionsFunction(); else af=NQueensFunctionFactory.getCActionsFunction(); Problem problem=new Problem(env.getBoard(),af,NQueensFunctionFactory.getResultFunction(),new NQueensGoalTest()); Search search=SEARCH_ALGOS.get(sSel); agent=new SearchAgent(problem,search); env.addAgent(agent); } }
Creates a new search agent and adds it to the current environment if necessary.
public OffScenePanel(int width,int height){ this.width=width; this.height=height; initComponents(); setupScene(); }
Creates new form ScenePanel
public Object runSafely(Catbert.FastStack stack) throws Exception { ManualRecord mr=Wizard.getInstance().getManualRecord(getAir(stack)); return (mr == null) ? "" : ManualRecord.getRecurrenceName(mr.getRecurrence()); }
If this Airing is a time-based recording this will get a description of the recurrence frequency for its recording recurrence
private void buildUI(String[] stockData){ FacesContext context=FacesContext.getCurrentInstance(); UIForm form=(UIForm)context.getViewRoot().findComponent("myform"); UIPanel dataPanel=(UIPanel)form.findComponent("stockdata"); dataPanel.getChildren().clear(); UIPanel titlePanel1=new UIPanel(); UIOutput output=new UIOutput(); output.setValue("Symbol"); titlePanel1.getChildren().add(output); dataPanel.getChildren().add(titlePanel1); UIPanel titlePanel2=new UIPanel(); output=new UIOutput(); output.setValue("Name"); titlePanel2.getChildren().add(output); dataPanel.getChildren().add(titlePanel2); UIPanel titlePanel3=new UIPanel(); output=new UIOutput(); output.setValue("Open"); titlePanel3.getChildren().add(output); dataPanel.getChildren().add(titlePanel3); UIPanel titlePanel4=new UIPanel(); output=new UIOutput(); output.setValue("Last"); titlePanel4.getChildren().add(output); dataPanel.getChildren().add(titlePanel4); UIPanel titlePanel5=new UIPanel(); output=new UIOutput(); output.setValue(""); titlePanel5.getChildren().add(output); dataPanel.getChildren().add(titlePanel5); UIPanel titlePanel6=new UIPanel(); output=new UIOutput(); output.setValue("Change"); titlePanel6.getChildren().add(output); dataPanel.getChildren().add(titlePanel6); UIPanel titlePanel7=new UIPanel(); output=new UIOutput(); output.setValue("Change %"); titlePanel7.getChildren().add(output); dataPanel.getChildren().add(titlePanel7); UIPanel titlePanel8=new UIPanel(); output=new UIOutput(); output.setValue("Volume"); titlePanel8.getChildren().add(output); dataPanel.getChildren().add(titlePanel8); for (int i=0; i < stockData.length; i++) { String[] data=stockData[i].split("\\,"); UIOutput outputComponent=null; UIGraphic imageComponent=null; double openPrice=0; double lastPrice=0; double change=0; boolean openPriceAvailable=true; outputComponent=new UIOutput(); outputComponent.setValue(data[0]); dataPanel.getChildren().add(outputComponent); outputComponent=new UIOutput(); outputComponent.setValue(data[1]); dataPanel.getChildren().add(outputComponent); outputComponent=new UIOutput(); try { openPrice=new Double(data[2]).doubleValue(); } catch ( NumberFormatException nfe) { openPriceAvailable=false; } outputComponent.setValue(data[2]); dataPanel.getChildren().add(outputComponent); outputComponent=new UIOutput(); if (openPriceAvailable) { lastPrice=new Double(data[3]).doubleValue(); lastPrice=round(lastPrice,2); change=lastPrice - openPrice; change=round(change,2); } outputComponent.setValue(lastPrice); dataPanel.getChildren().add(outputComponent); if (change < 0) { imageComponent=new UIGraphic(); imageComponent.setUrl("resources/down_r.gif"); dataPanel.getChildren().add(imageComponent); } else if (change > 0) { imageComponent=new UIGraphic(); imageComponent.setUrl("resources/up_g.gif"); dataPanel.getChildren().add(imageComponent); } else { outputComponent=new UIOutput(); outputComponent.setValue(""); dataPanel.getChildren().add(outputComponent); } outputComponent=new UIOutput(); if (change < 0) { outputComponent.getAttributes().put("styleClass","down-color"); } else if (change > 0) { outputComponent.getAttributes().put("styleClass","up-color"); } outputComponent.setValue(String.valueOf(change)); dataPanel.getChildren().add(outputComponent); outputComponent=new UIOutput(); if (change < 0) { outputComponent.getAttributes().put("styleClass","down-color"); } else if (change > 0) { outputComponent.getAttributes().put("styleClass","up-color"); } outputComponent.setValue(data[5]); dataPanel.getChildren().add(outputComponent); outputComponent=new UIOutput(); outputComponent.setValue(data[6]); dataPanel.getChildren().add(outputComponent); } }
Helper method to dynamically add JSF components to display the data.
private void buildRememberPassword(){ final Button checkbox=new Button(this.shell,SWT.CHECK); final GridData gridData=new GridData(GridData.BEGINNING,GridData.CENTER,true,false,4,1); gridData.horizontalIndent=35; checkbox.setLayoutData(gridData); checkbox.setText(ResourceManager.getLabel(ResourceManager.REMEMBER_PASSWORD)); checkbox.setSelection(this.rememberPassword); }
Build the "remember password" part of the box
public boolean isShowCrosshair(){ return (worldScene.getShowCrosshair()); }
Get cross hair visibility
public void paintSliderBorder(SynthContext context,Graphics g,int x,int y,int w,int h){ }
Paints the border of a slider.
public static String decode(String encodedValue,final String encoding){ try { if (encodedValue != null) { String previousEncodedValue; do { previousEncodedValue=encodedValue; encodedValue=URLDecoder.decode(encodedValue,encoding); } while (!encodedValue.equals(previousEncodedValue)); } return encodedValue; } catch ( UnsupportedEncodingException ignore) { return encodedValue; } }
Decodes the encoded String value using the specified encoding (such as UTF-8). It is assumed the String value was encoded with the URLEncoder using the specified encoding. This method handles UnsupportedEncodingException by just returning the encodedValue. Since it is possible for a String value to have been encoded multiple times, the String value is decoded until the value stops changing (in other words, until the value is completely decoded). <p/>
public EqualsMethodAsserter method(String name,Object... values){ Class<?> parameterTypes[]=new Class<?>[values.length]; for (int i=0; i < values.length; i++) { parameterTypes[i]=values[i].getClass(); } return method(name,parameterTypes,values); }
Defines a method that should be called after creating each object.
void showSettings(){ if (setdlg == null) { setdlg=new CommonSettingsDialog(frame); } setdlg.setVisible(true); }
Called when the user selects the "View->Client Settings" menu item.
public B missing(Object missingValue){ this.missing=missingValue; return (B)this; }
Configure the value to use when documents miss a value.
public static void showInfoMsg(final Object... messages){ Sound.beepOnInfo(); JOptionPane.showMessageDialog(LEnv.CURRENT_GUI_FRAME.get(),messages,"Info",JOptionPane.INFORMATION_MESSAGE); }
Shows an info message. <p> This method blocks until the dialog is closed. </p>
public static BigInteger createBigInteger(String val){ BigInteger bi=new BigInteger(val); return bi; }
<p>Convert a <code>String</code> to a <code>BigInteger</code>.</p>
@Deprecated public Object callReadResolve(final Object result){ return serializationMembers.callReadResolve(result); }
Resolves an object as native serialization does by calling readResolve(), if available.
public UploadResultWindow(final List<UploadStatus> uploadResultList,final I18N i18n){ this.uploadResultList=uploadResultList; this.i18n=i18n; eventBus=SpringContextHelper.getBean(EventBus.SessionEventBus.class); createComponents(); createLayout(); }
Initialize upload status popup.
public static long copyLarge(Reader input,Writer output,final long inputOffset,final long length,char[] buffer) throws IOException { if (inputOffset > 0) { skipFully(input,inputOffset); } if (length == 0) { return 0; } int bytesToRead=buffer.length; if (length > 0 && length < buffer.length) { bytesToRead=(int)length; } int read; long totalRead=0; while (bytesToRead > 0 && EOF != (read=input.read(buffer,0,bytesToRead))) { output.write(buffer,0,read); totalRead+=read; if (length > 0) { bytesToRead=(int)Math.min(length - totalRead,buffer.length); } } return totalRead; }
Copy some or all chars from a large (over 2GB) <code>InputStream</code> to an <code>OutputStream</code>, optionally skipping input chars. <p> This method uses the provided buffer, so there is no need to use a <code>BufferedReader</code>. <p>
public ParserString subCFMLString(int start){ return subCFMLString(start,text.length - start); }
Gibt eine Untermenge des CFMLString als CFMLString zurueck, ausgehend von start bis zum Ende des CFMLString.
public void padWithLen(byte[] in,int off,int len) throws ShortBufferException { if (in == null) return; if ((off + len) > in.length) { throw new ShortBufferException("Buffer too small to hold padding"); } byte paddingOctet=(byte)(len & 0xff); for (int i=0; i < len; i++) { in[i + off]=paddingOctet; } return; }
Adds the given number of padding bytes to the data input. The value of the padding bytes is determined by the specific padding mechanism that implements this interface.
public SVGImageElementBridge(){ }
Constructs a new bridge for the &lt;image> element.
public static TriggerDefinition toTriggerDefinition(VOTriggerDefinition vo) throws ValidationException { final TriggerDefinition domObj=new TriggerDefinition(); copyAttributes(domObj,vo); return domObj; }
Converts a value object trigger definition to a domain object representation.
@SuppressWarnings("unchecked") @Override public void eSet(int featureID,Object newValue){ switch (featureID) { case EipPackage.SERVICE_REF__NAME: setName((String)newValue); return; case EipPackage.SERVICE_REF__REFERENCE: setReference(newValue); return; case EipPackage.SERVICE_REF__OPERATIONS: getOperations().clear(); getOperations().addAll((Collection<? extends String>)newValue); return; } super.eSet(featureID,newValue); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public ActorMessageTypeInvalidException(String error){ super(error); }
Instantiates a new actor message type invalid exception.
void onDropChild(View child){ if (child != null) { LayoutParams lp=(LayoutParams)child.getLayoutParams(); lp.dropped=true; child.requestLayout(); } }
Mark a child as having been dropped. At the beginning of the drag operation, the child may have been on another screen, but it is re-parented before this method is called.
protected static void parseContentTypeParams(ByteArrayInputStream pduDataStream,HashMap<Integer,Object> map,Integer length){ assert (null != pduDataStream); assert (length > 0); int startPos=pduDataStream.available(); int tempPos=0; int lastLen=length; while (0 < lastLen) { int param=pduDataStream.read(); assert (-1 != param); lastLen--; switch (param) { case PduPart.P_TYPE: case PduPart.P_CT_MR_TYPE: pduDataStream.mark(1); int first=extractByteValue(pduDataStream); pduDataStream.reset(); if (first > TEXT_MAX) { int index=parseShortInteger(pduDataStream); if (index < PduContentTypes.contentTypes.length) { byte[] type=(PduContentTypes.contentTypes[index]).getBytes(); map.put(PduPart.P_TYPE,type); } else { } } else { byte[] type=parseWapString(pduDataStream,TYPE_TEXT_STRING); if ((null != type) && (null != map)) { map.put(PduPart.P_TYPE,type); } } tempPos=pduDataStream.available(); lastLen=length - (startPos - tempPos); break; case PduPart.P_START: case PduPart.P_DEP_START: byte[] start=parseWapString(pduDataStream,TYPE_TEXT_STRING); if ((null != start) && (null != map)) { map.put(PduPart.P_START,start); } tempPos=pduDataStream.available(); lastLen=length - (startPos - tempPos); break; case PduPart.P_CHARSET: pduDataStream.mark(1); int firstValue=extractByteValue(pduDataStream); pduDataStream.reset(); if (((firstValue > TEXT_MIN) && (firstValue < TEXT_MAX)) || (END_STRING_FLAG == firstValue)) { byte[] charsetStr=parseWapString(pduDataStream,TYPE_TEXT_STRING); try { int charsetInt=CharacterSets.getMibEnumValue(new String(charsetStr)); map.put(PduPart.P_CHARSET,charsetInt); } catch (UnsupportedEncodingException e) { Log.e(LOG_TAG,Arrays.toString(charsetStr),e); map.put(PduPart.P_CHARSET,CharacterSets.ANY_CHARSET); } } else { int charset=(int)parseIntegerValue(pduDataStream); if (map != null) { map.put(PduPart.P_CHARSET,charset); } } tempPos=pduDataStream.available(); lastLen=length - (startPos - tempPos); break; case PduPart.P_DEP_NAME: case PduPart.P_NAME: byte[] name=parseWapString(pduDataStream,TYPE_TEXT_STRING); if ((null != name) && (null != map)) { map.put(PduPart.P_NAME,name); } tempPos=pduDataStream.available(); lastLen=length - (startPos - tempPos); break; default : if (LOCAL_LOGV) { Log.v(LOG_TAG,"Not supported Content-Type parameter"); } if (-1 == skipWapValue(pduDataStream,lastLen)) { Log.e(LOG_TAG,"Corrupt Content-Type"); } else { lastLen=0; } break; } } if (0 != lastLen) { Log.e(LOG_TAG,"Corrupt Content-Type"); } }
Parse content type parameters. For now we just support four parameters used in mms: "type", "start", "name", "charset".
public NPCEmoteAction(String npcAction){ this.npcAction=npcAction.trim(); }
Creates a new EmoteAction.
public static <T>T byte2Obj(byte[] bytes,org.codehaus.jackson.type.TypeReference<T> typeReference){ if (bytes == null || typeReference == null) { return null; } try { return (T)(typeReference.getType().equals(byte[].class) ? bytes : objectMapper.readValue(bytes,typeReference)); } catch ( Exception e) { log.info("parse byte[] to Object error, byte[]:{}, TypeReference<T>:{}, error:{}",bytes,typeReference.getType(),e); return null; } }
byte[] => Object
public void scrollToFinishActivity(){ final int childWidth=mContentView.getWidth(); int left=0, top=0; left=childWidth + mShadowLeft.getIntrinsicWidth() + OVERSCROLL_DISTANCE; mDragHelper.smoothSlideViewTo(mContentView,left,top); invalidate(); }
Scroll out contentView and finish the activity
public void ReInit(JavaCharStream stream){ jjmatchedPos=jjnewStateCnt=0; curLexState=defaultLexState; input_stream=stream; ReInitRounds(); }
Reinitialise parser.
protected void sequence_TAnonymousFormalParameter(ISerializationContext context,TAnonymousFormalParameter semanticObject){ genericSequencer.createSequence(context,semanticObject); }
Contexts: TAnonymousFormalParameter returns TAnonymousFormalParameter Constraint: (variadic?='...'? name=BindingIdentifier? typeRef=TypeRef)
public void addContentView(View newContentView){ contentLayout.addView(newContentView); contentLayout.invalidate(); }
Add a view into the Content LinearLayout, the LinearLayout that expands or collapse in a fashion way.
public static boolean addCompressionRecipe(ItemStack aInput,ItemStack aOutput){ aOutput=GT_OreDictUnificator.get(true,aOutput); if (aInput == null || aOutput == null) return false; GT_Utility.removeSimpleIC2MachineRecipe(aInput,getCompressorRecipeList(),null); if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.compression,aInput,true)) return false; GT_Utility.addSimpleIC2MachineRecipe(aInput,getCompressorRecipeList(),null,aOutput); return true; }
IC2-Compressor Recipe. Overloads old Recipes automatically
public SnapshotId(String repository,String snapshot){ this.repository=repository; this.snapshot=snapshot; this.hashCode=computeHashCode(); }
Constructs new snapshot id
public ModuleAction(final ConfAction jsubaction){ super(jsubaction); }
Instantiates a new stop agent action.
public ConditionalRouteTest(String name){ super(name); }
Constructs a new Conditional Route test case with the given name. <!-- begin-user-doc --> <!-- end-user-doc -->
public SyntheticMethodBinding(SourceTypeBinding declaringEnum,int startIndex,int endIndex){ this.declaringClass=declaringEnum; SyntheticMethodBinding[] knownAccessMethods=declaringEnum.syntheticMethods(); this.index=knownAccessMethods == null ? 0 : knownAccessMethods.length; StringBuffer buffer=new StringBuffer(); buffer.append(TypeConstants.SYNTHETIC_ENUM_CONSTANT_INITIALIZATION_METHOD_PREFIX).append(this.index); this.selector=String.valueOf(buffer).toCharArray(); this.modifiers=ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic; this.tagBits|=(TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); this.purpose=SyntheticMethodBinding.TooManyEnumsConstants; this.thrownExceptions=Binding.NO_EXCEPTIONS; this.returnType=TypeBinding.VOID; this.parameters=Binding.NO_PARAMETERS; this.startIndex=startIndex; this.endIndex=endIndex; }
Construct enum special methods: values or valueOf methods
static int indexOf(final CharSequence cs,final CharSequence searchChar,final int start){ return cs.toString().indexOf(searchChar.toString(),start); }
Used by the indexOf(CharSequence methods) as a green implementation of indexOf.
private void calculateMaxValue(int seriesCount,int catCount){ double v; Number nV; for (int seriesIndex=0; seriesIndex < seriesCount; seriesIndex++) { for (int catIndex=0; catIndex < catCount; catIndex++) { nV=getPlotValue(seriesIndex,catIndex); if (nV != null) { v=nV.doubleValue(); if (v > this.maxValue) { this.maxValue=v; } } } } }
loop through each of the series to get the maximum value on each category axis
void callbackToActivity(String clientHandle,Status status,Bundle dataBundle){ Intent callbackIntent=new Intent(MqttServiceConstants.CALLBACK_TO_ACTIVITY); if (clientHandle != null) { callbackIntent.putExtra(MqttServiceConstants.CALLBACK_CLIENT_HANDLE,clientHandle); } callbackIntent.putExtra(MqttServiceConstants.CALLBACK_STATUS,status); if (dataBundle != null) { callbackIntent.putExtras(dataBundle); } sendBroadcast(callbackIntent); }
pass data back to the Activity, by building a suitable Intent object and broadcasting it
public boolean isMarkedForRemoval(){ return markedForRemoval; }
Gets the value of the markedForRemoval property.
public ServiceCall<Void> deleteCorpus(String customizationId,String corpusName){ Validator.notNull(customizationId,"customizationId cannot be null"); Validator.notNull(corpusName,"corpusName cannot be null"); RequestBuilder requestBuilder=RequestBuilder.delete(String.format(PATH_CORPUS,customizationId,corpusName)); return createServiceCall(requestBuilder.build(),ResponseConverterUtils.getVoid()); }
Delete customization corpus.
public Supplier<Pair<Integer,JsonNode>> handleDelete(StateContext state) throws HttpStatusException { throw new UnsupportedOperationException(this.getClass().toString()); }
Handle delete.
static String encodeEntities(String source){ StringBuffer buffer=new StringBuffer(); String encoded; for (int index=0; index < source.length(); index++) { char ch=source.charAt(index); if ((encoded=encodeEntity(ch)) != null) { buffer.append(encoded); } else { buffer.append(ch); } } return buffer.toString(); }
Utility method for encoding HTML entities within query parameters.
@Override public void eUnset(int featureID){ switch (featureID) { case UmplePackage.ANONYMOUS_MORE_CODE_1__CODE_LANG_1: getCodeLang_1().clear(); return; case UmplePackage.ANONYMOUS_MORE_CODE_1__CODE_LANGS_1: getCodeLangs_1().clear(); return; } super.eUnset(featureID); }
<!-- begin-user-doc --> <!-- end-user-doc -->
private void cmd_query(){ boolean reports=reportField.isChecked(); ListItem listitem=processField.getSelectedItem(); KeyNamePair process=null; if (listitem != null) process=(KeyNamePair)listitem.getValue(); listitem=tableField.getSelectedItem(); KeyNamePair table=null; if (listitem != null) table=(KeyNamePair)listitem.getValue(); Integer C_BPartner_ID=(Integer)bPartnerField.getValue(); String name=nameQField.getText(); String description=descriptionQField.getText(); String help=helpQField.getText(); listitem=createdByQField.getSelectedItem(); KeyNamePair createdBy=null; if (listitem != null) createdBy=(KeyNamePair)listitem.getValue(); Date date=null; Timestamp createdFrom=null; if (createdQFrom.getValue() != null) { date=createdQFrom.getValue(); createdFrom=new Timestamp(date.getTime()); } Timestamp createdTo=null; if (createdQTo.getValue() != null) { date=createdQTo.getValue(); createdTo=new Timestamp(date.getTime()); } cmd_query(reports,process,table,C_BPartner_ID,name,description,help,createdBy,createdFrom,createdTo); tabbox.setSelectedIndex(1); m_index=1; updateVDisplay(false); }
Create Query
public static String buildClusterCgName(String clusterName,String cgName){ return String.format("%s" + SPLITTER + "%s",clusterName,cgName); }
Builds a concatenated name combining the cluster name and consistency group name. This is used for mapping VPlex storage systems to their corresponding cluster consistency groups.
protected void loadThisOrOwner(){ if (isInnerClass()) { visitFieldExpression(new FieldExpression(controller.getClassNode().getDeclaredField("owner"))); } else { loadThis(null); } }
Loads either this object or if we're inside a closure then load the top level owner
protected void sequence_Wildcard_WildcardNewNotation(ISerializationContext context,Wildcard semanticObject){ genericSequencer.createSequence(context,semanticObject); }
Contexts: TypeArgument returns Wildcard Constraint: ( declaredUpperBound=TypeRef | declaredLowerBound=TypeRef | (usingInOutNotation?='out' declaredUpperBound=TypeRef) | (usingInOutNotation?='in' declaredLowerBound=TypeRef) )?
private void info(String msg){ if (logLevel.intValue() <= Level.INFO.intValue()) { println(Level.INFO,msg); } }
Used internally to log a message about the class at level INFO
boolean addModule(@Nonnull String moduleName){ verifyIsRoot(); if (children.containsKey(moduleName)) { children.get(moduleName).resetHierarchy(); return false; } else { CounterNode newNode=new CounterNode(ImmutableList.of(moduleName),null); children.put(moduleName,newNode); return true; } }
Add the given moduleName to the tree. Can only be called on the root. If the module already exists, the all counters of the module will be reset.
public void testDragOutOfTouchable(){ View outsideView=getViewByTestId("E"); View innerButton=getViewByTestId("A"); SingleTouchGestureGenerator gestureGenerator=createGestureGenerator(); gestureGenerator.startGesture(innerButton); waitForBridgeAndUIIdle(); gestureGenerator.dragTo(outsideView,15).endGesture(); waitForBridgeAndUIIdle(); assertTrue(mRecordingModule.getCalls().isEmpty()); }
Start gesture at view A, then drag and release on view {E}. Expect no touch handlers to fire
private void updateGwt27On(IJavaProject javaProject,List<String> programArgs,int indexDisabled,int indexEnabled,boolean superDevModeEnabled){ if (indexEnabled > -1) { programArgs.remove(indexEnabled); } if (indexDisabled > -1) { programArgs.remove(indexDisabled); } if (!superDevModeEnabled) { programArgs.add(0,SUPERDEVMODE_DISABLED_ARG); } }
Update program args for project GWT >= 2.7 use this for Dev Mode -nosuperDevMode and nothing for super dev mode.
public double compute(int... dataset){ return computeInPlace(intsToDoubles(dataset)); }
Computes the quantile value of the given dataset.
@ZeppelinApi public Object angular(String name){ AngularObject ao=getAngularObject(name,interpreterContext); if (ao == null) { return null; } else { return ao.get(); } }
Get angular object. Look up notebook scope first and then global scope
public QueueReader<E> reader(){ return new QueueReader<E>((E[])q,index); }
Create reader which will read objects from the queue.
public synchronized boolean performJoin(OsmElement element,Node nodeToJoin) throws OsmIllegalOperationException { boolean mergeOK=true; if (element instanceof Node) { Node node=(Node)element; createCheckpoint(R.string.undo_action_join); mergeOK=getDelegator().mergeNodes(node,nodeToJoin); map.invalidate(); } else if (element instanceof Way) { Way way=(Way)element; List<Node> wayNodes=way.getNodes(); for (int i=1, wayNodesSize=wayNodes.size(); i < wayNodesSize; ++i) { Node node1=wayNodes.get(i - 1); Node node2=wayNodes.get(i); float x=lonE7ToX(nodeToJoin.getLon()); float y=latE7ToY(nodeToJoin.getLat()); float node1X=lonE7ToX(node1.getLon()); float node1Y=latE7ToY(node1.getLat()); float node2X=lonE7ToX(node2.getLon()); float node2Y=latE7ToY(node2.getLat()); if (isPositionOnLine(x,y,node1X,node1Y,node2X,node2Y)) { float[] p=GeoMath.closestPoint(x,y,node1X,node1Y,node2X,node2Y); int lat=yToLatE7(p[1]); int lon=xToLonE7(p[0]); createCheckpoint(R.string.undo_action_join); Node node=null; if (node == null && lat == node1.getLat() && lon == node1.getLon()) { node=node1; } if (node == null && lat == node2.getLat() && lon == node2.getLon()) { node=node2; } if (node == null) { getDelegator().updateLatLon(nodeToJoin,lat,lon); getDelegator().addNodeToWayAfter(node1,nodeToJoin,way); } else { mergeOK=getDelegator().mergeNodes(node,nodeToJoin); } map.invalidate(); break; } } } return mergeOK; }
Join a node to a node or way at the point on the way closest to the node.
public PersistentCookieStore(Context context){ cookiePrefs=context.getSharedPreferences(COOKIE_PREFS,0); cookies=new ConcurrentHashMap<String,Cookie>(); String storedCookieNames=cookiePrefs.getString(COOKIE_NAME_STORE,null); if (storedCookieNames != null) { String[] cookieNames=TextUtils.split(storedCookieNames,","); for ( String name : cookieNames) { String encodedCookie=cookiePrefs.getString(COOKIE_NAME_PREFIX + name,null); if (encodedCookie != null) { Cookie decodedCookie=decodeCookie(encodedCookie); if (decodedCookie != null) { cookies.put(name,decodedCookie); } } } clearExpired(new Date()); } }
Construct a persistent cookie store.
protected Compression(int value){ super(value); }
Construct a new compression enumeration value with the given integer value.
public void actionPerformed(java.awt.event.ActionEvent ae){ String cmd=ae.getActionCommand(); server=serverAddrField.getText(); port=serverPortField.getText(); if (cmd == GetViewsCmd) { connectedStatus.setText(STATUS_CONNECTING); viewList=getViews(); if (viewList == null) { Debug.message("netmap","Can't get view list from " + server + ":"+ port); disconnect(); } } else if (cmd == ServerDisconnectCmd) { Debug.message("netmap","Disconnecting from server " + server + ":"+ port); disconnect(); } else if (cmd == LoadViewCmd) { ChoiceItem ci=viewList.get(viewChoice.getSelectedItem()); if (ci == null) { disconnect(); return; } String view=((String)ci.value()).trim(); Debug.message("netmap","Loading view " + view); connect(view); } }
Act on GUI commands controlling the NetMapReader.
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.
private static synchronized String nextID(){ return prefix + Long.toString(id++); }
Returns the next unique id. Each id made up of a short alphanumeric prefix along with a unique numeric value.
public static double[][] minus(double[][] v1,double v2){ double[][] array=new double[v1.length][v1[0].length]; for (int i=0; i < v1.length; i++) for (int j=0; j < v1[0].length; j++) array[i][j]=v1[i][j] - v2; return array; }
Subtract a scalar from each element of a matrix.
protected void processFailure(BaseStunMessageEvent event){ String receivedResponse; if (event instanceof StunFailureEvent) receivedResponse="unreachable"; else if (event instanceof StunTimeoutEvent) receivedResponse="timeout"; else receivedResponse="failure"; receivedResponses.add(receivedResponse); }
Notifies this <tt>ResponseCollector</tt> that a transaction described by the specified <tt>BaseStunMessageEvent</tt> has failed. The possible reasons for the failure include timeouts, unreachable destination, etc.
public boolean isOngoing(){ return isOngoingStorage.get(); }
The state of the current pomodoro.
private void returnData(Object ret){ if (myHost != null) { myHost.returnData(ret); } }
Used to communicate a return object from a plugin tool to the main Whitebox user-interface.
@Override public final short readShort() throws IOException { dis.readFully(work,0,2); return (short)((work[1] & 0xff) << 8 | (work[0] & 0xff)); }
Read short, 16-bits. Like DataInputStream.readShort except little endian.
public static void add(List<String> options,char option,int value){ add(options,"" + option,value); }
Adds the int value to the options.
private static void pixel(double x,double y){ offscreen.fillRect((int)Math.round(scaleX(x)),(int)Math.round(scaleY(y)),1,1); }
Draw one pixel at (x, y).
private static double distanceSq(Color a,Color b){ double rMean=(a.getRed() + b.getRed()) / 256.0 / 2.0; double dr=(a.getRed() - b.getRed()) / 256.0; double dg=(a.getGreen() - b.getGreen()) / 256.0; double db=(a.getBlue() - b.getBlue()) / 256.0; double d=(2.0 + rMean) * dr * dr + 4.0 * dg * dg + (2.0 + 1.0 - rMean) * db * db; return d / 9.0; }
Calculates the square of the distance between the two specified Colors.
public E removeFirst(){ if (head == null) { throw new NoSuchElementException("Nothing in List"); } E value=head.value; head=head.next; if (head != null) { head.prev=null; } else { last=null; } size--; return value; }
Remove first element without altering sort order.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:01:28.615 -0500",hash_original_method="713B19D560033B1B50E26BAD17DD5FF2",hash_generated_method="A5AC41D84F7549396CE8AAD5A06BF8E9") protected void releaseManagedConnection() throws IOException { if (managedConn != null) { try { managedConn.releaseConnection(); } finally { managedConn=null; } } }
Releases the connection gracefully. The connection attribute will be nullified. Subsequent invocations are no-ops.
public void test_getLjava_lang_ObjectI(){ int[] x={1}; Object ret=null; boolean thrown=false; try { ret=Array.get(x,0); } catch ( Exception e) { fail("Exception during get test : " + e.getMessage()); } assertEquals("Get returned incorrect value",1,((Integer)ret).intValue()); try { ret=Array.get(new Object(),0); } catch ( IllegalArgumentException e) { thrown=true; } if (!thrown) { fail("Passing non-array failed to throw exception"); } thrown=false; try { ret=Array.get(x,4); } catch ( ArrayIndexOutOfBoundsException e) { thrown=true; } if (!thrown) { fail("Invalid index failed to throw exception"); } Integer[] y=new Integer[]{1}; ret=null; thrown=false; try { ret=Array.get(y,0); } catch ( Exception e) { fail("Exception during get test : " + e.getMessage()); } assertEquals("Get returned incorrect value",1,((Integer)ret).intValue()); try { ret=Array.get(new Object(),0); } catch ( IllegalArgumentException e) { thrown=true; } if (!thrown) { fail("Passing non-array failed to throw exception"); } thrown=false; try { ret=Array.get(y,4); } catch ( ArrayIndexOutOfBoundsException e) { thrown=true; } if (!thrown) { fail("Invalid index failed to throw exception"); } }
java.lang.reflect.Array#get(java.lang.Object, int)
private synchronized void updateOrResetReqPerMinPerHrLstDay(float incr,boolean reset){ updateOrResetSampledValues(incr,reset,_reqPerMinHrDay); }
Updates or resets the request per minute per hour in the last day counter
private void convert(Problem problem,boolean reduced,ResultFileReader reader,PrintWriter writer){ int numberOfVariables=problem.getNumberOfVariables(); int numberOfObjectives=problem.getNumberOfObjectives(); if (reduced) { numberOfVariables=0; } while (reader.hasNext()) { ResultEntry entry=reader.next(); Population population=entry.getPopulation(); Properties properties=entry.getProperties(); if (population.isEmpty()) { continue; } if (properties.containsKey("NFE")) { writer.print(properties.getProperty("NFE")); } else { writer.print("0"); } writer.print(" "); if (properties.containsKey("ElapsedTime")) { writer.println(properties.getProperty("ElapsedTime")); } else { writer.println("0"); } writer.println("#"); for ( Solution solution : population) { for (int i=0; i < numberOfVariables; i++) { if (i > 0) { writer.print(" "); } writer.print(solution.getVariable(i)); } for (int i=0; i < numberOfObjectives; i++) { if ((i > 0) || (numberOfVariables > 0)) { writer.print(" "); } writer.print(solution.getObjective(i)); } writer.println(); } writer.println("#"); } }
Converts and writes the contents of the result file to the Aerovis format.
public void callPredicateVisitors(XPathVisitor visitor){ m_expr.callVisitors(new filterExprOwner(),visitor); super.callPredicateVisitors(visitor); }
This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.
public IndexedImage(int width,int height,int[] palette,byte[] data){ super(null); this.width=width; this.height=height; this.palette=palette; this.imageDataByte=data; initOpaque(); }
Creates an indexed image with byte data
@Override public void onSlotRemoved(final RPObject object,final String slotName,final RPObject sobject){ }
A slot object was removed.
private ContextHandler createContextHandler(String directory,boolean isInJar,File installRootDirectory,int expiresInSeconds){ final ContextHandler contextHandler=new ContextHandler(); final ResourceHandler resourceHandler=new ExpiresResourceHandler(expiresInSeconds); final String directoryWithSlash="/" + directory; contextHandler.setContextPath(directoryWithSlash); Resource directoryResource=getDirectoryResource(directory,isInJar,installRootDirectory); directoryResource=new JsMinifyingResource(directoryResource); if (isInJar) { directoryResource=new CachingResource(directoryResource,directoryWithSlash); } resourceHandler.setBaseResource(directoryResource); if (!isInJar) { resourceHandler.setMinMemoryMappedContentLength(0); } contextHandler.setHandler(resourceHandler); return contextHandler; }
Creates a context handler for the directory.
public void monitorEnter(){ mv.visitInsn(Opcodes.MONITORENTER); }
Generates the instruction to get the monitor of the top stack value.