code
stringlengths
10
174k
nl
stringlengths
3
129k
@DSComment("constructor") @DSSafe(DSCat.SAFE_OTHERS) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:15.039 -0500",hash_original_method="5474E95C495E2BDEA7848B2F1051B5AB",hash_generated_method="1FFFECB7616C84868E8040908FCDEBA5") @Deprecated public BitmapDrawable(java.io.InputStream is){ this(new BitmapState(BitmapFactory.decodeStream(is)),null); if (mBitmap == null) { android.util.Log.w("BitmapDrawable","BitmapDrawable cannot decode " + is); } }
Create a drawable by decoding a bitmap from the given input stream.
public static <T>String toString(Class<T> cls,T obj,String name0,Object val0,String name1,Object val1,String name2,Object val2){ assert cls != null; assert obj != null; assert name0 != null; assert name1 != null; assert name2 != null; Queue<GridToStringThreadLocal> queue=threadCache.get(); assert queue != null; GridToStringThreadLocal tmp=queue.isEmpty() ? new GridToStringThreadLocal() : queue.remove(); Object[] addNames=tmp.getAdditionalNames(); Object[] addVals=tmp.getAdditionalValues(); addNames[0]=name0; addVals[0]=val0; addNames[1]=name1; addVals[1]=val1; addNames[2]=name2; addVals[2]=val2; try { return toStringImpl(cls,tmp.getStringBuilder(),obj,addNames,addVals,3); } finally { queue.offer(tmp); } }
Produces auto-generated output of string presentation for given object and its declaration class.
public AsyncHttpClient(boolean fixNoHttpResponseException,int httpPort,int httpsPort){ this(getDefaultSchemeRegistry(fixNoHttpResponseException,httpPort,httpsPort)); }
Creates new AsyncHttpClient using given params
private void extractExtensionHeader(byte[] data,int length,int dataId,RtpPacket packet){ byte[] extensionHeaderData=new byte[length * 4]; System.arraycopy(data,++dataId,extensionHeaderData,0,extensionHeaderData.length); packet.extensionHeader=new RtpExtensionHeader(); int i=0; while (packet.extensionHeader.elementsCount() < length) { byte idAndLength=extensionHeaderData[i]; if (idAndLength == 0x00) { i=i + 1; continue; } int elementId=(idAndLength & 0xf0) >>> 4; if (elementId > 0 && elementId < 15) { int elementLength=(idAndLength & 0x0f); byte[] elementData=new byte[elementLength + 1]; System.arraycopy(extensionHeaderData,i + 1,elementData,0,elementData.length); packet.extensionHeader.addElement(elementId,elementData); i=i + elementData.length + 1; } else { break; } } }
Extract Extension Header
public static void showConfirmDialog(Context ctx,String message,DialogInterface.OnClickListener yesListener,DialogInterface.OnClickListener noListener){ showConfirmDialog(ctx,message,yesListener,noListener,android.R.string.yes,android.R.string.no); }
Creates a confirmation dialog with Yes-No Button. By default the buttons just dismiss the dialog.
public TelefoneTextWatcher(EventoDeValidacao callbackErros){ setEventoDeValidacao(callbackErros); }
TODO Javadoc pendente
public RenameResourceProcessor(IResource resource){ if (resource == null || !resource.exists()) { throw new IllegalArgumentException("resource must not be null and must exist"); } fResource=resource; fRenameArguments=null; fUpdateReferences=true; setNewResourceName(resource.getName()); }
Creates a new rename resource processor.
@Override public void perform(){ PyObject[] pyInputs=new PyObject[inputSockets.size()]; for (int i=0; i < inputSockets.size(); i++) { pyInputs[i]=Py.java2py(inputSockets.get(i).getValue().get()); } try { PyObject pyOutput=this.scriptFile.performFunction().__call__(pyInputs); if (pyOutput.isSequenceType()) { PySequence pySequence=(PySequence)pyOutput; Object[] javaOutputs=Py.tojava(pySequence,Object[].class); if (outputSockets.size() != javaOutputs.length) { throw new IllegalArgumentException(wrongNumberOfArgumentsMsg(outputSockets.size(),javaOutputs.length)); } for (int i=0; i < javaOutputs.length; i++) { outputSockets.get(i).setValue(javaOutputs[i]); } } else { if (outputSockets.size() != 1) { throw new IllegalArgumentException(wrongNumberOfArgumentsMsg(outputSockets.size(),1)); } Object javaOutput=Py.tojava(pyOutput,outputSockets.get(0).getSocketHint().getType()); outputSockets.get(0).setValue(javaOutput); } } catch ( RuntimeException e) { logger.log(Level.WARNING,e.getMessage(),e); } }
Perform the operation by calling a function in the Python script. This method adapts each of the inputs into Python objects, calls the Python function, and then converts the outputs of the function back into Java objects and assigns them to the outputs array. The Python function should return a tuple, list, or other sequence containing the outputs. If there is only one output, it can just return a value. Either way, the number of inputs and outputs should match up with the number of parameters and return values of the function.
public ConnectionConsumer createConnectionConsumer(Connection connection,Destination destination,ServerSessionPool ssp) throws JMSException { return connection.createConnectionConsumer(destination,null,ssp,1); }
Creates a connection for a consumer.
public static double[][] covarianceMatrix(double[][] data1,double[][] data2,int delay){ if (delay > 0) { double[][] data1Trimmed=new double[data1.length - delay][]; double[][] data2Trimmed=new double[data2.length - delay][]; for (int x=0; x < data1.length - delay; x++) { data1Trimmed[x]=data1[x]; data2Trimmed[x]=data2[x + delay]; } data1=data1Trimmed; data2=data2Trimmed; } int numVariables1=data1[0].length; int numVariables2=data2[0].length; int numVariables=numVariables1 + numVariables2; double[][] covariances=new double[numVariables][numVariables]; double[] means1=new double[numVariables1]; double[] means2=new double[numVariables2]; for (int r=0; r < numVariables1; r++) { means1[r]=mean(data1,r); } for (int r=0; r < numVariables2; r++) { means2[r]=mean(data2,r); } for (int r=0; r < numVariables1; r++) { for (int c=r; c < numVariables1; c++) { covariances[r][c]=covarianceTwoColumns(data1,r,c,means1[r],means1[c]); covariances[c][r]=covariances[r][c]; } for (int c=0; c < numVariables2; c++) { covariances[r][numVariables1 + c]=covarianceTwoColumns(data1,data2,r,c,means1[r],means2[c]); covariances[numVariables1 + c][r]=covariances[r][numVariables1 + c]; } } for (int r=0; r < numVariables2; r++) { for (int c=r; c < numVariables2; c++) { covariances[numVariables1 + r][numVariables1 + c]=covarianceTwoColumns(data2,r,c,means2[r],means2[c]); covariances[numVariables1 + c][numVariables1 + r]=covariances[numVariables1 + r][numVariables1 + c]; } } return covariances; }
Compute the covariance matrix between all column pairs (variables) in the multivariate data set, which consists of two separate multivariate vectors.
public boolean isProcessed(){ Object oo=get_Value(COLUMNNAME_Processed); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get Processed.
private static void quickSort1(char x[],int off,int len,CharComparator comp){ if (len < SMALL) { for (int i=off; i < len + off; i++) for (int j=i; j > off && comp.compare(x[j - 1],x[j]) > 0; j--) swap(x,j,j - 1); return; } int m=off + len / 2; if (len > SMALL) { int l=off; int n=off + len - 1; if (len > MEDIUM) { int s=len / 8; l=med3(x,l,l + s,l + 2 * s,comp); m=med3(x,m - s,m,m + s,comp); n=med3(x,n - 2 * s,n - s,n,comp); } m=med3(x,l,m,n,comp); } char v=x[m]; int a=off, b=a, c=off + len - 1, d=c; while (true) { int comparison; while (b <= c && (comparison=comp.compare(x[b],v)) <= 0) { if (comparison == 0) swap(x,a++,b); b++; } while (c >= b && (comparison=comp.compare(x[c],v)) >= 0) { if (comparison == 0) swap(x,c,d--); c--; } if (b > c) break; swap(x,b++,c--); } int s, n=off + len; s=Math.min(a - off,b - a); vecswap(x,off,b - s,s); s=Math.min(d - c,n - d - 1); vecswap(x,b,n - s,s); if ((s=b - a) > 1) quickSort1(x,off,s,comp); if ((s=d - c) > 1) quickSort1(x,n - s,s,comp); }
Sorts the specified sub-array of chars into ascending order.
public Sound(@Nonnull String path) throws NullPointerException { this(FileUtil.findURL(path)); }
Create a Sound object using the media file at path
public static boolean hasGwtFacet(IProject project){ boolean hasFacet=false; try { hasFacet=FacetedProjectFramework.hasProjectFacet(project,"com.gwtplugins.gwt.facet"); } catch ( CoreException e) { CorePluginLog.logInfo("hasGetFacet: Error, can't figure GWT facet.",e); } return hasFacet; }
Returns if this project has a GWT facet. TODO use extension point to get query GwtWtpPlugin...
public Yytoken yylex() throws java.io.IOException, ParseException { int zzInput; int zzAction; int zzCurrentPosL; int zzMarkedPosL; int zzEndReadL=zzEndRead; char[] zzBufferL=zzBuffer; char[] zzCMapL=ZZ_CMAP; int[] zzTransL=ZZ_TRANS; int[] zzRowMapL=ZZ_ROWMAP; int[] zzAttrL=ZZ_ATTRIBUTE; while (true) { zzMarkedPosL=zzMarkedPos; yychar+=zzMarkedPosL - zzStartRead; zzAction=-1; zzCurrentPosL=zzCurrentPos=zzStartRead=zzMarkedPosL; zzState=ZZ_LEXSTATE[zzLexicalState]; zzForAction: { while (true) { if (zzCurrentPosL < zzEndReadL) zzInput=zzBufferL[zzCurrentPosL++]; else if (zzAtEOF) { zzInput=YYEOF; break zzForAction; } else { zzCurrentPos=zzCurrentPosL; zzMarkedPos=zzMarkedPosL; boolean eof=zzRefill(); zzCurrentPosL=zzCurrentPos; zzMarkedPosL=zzMarkedPos; zzBufferL=zzBuffer; zzEndReadL=zzEndRead; if (eof) { zzInput=YYEOF; break zzForAction; } else { zzInput=zzBufferL[zzCurrentPosL++]; } } int zzNext=zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]]; if (zzNext == -1) break zzForAction; zzState=zzNext; int zzAttributes=zzAttrL[zzState]; if ((zzAttributes & 1) == 1) { zzAction=zzState; zzMarkedPosL=zzCurrentPosL; if ((zzAttributes & 8) == 8) break zzForAction; } } } zzMarkedPos=zzMarkedPosL; switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { case 11: { sb.append(yytext()); } case 25: break; case 4: { sb.delete(0,sb.length()); yybegin(STRING_BEGIN); } case 26: break; case 16: { sb.append('\b'); } case 27: break; case 6: { return new Yytoken(Yytoken.TYPE_RIGHT_BRACE,null); } case 28: break; case 23: { Boolean val=Boolean.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE,val); } case 29: break; case 22: { return new Yytoken(Yytoken.TYPE_VALUE,null); } case 30: break; case 13: { yybegin(YYINITIAL); return new Yytoken(Yytoken.TYPE_VALUE,sb.toString()); } case 31: break; case 12: { sb.append('\\'); } case 32: break; case 21: { Double val=Double.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE,val); } case 33: break; case 1: { throw new ParseException(yychar,ParseException.ERROR_UNEXPECTED_CHAR,new Character(yycharat(0))); } case 34: break; case 8: { return new Yytoken(Yytoken.TYPE_RIGHT_SQUARE,null); } case 35: break; case 19: { sb.append('\r'); } case 36: break; case 15: { sb.append('/'); } case 37: break; case 10: { return new Yytoken(Yytoken.TYPE_COLON,null); } case 38: break; case 14: { sb.append('"'); } case 39: break; case 5: { return new Yytoken(Yytoken.TYPE_LEFT_BRACE,null); } case 40: break; case 17: { sb.append('\f'); } case 41: break; case 24: { try { int ch=Integer.parseInt(yytext().substring(2),16); sb.append((char)ch); } catch (Exception e) { throw new ParseException(yychar,ParseException.ERROR_UNEXPECTED_EXCEPTION,e); } } case 42: break; case 20: { sb.append('\t'); } case 43: break; case 7: { return new Yytoken(Yytoken.TYPE_LEFT_SQUARE,null); } case 44: break; case 2: { Long val=Long.valueOf(yytext()); return new Yytoken(Yytoken.TYPE_VALUE,val); } case 45: break; case 18: { sb.append('\n'); } case 46: break; case 9: { return new Yytoken(Yytoken.TYPE_COMMA,null); } case 47: break; case 3: { } case 48: break; default : if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { zzAtEOF=true; return null; } else { zzScanError(ZZ_NO_MATCH); } } } }
Resumes scanning until the next regular expression is matched, the end of input is encountered or an I/O-Error occurs.
public void encode(OutputStream out) throws IOException { DerOutputStream tmp=new DerOutputStream(); if (extensionValue == null) { extensionId=PKIXExtensions.PolicyConstraints_Id; critical=false; encodeThis(); } super.encode(tmp); out.write(tmp.toByteArray()); }
Write the extension to the DerOutputStream.
public static <T extends Comparable<? super T>>void introSort(T[] a,int fromIndex,int toIndex){ if (toIndex - fromIndex <= 1) return; introSort(a,fromIndex,toIndex,Comparator.naturalOrder()); }
Sorts the given array slice in natural order. This method uses the intro sort algorithm, but falls back to insertion sort for small arrays.
public void deleteLabel(Serializable projectId,GitlabLabel label) throws IOException { deleteLabel(projectId,label.getName()); }
Deletes an existing label.
private static CalendarEventEntry createSingleEvent(CalendarService service,String eventTitle,String eventContent) throws ServiceException, IOException { return createEvent(service,eventTitle,eventContent,null,false,null); }
Creates a single-occurrence event.
public void testParams() throws Exception { ClassicSimilarity sim=getSimilarity("text_overlap",ClassicSimilarity.class); assertEquals(false,sim.getDiscountOverlaps()); }
Classic w/ explicit params
public static void registerRecipes(){ registerRecipeClasses(); addCraftingRecipes(); addBrewingRecipes(); }
Add this mod's recipes.
public boolean taxApplies(){ GenericValue product=getProduct(); if (product != null) { return ProductWorker.taxApplies(product); } else { return true; } }
Returns true if tax charges apply to this item.
@Action(value="/receipts/challan-printChallan") public String printChallan(){ try { reportId=collectionCommon.generateChallan(receiptHeader,true); } catch ( final Exception e) { LOGGER.error(CollectionConstants.REPORT_GENERATION_ERROR,e); throw new ApplicationRuntimeException(CollectionConstants.REPORT_GENERATION_ERROR,e); } setSourcePage("viewChallan"); return CollectionConstants.REPORT; }
This method generates the report for the requested challan
public void testIsMultiValued(){ SpellCheckedMetadata meta=new SpellCheckedMetadata(); assertFalse(meta.isMultiValued("key")); meta.add("key","value1"); assertFalse(meta.isMultiValued("key")); meta.add("key","value2"); assertTrue(meta.isMultiValued("key")); }
Test for <code>isMultiValued()</code> method.
public InitializeLoginAction(){ }
Instantiates a new login action.
protected Instrument(Soundbank soundbank,Patch patch,String name,Class<?> dataClass){ super(soundbank,name,dataClass); this.patch=patch; }
Constructs a new MIDI instrument from the specified <code>Patch</code>. When a subsequent request is made to load the instrument, the sound bank will search its contents for this instrument's <code>Patch</code>, and the instrument will be loaded into the synthesizer at the bank and program location indicated by the <code>Patch</code> object.
private static int putBytes(byte[] tgtBytes,int tgtOffset,byte[] srcBytes,int srcOffset,int srcLength){ System.arraycopy(srcBytes,srcOffset,tgtBytes,tgtOffset,srcLength); return tgtOffset + srcLength; }
Put bytes at the specified byte array position.
public HighlightTextView(Context context){ this(context,null); }
Instantiates a new Highlight text view.
@Override public void trim(){ }
Does nothing.
public void reset(byte[] data){ pos=0; mark=0; buf=data; count=data.length; }
Resets this <tt>BytesInputStream</tt> using the given byte[] as new input buffer.
public static <T,V>ObjectAnimator ofObject(T target,Property<T,V> property,TypeEvaluator<V> evaluator,V... values){ ObjectAnimator anim=new ObjectAnimator(target,property); anim.setObjectValues(values); anim.setEvaluator(evaluator); return anim; }
Constructs and returns an ObjectAnimator that animates between Object values. A single value implies that that value is the one being animated to. Two values imply a starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).
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.
public static int execUpdateGeo(final Context context,double latitude,double longitude,SelectedFiles selectedItems){ QueryParameter where=new QueryParameter(); setWhereSelectionPaths(where,selectedItems); ContentValues values=new ContentValues(2); values.put(SQL_COL_LAT,DirectoryFormatter.parseLatLon(latitude)); values.put(SQL_COL_LON,DirectoryFormatter.parseLatLon(longitude)); ContentResolver resolver=context.getContentResolver(); return resolver.update(SQL_TABLE_EXTERNAL_CONTENT_URI,values,where.toAndroidWhere(),where.toAndroidParameters()); }
Write geo data (lat/lon) media database.<br/>
public void reset(){ windowedBlockStream.reset(); }
reset the environment to reuse the resource.
@Override public Pair<OperandSize,String> generate(final ITranslationEnvironment environment,final long offset,final List<ReilInstruction> instructions) throws InternalTranslationException { Preconditions.checkNotNull(environment,"Error: Argument environment can't be null"); Preconditions.checkNotNull(instructions,"Error: Argument instructions can't be null"); Preconditions.checkArgument(offset >= 0,"Error: Argument offset can't be less than 0"); final String connected=environment.getNextVariableString(); final String negated=environment.getNextVariableString(); instructions.add(ReilHelpers.createXor(offset,OperandSize.BYTE,Helpers.SIGN_FLAG,OperandSize.BYTE,Helpers.OVERFLOW_FLAG,OperandSize.BYTE,connected)); instructions.add(ReilHelpers.createXor(offset + 1,OperandSize.BYTE,connected,OperandSize.BYTE,"1",OperandSize.BYTE,negated)); return new Pair<OperandSize,String>(OperandSize.BYTE,negated); }
Generates code for the NotLess condition.
public boolean isFinished(){ return isCompleted() || isFailed() || isCanceled(); }
<p>Finished means it is either completed, failed or canceled.</p>
private void drawBackground(){ final Rectangle rect=getClientArea(); cachedGC.setForeground(gradientStart); cachedGC.setBackground(gradientEnd); cachedGC.fillGradientRectangle(rect.x,rect.y,rect.width,rect.height / 2,true); cachedGC.setForeground(gradientEnd); cachedGC.setBackground(gradientStart); cachedGC.fillGradientRectangle(rect.x,rect.height / 2,rect.width,rect.height / 2,true); }
Draw the background
public void read(final byte[] buf){ int numToRead=buf.length; if ((position + numToRead) > buffer.length) { numToRead=buffer.length - position; System.arraycopy(buffer,position,buf,0,numToRead); for (int i=numToRead; i < buf.length; i++) { buf[i]=0; } } else { System.arraycopy(buffer,position,buf,0,numToRead); } position+=numToRead; }
Reads up to <tt>buf.length</tt> bytes from the stream into the given byte buffer.
public QueryExecutionTimeoutException(String msg){ super(msg); }
Constructs an instance of <code>QueryExecutionTimeoutException</code> with the specified detail message.
private void displayInternalServerError(){ alertDialog=CommonDialogUtils.getAlertDialogWithOneButtonAndTitle(context,getResources().getString(R.string.title_head_connection_error),getResources().getString(R.string.error_internal_server),getResources().getString(R.string.button_ok),null); alertDialog.show(); }
Displays an internal server error message to the user.
public static void updateOrdering(SQLiteDatabase database,long originalPosition,long newPosition){ Log.d("ItemDAO","original: " + originalPosition + ", newPosition:"+ newPosition); if (originalPosition > newPosition) { database.execSQL(UPDATE_ORDER_MORE,new String[]{String.valueOf(newPosition),String.valueOf(originalPosition)}); } else { database.execSQL(UPDATE_ORDER_LESS,new String[]{String.valueOf(originalPosition),String.valueOf(newPosition)}); } }
Updates the orderings between the original and new positions
@Override public void onAdChanged(){ notifyDataSetChanged(); }
Raised when the number of ads have changed. Adapters that implement this class should notify their data views that the dataset has changed.
public Socket createSocket(InetAddress host,int port) throws IOException { Socket socket=createSocket(); connectSocket(socket,new InetSocketAddress(host,port)); return socket; }
Creates a socket and connect it to the specified remote address on the specified remote port.
static LogFile openExistingFileForWrite(String name) throws Exception { File logfile=new File(name); LogFile tf=new LogFile(logfile); tf.openWrite(); return tf; }
Open an existing file for writing.
public AgeGreaterThanCondition(final int age){ this.age=age; }
Creates a new AgeGreaterThanCondition.
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:57:24.266 -0500",hash_original_method="542A19C49303D6524BE63DEB812200B5",hash_generated_method="433131C2E635F21E7867A70992F1749C") private ComparableTimSort(Object[] a){ this.a=a; int len=a.length; @SuppressWarnings({"unchecked","UnnecessaryLocalVariable"}) Object[] newArray=new Object[len < 2 * INITIAL_TMP_STORAGE_LENGTH ? len >>> 1 : INITIAL_TMP_STORAGE_LENGTH]; tmp=newArray; int stackLen=(len < 120 ? 5 : len < 1542 ? 10 : len < 119151 ? 19 : 40); runBase=new int[stackLen]; runLen=new int[stackLen]; }
Creates a TimSort instance to maintain the state of an ongoing sort.
public static int compare(Date left,double right){ return compare(left.getTime() / 1000,DateTimeUtil.getInstance().toDateTime(right).getTime() / 1000); }
compares a Date with a double
public final void removeGraphNode(SpaceEffGraphNode node){ if (node == _firstNode) { if (node == _lastNode) { _firstNode=_lastNode=null; } else { _firstNode=node.getNext(); } } else if (node == _lastNode) { _lastNode=node.getPrev(); } node.remove(); numberOfNodes--; }
Remove a node from the graph.
public static <T>JSONProperty<T> fromJSONString(String jsonString,String selectAs){ return fromJSONFunction(JSONFunctions.json(jsonString),selectAs); }
Construct a JSONProperty from a JSON string and with the given alias, e.g. "'hello' AS greeting". This is a convenience method equivalent to <code>fromJSONFunction(JSONFunctions.json(jsonString), selectAs)</code>
public void addGroupChatComposingStatus(String chatId,boolean status){ synchronized (getImsServiceSessionOperationLock()) { mGroupChatComposingStatusToNotify.put(chatId,status); } }
Adds the group chat composing status to the map to enable re-sending upon media session restart
public String[] createCmds(ChromeRunnerRunOptions runConfiguration) throws IOException { final ArrayList<String> commands=new ArrayList<>(); commands.add(nodeJsBinary.get().getBinaryAbsolutePath()); final String nodeOptions=System.getProperty(NODE_OPTIONS); if (nodeOptions != null) { for ( String nodeOption : nodeOptions.split(" ")) { commands.add(nodeOption); } } final StringBuilder elfData=getELFCode(runConfiguration.getInitModules(),runConfiguration.getExecModule(),runConfiguration.getExecutionData()); final File elf=createTempFileFor(elfData.toString()); commands.add(elf.getCanonicalPath()); return commands.toArray(new String[]{}); }
Creates commands for calling Node.js on command line. Data wrapped in passed parameter is used to configure node itself, and to generate file that will be executed by Node.
public Matrix4x3d mulComponentWise(Matrix4x3dc other){ return mulComponentWise(other,this); }
Component-wise multiply <code>this</code> by <code>other</code>.
public void testTypes() throws Exception { try { this.stmt.execute("DROP TABLE IF EXISTS typesRegressTest"); this.stmt.execute("CREATE TABLE typesRegressTest (varcharField VARCHAR(32), charField CHAR(2), enumField ENUM('1','2')," + "setField SET('1','2','3'), tinyblobField TINYBLOB, mediumBlobField MEDIUMBLOB, longblobField LONGBLOB, blobField BLOB)"); this.rs=this.stmt.executeQuery("SELECT * from typesRegressTest"); ResultSetMetaData rsmd=this.rs.getMetaData(); int numCols=rsmd.getColumnCount(); for (int i=0; i < numCols; i++) { String columnName=rsmd.getColumnName(i + 1); String columnTypeName=rsmd.getColumnTypeName(i + 1); System.out.println(columnName + " -> " + columnTypeName); } } finally { this.stmt.execute("DROP TABLE IF EXISTS typesRegressTest"); } }
Tests for types being returned correctly
public static boolean deleteFile(Context context,@NonNull final File file){ boolean success=file.delete(); if (!success && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { DocumentFile document=getDocumentFile(context,file,false,false); success=document != null && document.delete(); } if (!success && Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) { ContentResolver resolver=context.getContentResolver(); try { Uri uri=null; if (uri != null) { resolver.delete(uri,null,null); } success=!file.exists(); } catch ( Exception e) { Log.e(TAG,"Error when deleting file " + file.getAbsolutePath(),e); return false; } } if (success) scanFile(context,new String[]{file.getPath()}); return success; }
Delete a file. May be even on external SD card.
public void displayInfoLine(String infoLine,int labelDesignator){ if (infoLineHolder != null) { setLabel((infoLine != null && infoLine.length() > 0) ? infoLine : fudgeString,labelDesignator); } }
Display a line of text in a designated info line.
public DependenceResult addMember(final BaseType parentType,final BaseType memberType){ Preconditions.checkNotNull(parentType,"IE02762: Parent type can not be null."); Preconditions.checkNotNull(memberType,"IE02763: Member type can not be null."); final Node memberTypeNode=Preconditions.checkNotNull(containedRelationMap.get(memberType),"Type node for member type must exist prior to adding a member."); final Node parentNode=Preconditions.checkNotNull(containedRelationMap.get(parentType),"Type node for member parent must exist prior to adding a member"); if (willCreateCycle(parentType,memberType)) { return new DependenceResult(false,ImmutableSet.<BaseType>of()); } containedRelation.createEdge(memberTypeNode,parentNode); final TypeSearch search=new TypeSearch(containedRelationMap.inverse()); search.start(containedRelation,containedRelationMap.get(parentType)); return new DependenceResult(true,search.getDependentTypes()); }
Adds a member to the dependence graph and returns the set of base types that are affected by the changed compound type. This method assumes that all base type nodes that correspond to the member base type already exist.
int[] decodeStart(BitArray row) throws NotFoundException { int endStart=skipWhiteSpace(row); int[] startPattern=findGuardPattern(row,endStart,START_PATTERN); this.narrowLineWidth=(startPattern[1] - startPattern[0]) >> 2; validateQuietZone(row,startPattern[0]); return startPattern; }
Identify where the start of the middle / payload section starts.
public static boolean contains(int[] array,int value){ return indexOf(array,value) != -1; }
Returns <code>true</code> if an array contains given value.
public static double acosh(final double value){ if (!(value > 1.0)) { if (ANTI_JIT_OPTIM_CRASH_ON_NAN) { return value < 1.0 ? Double.NaN : value - 1.0; } else { return value == 1.0 ? 0.0 : Double.NaN; } } double result; if (value < ASINH_ACOSH_SQRT_ELISION_THRESHOLD) { result=log(value + sqrt(value * value - 1.0)); } else { result=LOG_2 + log(value); } return result; }
Some properties of acosh(x) = log(x + sqrt(x^2 - 1)): 1) defined on [1,+Infinity[ 2) result in ]0,+Infinity[ (by convention, since cosh(x) = cosh(-x)) 3) acosh(1) = 0 4) acosh(1+epsilon) ~= log(1 + sqrt(2*epsilon)) ~= sqrt(2*epsilon) 5) lim(acosh(x),x->+Infinity) = +Infinity (y increasing logarithmically slower than x)
public void fireDataStatusEEvent(String AD_Message,String info,boolean isError){ m_mTable.fireDataStatusEEvent(AD_Message,info,isError); }
Create and fire Data Status Error Event
AttributeDefinition(TextAttributeSet attrs,int beginIndex,int endIndex){ this.attrs=attrs; this.beginIndex=beginIndex; this.endIndex=endIndex; }
Create new AttributeDefinition.
public void consumeGreedy(String greedyToken){ if (greedyToken.length() < sval.length()) { pushBack(); setStartPosition(getStartPosition() + greedyToken.length()); sval=sval.substring(greedyToken.length()); } }
Consumes a substring from the current sval of the StreamPosTokenizer.
public static int hexToDecimal(String hex) throws HexFormatException { int decimalValue=0; for (int i=0; i < hex.length(); i++) { if (!((hex.charAt(i) >= '0' && hex.charAt(i) <= '9') || (hex.charAt(i) >= 'A' && hex.charAt(i) <= 'F'))) throw new HexFormatException(hex); char hexChar=hex.charAt(i); decimalValue=decimalValue * 16 + hexCharToDecimal(hexChar); } return decimalValue; }
Converts a hex string into a decimal number and throws a HexFormatException if the string is not a hex string
@Override public Result decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException { return decode(image,null); }
Locates and decodes a QR code in an image.
public BackupFileSet listRawBackup(final boolean ignore){ BackupFileSet clusterBackupFiles=new BackupFileSet(this.quorumSize); List<String> errorList=new ArrayList<>(); try { List<BackupProcessor.BackupTask<List<BackupSetInfo>>> backupTasks=(new BackupProcessor(getHosts(),Arrays.asList(ports.get(2)),null)).process(new ListBackupCallable(),false); Throwable result=null; for ( BackupProcessor.BackupTask task : backupTasks) { try { List<BackupSetInfo> nodeBackupFileList=(List<BackupSetInfo>)task.getResponse().getFuture().get(); clusterBackupFiles.addAll(nodeBackupFileList,task.getRequest().getNode()); log.info("List backup on node({})success",task.getRequest().getHost()); } catch ( CancellationException e) { log.warn("The task of listing backup on node({}) was canceled",task.getRequest().getHost(),e); } catch ( InterruptedException e) { log.error(String.format("List backup on node(%s:%d) failed",task.getRequest().getHost(),task.getRequest().getPort()),e); result=((result == null) ? e : result); errorList.add(task.getRequest().getNode()); } catch ( ExecutionException e) { Throwable cause=e.getCause(); if (ignore) { log.warn(String.format("List backup on node(%s:%d) failed.",task.getRequest().getHost(),task.getRequest().getPort()),cause); } else { log.error(String.format("List backup on node(%s:%d) failed.",task.getRequest().getHost(),task.getRequest().getPort()),cause); } result=((result == null) ? cause : result); errorList.add(task.getRequest().getNode()); } } if (result != null) { if (result instanceof Exception) { throw (Exception)result; } else { throw new Exception(result); } } } catch ( Exception e) { Throwable cause=(e.getCause() == null ? e : e.getCause()); if (ignore) { log.warn("List backup on nodes({}) failed, but ignore the errors",errorList.toString(),cause); } else { log.error("Exception when listing backups",e); throw BackupException.fatals.failedToListBackup(errorList.toString(),cause); } } return clusterBackupFiles; }
Get a list of backup sets info
public CountingIdlingResource(String resourceName,boolean debugCounting){ if (TextUtils.isEmpty(resourceName)) { throw new IllegalArgumentException("Resource name must not be empty or null"); } this.resourceName=resourceName; this.debugCounting=debugCounting; }
Creates a CountingIdlingResource.
public ImageReuseInfo create(String thisSize){ ArrayList<String> list=new ArrayList<String>(); boolean canBeReused=false; for (int i=0; i < mSizeList.length; i++) { String size=mSizeList[i]; if (!canBeReused && thisSize.equals(size)) { canBeReused=true; continue; } if (canBeReused && !thisSize.equals(size)) { list.add(size); } } if (list.size() == 0) { return new ImageReuseInfo(thisSize,null); } else { String[] sizeList=new String[list.size()]; list.toArray(sizeList); return new ImageReuseInfo(thisSize,sizeList); } }
Find out the size list can be re-sued.
public static void sync(Address address,int size){ SysCall.sysCall.sysSyncCache(address,size); }
Synchronize a region of memory: force data in dcache to be written out to main memory so that it will be seen by icache when instructions are fetched back.
public MonthDateFormat(Locale locale){ this(TimeZone.getDefault(),locale,1,true,false); }
Creates a new instance for the specified time zone.
public void testConnectorSecuritySettingsSSL_alias_not_defined(){ resetSecuritySystemProperties(); AuthenticationInfo authInfo=null; try { authInfo=SecurityHelper.loadAuthenticationInformation("test.ssl.alias.not.defined.security.properties",true,TUNGSTEN_APPLICATION_NAME.CONNECTOR); } catch ( ServerRuntimeException e) { assertTrue("There should not be any exception thrown",false); } catch ( ConfigurationException e) { assertFalse("That should not be this kind of Exception being thrown",true); } resetSecuritySystemProperties(); }
Confirm behavior when connector.security.use.SSL=true and alias are not defined This shows that it uses first alias it finds
public synchronized void add(double x,double y){ add(x,y,0d); }
Adds a new value to the series.
public void fatalError(SAXParseException exception) throws SAXException { throw exception; }
This method is called when a fatal error occurs during parsing. This method rethrows the exception
@Override public void run(){ amIActive=true; if (args.length < 2) { showFeedback("Plugin parameters have not been set properly."); return; } String inputHeader=args[0]; String outputHeader=args[1]; if ((inputHeader == null) || (outputHeader == null)) { showFeedback("One or more of the input parameters have not been set properly."); return; } try { int row, col; double z; int progress, oldProgress=-1; double[] data; WhiteboxRaster inputFile=new WhiteboxRaster(inputHeader,"r"); int rows=inputFile.getNumberRows(); int cols=inputFile.getNumberColumns(); double noData=inputFile.getNoDataValue(); WhiteboxRaster outputFile=new WhiteboxRaster(outputHeader,"rw",inputHeader,WhiteboxRaster.DataType.FLOAT,noData); outputFile.setPreferredPalette(inputFile.getPreferredPalette()); for (row=0; row < rows; row++) { data=inputFile.getRowValues(row); for (col=0; col < cols; col++) { z=data[col]; if (z != noData) { outputFile.setValue(row,col,Math.asin(z)); } } progress=(int)(100f * row / (rows - 1)); if (progress != oldProgress) { oldProgress=progress; updateProgress((int)progress); if (cancelOp) { cancelOperation(); return; } } } outputFile.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); outputFile.addMetadataEntry("Created on " + new Date()); inputFile.close(); outputFile.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 static void addMoreComponents(Container cnt,Component[] components,boolean areThereMore){ InfiniteScrollAdapter ia=(InfiniteScrollAdapter)cnt.getClientProperty("cn1$infinite"); ia.addMoreComponents(components,areThereMore); }
Invoke this method to add additional components to the container, if you use addComponent/removeComponent you will get undefined behavior. This is a convenience method saving the need to keep the InfiniteScrollAdapter as a variable
public static CCProgressTimer progress(CCTexture2D texture){ return new CCProgressTimer(texture); }
Creates a progress timer with the texture as the shape the timer goes through
protected EntityMappingModelImpl(){ super(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public MatchResult match(){ if (!matchSuccessful) { throw new IllegalStateException(); } return matcher.toMatchResult(); }
Returns the result of the last matching operation. <p> The next* and find* methods return the match result in the case of a successful match.
@Override public void dispatch(IEvent event){ Class<? extends IEvent> eventType=event.getClass(); Discord4J.logger.debug("Dispatching event of type {}.",eventType.getSimpleName()); if (listenerMap.containsKey(eventType)) { for ( IListener listener : listenerMap.get(eventType)) { listener.receive(event); } } }
Sends an IEvent to all listeners that listen for that specific event.
JComboBox createMouthComboBox(){ JComboBox cb=new JComboBox(); fillComboBox(cb); cb.addActionListener(this); return cb; }
Creates the mouth combo box.
public double leverageForRule(AprioriItemSet premise,AprioriItemSet consequence,int premiseCount,int consequenceCount){ double coverageForItemSet=(double)consequence.m_counter / (double)m_totalTransactions; double expectedCoverageIfIndependent=((double)premiseCount / (double)m_totalTransactions) * ((double)consequenceCount / (double)m_totalTransactions); double lev=coverageForItemSet - expectedCoverageIfIndependent; return lev; }
Outputs the leverage for a rule. Leverage is defined as: <br> prob(premise & consequence) - (prob(premise) * prob(consequence))
public RdKNNNode(int capacity,boolean isLeaf){ super(capacity,isLeaf,RdKNNEntry.class); }
Creates a new RdKNNNode object.
private void adaptGridViewHeight(){ if (gridView instanceof DividableGridView) { ((DividableGridView)gridView).adaptHeightToChildren(); } }
Adapts the height of the grid view, which is used to show the bottom sheet's items.
protected void validateOnStatus(){ if (Command.STATUS.equals(getCommand())) { } }
Validates the arguments passed to the Builder when the 'status' command has been issued.
public Optional<Boolean> eagerCheck(){ return Optional.ofNullable(this.eagerCheck); }
whether check errors as more as possible
public static NewPlaylistFragment newInstance(Song song){ NewPlaylistFragment fragment=new NewPlaylistFragment(); Bundle bundle=new Bundle(); bundle.putParcelable(KEY_SONG,song); fragment.setArguments(bundle); return fragment; }
Creates a new instance of the New Playlist dialog fragment to create a new playlist and add a song to it.
@DSSink({DSSinkKind.LOG}) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:29:19.771 -0500",hash_original_method="06AF2B97EC9C8BBE1303A237FE727449",hash_generated_method="103A7E1B02C228D1981B721CBC7DAC4C") public void updateCursor(View view,int left,int top,int right,int bottom){ checkFocus(); synchronized (mH) { if ((mServedView != view && (mServedView == null || !mServedView.checkInputConnectionProxy(view))) || mCurrentTextBoxAttribute == null || mCurMethod == null) { return; } mTmpCursorRect.set(left,top,right,bottom); if (!mCursorRect.equals(mTmpCursorRect)) { if (DEBUG) Log.d(TAG,"updateCursor"); try { if (DEBUG) Log.v(TAG,"CURSOR CHANGE: " + mCurMethod); mCurMethod.updateCursor(mTmpCursorRect); mCursorRect.set(mTmpCursorRect); } catch ( RemoteException e) { Log.w(TAG,"IME died: " + mCurId,e); } } } }
Report the current cursor location in its window.