code
stringlengths
10
174k
nl
stringlengths
3
129k
public Rectangle(Point center,double width,double height){ setRect(new Rect((int)(center.x - (width / 2)),(int)(center.y - (height / 2)),(int)width,(int)height)); }
Create a rectangle based on a center and its size
public void run(){ if (closed) { return; } try { sendSdesPacket(); boolean terminate=false; while (!terminate) { try { Thread.sleep((long)rtcpSession.getReportInterval()); if ((rtcpSession.timeOfLastRTCPSent + rtcpSession.T) <= rtcpSession.currentTime()) { if ((rtcpSession.isByeRequested && waitingForByeBackoff)) { if (rtcpSession.timeOfLastRTCPSent > 0 && rtcpSession.timeOfLastRTPSent > 0) { rtcpSession.getMySource().activeSender=false; rtcpSession.timeOfLastRTCPSent=rtcpSession.currentTime(); } else { terminate=true; } } else { if (!closed) { transmit(assembleRtcpPacket()); if (rtcpSession.isByeRequested && !waitingForByeBackoff) { terminate=true; } else { rtcpSession.timeOfLastRTCPSent=rtcpSession.currentTime(); } } else { terminate=true; } } } waitingForByeBackoff=false; } catch ( InterruptedException e) { waitingForByeBackoff=true; rtcpSession.isByeRequested=true; } } } catch ( Exception e) { e.printStackTrace(); } }
Background processing
public ExtentTest error(String details){ log(Status.ERROR,details); return this; }
Logs an event <code>Status.ERROR</code> with details
public int offset(){ return offset; }
Returns the offset of last used element in current inner array chunk.
public static PieDataset createPieDatasetForRow(CategoryDataset dataset,Comparable rowKey){ int row=dataset.getRowIndex(rowKey); return createPieDatasetForRow(dataset,row); }
Creates a pie dataset from a table dataset by taking all the values for a single row.
public void init() throws ServletException { }
Initialization of the servlet. <br>
public void committed(CompositeTransaction tx){ removeTransaction(tx); }
Called if a tx is ended successfully. In order to remove the tx from the mapping.
public static <T>CopyOnWriteArrayList<T> copyOnWriteArrayList(){ return new CopyOnWriteArrayList<T>(); }
Create a new CopyOnWriteArrayList.
public void startDocument() throws SAXException { int doc=addNode(DTM.DOCUMENT_NODE,DTM.DOCUMENT_NODE,DTM.NULL,DTM.NULL,0,true); m_parents.push(doc); m_previous=DTM.NULL; m_contextIndexes.push(m_prefixMappings.size()); }
Receive notification of the beginning of the document.
protected boolean authenticate(String user,String password){ return true; }
Hook for subclasses to perform the authentication here
public void initialize(){ lightState=new LightState(); lightState.setGlobalAmbient(globalAmbientIntensity); lightState.setEnabled(true); headlight=new DirectionalLight(); headlight.setDiffuse(headlightIntensity); headlight.setSpecular(new ColorRGBA(0.2f,0.2f,0.2f,1f)); headlight.setEnabled(headlightEnabled); lightState.attach(headlight); light=new DirectionalLightNode("Sol",azimuth,elevation,direction); light.getLight().setAmbient(ambientIntensity); light.getLight().setDiffuse(diffuseIntensity); }
Set up OpenGL lighting
public void addEmail(NgnEmail.EmailType type,String value,String description){ mEmails.add(new NgnEmail(type,value,description)); }
Attach a new email to this contact
static void accept(final AnnotationVisitor av,final String name,final Object value){ if (av != null) { if (value instanceof String[]) { String[] typeconst=(String[])value; av.visitEnum(name,typeconst[0],typeconst[1]); } else if (value instanceof AnnotationNode) { AnnotationNode an=(AnnotationNode)value; an.accept(av.visitAnnotation(name,an.desc)); } else if (value instanceof List) { AnnotationVisitor v=av.visitArray(name); List<?> array=(List<?>)value; for (int j=0; j < array.size(); ++j) { accept(v,null,array.get(j)); } v.visitEnd(); } else { av.visit(name,value); } } }
Makes the given visitor visit a given annotation value.
void updatedChannel(final StoredClientChannel channel){ log.info("Stored client channel {} was updated",channel.hashCode()); containingWallet.addOrUpdateExtension(this); }
Notifies the set of stored states that a channel has been updated. Use to notify the wallet of an update to this wallet extension.
public void testInvokeAll3() throws InterruptedException { ExecutorService e=new ForkJoinPool(1); PoolCleaner cleaner=null; try { cleaner=cleaner(e); List<Callable<String>> l=new ArrayList<Callable<String>>(); l.add(new StringTask()); l.add(null); try { e.invokeAll(l); shouldThrow(); } catch ( NullPointerException success) { } } finally { if (cleaner != null) { cleaner.close(); } } }
invokeAll(c) throws NullPointerException if c has null elements
public MapView(Context context,AttributeSet attrs){ this(context,attrs,com.android.internal.R.attr.mapViewStyle); }
Construct a new WebView with layout parameters.
@Override public void translate(final ITranslationEnvironment environment,final IInstruction instruction,final List<ReilInstruction> instructions) throws InternalTranslationException { TranslationHelpers.checkTranslationArguments(environment,instruction,instructions,"move"); final String targetValue=instruction.getOperands().get(0).getRootNode().getChildren().get(0).getValue(); final String sourceValue=instruction.getOperands().get(1).getRootNode().getChildren().get(0).getValue(); final OperandSize dw=OperandSize.DWORD; final long baseOffset=ReilHelpers.toReilAddress(instruction.getAddress()).toLong(); instructions.add(ReilHelpers.createStr(baseOffset,dw,sourceValue,dw,targetValue)); }
simplified instruction for simple register to register move
public void pushMessage(Message message){ for ( IMessageListener listener : listeners) { listener.pushMessage(message); } }
Push a message to all listeners
public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data,int width,int height){ Rect rect=getFramingRectInPreview(); int previewFormat=configManager.getPreviewFormat(); String previewFormatString=configManager.getPreviewFormatString(); switch (previewFormat) { case PixelFormat.YCbCr_420_SP: case PixelFormat.YCbCr_422_SP: return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height()); default : if ("yuv420p".equals(previewFormatString)) { return new PlanarYUVLuminanceSource(data,width,height,rect.left,rect.top,rect.width(),rect.height()); } } throw new IllegalArgumentException("Unsupported picture format: " + previewFormat + '/'+ previewFormatString); }
A factory method to build the appropriate LuminanceSource object based on the format of the preview buffers, as described by Camera.Parameters.
public boolean isEnforcePriceLimit(){ Object oo=get_Value(COLUMNNAME_EnforcePriceLimit); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; }
Get Enforce price limit.
public DefaultProcessingInstruction(Element parent,String target,String values){ super(target,values); this.parent=parent; }
<p> This will create a new PI with the given target and values </p>
public String cardinalityTipText(){ return "The cardinality of the attributes, incl the class attribute."; }
Returns the tip text for this property
public boolean isRequestAlreadyHooked(HttpServerRequest request){ String hooked=request.headers().get(HOOKED_HEADER); return hooked != null ? hooked.equals("true") : false; }
Checks if the original Request was already hooked. Eg. After a request is processed by the hook handler (register), the handler creates a self request with a copy of the original request. Therefore it's necessary to mark the request as already hooked.
public Entry<V> next(){ if (!hasNext) throw new NoSuchElementException(); long[] keyTable=map.keyTable; if (nextIndex == INDEX_ZERO) { entry.key=0; entry.value=map.zeroValue; } else { entry.key=keyTable[nextIndex]; entry.value=map.valueTable[nextIndex]; } currentIndex=nextIndex; findNextIndex(); return entry; }
Note the same entry instance is returned each time this method is called.
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.
public ConsensusMessage createAccept(int id,int epoch,byte[] value){ return new ConsensusMessage(ACCEPT,id,epoch,from,value); }
Creates a WRITE message to be sent by this process
public void write(int b) throws IOException { oneByte[0]=(byte)b; if (streamCipher != null) { out.write(streamCipher.returnByte((byte)b)); } else { write(oneByte,0,1); } }
Writes the specified byte to this output stream.
protected static int hashString(final String string,final MpqHashType mpqHash){ final int offset=mpqHash.offset; long seed1=0x7FED_7FEDL; long seed2=0xEEEE_EEEEL; int ch; final int length=string.length(); for (int i=0; i < length; i++) { ch=Character.toUpperCase(string.charAt(i)); seed1=CRYPT_TABLE[offset + ch] ^ ((seed1 + seed2) & 0xFFFF_FFFFL); seed2=(ch + seed1 + seed2+ (seed2 << 5)+ 3) & 0xFFFF_FFFFL; } return (int)seed1; }
Computes the hash of a string.
@Override public void disconnect(String scaleDownNodeID,boolean criticalError){ disconnect(criticalError); }
Disconnect the connection, closing all channels
public void save(Bundle bundle){ Validate.notNull(bundle,"bundle"); SharedPreferences.Editor editor=cache.edit(); for ( String key : bundle.keySet()) { try { serializeKey(key,bundle,editor); } catch ( JSONException e) { Logger.log(LoggingBehavior.CACHE,Log.WARN,TAG,"Error processing value for key: '" + key + "' -- "+ e); return; } } boolean successfulCommit=editor.commit(); if (!successfulCommit) { Logger.log(LoggingBehavior.CACHE,Log.WARN,TAG,"SharedPreferences.Editor.commit() was not successful"); } }
Persists all supported data types present in the passed in Bundle, to the cache
public void applyPreference(PreferenceClass preferenceValue,PreferenceChangeListener listener){ checkValues(); SharedPreferences.Editor editor=edit(); if (prefType.equals(Boolean.class)) { editor.putBoolean(prefKey,preferenceValue == null ? false : (Boolean)preferenceValue); } else if (prefType.equals(Integer.class)) { editor.putInt(prefKey,preferenceValue == null ? 0 : (Integer)preferenceValue); } else if (prefType.equals(Set.class)) { editor.putStringSet(prefKey,(Set<String>)preferenceValue); } else if (prefType.equals(Float.class)) { editor.putFloat(prefKey,preferenceValue == null ? 0.0f : (Float)preferenceValue); } else if (prefType.equals(Long.class)) { editor.putLong(prefKey,preferenceValue == null ? 0l : (Long)preferenceValue); } else if (prefType.equals(String.class)) { editor.putString(prefKey,((String)preferenceValue)); } editor.apply(); if (listener != null) { listener.onPreferenceChanged(prefKey,preferenceValue); } }
Changes the preference
protected void loadUrlRewriter(FilterConfig filterConfig) throws ServletException { try { loadUrlRewriterLocal(); } catch ( Throwable e) { log.error(e); throw new ServletException(e); } }
Separate from init so that it can be overidden.
@Override public void readFromNBT(NBTTagCompound tag){ super.readFromNBT(tag); NBTTagCompound data=tag.getCompoundTag("IC2BasicSink"); energyStored=data.getDouble("energy"); }
Forward for the base TileEntity's readFromNBT(), used for loading the state.
public static void main(String[] args){ runFileLoader(new MatlabLoader(),args); }
Main method.
public boolean contains(Album p){ synchronized (mAlbums) { return mAlbums.contains(p); } }
Returns whether or not the adapter contains the provided album
protected void appendConstant(final Object cst){ appendConstant(buf,cst); }
Appends a string representation of the given constant to the given buffer.
public void pointerHover(final int[] x,final int[] y){ if (impl.getCurrentForm() == null) { return; } if (x.length == 1) { addPointerEventWithTimestamp(POINTER_HOVER,x[0],y[0]); } else { addPointerEvent(POINTER_HOVER,x,y); } }
Pushes a pointer hover event with the given coordinates into Codename One
public Size(int width,int height){ mWidth=width; mHeight=height; }
Create a new immutable Size instance.
protected int AxisName() throws javax.xml.transform.TransformerException { Object val=Keywords.getAxisName(m_token); if (null == val) { error(XPATHErrorResources.ER_ILLEGAL_AXIS_NAME,new Object[]{m_token}); } int axesType=((Integer)val).intValue(); appendOp(2,axesType); return axesType; }
Basis ::= AxisName '::' NodeTest | AbbreviatedBasis
public JSONObject(String baseName,Locale locale) throws JSONException { this(); ResourceBundle bundle=ResourceBundle.getBundle(baseName,locale,Thread.currentThread().getContextClassLoader()); Enumeration<String> keys=bundle.getKeys(); while (keys.hasMoreElements()) { Object key=keys.nextElement(); if (key != null) { String[] path=((String)key).split("\\."); int last=path.length - 1; JSONObject target=this; for (int i=0; i < last; i+=1) { String segment=path[i]; JSONObject nextTarget=target.optJSONObject(segment); if (nextTarget == null) { nextTarget=new JSONObject(); target.put(segment,nextTarget); } target=nextTarget; } target.put(path[last],bundle.getString((String)key)); } } }
Construct a JSONObject from a ResourceBundle.
static Object doFloorMod(long x,long y){ try { return Math.floorMod(x,y); } catch ( ArithmeticException ae) { return ae; } }
Invoke floorDiv and return the result or any exception.
public static void print(Context cx,Scriptable thisObj,Object[] args,Function funObj){ for (int i=0; i < args.length; i++) { if (i > 0) System.out.print(" "); String s=Context.toString(args[i]); System.out.print(s); } System.out.println(); }
Print the string values of its arguments. This method is defined as a JavaScript function. Note that its arguments are of the "varargs" form, which allows it to handle an arbitrary number of arguments supplied to the JavaScript function.
public CompositeComparator(Comparator[] cmp,boolean reverse){ this(cmp.length,reverse); System.arraycopy(cmp,0,m_cmp,0,cmp.length); m_size=cmp.length; }
Creates a new CompositeComparator.
public ValueComparator(Map<String,Double> base){ this.base=base; }
Create a new comparator using a mapping of probabilities. The comparator will use the attached probabilities to return the ordering for two Strings.
public void testSave() throws Exception { System.out.println("save"); final File file=File.createTempFile("testconf",".xml"); final MBeanServer mbs=ManagementFactory.getPlatformMBeanServer(); final ScanManagerMXBean manager=ScanManager.register(mbs); try { final ScanDirConfigMXBean instance=manager.createOtherConfigurationMBean("testSave",file.getAbsolutePath()); assertTrue(mbs.isRegistered(ScanManager.makeScanDirConfigName("testSave"))); final ScanManagerConfig bean=new ScanManagerConfig("testSave"); final DirectoryScannerConfig dir=new DirectoryScannerConfig("tmp"); dir.setRootDirectory(file.getParent()); bean.putScan(dir); instance.setConfiguration(bean); instance.save(); final ScanManagerConfig loaded=new XmlConfigUtils(file.getAbsolutePath()).readFromFile(); assertEquals(instance.getConfiguration(),loaded); assertEquals(bean,loaded); instance.getConfiguration().removeScan("tmp"); instance.save(); assertNotSame(loaded,instance.getConfiguration()); final ScanManagerConfig loaded2=new XmlConfigUtils(file.getAbsolutePath()).readFromFile(); assertEquals(instance.getConfiguration(),loaded2); } finally { manager.close(); mbs.unregisterMBean(ScanManager.SCAN_MANAGER_NAME); } final ObjectName all=new ObjectName(ScanManager.SCAN_MANAGER_NAME.getDomain() + ":*"); assertEquals(0,mbs.queryNames(all,null).size()); }
Test of save method, of class com.sun.jmx.examples.scandir.ScanDirConfig.
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XNumber xnum=new XNumber((double)getCountOfContextNodeList(xctxt)); return xnum; }
Execute the function. The function must return a valid object.
public static Event convertToEvent(RecordableEvent event){ Event dbEvent=new Event(); dbEvent.setTimeInMillis(event.getTimestamp()); dbEvent.setEventType(event.getType()); dbEvent.setTenantId(event.getTenantId()); dbEvent.setProjectId(event.getProjectId()); dbEvent.setUserId(event.getUserId()); dbEvent.setVirtualPool(event.getVirtualPool()); dbEvent.setService(event.getService()); dbEvent.setResourceId(event.getResourceId()); dbEvent.setSeverity(event.getSeverity()); dbEvent.setDescription(event.getDescription()); dbEvent.setExtensions(event.getExtensions()); dbEvent.setEventId(event.getEventId()); dbEvent.setAlertType(event.getAlertType()); dbEvent.setRecordType(event.getRecordType()); dbEvent.setNativeGuid(event.getNativeGuid()); dbEvent.setOperationalStatusCodes(event.getOperationalStatusCodes()); dbEvent.setOperationalStatusDescriptions(event.getOperationalStatusDescriptions()); dbEvent.setEventSource(event.getSource()); return dbEvent; }
Converts a RecordableEvent to an Event Model
static final public boolean[] parseBoolean(int what[]){ boolean outgoing[]=new boolean[what.length]; for (int i=0; i < what.length; i++) { outgoing[i]=(what[i] != 0); } return outgoing; }
Convert an int array to a boolean array. An int equal to zero will return false, and any other value will return true.
public Model lookup(String name,int index){ ModelList list=get(name); if (list != null) { return list.lookup(index); } return null; }
This method is used to look for a <code>Model</code> that matches the specified element name. If no such model exists then this will return null. This is as a convenient way to find a model within the tree of models being built.
public static TransportAddress applyXor(TransportAddress address,byte[] transactionID){ byte[] addressBytes=address.getAddressBytes(); char port=(char)address.getPort(); char portModifier=(char)((transactionID[0] << 8 & 0x0000FF00) | (transactionID[1] & 0x000000FF)); port^=portModifier; for (int i=0; i < addressBytes.length; i++) addressBytes[i]^=transactionID[i]; TransportAddress xoredAdd; try { xoredAdd=new TransportAddress(addressBytes,port,Transport.UDP); } catch ( UnknownHostException e) { throw new IllegalArgumentException(e); } return xoredAdd; }
Returns the result of applying XOR on the specified attribute's address. The method may be used for both encoding and decoding XorMappedAddresses.
public static RestorableSupport newRestorableSupport(){ return newRestorableSupport(DEFAULT_DOCUMENT_ELEMENT_TAG_NAME); }
Creates a new RestorableSupport with no contents.
protected Instances modifyHeader(Instances instanceInfo){ instanceInfo=new Instances(getInputFormat(),0); Attribute oldAtt=instanceInfo.attribute(m_AttIndex.getIndex()); int[] selection=new int[m_Values.size()]; Iterator<String> iter=m_Values.iterator(); int i=0; while (iter.hasNext()) { selection[i]=oldAtt.indexOfValue(iter.next().toString()); i++; } ArrayList<String> newVals=new ArrayList<String>(); for (i=0; i < selection.length; i++) { newVals.add(oldAtt.value(selection[i])); } Attribute newAtt=new Attribute(oldAtt.name(),newVals); newAtt.setWeight(oldAtt.weight()); instanceInfo.replaceAttributeAt(newAtt,m_AttIndex.getIndex()); m_NominalMapping=new int[oldAtt.numValues()]; for (i=0; i < m_NominalMapping.length; i++) { boolean found=false; for (int j=0; j < selection.length; j++) { if (selection[j] == i) { m_NominalMapping[i]=j; found=true; break; } } if (!found) { m_NominalMapping[i]=-1; } } return instanceInfo; }
modifies the header of the Instances and returns the format w/o any instances
private void initfromRootBlock(final IRootBlockView rb) throws IOException { assert (rb != null); m_storeUUID=rb.getUUID(); if (rb.getNextOffset() == 0) { defaultInit(); } else { final long nxtOffset=rb.getNextOffset(); m_nextAllocation=-(int)(nxtOffset >> 32); if (m_nextAllocation == 0) { m_nextAllocation=-(1 + META_ALLOCATION); } m_committedNextAllocation=m_nextAllocation; m_metaBitsAddr=-(int)nxtOffset; if (log.isInfoEnabled()) { log.info("MetaBitsAddr: " + m_metaBitsAddr); } { final long metaAddr=rb.getMetaStartAddr(); m_fileSize=(int)-(metaAddr & 0xFFFFFFFF); if (log.isInfoEnabled()) log.info("InitFromRootBlock m_fileSize: " + convertAddr(m_fileSize)); } long rawmbaddr=rb.getMetaBitsAddr(); final int metaBitsStore=(int)(rawmbaddr & 0xFFFF); if (metaBitsStore > 0) { rawmbaddr>>=16; final byte[] buf=new byte[metaBitsStore * 4]; FileChannelUtility.readAll(m_reopener,ByteBuffer.wrap(buf),rawmbaddr); final DataInputStream strBuf=new DataInputStream(new ByteArrayInputStream(buf)); final int storeVersion=strBuf.readInt(); switch ((storeVersion & 0xFF00)) { case (cVersion & 0xFF00): case (cVersionDemispace & 0xFF00): break; default : throw new IllegalStateException("Incompatible RWStore header version: storeVersion=" + storeVersion + ", cVersion="+ cVersion+ ", demispace: "+ isUsingDemiSpace()); } m_lastDeferredReleaseTime=strBuf.readLong(); if (strBuf.readInt() != cDefaultMetaBitsSize) { throw new IllegalStateException("Store opened with unsupported metabits size"); } final int allocBlocks=strBuf.readInt(); m_storageStatsAddr=strBuf.readLong(); for (int i=0; i < cReservedMetaBits; i++) { strBuf.readInt(); } m_allocSizes=new int[allocBlocks]; for (int i=0; i < allocBlocks; i++) { m_allocSizes[i]=strBuf.readInt(); } m_metaBitsSize=metaBitsStore - allocBlocks - cMetaHdrFields; m_metaBits=new int[m_metaBitsSize]; if (log.isInfoEnabled()) { log.info("Raw MetaBitsAddr: " + rawmbaddr); } for (int i=0; i < m_metaBitsSize; i++) { m_metaBits[i]=strBuf.readInt(); } syncMetaTransients(); final int numFixed=m_allocSizes.length; m_freeFixed=new ArrayList[numFixed]; for (int i=0; i < numFixed; i++) { m_freeFixed[i]=new ArrayList<FixedAllocator>(); } checkCoreAllocations(); readAllocationBlocks(); } if (log.isInfoEnabled()) log.info("restored from RootBlock: " + m_nextAllocation + ", "+ m_metaBitsAddr); } }
Should be called where previously initFileSpec was used. Rather than reading from file, instead reads from the current root block. We use the rootBlock fields, nextOffset, metaStartAddr, metaBitsAddr. metaBitsAddr indicates where the meta allocation bits are. metaStartAddr is the offset in the file where the allocation blocks are allocated the long value also indicates the size of the allocation, such that the address plus the size is the "filesize". Note that metaBitsAddr must be an absolute address, with the low order 16 bits used to indicate the size.
public WarrantyAction(){ super("Warranty"); }
Creates a new close session action for the given desktop.
public Escaper toEscaper(){ return new CharArrayDecorator(toArray()); }
Convert this builder into a char escaper which is just a decorator around the underlying array of replacement char[]s.
public Object runSafely(Catbert.FastStack stack) throws Exception { EPG.getInstance().setAutodial(evalBool(stack.pop())); return null; }
Sets whether or not SageTV should autodial before accessing the Internet
public static void onClick(Activity activity,View img,String videoId,int position){ if (activity != null) { FragmentManager fragmentManager=activity.getFragmentManager(); YoutubeOverlayFragment yt=(YoutubeOverlayFragment)fragmentManager.findFragmentByTag(YoutubeOverlayFragment.class.getName()); if (yt != null) { yt.onClick(img,videoId,position); } } }
Performs video playback of passed videoId in fragment video container. Video container is attached to img container of an row item.
@Override public boolean onOptionsItemSelected(MenuItem item){ if (item.getItemId() == android.R.id.home) return containerAsHandlesBack.onBackPressed(); return super.onOptionsItemSelected(item); }
Inform the view about up events.
public void updateText(int x,int y,String stuff,String font,int justify,LinkProperties properties,int graphicUpdateMask) throws IOException { writeGraphicGestureHeader(graphicUpdateMask); LinkText.write(x,y,stuff,font,justify,properties,link.dos); }
Write a text in the response.
protected BlockImpl(){ super(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-02-25 10:38:02.452 -0500",hash_original_method="748B8AADFB217AB8F29DF7ED1C81D966",hash_generated_method="0B4E66181B796C9630F40375F7787CCF") @DSVerified @DSSpec(DSCat.IO) @DSSink({DSSinkKind.NETWORK}) public int data() throws IOException { return sendCommand(SMTPCommand.DATA); }
A convenience method to send the SMTP DATA command to the server, receive the reply, and return the reply code. <p>
public String executeCommand(String command) throws IOException { command=command.endsWith("\r\n") ? command : (command + "\r\n"); byte b[]=command.getBytes(Sage.BYTE_CHARSET); return executeCommand(b,0,b.length); }
Execute a command on the media server. </p> If \r\n is missing, it will automatically be appended for you. Everything sent with this method will be encoded as Sage.BYTE_CHARSET.
public void explain(boolean explain){ this.explain=explain; }
Indicate if detailed information about query is requested
public static void newrelease(final Player player){ }
player > level 2 logged in for new release.
public static DigestAlgorithm forXML(final String xmlName,final DigestAlgorithm defaultValue){ final DigestAlgorithm algorithm=Registry.XML_ALGORITHMS.get(xmlName); if (algorithm == null) { return defaultValue; } return algorithm; }
Returns the digest algorithm associated to the given XML url or the default one if the algorithm does not exist.
protected final void clearPositionCache(){ if (fCachedPositions != null) { fCachedPositions=null; } }
Clears the position cache. Needs to be called whenever the positions have been updated.
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:28:44.160 -0500",hash_original_method="579B4F5DF75F7C70B58361D381AB3677",hash_generated_method="B38ADA6C9E0B1F648A7D372DCFD6BAE1") public String buildUnionSubQuery(String typeDiscriminatorColumn,String[] unionColumns,Set<String> columnsPresentInTable,int computedColumnsOffset,String typeDiscriminatorValue,String selection,String groupBy,String having){ int unionColumnsCount=unionColumns.length; String[] projectionIn=new String[unionColumnsCount]; for (int i=0; i < unionColumnsCount; i++) { String unionColumn=unionColumns[i]; if (unionColumn.equals(typeDiscriminatorColumn)) { projectionIn[i]="'" + typeDiscriminatorValue + "' AS "+ typeDiscriminatorColumn; } else if (i <= computedColumnsOffset || columnsPresentInTable.contains(unionColumn)) { projectionIn[i]=unionColumn; } else { projectionIn[i]="NULL AS " + unionColumn; } } return buildQuery(projectionIn,selection,groupBy,having,null,null); }
Construct a SELECT statement suitable for use in a group of SELECT statements that will be joined through UNION operators in buildUnionQuery.
public void removeCheckConstraint(){ checkConstraint=null; checkConstraintSQL=null; }
Remove the check constraint if there is one.
public static String join(String[] array,String separator){ int len=array.length; if (len == 0) { return ""; } StringBuilder out=new StringBuilder(); out.append(array[0]); for (int i=1; i < len; i++) { out.append(separator).append(array[i]); } return out.toString(); }
Join an array of strings with the given separator. <p> Note: This might be replaced by utility method from commons-lang or guava someday if one of those libraries is added as dependency. </p>
public static ExitState error(JavaCompiler comp){ if (hasCeylonCodegenErrors(comp)) { return new ExitState(ERROR,CeylonState.BUG,comp.errorCount(),null,comp); } else { return new ExitState(ERROR,CeylonState.ERROR,comp.errorCount(),null); } }
javac had errors logged. Causes: <ul> <li>Compiling .java source which had errors <li>Compiling .ceylon source and codegen produced a bad tree <li>Compiling .ceylon source and codegen threw an exception </ul>
public ElideResponse delete(String path,String jsonApiDocument,Object opaqueUser){ return this.delete(path,jsonApiDocument,opaqueUser,SecurityMode.SECURITY_ACTIVE); }
Handle DELETE.
private static Object[] createRemoveOptions(){ if (OSUtils.supportsTrash()) { String trashLabel=OSUtils.isWindows() ? I18n.tr("Move to Recycle Bin") : I18n.tr("Move to Trash"); return new Object[]{trashLabel,I18n.tr("Delete"),I18n.tr("Cancel")}; } else { return new Object[]{I18n.tr("Delete"),I18n.tr("Cancel")}; } }
Returns the options offered to the user when removing files. Depending on the platform these can be a subset of MOVE_TO_TRASH, DELETE, CANCEL.
public static <T extends Object & Comparable<? super T>>T min(Collection<? extends T> collection){ Iterator<? extends T> it=collection.iterator(); T min=it.next(); while (it.hasNext()) { T next=it.next(); if (min.compareTo(next) > 0) { min=next; } } return min; }
Searches the specified collection for the minimum element.
public TypeRefAnnotationArgument createTypeRefAnnotationArgument(){ TypeRefAnnotationArgumentImpl typeRefAnnotationArgument=new TypeRefAnnotationArgumentImpl(); return typeRefAnnotationArgument; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public boolean isLessThan(Hours other){ if (other == null) { return getValue() < 0; } return getValue() < other.getValue(); }
Is this hours instance less than the specified number of hours.
public void merge(Region r){ if (this.start == r.end + 1) { this.start=r.start; } else if (this.end == r.start - 1) { this.end=r.end; } else { throw new AssertionError("Ranges : Merge called on non contiguous values : [this]:" + this + " and "+ r); } updateAvailable(); }
Merge the supplied region into this region (if they are adjoining).
public XYLine3DRenderer(){ this.wallPaint=DEFAULT_WALL_PAINT; this.xOffset=DEFAULT_X_OFFSET; this.yOffset=DEFAULT_Y_OFFSET; }
Creates a new renderer.
public void emptyLine(){ out.println(); out.println("\t\t// -----------------------------------------------"); out.println(); }
an empty line
protected void addImpl(Component x,Object constraints,int index){ if (x.getParent() == this) { return; } else { super.addImpl(x,constraints,index); } }
If the specified component is already a child of this then we don't bother doing anything - stacking order doesn't matter for cell renderer components (CellRendererPane doesn't paint anyway).
public static boolean isXMLCharacter(int c){ return (((XML_CHARACTER[c >>> 5] & (1 << (c & 0x1F))) != 0) || (c >= 0x10000 && c <= 0x10ffff)); }
Tests whether the given 32 bits character is valid in XML documents. Because the majority of code-points is covered by the table-lookup-test, we do it first. This method gives meaningful results only for c >= 0 .
public static String toJSONString(Object value){ if (value == null) return "null"; if (value instanceof String) return "\"" + escape((String)value) + "\""; if (value instanceof Double) { if (((Double)value).isInfinite() || ((Double)value).isNaN()) return "null"; else return value.toString(); } if (value instanceof Float) { if (((Float)value).isInfinite() || ((Float)value).isNaN()) return "null"; else return value.toString(); } if (value instanceof Number) return value.toString(); if (value instanceof Boolean) return value.toString(); if ((value instanceof JSONAware)) return ((JSONAware)value).toJSONString(); if (value instanceof Map) return JSONObject.toJSONString((Map)value); if (value instanceof List) return JSONArray.toJSONString((List)value); return value.toString(); }
Convert an object to JSON text. <p> If this object is a Map or a List, and it's also a JSONAware, JSONAware will be considered firstly. <p> DO NOT call this method from toJSONString() of a class that implements both JSONAware and Map or List with "this" as the parameter, use JSONObject.toJSONString(Map) or JSONArray.toJSONString(List) instead.
public StandardXYZToolTipGenerator(){ this(DEFAULT_TOOL_TIP_FORMAT,NumberFormat.getNumberInstance(),NumberFormat.getNumberInstance(),NumberFormat.getNumberInstance()); }
Creates a new tool tip generator using default number formatters for the x, y and z-values.
public synchronized long fileCount(){ return fileCount; }
Returns the number of files currently being used to store the values in this cache. This may be greater than the max file count if a background deletion is pending.
public static void addIsNewVersionOfDOIRelatedIdentifier(@NotNull DataCiteMetadata metadata,@NotNull DOI replaced) throws InvalidMetadataException { DataCiteMetadata.RelatedIdentifiers.RelatedIdentifier rid=FACTORY.createDataCiteMetadataRelatedIdentifiersRelatedIdentifier(); rid.setRelatedIdentifierType(RelatedIdentifierType.DOI); rid.setValue(replaced.getDoiName()); rid.setRelationType(RelationType.IS_NEW_VERSION_OF); metadata.getRelatedIdentifiers().getRelatedIdentifier().add(rid); }
Add RelatedIdentifier describing the DOI of the resource being replaced by the resource being registered.
public void testMoveToStringShortForm() throws ChessParseError { String fen="r4rk1/2pn3p/2q1q1n1/8/2q2p2/6R1/p4PPP/1R4K1 b - - 0 1"; Position pos=TextIO.readFEN(fen); assertEquals(fen,TextIO.toFEN(pos)); boolean longForm=false; Move move=new Move(Position.getSquare(4,5),Position.getSquare(4,3),Piece.EMPTY); String result=moveToString(pos,move,longForm); assertEquals("Qee4",result); move=new Move(Position.getSquare(2,5),Position.getSquare(4,3),Piece.EMPTY); result=moveToString(pos,move,longForm); assertEquals("Qc6e4",result); move=new Move(Position.getSquare(2,3),Position.getSquare(4,3),Piece.EMPTY); result=moveToString(pos,move,longForm); assertEquals("Q4e4",result); move=new Move(Position.getSquare(2,3),Position.getSquare(2,0),Piece.EMPTY); result=moveToString(pos,move,longForm); assertEquals("Qc1+",result); move=new Move(Position.getSquare(0,1),Position.getSquare(0,0),Piece.BQUEEN); result=moveToString(pos,move,longForm); assertEquals("a1Q",result); move=new Move(Position.getSquare(0,1),Position.getSquare(1,0),Piece.BQUEEN); result=moveToString(pos,move,longForm); assertEquals("axb1Q#",result); move=new Move(Position.getSquare(0,1),Position.getSquare(1,0),Piece.BKNIGHT); result=moveToString(pos,move,longForm); assertEquals("axb1N",result); move=new Move(Position.getSquare(3,6),Position.getSquare(4,4),Piece.EMPTY); result=moveToString(pos,move,longForm); assertEquals("Ne5",result); move=new Move(Position.getSquare(7,6),Position.getSquare(7,4),Piece.EMPTY); result=moveToString(pos,move,longForm); assertEquals("h5",result); move=new Move(Position.getSquare(5,7),Position.getSquare(3,7),Piece.EMPTY); result=moveToString(pos,move,longForm); assertEquals("Rfd8",result); }
Test of moveToString method, of class TextIO, short form.
public static void d(String tag,String msg,Throwable tr){ println(DEBUG,tag,msg,tr); }
Prints a message at DEBUG priority.
protected void deleteDevice(Device device){ ArrayList<Entity> emptyToKeep=new ArrayList<Entity>(); for ( Entity entity : device.getEntities()) { this.removeEntity(entity,device.getEntityClass(),device.getDeviceKey(),emptyToKeep); } if (!deviceMap.remove(device.getDeviceKey(),device)) { if (logger.isDebugEnabled()) logger.debug("device map does not have this device -" + device.toString()); } }
method to delete a given device, remove all entities first and then finally delete the device itself.
public void runTest() throws Throwable { Document doc; DocumentType docType; NamedNodeMap notations; Node notationNode; String notationName; doc=(Document)load("staff",false); docType=doc.getDoctype(); assertNotNull("docTypeNotNull",docType); notations=docType.getNotations(); assertNotNull("notationsNotNull",notations); notationNode=notations.getNamedItem("notation1"); assertNotNull("notationNotNull",notationNode); notationName=notationNode.getNodeName(); assertEquals("nodeName","notation1",notationName); }
Runs the test case.
public boolean isStateActive(State state){ switch (state) { case main_region_A: return stateVector[0] == State.main_region_A; default : return false; } }
Returns true if the given state is currently active otherwise false.
private void resetNetworkVisited(){ for ( Node node : this.network.getNodes().values()) { DijkstraNodeData data=getData(node); data.resetVisited(); } }
Resets all nodes in the network as if they have not been visited yet.
private DeleteGlossaryCommand(){ }
This is a singleton.
private void showFeedback(String feedback){ if (myHost != null) { myHost.showFeedback(feedback); } else { System.out.println(feedback); } }
Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface.
static void add(JarOutputStream jar,Class<?> c) throws IOException { String name=c.getName(); String classAsPath=name.replace('.','/') + ".class"; jar.putNextEntry(new JarEntry(classAsPath)); InputStream stream=c.getClassLoader().getResourceAsStream(classAsPath); int nRead; byte[] buf=new byte[1024]; while ((nRead=stream.read(buf,0,buf.length)) != -1) { jar.write(buf,0,nRead); } jar.closeEntry(); }
Adds the class file bytes for a given class to a JAR stream.
private void adjustMinPrefForSpanningComps(DimConstraint[] specs,Float[] defPush,FlowSizeSpec fss,ArrayList<LinkedDimGroup>[] groupsLists){ for (int r=groupsLists.length - 1; r >= 0; r--) { ArrayList<LinkedDimGroup> groups=groupsLists[r]; for ( LinkedDimGroup group : groups) { if (group.span == 1) { continue; } int[] sizes=group.getMinPrefMax(); for (int s=LayoutUtil.MIN; s <= LayoutUtil.PREF; s++) { int cSize=sizes[s]; if (cSize == LayoutUtil.NOT_SET) { continue; } int rowSize=0; int sIx=(r << 1) + 1; int len=Math.min((group.span << 1),fss.sizes.length - sIx) - 1; for (int j=sIx; j < sIx + len; j++) { int sz=fss.sizes[j][s]; if (sz != LayoutUtil.NOT_SET) { rowSize+=sz; } } if (rowSize < cSize && len > 0) { for (int eagerness=0, newRowSize=0; eagerness < 4 && newRowSize < cSize; eagerness++) { newRowSize=fss.expandSizes(specs,defPush,cSize,sIx,len,s,eagerness); } } } } } }
Adjust min/pref size for columns(or rows) that has components that spans multiple columns (or rows).
public void startDetection(String containerId,String machineId,String workspaceId){ instances.put(containerId,Pair.of(machineId,workspaceId)); }
Start container stop detection.
public acronym addElement(String element){ addElementToRegistry(element); return (this); }
Adds an Element to the element.
public static void dump(String fileName,Writer writer,boolean details){ PrintWriter pw=new PrintWriter(writer,true); if (!FilePath.get(fileName).exists()) { pw.println("File not found: " + fileName); return; } long size=FileUtils.size(fileName); pw.printf("File %s, %d bytes, %d MB\n",fileName,size,size / 1024 / 1024); FileChannel file=null; int blockSize=MVStore.BLOCK_SIZE; TreeMap<Integer,Long> mapSizesTotal=new TreeMap<Integer,Long>(); long pageSizeTotal=0; try { file=FilePath.get(fileName).open("r"); long fileSize=file.size(); int len=Long.toHexString(fileSize).length(); ByteBuffer block=ByteBuffer.allocate(4096); long pageCount=0; for (long pos=0; pos < fileSize; ) { block.rewind(); DataUtils.readFully(file,pos,block); block.rewind(); int headerType=block.get(); if (headerType == 'H') { String header=new String(block.array(),DataUtils.LATIN).trim(); pw.printf("%0" + len + "x fileHeader %s%n",pos,header); pos+=blockSize; continue; } if (headerType != 'c') { pos+=blockSize; continue; } block.position(0); Chunk c=null; try { c=Chunk.readChunkHeader(block,pos); } catch ( IllegalStateException e) { pos+=blockSize; continue; } if (c.len <= 0) { pos+=blockSize; continue; } int length=c.len * MVStore.BLOCK_SIZE; pw.printf("%n%0" + len + "x chunkHeader %s%n",pos,c.toString()); ByteBuffer chunk=ByteBuffer.allocate(length); DataUtils.readFully(file,pos,chunk); int p=block.position(); pos+=length; int remaining=c.pageCount; pageCount+=c.pageCount; TreeMap<Integer,Integer> mapSizes=new TreeMap<Integer,Integer>(); int pageSizeSum=0; while (remaining > 0) { int start=p; try { chunk.position(p); } catch ( IllegalArgumentException e) { pw.printf("ERROR illegal position %d%n",p); break; } int pageSize=chunk.getInt(); chunk.getShort(); int mapId=DataUtils.readVarInt(chunk); int entries=DataUtils.readVarInt(chunk); int type=chunk.get(); boolean compressed=(type & DataUtils.PAGE_COMPRESSED) != 0; boolean node=(type & 1) != 0; if (details) { pw.printf("+%0" + len + "x %s, map %x, %d entries, %d bytes, maxLen %x%n",p,(node ? "node" : "leaf") + (compressed ? " compressed" : ""),mapId,node ? entries + 1 : entries,pageSize,DataUtils.getPageMaxLength(DataUtils.getPagePos(0,0,pageSize,0))); } p+=pageSize; Integer mapSize=mapSizes.get(mapId); if (mapSize == null) { mapSize=0; } mapSizes.put(mapId,mapSize + pageSize); Long total=mapSizesTotal.get(mapId); if (total == null) { total=0L; } mapSizesTotal.put(mapId,total + pageSize); pageSizeSum+=pageSize; pageSizeTotal+=pageSize; remaining--; long[] children=null; long[] counts=null; if (node) { children=new long[entries + 1]; for (int i=0; i <= entries; i++) { children[i]=chunk.getLong(); } counts=new long[entries + 1]; for (int i=0; i <= entries; i++) { long s=DataUtils.readVarLong(chunk); counts[i]=s; } } String[] keys=new String[entries]; if (mapId == 0 && details) { ByteBuffer data; if (compressed) { boolean fast=!((type & DataUtils.PAGE_COMPRESSED_HIGH) == DataUtils.PAGE_COMPRESSED_HIGH); Compressor compressor=getCompressor(fast); int lenAdd=DataUtils.readVarInt(chunk); int compLen=pageSize + start - chunk.position(); byte[] comp=DataUtils.newBytes(compLen); chunk.get(comp); int l=compLen + lenAdd; data=ByteBuffer.allocate(l); compressor.expand(comp,0,compLen,data.array(),0,l); } else { data=chunk; } for (int i=0; i < entries; i++) { String k=StringDataType.INSTANCE.read(data); keys[i]=k; } if (node) { for (int i=0; i < entries; i++) { long cp=children[i]; pw.printf(" %d children < %s @ " + "chunk %x +%0" + len + "x%n",counts[i],keys[i],DataUtils.getPageChunkId(cp),DataUtils.getPageOffset(cp)); } long cp=children[entries]; pw.printf(" %d children >= %s @ chunk %x +%0" + len + "x%n",counts[entries],keys.length >= entries ? null : keys[entries],DataUtils.getPageChunkId(cp),DataUtils.getPageOffset(cp)); } else { String[] values=new String[entries]; for (int i=0; i < entries; i++) { String v=StringDataType.INSTANCE.read(data); values[i]=v; } for (int i=0; i < entries; i++) { pw.println(" " + keys[i] + " = "+ values[i]); } } } else { if (node && details) { for (int i=0; i <= entries; i++) { long cp=children[i]; pw.printf(" %d children @ chunk %x +%0" + len + "x%n",counts[i],DataUtils.getPageChunkId(cp),DataUtils.getPageOffset(cp)); } } } } pageSizeSum=Math.max(1,pageSizeSum); for ( Integer mapId : mapSizes.keySet()) { int percent=100 * mapSizes.get(mapId) / pageSizeSum; pw.printf("map %x: %d bytes, %d%%%n",mapId,mapSizes.get(mapId),percent); } int footerPos=chunk.limit() - Chunk.FOOTER_LENGTH; try { chunk.position(footerPos); pw.printf("+%0" + len + "x chunkFooter %s%n",footerPos,new String(chunk.array(),chunk.position(),Chunk.FOOTER_LENGTH,DataUtils.LATIN).trim()); } catch ( IllegalArgumentException e) { pw.printf("ERROR illegal footer position %d%n",footerPos); } } pw.printf("%n%0" + len + "x eof%n",fileSize); pw.printf("\n"); pageCount=Math.max(1,pageCount); pw.printf("page size total: %d bytes, page count: %d, average page size: %d bytes\n",pageSizeTotal,pageCount,pageSizeTotal / pageCount); pageSizeTotal=Math.max(1,pageSizeTotal); for ( Integer mapId : mapSizesTotal.keySet()) { int percent=(int)(100 * mapSizesTotal.get(mapId) / pageSizeTotal); pw.printf("map %x: %d bytes, %d%%%n",mapId,mapSizesTotal.get(mapId),percent); } } catch ( IOException e) { pw.println("ERROR: " + e); e.printStackTrace(pw); } finally { if (file != null) { try { file.close(); } catch ( IOException e) { } } } pw.flush(); }
Read the contents of the file and display them in a human-readable format.
public void writeBinary(final PacketOutputStream writeBuffer){ if (options.useLegacyDatetimeCode) calendar=Calendar.getInstance(); calendar.setTimeInMillis(ts.getTime()); writeBuffer.writeTimestampLength(calendar,ts,fractionalSeconds); }
Write timeStamp in binary format.
public InputBitStream(final InputStream is,final int bufSize,final boolean testForPosition){ this.is=is; wrapping=false; if (!(this.noBuffer=bufSize == 0)) this.buffer=new byte[bufSize]; if (is instanceof RepositionableStream) { repositionableStream=(RepositionableStream)is; fileChannel=null; } else if (testForPosition) { FileChannel fc=null; try { fc=(FileChannel)(is.getClass().getMethod("getChannel")).invoke(is); } catch ( IllegalAccessException e) { } catch ( IllegalArgumentException e) { } catch ( NoSuchMethodException e) { } catch ( InvocationTargetException e) { } catch ( ClassCastException e) { } fileChannel=fc; repositionableStream=null; } else { repositionableStream=null; fileChannel=null; } }
Creates a new input bit stream wrapping a given input stream with a specified buffer size.
private int score(Variable v){ int variableScore=100 - v.variableType; int subStringScore=getLongestCommonSubstring(v.name,fParamName).length(); int shorter=Math.min(v.name.length(),fParamName.length()); if (subStringScore < 0.6 * shorter) subStringScore=0; int positionScore=v.positionScore; int matchedScore=v.alreadyMatched ? 0 : 1; int autoboxingScore=v.isAutoboxingMatch ? 0 : 1; int score=autoboxingScore << 30 | variableScore << 21 | subStringScore << 11 | matchedScore << 10 | positionScore; return score; }
The four order criteria as described below - put already used into bit 10, all others into bits 0-9, 11-20, 21-30; 31 is sign - always 0