code
stringlengths
10
174k
nl
stringlengths
3
129k
private void checkSequenceNumber(Authenticator authenticator,byte type) throws IOException { if (connectionState >= cs_ERROR || authenticator == MAC.NULL) { return; } if (authenticator.seqNumOverflow()) { if (debug != null && Debug.isOn("ssl")) { System.out.println(Thread.currentThread().getName() + ", sequence number extremely close to overflow " + "(2^64-1 packets). Closing connection."); } fatal(Alerts.alert_handshake_failure,"sequence number overflow"); } if ((type != Record.ct_handshake) && authenticator.seqNumIsHuge()) { if (debug != null && Debug.isOn("ssl")) { System.out.println(Thread.currentThread().getName() + ", request renegotiation " + "to avoid sequence number overflow"); } startHandshake(); } }
Check the sequence number state RFC 4346 states that, "Sequence numbers are of type uint64 and may not exceed 2^64-1. Sequence numbers do not wrap. If a TLS implementation would need to wrap a sequence number, it must renegotiate instead."
public void addHeaderView(View v,Object data,boolean isSelectable){ ListAdapter adapter=getAdapter(); if (adapter != null && !(adapter instanceof HeaderViewGridAdapter)) { throw new IllegalStateException("Cannot add header view to grid -- setAdapter has already been called."); } ViewGroup.LayoutParams lyp=v.getLayoutParams(); FixedViewInfo info=new FixedViewInfo(); FrameLayout fl=new FullWidthFixedViewLayout(getContext()); if (lyp != null) { v.setLayoutParams(new FrameLayout.LayoutParams(lyp.width,lyp.height)); fl.setLayoutParams(new LayoutParams(lyp.width,lyp.height)); } fl.addView(v); info.view=v; info.viewContainer=fl; info.data=data; info.isSelectable=isSelectable; mHeaderViewInfos.add(info); if (adapter != null) { ((HeaderViewGridAdapter)adapter).notifyDataSetChanged(); } }
Add a fixed view to appear at the top of the grid. If addHeaderView is called more than once, the views will appear in the order they were added. Views added using this call can take focus if they want. <p/> NOTE: Call this before calling setAdapter. This is so HeaderGridView can wrap the supplied cursor with one that will also account for header views.
public String useSupervisedDiscretizationTipText(){ return "Use supervised discretization to convert numeric attributes to nominal " + "ones."; }
Returns the tip text for this property
protected SmpBlas(int maxThreads,Blas seqBlas){ this.seqBlas=seqBlas; this.maxThreads=maxThreads; this.smp=new Smp(maxThreads); }
Constructs a blas using a maximum of <tt>maxThreads<tt> threads; each executing the given sequential algos.
public Complex evaluate(Complex c){ Complex retval=new Complex(0.0,0.0); Complex num=N.evaluate(c); Complex denom=D.evaluate(c); if (denom.abs() != 0.0) retval=num.over(denom); return retval; }
Evaluates a rational function for a complex argument.
public static void addSecondaryObjective(SecondaryObjective<?> objective){ secondaryObjectives.add(objective); }
Add an additional secondary objective to the end of the list of objectives
public void returnValue(){ mv.visitInsn(returnType.getOpcode(Opcodes.IRETURN)); }
Generates the instruction to return the top stack value to the caller.
private static String buildIntegerOperand(final COperandTreeNode operandTreeNode,final INodeModifier nodeModifier){ BigInteger treeNodeValue=new BigInteger(operandTreeNode.getValue()); if ((nodeModifier != null) && RelocationChecker.needsRelocation(operandTreeNode,operandTreeNode.getOperand().getInstruction().getModule())) { treeNodeValue=relocateIntegerOperand(operandTreeNode,nodeModifier,treeNodeValue); } return buildIntegerOperandString(operandTreeNode,treeNodeValue); }
Builds an integer operand.
public SVGOMFEFuncGElement(String prefix,AbstractDocument owner){ super(prefix,owner); }
Creates a new Element object.
public Message sendMessageSynchronously(int what,Object obj){ Message msg=Message.obtain(); msg.what=what; msg.obj=obj; Message resultMsg=sendMessageSynchronously(msg); return resultMsg; }
Send the Message synchronously.
public static <T>Predicate<T> isNull(){ return null; }
Create a new predicate returning true when the input is null.
public boolean scheduleAtExtreme(Steppable event,boolean atEnd){ return _scheduleAtExtreme(event,atEnd); }
Schedules an item to occur when the user starts or stops the simulator, or when it stops on its own accord. If atEnd is TRUE, then the item is scheduled to occur when the finish() method is executed. If atEnd is FALSE, then the item is scheduled to occur when the start() method is executed. Returns true if scheduling succeeded.
public static String randomRealisticUnicodeString(Random r,int maxLength){ return randomRealisticUnicodeString(r,0,maxLength); }
Returns random string of length up to maxLength codepoints , all codepoints within the same unicode block.
public void dataIgnore(){ if (!m_inserting && !m_changed && m_rowChanged < 0) { log.fine("Nothing to ignore"); return; } log.info("Inserting=" + m_inserting); if (m_inserting) { MSort sort=(MSort)m_sort.get(m_newRow); if (m_virtual) { m_virtualBuffer.remove(NEW_ROW_ID); } else { m_buffer.remove(sort.index); } m_rowCount--; m_sort.remove(m_newRow); m_changed=false; m_rowData=null; m_rowChanged=-1; m_inserting=false; fireTableRowsDeleted(m_newRow,m_newRow); } else { if (m_rowData != null) { setDataAtRow(m_rowChanged,m_rowData); } m_changed=false; m_rowData=null; m_rowChanged=-1; m_inserting=false; } m_newRow=-1; fireDataStatusIEvent("Ignored",""); }
Ignore changes
public static int decodeZigZag32(final int n){ return (n >>> 1) ^ -(n & 1); }
Decode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.)
public boolean isLeaf(){ return children == null; }
Check whether this is a leaf page.
public ClusterInfo cancelInstallImage(){ UriBuilder builder=client.uriBuilder(IMAGE_INSTALL_CANCEL_URL); return client.postURI(ClusterInfo.class,builder.build()); }
Cancels download of an image <p> API Call: POST /upgrade/install/cancel
public static double logcdf(double val,double loc,double scale){ val=(val - loc) / scale; if (val <= 18.) { return -Math.log1p(Math.exp(-val)); } else if (val > 33.3) { return val; } else { return val - Math.exp(val); } }
log Cumulative density function. TODO: untested.
public static void checkNewData(SupportUpdateListener updateListener,EventBean[] expectedValues){ EventBean[] newData=updateListener.getLastNewData(); EPAssertionUtil.assertEqualsExactOrder(expectedValues,newData); updateListener.setLastNewData(null); }
Compare the new data captured by the child against expected values in the exact same order. Clears the last new data in the test child view after comparing.
public void addSeriesRenderer(SimpleSeriesRenderer renderer){ mRenderers.add(renderer); }
Adds a simple renderer to the multiple renderer.
@Override public CallableStatement prepareCall(String sql,int resultSetType,int resultSetConcurrency,int resultSetHoldability) throws SQLException { try { int id=getNextId(TraceObject.CALLABLE_STATEMENT); if (isDebugEnabled()) { debugCodeAssign("CallableStatement",TraceObject.CALLABLE_STATEMENT,id,"prepareCall(" + quote(sql) + ", "+ resultSetType+ ", "+ resultSetConcurrency+ ", "+ resultSetHoldability+ ")"); } checkTypeConcurrency(resultSetType,resultSetConcurrency); checkHoldability(resultSetHoldability); checkClosed(); sql=translateSQL(sql); return new JdbcCallableStatement(this,sql,id,resultSetType,resultSetConcurrency); } catch ( Exception e) { throw logAndConvert(e); } }
Creates a callable statement with the specified result set type, concurrency, and holdability.
@NotNull public GridBag insets(@Nullable Insets insets){ if (insets != null && (insets.top < 0 || insets.bottom < 0 || insets.left < 0 || insets.right < 0)) { Insets def=getDefaultInsets(gridx); insets=(Insets)insets.clone(); if (insets.top < 0) insets.top=def == null ? 0 : def.top; if (insets.left < 0) insets.left=def == null ? 0 : def.left; if (insets.bottom < 0) insets.bottom=def == null ? 0 : def.bottom; if (insets.right < 0) insets.right=def == null ? 0 : def.right; } this.insets=insets; return this; }
Pass -1 to use a default value for this column. E.g, Insets(10, -1, -1, -1) means that 'top' will be changed to 10 and other sides will be set to defaults for this column.
private static String jsonValue(byte value){ return String.valueOf(value); }
Parse the specified value into JSON.
public final void yyclose() throws java.io.IOException { zzAtEOF=true; zzEndRead=zzStartRead; if (zzReader != null) zzReader.close(); }
Closes the input stream.
public void evaluateKNN(double[] knnperf,ModifiableDoubleDBIDList nlist,Relation<?> lrelation,TObjectIntHashMap<Object> counters,Object label){ final int maxk=knnperf.length; int k=1, prevk=0, max=0; counters.clear(); DoubleDBIDListIter iter=nlist.iter(); while (iter.valid() && prevk < maxk) { double prev=iter.doubleValue(); Object l=lrelation.get(iter); max=Math.max(max,countkNN(counters,l)); iter.advance(); ++k; if (!iter.valid() || iter.doubleValue() > prev) { int pties=0, ties=0; for (TObjectIntIterator<Object> cit=counters.iterator(); cit.hasNext(); ) { cit.advance(); if (cit.value() < max) { continue; } ties++; if (cit.key() == null) { continue; } if (cit.key().equals(label)) { pties++; } else if (label instanceof LabelList) { LabelList ll=(LabelList)label; for (int i=0, e=ll.size(); i < e; i++) { if (cit.key().equals(ll.get(i))) { pties++; break; } } } } while (prevk < k && prevk < maxk) { knnperf[prevk++]+=pties / (double)ties; } } } }
Evaluate by simulating kNN classification for k=1...maxk
public double cdf(double x){ return Probability.normal(mean,variance,x); }
Returns the cumulative distribution function.
private Command processFlowRemovedMessage(IOFSwitch sw,OFFlowRemoved flowRemovedMessage){ if (!flowRemovedMessage.getCookie().equals(U64.of(LearningSwitch.LEARNING_SWITCH_COOKIE))) { return Command.CONTINUE; } if (log.isTraceEnabled()) { log.trace("{} flow entry removed {}",sw,flowRemovedMessage); } Match match=flowRemovedMessage.getMatch(); this.removeFromPortMap(sw,match.get(MatchField.ETH_SRC),match.get(MatchField.VLAN_VID) == null ? VlanVid.ZERO : match.get(MatchField.VLAN_VID).getVlanVid()); Match.Builder mb=sw.getOFFactory().buildMatch(); mb.setExact(MatchField.ETH_SRC,match.get(MatchField.ETH_DST)).setExact(MatchField.ETH_DST,match.get(MatchField.ETH_SRC)); if (match.get(MatchField.VLAN_VID) != null) { mb.setExact(MatchField.VLAN_VID,match.get(MatchField.VLAN_VID)); } this.writeFlowMod(sw,OFFlowModCommand.DELETE,OFBufferId.NO_BUFFER,mb.build(),match.get(MatchField.IN_PORT)); return Command.CONTINUE; }
Processes a flow removed message. We will delete the learned MAC/VLAN mapping from the switch's table.
public RoundRectangleFigure(){ this(0,0,0,0); }
Creates a new instance.
@Override public N pop(){ try { return stack[(--stackTop) & mask]; } finally { stack[(stackTop & mask)]=null; } }
pop the next element off the stack
public synchronized boolean shutdown(){ if (isShutdown) return !clientThread.isAlive(); logger.info("Shutting down echo client: " + clientName + " echoCount="+ echoCount); shutdownRequested=true; socket.close(); clientThread.interrupt(); try { clientThread.join(5000); } catch ( InterruptedException e) { logger.warn("Unable to shut down echo client: " + clientName); } finally { isShutdown=true; } return !clientThread.isAlive(); }
Shut down a running client nicely, returning true if the thread is finished.
public int indexOf(Type type){ if (type == null) { throw new NullPointerException("type == null"); } throwIfNotPrepared(); TypeIdItem item=typeIds.get(type); if (item == null) { throw new IllegalArgumentException("not found: " + type); } return item.getIndex(); }
Gets the index of the given type, which must have been added to this instance.
public void initStaticFields(){ Logging.logd("Initializing static fields"); staticActivity=this; staticContext=this.getApplicationContext(); staticView=findViewById(R.id.corn_root_view); staticWindow=this.getWindow(); staticRootView=(RelativeLayout)staticView; if (!isNewIntent) publicWebRenderLayout=(RelativeLayout)findViewById(R.id.webrender_layout); if (!isNewIntent) initBrowsing(); }
Initialize static fields
public Boolean shouldAllowRequest(String url){ return null; }
Hook for blocking the loading of external resources. This will be called when the WebView's shouldInterceptRequest wants to know whether to open a connection to an external resource. Return false to block the request: if any plugin returns false, Cordova will block the request. If all plugins return null, the default policy will be enforced. If at least one plugin returns true, and no plugins return false, then the request will proceed. Note that this only affects resource requests which are routed through WebViewClient.shouldInterceptRequest, such as XMLHttpRequest requests and img tag loads. WebSockets and media requests (such as <video> and <audio> tags) are not affected by this method. Use CSP headers to control access to such resources.
public String reapplyFilters(){ List<Integer> selectedFilterIds=filterBean.getSelectedFilterIds(); try { ScriptFilterUtil.applyFilters(selectedFilterIds,script); ScriptUtil.setScriptStepLabels(script); messages.info("Applied " + selectedFilterIds.size() + " filter(s) to \""+ script.getName()+ "\"."); return "success"; } catch ( Exception e) { e.printStackTrace(); } messages.error("Error applying filters to \"" + script.getName() + "\"."); return "failure"; }
applies all selected filters to the script currently being edited
public InvalidHeaderValueException(){ super(); }
Constructs an InvalidHeaderValueException with no detailed message.
@Override public String toString(){ if (value.isNull()) { return "null"; } return value.toString(); }
Prints the address of the object.
protected int lookupState(int state,int category){ return stateTable[state * numCategories + category]; }
Given a current state and a character category, looks up the next state to transition to in the state table.
public static AndroidHttpClient newInstance(String userAgent){ return newInstance(userAgent,null); }
Create a new HttpClient with reasonable defaults (which you can update).
@Override public final void postSetUp() throws Exception { final Host host=Host.getHost(0); vm0=host.getVM(0); vm1=host.getVM(1); vm2=host.getVM(2); vm3=host.getVM(3); }
This function creates regionqueue on 4 VMs
private void constrainSize(int axis,SizeRequirements want,SizeRequirements min){ if (min.minimum > want.minimum) { want.minimum=want.preferred=min.minimum; want.maximum=Math.max(want.maximum,min.maximum); } }
Constrains <code>want</code> to fit in the minimum size specified by <code>min</code>.
public static void addDatasource(String sourcePath,DsDef newDatasource,boolean saveBackup) throws IOException { addDatasources(sourcePath,Collections.singleton(newDatasource),saveBackup); }
<p>Adds one more datasource to a RRD file.</p> <p>WARNING: This method is potentially dangerous! It will modify your RRD file. It is highly recommended to preserve the original RRD file (<i>saveBackup</i> should be set to <code>true</code>). The backup file will be created in the same directory as the original one with <code>.bak</code> extension added to the original name.</p> <p>Before applying this method, be sure that the specified RRD file is not in use (not open)</p>
private boolean analyseEntityRequiresUpdate(AuditInformation audit,Entity entity,Set<Entity> updateRequired,Set<Entity> updateNotRequired){ if (updateRequired.contains(entity)) { return true; } if (updateNotRequired.contains(entity)) { return false; } if (audit.contains(entity)) { updateRequired.add(entity); return true; } for ( RefNode refNode : entity.getChildren(RefNode.class)) { if (refNode.getReference() == null) { continue; } if (refNode.getReference().isFetchRequired()) { continue; } if (!refNode.getNodeType().isOwns()) { continue; } if (refNode.getEntityType().supportsOptimisticLocking()) { continue; } boolean ownedEntityRequiresUpdate=analyseEntityRequiresUpdate(audit,refNode.getReference(),updateRequired,updateNotRequired); if (ownedEntityRequiresUpdate) { LOG.debug("Update required to optimistic lock for " + entity + " due to ref to "+ refNode.getReference()); updateRequired.add(entity); return true; } } for ( ToManyNode toManyNode : entity.getChildren(ToManyNode.class)) { if (!toManyNode.isFetched()) { continue; } if (!toManyNode.getNodeType().isOwns()) { continue; } if (toManyNode.getEntityType().supportsOptimisticLocking()) { continue; } for ( Entity toManyEntity : toManyNode.getList()) { boolean ownedEntityRequiresUpdate=false; if (toManyEntity.isClearlyNotInDatabase()) { ownedEntityRequiresUpdate=true; } else { ownedEntityRequiresUpdate=analyseEntityRequiresUpdate(audit,toManyEntity,updateRequired,updateNotRequired); } if (ownedEntityRequiresUpdate) { LOG.debug("Update required to optimistic lock for " + entity + " due to ref to "+ toManyEntity); updateRequired.add(entity); return true; } } } updateNotRequired.add(entity); return false; }
analyses the entity and it's dependents adding it and them to the relevant sets
static double slowexp(final double x,final double result[]){ final double xs[]=new double[2]; final double ys[]=new double[2]; final double facts[]=new double[2]; final double as[]=new double[2]; split(x,xs); ys[0]=ys[1]=0.0; for (int i=FACT.length - 1; i >= 0; i--) { splitMult(xs,ys,as); ys[0]=as[0]; ys[1]=as[1]; split(FACT[i],as); splitReciprocal(as,facts); splitAdd(ys,facts,as); ys[0]=as[0]; ys[1]=as[1]; } if (result != null) { result[0]=ys[0]; result[1]=ys[1]; } return ys[0] + ys[1]; }
For x between 0 and 1, returns exp(x), uses extended precision
protected void removeTag(short tagId,int ifdId){ IfdData ifdData=mIfdDatas[ifdId]; if (ifdData == null) { return; } ifdData.removeTag(tagId); }
Removes the tag with a given TID and IFD.
public static CommandLine parse(String... args) throws Exception { return CommandLineParser.parse(defaultOptions(),args); }
Parse an array of arguments using the default options.
public void draw(String text,int x,int y){ this.draw(text,x,y,this.lineHeight); }
Draw a multi-line text string with bounding rectangle top starting at the y position. Depending on the current textAlign, the x position is either the rectangle left side, middle or right side. <p/> Uses the current line height.
static public NetMember newNetMember(InetAddress i,int p){ NetMember result=services.newNetMember(i,p); return result; }
Return a new NetMember representing current host
private static final boolean checkClassParameterIsValid(String key,String value,String type){ Class<?> rootClass=null; try { rootClass=Class.forName(type); } catch ( ClassNotFoundException e1) { logger.log(Level.WARNING,"INTERNAL ERROR: Class [{0}]] does not exist, required for property [{1}]",new Object[]{type,key}); return false; } if (value.equalsIgnoreCase("webspheremq") && !value.equals("WebSphereMQ")) { parms.put("pc","WebSphereMQ"); parmsInternal.put("pc","WebSphereMQ"); value="WebSphereMQ"; Log.logger.log(Level.WARNING,"Parameter -pc ({0}) is case-sensitive and should read WebSphereMQ",value); } if (value.equalsIgnoreCase("wbimb") && !value.equals("WBIMB")) { parms.put("pc","WMB"); parmsInternal.put("pc","WMB"); value="WMB"; Log.logger.log(Level.WARNING,"Parameter -pc ({0}) specified WBIMB this class has been renamed to WMB",value); } if (value == null || "".equals(value)) return true; Class<?> clazz; try { clazz=Class.forName(value); } catch ( ClassNotFoundException e2) { try { final String newvalue="com.ibm.uk.hursley.perfharness." + value; clazz=Class.forName(newvalue); parmsInternal.put(key,newvalue); } catch ( ClassNotFoundException e3) { try { final String newvalue=rootClass.getPackage().getName() + '.' + value; clazz=Class.forName(newvalue); parmsInternal.put(key,newvalue); } catch ( ClassNotFoundException e4) { logger.log(Level.WARNING,"Property [{0}] specifies a class [{1}] which cannot be located.",new Object[]{key,value}); return false; } } } if (!rootClass.isAssignableFrom(clazz)) { logger.log(Level.WARNING,"Property [{0}={1}] specifies a class that does extend {3}",new Object[]{key,value,rootClass}); return false; } return true; }
Checks that non-primitive types pass the following checks: <ul> <li>Class type exists.</li> <li>Configured implementiation exists.</li> <li>Implementaiton extends the class-type.</li> </ul> The classes are searched for in the following manner <ul> <li>(Fully qualified) &lt;type&gt; already exists.</li> <li>&lt;type&gt; is relative from the root package (e.g. -tc jms.r11.Publisher)</li> <li>&lt;type&gt; is relative from the package of the class type (e.g. -pc WebSphereMQ)</li> </ul>
private final boolean compareAndSetTail(Node expect,Node update){ return unsafe.compareAndSwapObject(this,tailOffset,expect,update); }
CAS tail field. Used only by enq.
private void showFeedback(String message){ if (myHost != null) { myHost.showFeedback(message); } else { System.out.println(message); } }
Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface.
public String echo(Socket sock,String message) throws IOException { InputStream is=sock.getInputStream(); OutputStream os=sock.getOutputStream(); byte[] buf1=message.getBytes(); os.write(buf1,0,buf1.length); byte[] buf2=new byte[buf1.length]; int offset=0; int length=0; while (offset < buf2.length) { length=is.read(buf2,offset,buf2.length - offset); offset+=length; } String echoMessage=new String(buf2); return echoMessage; }
Sends a string and confirms it is echoed back.
protected long handleRequestTimeouts(){ long smallestTimeout=Long.MAX_VALUE; synchronized (this) { if (this.pendingRequests == null) return smallestTimeout; if (this.grantor.isDestroyed()) return smallestTimeout; } List timeouts=new ArrayList(); DLockRequestMessage req=null; synchronized (this) { for (Iterator iter=this.pendingRequests.iterator(); iter.hasNext(); ) { req=(DLockRequestMessage)iter.next(); if (req.checkForTimeout()) { this.grantor.cleanupSuspendState(req); timeouts.add(req); } else { long timeout=req.getTimeoutTS(); if (timeout < smallestTimeout) { smallestTimeout=timeout; } } } removeRequests(timeouts); } return smallestTimeout; }
Handle timeouts for requests waiting on this lock. Any requests that have timed out will be removed. Calculates and returns the next smallest timeout of the requests still waiting on this lock. <p> Synchronizes on this grant token.
public OMLine(double lat_1,double lon_1,int x1,int y1,int x2,int y2){ super(RENDERTYPE_OFFSET,LINETYPE_STRAIGHT,DECLUTTERTYPE_NONE); latlons=new double[4]; pts=new int[4]; latlons[0]=lat_1; latlons[1]=lon_1; pts[0]=x1; pts[1]=y1; pts[2]=x2; pts[3]=y2; }
Create a line between two x-y points on the window, where the x-y points are offsets from a lat-lon point. It assumes that you'll want a straight window line between the points, so if you don't, use the setLineType() method to change it.
public DecodingException(HumanReadableText key,String s,Throwable t){ super(s); this.key=key; this.t=t; }
Constructs a decoding exception.
public static boolean fieldIsNonnull(ClassAccessor<?> classAccessor,Field field){ if (classAccessor.fieldHasAnnotation(field,NONNULL)) { return true; } if (classAccessor.fieldHasAnnotation(field,NULLABLE)) { return false; } return annotationIsInScope(classAccessor,FINDBUGS1X_DEFAULT_ANNOTATION_NONNULL) || annotationIsInScope(classAccessor,JSR305_DEFAULT_ANNOTATION_NONNULL) || annotationIsInScope(classAccessor,ECLIPSE_DEFAULT_ANNOTATION_NONNULL); }
Checks whether the given field is marked with an Nonnull annotation, whether directly, or through some default annotation mechanism.
public void onChildThreadResumeEnd(){ _threadCount.getAndDecrement(); wake(); }
End housekeeping for a child thread managed by the launcher's housekeeping, but not spawned by the launcher itself, e.g. comet, websocket, keepalive.
private static void createInfoLabel(Composite parent,FormToolkit toolkit,String text){ Label label=toolkit.createLabel(parent,""); label.setToolTipText(text); label.setImage(InspectIT.getDefault().getImage(InspectITImages.IMG_INFORMATION)); }
Creates info icon with given text as tool-tip.
public SymmetricMatrix(double[][] a){ super(a); }
Creates a symmetric matrix with given components.
public GsonRequest(int method,String requestUrl,String requestBody,Class<T> clazz,Response.Listener<T> successListener,Response.ErrorListener errorListener){ this(method,requestUrl,requestBody,clazz,successListener,errorListener,null,null); }
Create a new unauthorized request.
public int numberOfFeatureVectors(){ return ids.size(); }
Returns the number of feature vectors this unit contains.
public List<Protos.Key> serializeToProtobuf(){ List<Protos.Key> result; if (basic != null) result=basic.serializeToProtobuf(); else result=Lists.newArrayList(); for ( DeterministicKeyChain chain : chains) { List<Protos.Key> protos=chain.serializeToProtobuf(); result.addAll(protos); } return result; }
Returns a list of key protobufs obtained by merging the chains.
protected int index(int rank){ return zero + rank * stride; }
Returns the position of the element with the given relative rank within the (virtual or non-virtual) internal 1-dimensional array. You may want to override this method for performance.
protected Consumer<?> createConsumer(final PotentialAttribute potentialAttribute){ return createConsumer(potentialAttribute.getBaseObject(),potentialAttribute.getMethodName(),potentialAttribute.getArgumentDataTypes(),potentialAttribute.getArgumentValues(),potentialAttribute.getDescription()); }
Create an actual consumer from a potential consumer.
public void save(File outputArchiveFile) throws IOException { JarInputStream zin=null; JarOutputStream zout=null; try { byte[] buf=new byte[1024]; zin=new JarInputStream(new FileInputStream(jarFile)); zout=new JarOutputStream(new FileOutputStream(outputArchiveFile)); JarEntry entry=zin.getNextJarEntry(); while (entry != null) { if (jarEntries.containsKey(entry.getName()) && !jarEntriesToAdd.containsKey(entry.getName())) { zout.putNextEntry(jarEntries.get(entry.getName())); int len; while ((len=zin.read(buf)) > 0) { zout.write(buf,0,len); } zout.closeEntry(); } entry=zin.getNextJarEntry(); } for ( Entry<String,byte[]> jarEntryToAdd : jarEntriesToAdd.entrySet()) { String entryName=jarEntryToAdd.getKey(); byte[] bytes=jarEntryToAdd.getValue(); InputStream fin=null; try { fin=new ByteArrayInputStream(bytes); zout.putNextEntry(jarEntries.get(entryName)); int len; while ((len=fin.read(buf)) > 0) { zout.write(buf,0,len); } zout.closeEntry(); } finally { if (fin != null) { fin.close(); } } } } finally { if (zin != null) { zin.close(); } if (zout != null) { zout.close(); } } }
Writes the modified output archive to a file
private boolean createJournalLine(MJournal mj,int noOfMonth){ boolean lineCreated=false; StringBuffer sql=new StringBuffer("SELECT * FROM I_Budget " + "WHERE I_IsImported='N'").append(clientCheck).append(docCheck); PreparedStatement pstmt=null; ResultSet rs=null; try { pstmt=DB.prepareStatement(sql.toString(),get_TrxName()); rs=pstmt.executeQuery(); int line=10; while (rs.next()) { BigDecimal amt=rs.getBigDecimal("Month_" + noOfMonth + "_Amt"); BigDecimal qty=rs.getBigDecimal("Month_" + noOfMonth + "_Qty"); if (amt != null && amt.compareTo(BigDecimal.ZERO) != 0) { if (mj.get_ID() == 0) mj.saveEx(); MJournalLine journalLine=new MJournalLine(getCtx(),0,get_TrxName()); journalLine.setGL_Journal_ID(mj.getGL_Journal_ID()); if (amt.compareTo(BigDecimal.ZERO) < 0) journalLine.setAmtSourceCr(amt.abs()); else journalLine.setAmtSourceDr(amt); if (qty != null) journalLine.setQty(qty); journalLine.setAD_Org_ID(journalLine.getParent().getAD_Org_ID()); journalLine.setC_Currency_ID(c_Currency_ID); journalLine.setDateAcct(journalLine.getParent().getDateAcct()); journalLine.setC_ConversionType_ID(journalLine.getParent().getC_ConversionType_ID()); journalLine.setCurrencyRate(BigDecimal.ONE); journalLine.setLine(line); journalLine.setDescription(rs.getString("Jnl_Line_Description")); line=line + 10; if (rs.getInt("A_Asset_ID") > 0) { journalLine.setA_Asset_ID(rs.getInt("A_Asset_ID")); journalLine.setA_CreateAsset(true); } MAccount acct=MAccount.get(getCtx(),rs.getInt("AD_Client_ID"),rs.getInt("AD_Org_ID"),rs.getInt("C_AcctSchema_ID"),rs.getInt("Account_ID"),0,rs.getInt("M_Product_ID"),rs.getInt("C_BPartner_ID"),rs.getInt("AD_OrgTrx_ID"),rs.getInt("C_LocFrom_ID"),rs.getInt("C_LocTo_ID"),rs.getInt("C_SalesRegion_ID"),rs.getInt("C_Project_ID"),rs.getInt("C_Campaign_ID"),rs.getInt("C_Activity_ID"),rs.getInt("User1_ID"),rs.getInt("User2_ID"),0,0,get_TrxName()); if (acct != null && acct.get_ID() == 0) acct.saveEx(); if (acct == null || acct.get_ID() == 0) { sql=new StringBuffer("UPDATE I_Budget " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=ERROR creating Account, '" + "WHERE I_IsImported<>'Y' and I_Budget_ID=").append(rs.getInt("I_Budget_ID")).append(clientCheck).append(docCheck); DB.executeUpdate(sql.toString(),get_TrxName()); return lineCreated; } else { journalLine.setC_ValidCombination_ID(acct.get_ID()); sql=new StringBuffer("UPDATE I_Budget " + "SET C_ValidCombination_ID =").append(acct.get_ID()).append("WHERE I_IsImported<>'Y' and I_Budget_ID=").append(rs.getInt("I_Budget_ID")).append(clientCheck).append(docCheck); DB.executeUpdate(sql.toString(),get_TrxName()); } journalLine.saveEx(); lineCreated=true; } } } catch ( Exception e) { log.log(Level.SEVERE,"",e); } try { if (pstmt != null) pstmt.close(); } catch ( SQLException ex1) { } pstmt=null; return lineCreated; }
Create journal lines
public void addNewImageWizard(){ AddResourceDialog addResource=new AddResourceDialog(loadedResources,AddResourceDialog.IMAGE); if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(mainPanel,addResource,"Add Image",JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE)) { if (addResource.checkName(loadedResources)) { JOptionPane.showMessageDialog(mainPanel,"A resource with that name already exists","Add Image",JOptionPane.ERROR_MESSAGE); addNewImageWizard(); return; } ImageRGBEditor image=new ImageRGBEditor(loadedResources,null,this); image.setImage(com.codename1.ui.Image.createImage(5,5)); if (JOptionPane.OK_OPTION == JOptionPane.showConfirmDialog(mainPanel,image,"Add Image",JOptionPane.OK_CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE)) { loadedResources.setImage(addResource.getResourceName(),image.getImage()); } } }
Invoked by the "..." button in the add theme entry dialog, allows us to add an image on the fly while working on a theme
public static void picture(double x,double y,String filename,double scaledWidth,double scaledHeight){ Image image=getImage(filename); if (scaledWidth < 0) throw new IllegalArgumentException("width is negative: " + scaledWidth); if (scaledHeight < 0) throw new IllegalArgumentException("height is negative: " + scaledHeight); double xs=scaleX(x); double ys=scaleY(y); double ws=factorX(scaledWidth); double hs=factorY(scaledHeight); if (ws < 0 || hs < 0) throw new IllegalArgumentException("image " + filename + " is corrupt"); if (ws <= 1 && hs <= 1) pixel(x,y); else { offscreen.drawImage(image,(int)Math.round(xs - ws / 2.0),(int)Math.round(ys - hs / 2.0),(int)Math.round(ws),(int)Math.round(hs),null); } draw(); }
Draws the specified image centered at (<em>x</em>, <em>y</em>), rescaled to the specified bounding box. The supported image formats are JPEG, PNG, and GIF.
public TFragment addFragment(TFragment fragment){ List<TFragment> fragments=new ArrayList<TFragment>(1); fragments.add(fragment); List<TFragment> fragments2=addFragments(fragments); return fragments2.get(0); }
fragment management
protected void beginBody() throws IOException { }
Extra stuff printed at the beginning of the &lt;body&gt; element.
public Matrix3d add(Matrix3dc other){ return add(other,this); }
Component-wise add <code>this</code> and <code>other</code>.
public <T>T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException { try { return iface.cast(this); } catch ( ClassCastException cce) { throw SQLError.createSQLException("Unable to unwrap to " + iface.toString(),SQLError.SQL_STATE_ILLEGAL_ARGUMENT,this.conn.getExceptionInterceptor()); } }
Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy. The result may be either the object found to implement the interface or a proxy for that object. If the receiver implements the interface then that is the object. If the receiver is a wrapper and the wrapped object implements the interface then that is the object. Otherwise the object is the result of calling <code>unwrap</code> recursively on the wrapped object. If the receiver is not a wrapper and does not implement the interface, then an <code>SQLException</code> is thrown.
public boolean elementHasSpecificAncestor(Element theElement,String ancestorLocalName,String ancestorNamespaceURI){ boolean ret=false; Node up=theElement.getParentNode(); while (up != null && up.getNodeType() == Node.ELEMENT_NODE) { if (up.getNamespaceURI().equals(ancestorNamespaceURI) && up.getLocalName().equals(ancestorLocalName)) { ret=true; break; } up=up.getParentNode(); } return ret; }
Checks theElement has an ancestor element with given ancestorLocalName and ancestorNamespaceURI.
@Dev public TextHasNumberCondition(@Dev(defaultValue="0") final int min,@Dev(defaultValue="2147483647") final int max){ this.min=min; this.max=max; }
Creates a new TextHasNumberCondition which checks if there is a number and if it is in range.
public void updateObject(String columnLabel,Object x,SQLType targetSqlType,int scaleOrLength) throws SQLException { throw new NotUpdatable(); }
Support for java.sql.JDBCType/java.sql.SQLType.
private boolean isIgnore(Method method){ String name=method.getName(); if (ignore != null) { for ( String value : ignore) { if (name.equals(value)) { return true; } } } return false; }
This is used to determine if the method for an attribute is to be ignore. To determine if it should be ignore the method name is compared against the list of attributes to ignore.
public void testLoggingAccordingToLogLevels(){ TestableAbstractLogger logger=new TestableAbstractLogger(); logger.setLevel(LogLevel.WARN); logger.debug("test1","category"); assertNull(logger.popMessage()); logger.info("test2","category"); assertNull(logger.popMessage()); logger.warn("test3","category"); assertEquals("[warn][category][test3]",logger.popMessage()); logger.setLevel(LogLevel.INFO); logger.debug("test4","category"); assertNull(logger.popMessage()); logger.info("test5","category"); assertEquals("[info][category][test5]",logger.popMessage()); logger.warn("test6","category"); assertEquals("[warn][category][test6]",logger.popMessage()); logger.setLevel(LogLevel.DEBUG); logger.debug("test7","category"); assertEquals("[debug][category][test7]",logger.popMessage()); logger.info("test8","category"); assertEquals("[info][category][test8]",logger.popMessage()); logger.warn("test9","category"); assertEquals("[warn][category][test9]",logger.popMessage()); }
Test the matching between logging levels.
public void makeAdditionalChecks(MetaData received){ }
Override this method to make additional checks. The default implementation does nothing.
public static void runStop(){ printMessage("Simulation completed."); }
Internal method used to stop the simulation. This method should <b>not</b> be used directly.
public static <Req,Res>void loadTestThroughput(final IntervalGenerator intervalGen,final int warmupRequests,final ReceivePort<Req> requests,final RequestExecutor<Req,Res> executor,final SendPort<TimingEvent<Res>> eventChannel) throws InterruptedException, SuspendExecution { loadTestThroughput(intervalGen,warmupRequests,requests,executor,eventChannel,null,null); }
Run a load test with the given throughput, using as many fibers as necessary. This method can be run in any strand; thread-fiber synchronization is more expensive than fiber-fiber synchronization though, so if requests are being performed by fibers its best to call this method inside a fiber.
private void initData(){ this.locationList=DatabaseHelper.getInstance(this).readLocation(); }
<br> data.
public BooleanArrayList(int initialCapacity){ this(new boolean[initialCapacity]); setSizeRaw(0); }
Constructs an empty list with the specified initial capacity.
public static String TO_DATE(Timestamp time,boolean dayOnly){ return s_cc.getDatabase().TO_DATE(time,dayOnly); }
Create SQL TO Date String from Timestamp
@EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true) public void onBlockFromTo(BlockFromToEvent event){ Match match=Cardinal.getMatch(event.getWorld()); if (match == null) { return; } Block to=event.getToBlock(); Material type=event.getBlock().getType(); if (type.equals(Material.STATIONARY_LAVA) || type.equals(Material.LAVA)) { Core core=getClosestCore(match,to.getLocation().clone()); if (core != null && !core.isComplete()) { int distance=getBottom(core) - to.getY(); if (distance >= core.getLeak()) { core.setComplete(true); Channels.getGlobalChannel(Cardinal.getMatchThread(match)).sendMessage(new LocalizedComponentBuilder(ChatConstant.getConstant("objective.core.completed"),new TeamComponent(core.getOwner()),Components.setColor(core.getComponent(),ChatColor.RED)).color(ChatColor.RED).build()); Bukkit.getPluginManager().callEvent(new ObjectiveCompleteEvent(core,null)); } } } }
Checks if lava has reached the leak distance below this core.
@CanIgnoreReturnValue @Deprecated @Override public <T extends B>T putInstance(TypeToken<T> type,T value){ throw new UnsupportedOperationException(); }
Guaranteed to throw an exception and leave the map unmodified.
private void checkRemarks() throws Exception { int index; if (_remarks != null) { index=_remarks.indexOf("\""); if (index > -1) AdminException.throwException(RepositoryErrorCodes.EC_REP_REMARKS_EXIST_QUOTES); } }
Comprueba si el texto del campo Comentario tiene comillas dobles
public Constraint findConstraint(Session session,String name){ Constraint constraint=constraints.get(name); if (constraint == null) { constraint=session.findLocalTempTableConstraint(name); } return constraint; }
Try to find a constraint with this name. This method returns null if no object with this name exists.
public void entityReference(String name) throws org.xml.sax.SAXException { append(m_doc.createEntityReference(name)); }
Receive notivication of a entityReference.
public static boolean validateUint8(String value){ try { int intValue=Integer.parseInt(value); return intValue >= 0 && intValue <= 255; } catch ( Exception e) { return false; } }
Validate uint8 values.
public long[] keys(){ long[] keys=new long[size()]; long[] k=_set; byte[] states=_states; for (int i=k.length, j=0; i-- > 0; ) { if (states[i] == FULL) { keys[j++]=k[i]; } } return keys; }
returns the keys of the map.
public static void fill(double[] array,int start,int end,double value){ checkBounds(array.length,start,end); for (int i=start; i < end; i++) { array[i]=value; } }
Fills the specified range in the array with the specified element.
public static void test_getStaticVariable(){ Target.setStaticVariable(22); assertSame(22,Target.staticVariable); }
Test getting a static variable of a sibling class.
private int createServer(){ CacheServer server=null; try { Properties p=new Properties(); p.put(MCAST_PORT,"0"); p.put(LOCATORS,""); this.system=DistributedSystem.connect(p); this.cache=CacheFactory.create(system); server=this.cache.addCacheServer(); int port=AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); server.setMaximumTimeBetweenPings(TIME_BETWEEN_PINGS); server.setMaxThreads(getMaxThreads()); server.setPort(port); server.start(); } catch ( Exception e) { e.printStackTrace(); fail("Failed to create server"); } return server.getPort(); }
Creates and starts the server instance
public double stdErr(){ if (num == 0) { return 0; } return std() / Math.sqrt(num); }
Calculate the standard error of the mean (SEM): the standard deviation of the sample-mean's estimate of a population mean.
public void onClick(View view,String videoId,int position){ setVideoId(videoId); attachToView(view,position); }
Used for handling onclick in AbsListView. Overlay takes size of view passed.
public static DbException convert(Throwable e){ if (e instanceof DbException) { return (DbException)e; } else if (e instanceof SQLException) { return new DbException((SQLException)e); } else if (e instanceof InvocationTargetException) { return convertInvocation((InvocationTargetException)e,null); } else if (e instanceof IOException) { return get(ErrorCode.IO_EXCEPTION_1,e,e.toString()); } else if (e instanceof OutOfMemoryError) { return get(ErrorCode.OUT_OF_MEMORY,e); } else if (e instanceof StackOverflowError || e instanceof LinkageError) { return get(ErrorCode.GENERAL_ERROR_1,e,e.toString()); } else if (e instanceof Error) { throw (Error)e; } return get(ErrorCode.GENERAL_ERROR_1,e,e.toString()); }
Convert a throwable to an SQL exception using the default mapping. All errors except the following are re-thrown: StackOverflowError, LinkageError.
public In(){ scanner=new Scanner(new BufferedInputStream(System.in),CHARSET_NAME); scanner.useLocale(LOCALE); }
Create an input stream from standard input.
public DefaultConfiguration(double gapBetweenLevels,double gapBetweenNodes,Location location,AlignmentInLevel alignmentInLevel){ checkArg(gapBetweenLevels >= 0,"gapBetweenLevels must be >= 0"); checkArg(gapBetweenNodes >= 0,"gapBetweenNodes must be >= 0"); this.gapBetweenLevels=gapBetweenLevels; this.gapBetweenNodes=gapBetweenNodes; this.location=location; this.alignmentInLevel=alignmentInLevel; }
Specifies the constants to be used for this Configuration.
public void turnChecksOff(){ m_checksTurnedOff=true; }
Turns off checks for missing values, etc. Use with caution.
@Override public boolean isActive(){ return amIActive; }
Used by the Whitebox GUI to tell if this plugin is still running.
public boolean contains(char c){ char[] pairs=fPairs; for (int i=0, n=pairs.length; i < n; i++) { if (c == pairs[i]) return true; } return false; }
Returns true if the specified character occurs in one of the character pairs.