code
stringlengths
10
174k
nl
stringlengths
3
129k
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2014-09-03 14:59:51.186 -0400",hash_original_method="A9166391D9A7ACF8C30AB68B073CEF60",hash_generated_method="EAF7FED493196D746F3C93A3E19B3B66") public static void write(File file,CharSequence data,boolean append) throws IOException { write(file,data,Charset.defaultCharset(),append); }
Writes a CharSequence to a file creating the file if it does not exist using the default encoding for the VM.
public CarrierVehicleTypes buildAndWriteVehicleTypes(String vehicleTypeFile,boolean totalCost){ double factor=0.1; double[] fixCostPerKm; if (totalCost) { fixCostPerKm=new double[]{4.1998 * factor,5.1704 * factor,6.5067 * factor,7.4026 * factor,8.2904 * factor}; } else { fixCostPerKm=new double[]{0,0,0,0,0}; } double[] varCostPerKm={7.7637 * factor,9.1092 * factor,9.6589 * factor,7.3485 * factor,7.2059 * factor}; CarrierVehicleType typeThree=CarrierVehicleType.Builder.newInstance(Id.create("3_tonner",VehicleType.class)).setCapacity(3000).setCostPerDistanceUnit(varCostPerKm[0] + fixCostPerKm[0]).build(); CarrierVehicleType typeSix=CarrierVehicleType.Builder.newInstance(Id.create("6_tonner",VehicleType.class)).setCapacity(6000).setCostPerDistanceUnit(varCostPerKm[1] + fixCostPerKm[1]).build(); CarrierVehicleType typeSeven=CarrierVehicleType.Builder.newInstance(Id.create("7_tonner",VehicleType.class)).setCapacity(7000).setCostPerDistanceUnit(varCostPerKm[2] + fixCostPerKm[2]).build(); CarrierVehicleType typeTwelve=CarrierVehicleType.Builder.newInstance(Id.create("12_tonner",VehicleType.class)).setCapacity(12000).setCostPerDistanceUnit(varCostPerKm[3] + fixCostPerKm[3]).build(); CarrierVehicleType typeFifteen=CarrierVehicleType.Builder.newInstance(Id.create("15_tonner",VehicleType.class)).setCapacity(15000).setCostPerDistanceUnit(varCostPerKm[4] + fixCostPerKm[4]).build(); CarrierVehicleTypes carrierVehicleTypes=new CarrierVehicleTypes(); carrierVehicleTypes.getVehicleTypes().put(typeThree.getId(),typeThree); carrierVehicleTypes.getVehicleTypes().put(typeSix.getId(),typeSix); carrierVehicleTypes.getVehicleTypes().put(typeSeven.getId(),typeSeven); carrierVehicleTypes.getVehicleTypes().put(typeTwelve.getId(),typeTwelve); carrierVehicleTypes.getVehicleTypes().put(typeFifteen.getId(),typeFifteen); if (vehicleTypeFile != null) { CarrierVehicleTypeWriter typeWriter=new CarrierVehicleTypeWriter(carrierVehicleTypes); typeWriter.write(vehicleTypeFile); } return carrierVehicleTypes; }
This method builds vehicle types and writes a file containing the vehicle types. Five vehicle types are created with costs relating to the vehicle cost schedule of the RFA.
protected void reset(){ for ( List<? extends Position> boundary : this.boundaries) { if (boundary == null || boundary.size() < 3) continue; if (WWMath.computeWindingOrderOfLocations(boundary) != AVKey.COUNTER_CLOCKWISE) Collections.reverse(boundary); } this.numPositions=this.countPositions(); this.previousIntersectionShapeData=null; this.previousIntersectionTerrain=null; this.previousIntersectionGlobeStateKey=null; super.reset(); }
Void any computed data. Called when a factor affecting the computed data is changed.
public Property centuryOfEra(){ return new Property(this,getChronology().centuryOfEra()); }
Get the century of era property.
public JClassDependency(String className,String digest){ _className=className; String newDigest=getDigest(); if (!newDigest.equals(digest)) { if (log.isLoggable(Level.FINE)) log.fine(_className + " digest is modified."); _isDigestModified=true; } }
Create a new dependency with a given digest.
public PBEWithMD5AndDESCipher() throws NoSuchAlgorithmException, NoSuchPaddingException { core=new PBES1Core("DES"); }
Creates an instance of this cipher, and initializes its mode (CBC) and padding (PKCS5).
public static String toString(Object object,ToStringStyle style,boolean outputTransients){ return toString(object,style,outputTransients,false,null); }
<p> Builds a <code>toString</code> value through reflection. </p> <p> It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will throw a security exception if run under a security manager, if the permissions are not set up correctly. It is also not as efficient as testing explicitly. </p> <p> If the <code>outputTransients</code> is <code>true</code>, transient members will be output, otherwise they are ignored, as they are likely derived fields, and not part of the value of the Object. </p> <p> Static fields will not be included. Superclass fields will be appended. </p> <p> If the style is <code>null</code>, the default <code>ToStringStyle</code> is used. </p>
public void paintSliderBorder(SynthContext context,Graphics g,int x,int y,int w,int h,int orientation){ paintSliderBorder(context,g,x,y,w,h); }
Paints the border of a slider. This implementation invokes the method of the same name without the orientation.
public static void main(String[] args) throws IOException { boolean enableOutput=true; boolean outputToFile=false; String inputFolder=LrrMmt.class.getClassLoader().getResource("workload/planetlab").getPath(); String outputFolder="output"; String workload="20110303"; String vmAllocationPolicy="lrr"; String vmSelectionPolicy="mmt"; String parameter="1.2"; new PlanetLabRunner(enableOutput,outputToFile,inputFolder,outputFolder,workload,vmAllocationPolicy,vmSelectionPolicy,parameter); }
The main method.
public static void main(final String[] args){ DOMTestCase.doMain(getAttributeNS01.class,args); }
Runs this test from the command line.
public int compareToIgnoreCase(CharSeq another){ return str.compareToIgnoreCase(another.str); }
Compares two CharSeqs lexicographically ignore case differences.
public LIMIT LIMIT(String limit){ return new LIMIT(this,limit); }
Adds a SQL LIMIT clause
protected AbstractMetadataRegexAnnotator(String regex,int matcherGroup,boolean caseSensitive,String key,int valueGroup){ super(regex,matcherGroup,caseSensitive,1.0); this.key=key; this.valueGroup=valueGroup; }
New instance.
synchronized boolean isSuspendedInTransaction(CompositeTransaction ct){ return state.isSuspendedInTransaction(ct); }
Checks if this branch is suspended in the given transaction.
public static _ConstantRecordSearchFactor fromString(final String value) throws SOAPSerializationException { return (_ConstantRecordSearchFactor)Enumeration.fromString(value,_ConstantRecordSearchFactor.VALUES_TO_INSTANCES); }
Gets the specific enumeration value in this class appropriate for the given XML attribute value. If no value is known, null is returned (_DEFAULT is not used; that value is for when the attribute is not present).
private void addFinally(ArrayList returnList,Stmnt finallyBlock) throws CompileError { Bytecode bc=bytecode; int n=returnList.size(); for (int i=0; i < n; ++i) { final int[] ret=(int[])returnList.get(i); int pc=ret[0]; bc.write16bit(pc,bc.currentPc() - pc + 1); ReturnHook hook=new JsrHook2(this,ret); finallyBlock.accept(this); hook.remove(this); if (!hasReturned) { bc.addOpcode(Opcode.GOTO); bc.addIndex(pc + 3 - bc.currentPc()); } } }
Adds a finally clause for earch return statement.
public X509CRLImpl(InputStream in) throws CRLException { try { this.crl=(CertificateList)CertificateList.ASN1.decode(in); this.tbsCertList=crl.getTbsCertList(); this.extensions=tbsCertList.getCrlExtensions(); } catch ( IOException e) { throw new CRLException(e); } }
Creates X.509 CRL on the base of ASN.1 DER encoded form of the CRL (CertificateList structure described in RFC 3280) provided via input stream.
public PingResponse isReachable(HostAddress host) throws HostException { PingResponse response=new PingResponse(); response.setReachable(false); for ( String name : this.getEnabledMethodNames()) { PingNotification notification=_isReachableByMethod(name,host); response.addNotification(notification); response.setReachable(notification.isReachable()); if (response.isReachable()) { break; } } return response; }
Returns true if the host is reachable by an available ping method. This method clears previous notifications.
public void lockAndSwitchMaster(Protocol newMasterProtocol) throws ReconnectDuringTransactionException { if (masterProtocol != null && !masterProtocol.isClosed()) { masterProtocol.close(); } if (!currentReadOnlyAsked || isSecondaryHostFail()) { try { syncConnection(currentProtocol,newMasterProtocol); } catch ( Exception e) { } currentProtocol=newMasterProtocol; } boolean inTransaction=this.masterProtocol != null && this.masterProtocol.inTransaction(); this.masterProtocol=newMasterProtocol; resetMasterFailoverData(); if (inTransaction) { throw new ReconnectDuringTransactionException("Connection reconnect automatically during an active transaction",1401,"25S03"); } }
Use the parameter newMasterProtocol as new current master connection.
public void testBaseUriResolutionWithHashes() throws Exception { document=builder.parse(new InputSource(new StringReader("<a xml:base=\"http://a1/a2\">" + " <b xml:base=\"b1#b2\"/>" + " <c xml:base=\"#c1\">"+ " <d xml:base=\"\"/>"+ " </c>"+ " <e xml:base=\"\"/>"+ "</a>"))); Element a=document.getDocumentElement(); assertEquals("http://a1/a2",a.getBaseURI()); String message="This implementation's getBaseURI() doesn't handle " + "relative URIs with hashes"; Element b=(Element)a.getChildNodes().item(1); Element c=(Element)a.getChildNodes().item(3); Element d=(Element)c.getChildNodes().item(1); Element e=(Element)a.getChildNodes().item(5); assertEquals(message,"http://a1/b1#b2",b.getBaseURI()); assertEquals(message,"http://a1/a2#c1",c.getBaseURI()); assertEquals(message,"http://a1/a2#c1",d.getBaseURI()); assertEquals(message,"http://a1/a2",e.getBaseURI()); }
According to the <a href="http://www.w3.org/TR/xmlbase/">XML Base</a> spec, fragments (like "#frag" or "") should not be dereferenced.
public void extendTo(long newMax){ if (newMax < mCurrentLength) { throw new IllegalArgumentException("" + newMax + " is less than current length of: "+ mCurrentLength); } while (mTotalSize < newMax) { final long i=mTotalSize >>> mBits; if (i >= mData.length) { final long newSize=(mData.length + 1) * 2; if (newSize > Integer.MAX_VALUE) { throw new RuntimeException("Attempting to allocate too large a chunk array. newSize=" + newSize); } mData=Arrays.copyOf(mData,(int)newSize); } final int ii=(int)i; if (mData[ii] == null) { mData[ii]=new byte[mChunkSize]; mTotalSize+=mChunkSize; } else { final byte[] newSubArray=new byte[mChunkSize]; final byte[] arr=mData[ii]; final int lenArr=arr.length; System.arraycopy(arr,0,newSubArray,0,lenArr); mTotalSize+=mChunkSize - lenArr; mData[ii]=newSubArray; } } mCurrentLength=newMax; }
Ensure there is enough space to store at least given number of entries. Internally there may be room for more.
public InstructionGraphEdge(final InstructionGraphNode source,final InstructionGraphNode target,final EdgeType edgeType){ super(source,target); this.edgeType=Preconditions.checkNotNull(edgeType,"Error: edgeType argument can not be null"); }
Creates a new instruction graph edge.
public static String toPoints(Point2D.Double[] points) throws IOException { StringBuilder buf=new StringBuilder(); for (int i=0; i < points.length; i++) { if (i != 0) { buf.append(", "); } buf.append(toNumber(points[i].x)); buf.append(','); buf.append(toNumber(points[i].y)); } return buf.toString(); }
Returns a Point2D.Double array as a Points attribute value. as specified in http://www.w3.org/TR/SVGMobile12/shapes.html#PointsBNF
@XmlElement(name="licensed_ind") public boolean isLicensed(){ return licensed; }
Flag which indicates if the application contains a license file..whether expired or not.
protected void frameInit(){ super.frameInit(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); Container c=getContentPane(); if (c instanceof JPanel) { JPanel panel=(JPanel)c; panel.getActionMap().put(CDialog.ACTION_DISPOSE,CDialog.s_dialogAction); panel.getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW).put(CDialog.s_disposeKeyStroke,CDialog.ACTION_DISPOSE); } }
Frame Init. Install ALT-Pause
public static Object withInputStream(File file,@ClosureParams(value=SimpleType.class,options="java.io.InputStream") Closure closure) throws IOException { return IOGroovyMethods.withStream(newInputStream(file),closure); }
Create a new InputStream for this file and passes it into the closure. This method ensures the stream is closed after the closure returns.
public AttachmentNoSoapResponse(){ requestFileName="getstate.query"; responseFile="attachm-no-soap.query"; responseContentType="multipart/related; charset=UTF-8; " + "boundary=jetty771207119h3h10dty"; }
Constructs the test case.
public static char[] toCharArray(InputStream is,Charset encoding) throws IOException { CharArrayWriter output=new CharArrayWriter(); copy(is,output,encoding); return output.toCharArray(); }
Get the contents of an <code>InputStream</code> as a character array using the specified character encoding. <p> This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>.
public void handleEvent(Event evt){ Node node=(Node)evt.getTarget(); while (node != null && !(node instanceof SVGOMElement)) { node=(Node)((AbstractNode)node).getParentNodeEventTarget(); } BridgeUpdateHandler h=getBridgeUpdateHandler(node); if (h != null) { try { h.handleDOMCharacterDataModified((MutationEvent)evt); } catch ( Exception e) { userAgent.displayError(e); } } }
Handles 'DOMCharacterDataModified' event type.
static Annotation parseAnnotation(ByteBuffer buf,ConstantPool constPool,Class<?> container,boolean exceptionOnMissingAnnotationClass){ return parseAnnotation2(buf,constPool,container,exceptionOnMissingAnnotationClass,null); }
Parses the annotation at the current position in the specified byte buffer, resolving constant references in the specified constant pool. The cursor of the byte buffer must point to an "annotation structure" as described in the RuntimeVisibleAnnotations_attribute: annotation { u2 type_index; u2 num_member_value_pairs; { u2 member_name_index; member_value value; } member_value_pairs[num_member_value_pairs]; } } Returns the annotation, or null if the annotation's type cannot be found by the VM, or is not a valid annotation type.
public boolean isValidInspector(){ return validInspector; }
Returns true if the inspector is valid. By default this returns false.
private void drawItems(Canvas canvas){ canvas.save(); int top=(currentItem - firstItem) * getItemHeight() + (getItemHeight() - getHeight()) / 2; canvas.translate(PADDING,-top + scrollingOffset); itemsLayout.draw(canvas); canvas.restore(); }
Draws items
public Attribute removeAttribute(String name){ for (int i=_attributes.size() - 1; i >= 0; i--) { Attribute attr=_attributes.get(i); if (attr.getName().equals(name)) { _attributes.remove(i); return attr; } } return null; }
Removes an attribute.
public void initDiskCache(){ synchronized (mDiskCacheLock) { if (mDiskLruCache == null || mDiskLruCache.isClosed()) { File diskCacheDir=mCacheParams.diskCacheDir; if (mCacheParams.diskCacheEnabled && diskCacheDir != null) { if (!diskCacheDir.exists()) { diskCacheDir.mkdirs(); } if (getUsableSpace(diskCacheDir) > mCacheParams.diskCacheSize) { try { mDiskLruCache=DiskLruCache.open(diskCacheDir,1,1,mCacheParams.diskCacheSize); if (BuildConfig.DEBUG) { Log.d(TAG,"Disk cache initialized"); } } catch ( final IOException e) { mCacheParams.diskCacheDir=null; Log.e(TAG,"initDiskCache - " + e); } } } } mDiskCacheStarting=false; mDiskCacheLock.notifyAll(); } }
Initializes the disk cache. Note that this includes disk access so this should not be executed on the main/UI thread. By default an ImageCache does not initialize the disk cache when it is created, instead you should call initDiskCache() to initialize it on a background thread.
boolean isLaunchable(){ return false; }
Determines if this line is launchable.
public GossipSeed(InetSocketAddress endpoint,String hostHeader){ this.endpoint=endpoint; this.hostHeader=hostHeader; }
Creates a new instance with the specified endpoint and host header.
@Override public List<Action> search(Problem problem,Queue<Node> frontier){ explored.clear(); frontierStates.clear(); return super.search(problem,frontier); }
Clears the set of explored states and calls the search implementation of <code>QueSearch</code>
public FastCharBuffer append(FastCharBuffer buff){ if (buff.size == 0) { return this; } for (int i=0; i < buff.currentBufferIndex; i++) { append(buff.buffers[i]); } append(buff.currentBuffer,0,buff.offset); return this; }
Appends another fast buffer to this one.
public static boolean isXML11Space(int c){ return (c < 0x10000 && (XML11CHARS[c] & MASK_XML11_SPACE) != 0); }
Returns true if the specified character is a space character as amdended in the XML 1.1 specification.
@Override public GridNioFuture<Boolean> onSessionClose(GridNioSession ses) throws IgniteCheckedException { return tail.onSessionClose(ses); }
Starts chain notification from tail to head.
public boolean isMessageIdRequired(){ return false; }
Returns whether or not this message needs to include a message ID.
@Override public boolean nextBoolean(){ return next(1) != 0; }
This method is missing from jdk 1.0.x and below. JDK 1.1 includes this for us, but what the heck.
public void storeDeviceThrottled(Device d){ long intervalNs=syncStoreWriteIntervalMs * 1000L * 1000L; if (!isMaster) return; if (d == null) return; long now=System.nanoTime(); Long last=lastWriteTimes.get(d.getDeviceKey()); if (last == null || now - last > intervalNs) { writeUpdatedDeviceToStorage(d); lastWriteTimes.put(d.getDeviceKey(),now); } else { cntDeviceStoreThrottled.updateCounterWithFlush(); } }
Write the given device to storage if we are MASTER and if the last write for the device was more than this.syncStoreIntervalNs time ago. Use this method to updated last active times in the store.
protected ClientHttpRequest createHttpRequest(final Link link){ final ClientHttpRequest request=new ClientHttpRequest(link); request.addHeaderValues(HttpHeader.USER_AGENT.getName(),USER_AGENT_HTTP_REQUEST_HEADER_VALUE); request.getHeaders().setAccept(getAcceptableMediaTypes()); if (this.securityProperties != null) { Iterator<Entry<String,String>> it=this.securityProperties.entrySet().iterator(); while (it.hasNext()) { Entry<String,String> entry=it.next(); request.addHeaderValues(entry.getKey(),entry.getValue()); } } return request; }
Creates an instance of a client HTTP request with the specified Link targeting the resource as well as the intended operation on the resource.
private void processCommonFilterStatus(final TargetUpdateStatus status,final boolean buttonPressed){ if (buttonPressed) { buttonClicked.addStyleName(BTN_CLICKED); managementUIState.getTargetTableFilters().getClickedStatusTargetTags().add(status); eventBus.publish(this,TargetFilterEvent.FILTER_BY_STATUS); } else { buttonClicked.removeStyleName(BTN_CLICKED); managementUIState.getTargetTableFilters().getClickedStatusTargetTags().remove(status); eventBus.publish(this,TargetFilterEvent.REMOVE_FILTER_BY_STATUS); } }
Process - COMMON PROCESS.
private void writeObject(ObjectOutputStream out) throws ClassNotFoundException, IOException { out.defaultWriteObject(); out.writeObject(SerializationUtils.wrap(borderStroke)); }
Custom serialization method.
protected void paintPlaceholderText(SeaGlassContext context,Graphics g,JComponent c){ g.setColor(placeholderColor); g.setFont(c.getFont()); Rectangle innerArea=SwingUtilities.calculateInnerArea(c,null); Rectangle cancelBounds=getCancelButtonBounds(); context.getStyle().getGraphicsUtils(context).paintText(context,g,getPlaceholderText(g,innerArea.width + cancelBounds.width),innerArea.x,innerArea.y,-1); }
DOCUMENT ME!
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:55:12.848 -0500",hash_original_method="08919BACEEB275448156EA2ACF7B3D6A",hash_generated_method="43830782CE56377739CB711511AC20E1") public boolean inUse(){ synchronized (messageQueue) { return messageQueue.size() != 0; } }
Return true if there are any messages in use.
public void initialize(GL10 gl){ mState=STATE_INITIALIZED; int[] textures=new int[1]; gl.glGenTextures(1,textures,0); mTextureID=textures[0]; gl.glBindTexture(GL10.GL_TEXTURE_2D,mTextureID); gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MAG_FILTER,GL10.GL_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_S,GL10.GL_CLAMP_TO_EDGE); gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_T,GL10.GL_CLAMP_TO_EDGE); gl.glTexEnvf(GL10.GL_TEXTURE_ENV,GL10.GL_TEXTURE_ENV_MODE,GL10.GL_REPLACE); }
Call to initialize the class. Call whenever the surface has been created.
public ByteVector putLong(final long l){ int length=this.length; if (length + 8 > data.length) { enlarge(8); } byte[] data=this.data; int i=(int)(l >>> 32); data[length++]=(byte)(i >>> 24); data[length++]=(byte)(i >>> 16); data[length++]=(byte)(i >>> 8); data[length++]=(byte)i; i=(int)l; data[length++]=(byte)(i >>> 24); data[length++]=(byte)(i >>> 16); data[length++]=(byte)(i >>> 8); data[length++]=(byte)i; this.length=length; return this; }
Puts a long into this byte vector. The byte vector is automatically enlarged if necessary.
private int[] shift(int[] array,int val){ array[0]=array[1]; array[1]=array[2]; array[2]=array[3]; array[3]=array[4]; array[4]=val; return array; }
Shift array 16 bits and add val to index.length - 1.
public static boolean isCacheSafe(Class<?> clazz,ClassLoader classLoader){ Assert.notNull(clazz,"Class must not be null"); try { ClassLoader target=clazz.getClassLoader(); if (target == null) { return true; } ClassLoader cur=classLoader; if (cur == target) { return true; } while (cur != null) { cur=cur.getParent(); if (cur == target) { return true; } } return false; } catch ( SecurityException ex) { return true; } }
Check whether the given class is cache-safe in the given context, i.e. whether it is loaded by the given ClassLoader or a parent of it.
public byte decode16BitsTo8Bits(int s){ return (byte)((s >> 8) & 0xffff); }
Returns an unsigned 8 bit value computed by dithering the unsigned 16 bit value. Note that the TIFF specified short datatype is an unsigned value, while Java's <code>short</code> datatype is a signed value. Therefore the Java <code>short</code> datatype cannot be used to store the TIFF specified short value. A Java <code>int</code> is used as input instead to this method. The method deals correctly only with 16 bit unsigned values.
private static int blend_difference(int a,int b){ int f=(b & ALPHA_MASK) >>> 24; int ar=(a & RED_MASK) >> 16; int ag=(a & GREEN_MASK) >> 8; int ab=(a & BLUE_MASK); int br=(b & RED_MASK) >> 16; int bg=(b & GREEN_MASK) >> 8; int bb=(b & BLUE_MASK); int cr=(ar > br) ? (ar - br) : (br - ar); int cg=(ag > bg) ? (ag - bg) : (bg - ag); int cb=(ab > bb) ? (ab - bb) : (bb - ab); return (low(((a & ALPHA_MASK) >>> 24) + f,0xff) << 24 | (peg(ar + (((cr - ar) * f) >> 8)) << 16) | (peg(ag + (((cg - ag) * f) >> 8)) << 8) | (peg(ab + (((cb - ab) * f) >> 8)))); }
returns the absolute value of the difference of the input colors C = |A - B|
public static Object instantiateObject(String className,PackageType packageType,Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException { return instantiateObject(packageType.getClass(className),arguments); }
Returns an instance of a desired class with the given arguments
public static byte[] twoBytePacket(int address,boolean longAddr,byte arg1,byte arg2){ if (!addressCheck(address,longAddr)) { return null; } byte[] retVal; if (longAddr) { retVal=new byte[5]; retVal[0]=(byte)(192 + ((address / 256) & 0x3F)); retVal[1]=(byte)(address & 0xFF); retVal[2]=arg1; retVal[3]=arg2; retVal[4]=(byte)(retVal[0] ^ retVal[1] ^ retVal[2]^ retVal[3]); } else { retVal=new byte[4]; retVal[0]=(byte)(address & 0xFF); retVal[1]=arg1; retVal[2]=arg2; retVal[3]=(byte)(retVal[0] ^ retVal[1] ^ retVal[2]); } return retVal; }
Create a packet containing a two-byte instruction.
private void fillArguments(DLangRunDmdConfiguration config){ Module module=comboModules.getSelectedModule(); if (module == null) { return; } try { java.util.List<String> args=DLangDmdConfigToArgsConverter.getDmdParameters(config,module); textArgsPane.setText(StringUtils.join(args,"\n")); } catch ( NoSourcesException e) { textArgsPane.setText("*Exception*:\n" + e.getMessage()); } catch ( ExecutionException e) { textArgsPane.setText("*Exception*:\n" + e.getMessage()); } }
Update "textArgsPane" text area with actual DMD command line arguments
public void removeObserver(final T observer){ observers.remove(observer); }
Remove one observer
public void testRandomStrings() throws Exception { Analyzer analyzer=new GalicianAnalyzer(); checkRandomData(random(),analyzer,1000 * RANDOM_MULTIPLIER); analyzer.close(); }
blast some random strings through the analyzer
private void marshallPrimitive(Object value,PrimitiveType primitiveType) throws XMLStreamException { LOG.debug("Primitive value: {} of type: {}",value,primitiveType); if (value != null) { xmlWriter.writeCharacters(value.toString()); } }
Marshall a primitive value.
protected UDPMasterTerminal(InetAddress addr){ address=addr; }
Create a UDP master connection to the specified Internet address.
public HashDocSet(int[] docs,int offset,int len){ this(docs,offset,len,DEFAULT_INVERSE_LOAD_FACTOR); }
Create a HashDocSet from a list of *unique* ids
public static double sum(double[] array){ double sum=0; for ( double x : array) { sum+=x; } return sum; }
Sum all numbers from array.
public NodeTest(int whatToShow,String namespace,String name){ initNodeTest(whatToShow,namespace,name); }
Construct an NodeTest that tests for namespaces and node names.
public ActivityChooserView(Context context,AttributeSet attrs){ this(context,attrs,0); }
Create a new instance.
public Builder badge(int value){ badge=value; return this; }
Sets the badge property.
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.
public void buildTrapEntries(Hashtable<InetAddress,Vector<String>> dest){ if (children != null) { for (int i=0; i < children.length; ++i) { SimpleNode n=(SimpleNode)children[i]; if (n != null) { n.buildTrapEntries(dest); } } } }
Build the Trap entries from the syntactic tree.
public void reset(){ n_=0; combinedBufferItemCapacity_=Math.min(Util.MIN_BASE_BUF_SIZE,2 * k_); combinedBuffer_=new Object[combinedBufferItemCapacity_]; baseBufferCount_=0; bitPattern_=0; minValue_=null; maxValue_=null; }
Resets this sketch to a virgin state, but retains the original value of k.
public String printFeatures(){ int i; String s=""; for (i=0; i < m_decisionFeatures.length; i++) { if (i == 0) { s="" + (m_decisionFeatures[i] + 1); } else { s+="," + (m_decisionFeatures[i] + 1); } } return s; }
Returns a string description of the features selected
public void removeVisualizationListener(VisualizationListener listener){ vistree.removeVisualizationListener(listener); }
Add a listener.
public void testSqlCrossCacheQueryFailedMetrics() throws Exception { IgniteCache<String,Integer> cache=grid(0).context().cache().jcache("A"); SqlFieldsQuery qry=new SqlFieldsQuery("select * from \"G\".Integer"); testQueryFailedMetrics(cache,qry); }
Test metrics for failed SQL cross cache queries.
@Override public boolean isActive(){ return amIActive; }
Used by the Whitebox GUI to tell if this plugin is still running.
@Override public void updateStatus(JobContext jobContext) throws Exception { DbClient dbClient=jobContext.getDbClient(); try { if (_status == JobStatus.IN_PROGRESS) { return; } String opId=getTaskCompleter().getOpId(); StringBuilder logMsgBuilder=new StringBuilder(String.format("Updating status of job %s to %s",opId,_status.name())); List<Volume> volumes=dbClient.queryObject(Volume.class,getTaskCompleter().getIds()); Set<URI> poolURIs=new HashSet<URI>(); for ( Volume volume : volumes) { poolURIs.add(volume.getPool()); } VNXeApiClient vnxeApiClient=getVNXeClient(jobContext); if (_status == JobStatus.SUCCESS || _status == JobStatus.FAILED) { for ( URI poolURI : poolURIs) { VNXeJob.updateStoragePoolCapacity(dbClient,vnxeApiClient,poolURI,null); } } if (_status == JobStatus.SUCCESS) { for ( Volume volume : volumes) { volume.setInactive(true); volume.setConsistencyGroup(NullColumnValueGetter.getNullURI()); dbClient.updateObject(volume); if (logMsgBuilder.length() != 0) { logMsgBuilder.append("\n"); } logMsgBuilder.append(String.format("Successfully deleted volume %s",volume.getId())); } } else if (_status == JobStatus.FAILED) { for ( URI id : getTaskCompleter().getIds()) { if (logMsgBuilder.length() != 0) { logMsgBuilder.append("\n"); } logMsgBuilder.append(String.format("Failed to delete volume: %s",id)); } } _logger.info(logMsgBuilder.toString()); } catch ( Exception e) { _logger.error("Caught an exception while trying to updateStatus for VNXeDeleteVolumesJob",e); setErrorStatus("Encountered an internal error during volume delete job status processing : " + e.getMessage()); } finally { super.updateStatus(jobContext); } }
Called to update the job status when the volumes delete job completes.
private static int LocationToLine(IDocument document,int location) throws BadLocationException { if (location == -1) { return -1; } else { return document.getLineOfOffset(location); } }
If location = -1, then it returns -1. Else it returns the number of the line with this location.
public byte[] bytes(){ return ref.bytes; }
Return a reference to the bytes of this builder.
public static String encodeXmlValue(String inString){ String retString=inString; retString=StringUtil.replaceString(retString,"&","&amp;"); retString=StringUtil.replaceString(retString,"<","&lt;"); retString=StringUtil.replaceString(retString,">","&gt;"); retString=StringUtil.replaceString(retString,"\"","&quot;"); retString=StringUtil.replaceString(retString,"'","&apos;"); return retString; }
Encodes an XML string replacing the characters '<', '>', '"', ''', '&'
public int addTree(){ int total=value; if (left != null) total+=left.addTree(); if (right != null) total+=right.addTree(); return total; }
Add the value of this node with the cumulative values of the children of this node.
public boolean offer(PooledConnection pooledConnection){ acquiredConnections.remove(pooledConnection); boolean offer=queue.offer(pooledConnection); if (!offer) { pooledConnection.dispose(); } if (isTerminating.get()) { PooledConnection poll=queue.poll(); if (poll != null) { poll.dispose(); } } return offer; }
Offer a connections back to the queue
public static boolean isEmpty(Object[] array){ return array == null || array.length == 0; }
Returns <code>true</code> if the given array is null or is empty.
public static void computeBestFittingControlPoints4(java.awt.geom.Point2D[] imagePoints,LatLon[] geoPoints,java.awt.geom.Point2D[] outImagePoints,LatLon[] outGeoPoints){ String message=validateControlPoints(4,imagePoints,geoPoints); if (message != null) { Logging.logger().severe(message); throw new IllegalArgumentException(message); } message=validateControlPoints(3,outImagePoints,outGeoPoints); if (message != null) { Logging.logger().severe(message); throw new IllegalArgumentException(message); } java.awt.geom.Point2D[] bestFitImagePoints=null; LatLon[] bestFitGeoPoints=null; double minError=Double.MAX_VALUE; for ( int[] indices : new int[][]{{0,1,2},{0,1,3},{1,2,3},{0,2,3}}) { java.awt.geom.Point2D[] points=new java.awt.geom.Point2D[]{imagePoints[indices[0]],imagePoints[indices[1]],imagePoints[indices[2]]}; LatLon[] locations=new LatLon[]{geoPoints[indices[0]],geoPoints[indices[1]],geoPoints[indices[2]]}; Matrix m=Matrix.fromImageToGeographic(points,locations); double error=0.0; for (int j=0; j < 4; j++) { Vec4 vec=new Vec4(imagePoints[j].getX(),imagePoints[j].getY(),1.0).transformBy3(m); LatLon ll=LatLon.fromDegrees(vec.y,vec.x); LatLon diff=geoPoints[j].subtract(ll); double d=diff.getLatitude().degrees * diff.getLatitude().degrees + diff.getLongitude().degrees * diff.getLongitude().degrees; error+=d; } if (error < minError) { bestFitImagePoints=points; bestFitGeoPoints=locations; minError=error; } } if (bestFitImagePoints != null) { System.arraycopy(bestFitImagePoints,0,outImagePoints,0,3); System.arraycopy(bestFitGeoPoints,0,outGeoPoints,0,3); } }
Computes which three control points out of four provide the best estimate an image's geographic location. The result is placed in the output parameters <code>outImagePoints</code> and <code>outGeoPoints</code>, both of which must be non-null and at least length 3.
public static boolean groupVerify(int userId,int groupId,OperationType operationType,int dstUserId){ if (isAdmin(userId)) { return true; } UserGroupMap userGroup=authBiz.getUserGroup(userId,groupId); Role userRoleType=Role.NOTEXIST; if (userGroup != null) { userRoleType=userGroup.getRole(); } boolean result=false; switch (operationType) { case DELETE: result=userRoleType.getAccessLevel() <= Role.MASTER.getAccessLevel(); break; case ADDGROUPMEMBER: case MODIFYGROUPMEMBER: result=userRoleType.getAccessLevel() <= Role.MASTER.getAccessLevel(); break; case DELETEGROUPMEMBER: if (userRoleType.getAccessLevel() <= Role.MASTER.getAccessLevel()) { if (userId == dstUserId) { if (authBiz.masterCountInGroup(groupId) <= 1) { result=false; } else { result=true; } } else { result=true; } } else { result=(userId == dstUserId); } break; case LISTGROUPMEMBER: result=userRoleType.getAccessLevel() < Role.NOTEXIST.getAccessLevel(); break; case GET: result=userRoleType.getAccessLevel() <= Role.REPORTER.getAccessLevel(); break; case MODIFY: result=userRoleType.getAccessLevel() <= Role.DEVELOPER.getAccessLevel(); break; } if (!result) { throw new PermitException(userId,groupId,operationType,dstUserId); } return true; }
user group related verify
public static void submit(String xml,Patient patient){ Element patientNode=XformBuilder.getElement(XformBuilder.getDocument(xml).getRootElement(),XformBuilder.NODE_PATIENT); if (patientNode == null) return; if (XformBuilder.getElement(patientNode,RelativeBuilder.NODE_RELATIVE) == null) { return; } PersonService ps=Context.getPersonService(); List<Relationship> deletedRelationships=ps.getRelationshipsByPerson(patient); List<Relationship> newRelationships=new ArrayList<Relationship>(); for (int i=0; i < patientNode.getChildCount(); i++) { if (patientNode.getType(i) != Element.ELEMENT || !RelativeBuilder.NODE_RELATIVE.equals(patientNode.getElement(i).getName())) { continue; } Element relativeNode=patientNode.getElement(i); String relationshipUuid=relativeNode.getAttributeValue(null,XformBuilder.ATTRIBUTE_UUID); if (!("true()".equals(relativeNode.getAttributeValue(null,"new"))) && StringUtils.isNotBlank(relationshipUuid)) { updateRelationship(relationshipUuid,relativeNode,patient,deletedRelationships,ps); continue; } Relationship relationship=getRelationship(relativeNode,patient,ps); if (relationship != null) { newRelationships.add(relationship); } } for ( Relationship reltnp : newRelationships) { ps.saveRelationship(reltnp); } for ( Relationship reltnp : deletedRelationships) { ps.purgeRelationship(reltnp); } }
Saves relationships which have been edited, added, or deleted.
public static int EPROTONOSUPPORT(){ return Errno.EPROTONOSUPPORT.intValue(); }
Protocol not supported
public static Number minus(Number left,Number right){ return NumberMath.subtract(left,right); }
Subtraction of two Numbers.
public Element writeMatrix(Element parent,Object o,String name) throws Exception { weka.core.matrix.Matrix matrix; Element node; if (DEBUG) { trace(new Throwable(),name); } m_CurrentNode=parent; matrix=(weka.core.matrix.Matrix)o; node=addElement(parent,name,o.getClass().getName(),false); invokeWriteToXML(node,matrix.getArray(),VAL_CELLS); return node; }
adds the given Matrix to a DOM structure.
@Override public boolean execute(final String[] params,final String remainder){ final RPAction action=new RPAction(); action.put("type","ignore"); if (params[0] == null) { action.put("list","1"); } else { action.put("target",params[0]); String duration=params[1]; if (duration != null) { if (!duration.equals("*") || !duration.equals("-")) { try { Integer.parseInt(duration); } catch ( final NumberFormatException ex) { return false; } action.put("duration",duration); } } if (remainder.length() != 0) { action.put("reason",remainder); } } ClientSingletonRepository.getClientFramework().send(action); return true; }
Execute an ignore command.
@Override public void run(){ amIActive=true; String inputFilesString=null; String fileName=null; String inputDataFile=null; String whiteboxHeaderFile=null; String whiteboxDataFile=null; WhiteboxRaster output=null; int i=0; int row, col, rows, cols; String[] imageFiles; int numImages=0; double noData=-32768; InputStream inStream=null; OutputStream outStream=null; String dataType="float"; String dataScale="rgb"; DataInputStream in=null; BufferedReader br=null; String str1=null; FileWriter fw=null; BufferedWriter bw=null; PrintWriter out=null; if (args.length <= 0) { showFeedback("Plugin parameters have not been set."); return; } inputFilesString=args[0]; if ((inputFilesString == null)) { showFeedback("One or more of the input parameters have not been set properly."); return; } imageFiles=inputFilesString.split(";"); numImages=imageFiles.length; try { for (i=0; i < numImages; i++) { int progress=(int)(100f * i / (numImages - 1)); if (numImages > 1) { updateProgress("Loop " + (i + 1) + " of "+ numImages+ ":",progress); } fileName=imageFiles[i]; if (!((new File(fileName)).exists())) { showFeedback("Image file does not exist."); break; } File file=new File(fileName); String fileExtension=whitebox.utilities.FileUtilities.getFileExtension(fileName).toLowerCase(); String[] formatNames=ImageIO.getReaderFormatNames(); boolean checkForSupportedFormat=false; for ( String str : formatNames) { if (str.toLowerCase().equals(fileExtension)) { checkForSupportedFormat=true; break; } } if (!checkForSupportedFormat) { showFeedback("This image file format is not currently supported by this tool."); return; } BufferedImage image=ImageIO.read(new File(fileName)); rows=image.getHeight(); cols=image.getWidth(); if (image.getColorModel().getPixelSize() == 24) { dataType="float"; dataScale="rgb"; } int dot=imageFiles[i].lastIndexOf("."); String imageExtension=imageFiles[i].substring(dot + 1); whiteboxHeaderFile=imageFiles[i].replace(imageExtension,"dep"); whiteboxDataFile=imageFiles[i].replace(imageExtension,"tas"); char[] extChars=imageExtension.toCharArray(); boolean worldFileFound=false; String wfExtension=Character.toString(extChars[0]) + Character.toString(extChars[2]) + "w"; String worldFile=imageFiles[i].replace(imageExtension,wfExtension); if ((new File(worldFile)).exists()) { worldFileFound=true; } else { wfExtension=imageExtension + "w"; worldFile=imageFiles[i].replace(imageExtension,wfExtension); if ((new File(worldFile)).exists()) { worldFileFound=true; } else { wfExtension=".wld"; worldFile=imageFiles[i].replace(imageExtension,wfExtension); if ((new File(worldFile)).exists()) { worldFileFound=true; } } } if (worldFileFound) { double A=0, B=0, C=0, D=0, E=0, F=0; FileInputStream fstream=new FileInputStream(worldFile); in=new DataInputStream(fstream); br=new BufferedReader(new InputStreamReader(in)); String line; int n=0; while ((line=br.readLine()) != null) { switch (n) { case 0: A=Double.parseDouble(line); break; case 1: D=Double.parseDouble(line); break; case 2: B=Double.parseDouble(line); break; case 3: E=Double.parseDouble(line); break; case 4: C=Double.parseDouble(line); break; case 5: F=Double.parseDouble(line); break; } n++; } if (B == 0 && D == 0) { double west=A * 0 + B * 0 + C; double north=D * 0 + E * 0 + F; double east=A * (cols - 1) + B * (rows - 1) + C; double south=D * (cols - 1) + E * (rows - 1) + F; (new File(whiteboxHeaderFile)).delete(); (new File(whiteboxDataFile)).delete(); fw=new FileWriter(whiteboxHeaderFile,false); bw=new BufferedWriter(fw); out=new PrintWriter(bw,true); String byteOrder=java.nio.ByteOrder.nativeOrder().toString(); str1="Min:\t" + Double.toString(Integer.MAX_VALUE); out.println(str1); str1="Max:\t" + Double.toString(Integer.MIN_VALUE); out.println(str1); str1="North:\t" + Double.toString(north); out.println(str1); str1="South:\t" + Double.toString(south); out.println(str1); str1="East:\t" + Double.toString(east); out.println(str1); str1="West:\t" + Double.toString(west); out.println(str1); str1="Cols:\t" + Integer.toString(cols); out.println(str1); str1="Rows:\t" + Integer.toString(rows); out.println(str1); str1="Data Type:\t" + dataType; out.println(str1); str1="Z Units:\t" + "not specified"; out.println(str1); str1="XY Units:\t" + "not specified"; out.println(str1); str1="Projection:\t" + "not specified"; out.println(str1); str1="Data Scale:\t" + dataScale; out.println(str1); str1="Preferred Palette:\t" + "greyscale.pal"; out.println(str1); str1="NoData:\t-32768"; out.println(str1); if (byteOrder.toLowerCase().contains("lsb") || byteOrder.toLowerCase().contains("little")) { str1="Byte Order:\t" + "LITTLE_ENDIAN"; } else { str1="Byte Order:\t" + "BIG_ENDIAN"; } out.println(str1); output=new WhiteboxRaster(whiteboxHeaderFile,"rw"); int z, r, g, b; for (row=0; row < rows; row++) { for (col=0; col < cols; col++) { z=image.getRGB(col,row); r=(int)z & 0xFF; g=((int)z >> 8) & 0xFF; b=((int)z >> 16) & 0xFF; output.setValue(row,col,(double)((255 << 24) | (b << 16) | (g << 8)| r)); } } output.findMinAndMaxVals(); output.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); output.addMetadataEntry("Created on " + new Date()); output.writeHeaderFile(); output.close(); } else { showFeedback("We're sorry but Whitebox cannot currently handle the import of rotated images."); break; } } else { double west=0; double north=rows - 1; double east=cols - 1; double south=0; (new File(whiteboxHeaderFile)).delete(); (new File(whiteboxDataFile)).delete(); fw=new FileWriter(whiteboxHeaderFile,false); bw=new BufferedWriter(fw); out=new PrintWriter(bw,true); String byteOrder=java.nio.ByteOrder.nativeOrder().toString(); str1="Min:\t" + Double.toString(Integer.MAX_VALUE); out.println(str1); str1="Max:\t" + Double.toString(Integer.MIN_VALUE); out.println(str1); str1="North:\t" + Double.toString(north); out.println(str1); str1="South:\t" + Double.toString(south); out.println(str1); str1="East:\t" + Double.toString(east); out.println(str1); str1="West:\t" + Double.toString(west); out.println(str1); str1="Cols:\t" + Integer.toString(cols); out.println(str1); str1="Rows:\t" + Integer.toString(rows); out.println(str1); str1="Data Type:\t" + dataType; out.println(str1); str1="Z Units:\t" + "not specified"; out.println(str1); str1="XY Units:\t" + "not specified"; out.println(str1); str1="Projection:\t" + "not specified"; out.println(str1); str1="Data Scale:\t" + dataScale; out.println(str1); str1="Preferred Palette:\t" + "greyscale.pal"; out.println(str1); str1="NoData:\t-32768"; out.println(str1); if (byteOrder.toLowerCase().contains("lsb") || byteOrder.toLowerCase().contains("little")) { str1="Byte Order:\t" + "LITTLE_ENDIAN"; } else { str1="Byte Order:\t" + "BIG_ENDIAN"; } out.println(str1); output=new WhiteboxRaster(whiteboxHeaderFile,"rw"); int z, r, g, b; for (row=0; row < rows; row++) { for (col=0; col < cols; col++) { z=image.getRGB(col,row); r=(int)z & 0xFF; g=((int)z >> 8) & 0xFF; b=((int)z >> 16) & 0xFF; output.setValue(row,col,(double)((255 << 24) | (b << 16) | (g << 8)| r)); } } output.findMinAndMaxVals(); output.addMetadataEntry("Created by the " + getDescriptiveName() + " tool."); output.addMetadataEntry("Created on " + new Date()); output.writeHeaderFile(); output.close(); returnData(whiteboxHeaderFile); } } } 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 StyledToolTipUI(Style style){ this.style=style; border=BorderFactory.createLineBorder(style.getShadowColor()); }
Create a new StyledToolTipUI.
public DrawerBuilder withRecyclerView(@NonNull RecyclerView recyclerView){ this.mRecyclerView=recyclerView; return this; }
Define a custom RecyclerView which will be used in the drawer NOTE: this is not recommended
public ExtZipEntry(ExtZipEntry entry){ super(entry.getName()); setCompressedSize(entry.getCompressedSize()); setSize(entry.getSize()); setComment(entry.getComment()); setTime(entry.getTime()); setMethod(entry.getMethod()); }
copy all "non-compression" attributes
public synchronized void addTextListener(TextListener l){ if (l == null) { return; } textListener=AWTEventMulticaster.add(textListener,l); newEventsOnly=true; }
Adds the specified text event listener to receive text events from this text component. If <code>l</code> is <code>null</code>, no exception is thrown and no action is performed. <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads" >AWT Threading Issues</a> for details on AWT's threading model.
public static boolean hasImmediateRecursiveRuleRefs(GrammarAST t,String ruleName){ if (t == null) return false; GrammarAST blk=(GrammarAST)t.getFirstChildWithType(BLOCK); if (blk == null) return false; int n=blk.getChildren().size(); for (int i=0; i < n; i++) { GrammarAST alt=(GrammarAST)blk.getChildren().get(i); Tree first=alt.getChild(0); if (first == null) continue; if (first.getType() == ELEMENT_OPTIONS) { first=alt.getChild(1); if (first == null) { continue; } } if (first.getType() == RULE_REF && first.getText().equals(ruleName)) return true; Tree rref=first.getChild(1); if (rref != null && rref.getType() == RULE_REF && rref.getText().equals(ruleName)) return true; } return false; }
Match (RULE RULE_REF (BLOCK (ALT .*) (ALT RULE_REF[self] .*) (ALT .*))) Match (RULE RULE_REF (BLOCK (ALT .*) (ALT (ASSIGN ID RULE_REF[self]) .*) (ALT .*)))
public void yypushback(int number){ if (number > yylength()) zzScanError(ZZ_PUSHBACK_2BIG); zzMarkedPos-=number; }
Pushes the specified amount of characters back into the input stream. They will be read again by then next call of the scanning method
public static SimpleModule makeModule(){ Version moduleVersion=new Version(1,0,0,null,null,null); SimpleModule module=new SimpleModule("LocalDate",moduleVersion); module.addSerializer(LocalDate.class,new JavaLocalDateSerializer()); module.addDeserializer(LocalDate.class,new JavaLocalDateDeserializer()); return module; }
Create a module including the serializer and deserializer for local dates
private static void attemptRetryOnException(String logPrefix,Request<?> request,VolleyError exception) throws VolleyError { RetryPolicy retryPolicy=request.getRetryPolicy(); int oldTimeout=request.getTimeoutMs(); try { retryPolicy.retry(exception); } catch ( VolleyError e) { request.addMarker(String.format("%s-timeout-giveup [timeout=%s]",logPrefix,oldTimeout)); throw e; } request.addMarker(String.format("%s-retry [timeout=%s]",logPrefix,oldTimeout)); }
Attempts to prepare the request for a retry. If there are no more attempts remaining in the request's retry policy, a timeout exception is thrown.
public void removed(Container cont){ linkManager.resetLink(); }
Called when the layer is no longer part of the map. In this case, we should disconnect from the server if we have a link.
protected Size2D arrangeRR(BlockContainer container,Graphics2D g2,RectangleConstraint constraint){ Size2D s1=arrangeNN(container,g2); if (constraint.getHeightRange().contains(s1.height)) { return s1; } else { RectangleConstraint c=constraint.toFixedHeight(constraint.getHeightRange().getUpperBound()); return arrangeRF(container,g2,c); } }
Arranges a container with range constraints for both the horizontal and vertical.
public long updateTtl(long elapsedTime){ this.ttl-=elapsedTime; this.currentAnimTimeMillis+=elapsedTime; if (this.currentAnimTimeMillis >= this.getUpdateTextureMillis() && this.animFrames > 0) { this.currentAnimTimeMillis=0; int pos=this.getTextPos(); pos++; if (pos < this.animFrames) { this.setTextPos(pos); } else { this.setTextPos(0); } } return this.ttl; }
Updates the Particle's TTL
private void renderAxes(Camera camera){ glPushMatrix(); glLoadIdentity(); float rotX=camera.getRotation().x; float rotY=camera.getRotation().y; float rotZ=0; glRotatef(rotX,1.0f,0.0f,0.0f); glRotatef(rotY,0.0f,1.0f,0.0f); glRotatef(rotZ,0.0f,0.0f,1.0f); glLineWidth(2.0f); glBegin(GL_LINES); glColor3f(1.0f,0.0f,0.0f); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(1.0f,0.0f,0.0f); glColor3f(0.0f,1.0f,0.0f); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(0.0f,1.0f,0.0f); glColor3f(1.0f,1.0f,1.0f); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(0.0f,0.0f,1.0f); glEnd(); glPopMatrix(); }
Renders the three axis in space (For debugging purposes only