code
stringlengths
10
174k
nl
stringlengths
3
129k
public JsonObject add(String name,float value){ add(name,valueOf(value)); return this; }
Appends a new member to the end of this object, with the specified name and the JSON representation of the specified <code>float</code> value. <p> This method <strong>does not prevent duplicate names</strong>. Calling this method with a name that already exists in the object will append another member with the same name. In order to replace existing members, use the method <code>set(name, value)</code> instead. However, <strong> <em>add</em> is much faster than <em>set</em></strong> (because it does not need to search for existing members). Therefore <em>add</em> should be preferred when constructing new objects. </p>
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) public static boolean sameAs(Typeface typeface1,Typeface typeface2){ if (typeface1 == null) { return typeface2 == null; } else if (typeface2 == null) { return false; } Paint paint=new Paint(); paint.setTypeface(typeface1); Rect bounds=new Rect(); paint.getTextBounds(TEXT,0,TEXT.length(),bounds); Bitmap bitmap1=Bitmap.createBitmap(bounds.width(),bounds.height(),Bitmap.Config.ALPHA_8); Canvas canvas=new Canvas(bitmap1); canvas.drawText(TEXT,0,0,paint); paint.setTypeface(typeface2); paint.getTextBounds(TEXT,0,TEXT.length(),bounds); Bitmap bitmap2=Bitmap.createBitmap(bounds.width(),bounds.height(),Bitmap.Config.ALPHA_8); canvas.setBitmap(bitmap2); canvas.drawText(TEXT,0,0,paint); return bitmap1.sameAs(bitmap2); }
Returns true if all letters of the English alphabet of the typefaces are the same.
public static LazyDequeX<Integer> range(int start,int end){ return fromStreamS(ReactiveSeq.range(start,end)); }
Create a LazyListX that contains the Integers between start and end
protected static String LexicalError(boolean EOFSeen,int lexState,int errorLine,int errorColumn,String errorAfter,char curChar){ return ("Lexical error at line " + errorLine + ", column "+ errorColumn+ ". Encountered: "+ (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar+ "), ")+ "after : \""+ addEscapes(errorAfter)+ "\""); }
Returns a detailed message for the Error when it is thrown by the token manager to indicate a lexical error. Parameters : EOFSeen : indicates if EOF caused the lexicl error curLexState : lexical state in which this error occured errorLine : line number when the error occured errorColumn : column number when the error occured errorAfter : prefix that was seen before this error occured curchar : the offending character Note: You can customize the lexical error message by modifying this method.
private static PrivateKey readPrivateKey(InputStream file) throws IOException, GeneralSecurityException { final DataInputStream input=new DataInputStream(file); try { byte[] bytes=new byte[10000]; int nBytesTotal=0, nBytes; while ((nBytes=input.read(bytes,nBytesTotal,10000 - nBytesTotal)) != -1) { nBytesTotal+=nBytes; } final byte[] bytes2=new byte[nBytesTotal]; System.arraycopy(bytes,0,bytes2,0,nBytesTotal); bytes=bytes2; KeySpec spec=decryptPrivateKey(bytes); if (spec == null) { spec=new PKCS8EncodedKeySpec(bytes); } try { return KeyFactory.getInstance("RSA").generatePrivate(spec); } catch ( final InvalidKeySpecException ex) { return KeyFactory.getInstance("DSA").generatePrivate(spec); } } finally { input.close(); } }
Read a PKCS 8 format private key.
private void createStyles(){ this.redCrossStyle=kmlObjectFactory.createStyleType(); this.redCrossStyle.setId("redCrossStyle"); this.redMinusStyle=kmlObjectFactory.createStyleType(); this.redMinusStyle.setId("redMinusStyle"); this.yellowCrossStyle=kmlObjectFactory.createStyleType(); this.yellowCrossStyle.setId("yellowCrossStyle"); this.yellowMinusStyle=kmlObjectFactory.createStyleType(); this.yellowMinusStyle.setId("yellowMinusStyle"); this.greenCrossStyle=kmlObjectFactory.createStyleType(); this.greenCrossStyle.setId("greenCrossStyle"); this.greenMinusStyle=kmlObjectFactory.createStyleType(); this.greenMinusStyle.setId("greenMinusStyle"); this.greyCrossStyle=kmlObjectFactory.createStyleType(); this.greyCrossStyle.setId("greyCrossStyle"); this.greyMinusStyle=kmlObjectFactory.createStyleType(); this.greyMinusStyle.setId("greyMinusStyle"); byte[] red=new byte[]{(byte)0xFF,(byte)0x0F,(byte)0x0F,(byte)0xBE}; byte[] green=new byte[]{(byte)0xFF,(byte)0x14,(byte)0xDC,(byte)0x0A}; byte[] yellow=new byte[]{(byte)0xFF,(byte)0x14,(byte)0xE6,(byte)0xE6}; byte[] grey=new byte[]{(byte)0xFF,(byte)0x42,(byte)0x42,(byte)0x42}; HashMap<StyleType,byte[]> colors=new HashMap<StyleType,byte[]>(); colors.put(this.redCrossStyle,red); colors.put(this.redMinusStyle,red); colors.put(this.yellowCrossStyle,yellow); colors.put(this.yellowMinusStyle,yellow); colors.put(this.greenCrossStyle,green); colors.put(this.greenMinusStyle,green); colors.put(this.greyCrossStyle,grey); colors.put(this.greyMinusStyle,grey); HashMap<StyleType,String> hrefs=new HashMap<StyleType,String>(); hrefs.put(this.redCrossStyle,CROSSICON); hrefs.put(this.redMinusStyle,MINUSICON); hrefs.put(this.yellowCrossStyle,CROSSICON); hrefs.put(this.yellowMinusStyle,MINUSICON); hrefs.put(this.greenCrossStyle,CROSSICON); hrefs.put(this.greenMinusStyle,MINUSICON); hrefs.put(this.greyCrossStyle,CROSSICON); hrefs.put(this.greyMinusStyle,MINUSICON); for ( StyleType styleType : new StyleType[]{this.redCrossStyle,this.redMinusStyle,this.yellowCrossStyle,this.yellowMinusStyle,this.greenCrossStyle,this.greenMinusStyle,this.greyCrossStyle,this.greyMinusStyle}) { IconStyleType icon=kmlObjectFactory.createIconStyleType(); icon.setColor(new byte[]{colors.get(styleType)[0],colors.get(styleType)[1],colors.get(styleType)[2],colors.get(styleType)[3]}); icon.setScale(ICONSCALE); LinkType link=kmlObjectFactory.createLinkType(); link.setHref(hrefs.get(styleType)); icon.setIcon(link); styleType.setIconStyle(icon); this.mainDoc.getAbstractStyleSelectorGroup().add(kmlObjectFactory.createStyle(styleType)); } }
This method initializes the styles for the different icons used.
public int calcChecksum(final ChecksumUtility checker){ if (checker == null) throw new IllegalArgumentException(); return checker.checksum(buf,0,SIZEOF_ROOT_BLOCK - SIZEOF_CHECKSUM); }
Compute the checksum of the root block (excluding only the field including the checksum value itself).
public static SerializedProxy makeSerializedProxy(Object proxy) throws java.io.InvalidClassException { Class clazz=proxy.getClass(); MethodHandler methodHandler=null; if (proxy instanceof ProxyObject) methodHandler=((ProxyObject)proxy).getHandler(); else if (proxy instanceof Proxy) methodHandler=ProxyFactory.getHandler((Proxy)proxy); return new SerializedProxy(clazz,ProxyFactory.getFilterSignature(clazz),methodHandler); }
Converts a proxy object to an object that is writable to an object stream. This method is called by <code>writeReplace()</code> in a proxy class.
public static void main(String[] args){ String userToShareWith=null; if (args.length < 2 || args.length > 3) { usage(); return; } else if (args.length == 3) { userToShareWith=args[2]; } CalendarService myService=new CalendarService("demo-AclFeedDemo-1"); String userName=args[0]; String userPassword=args[1]; try { metafeedUrl=new URL(METAFEED_URL_BASE + userName); aclFeedUrl=new URL(METAFEED_URL_BASE + userName + ACL_FEED_URL_SUFFIX); } catch ( MalformedURLException e) { System.err.println("Uh oh - you've got an invalid URL."); e.printStackTrace(); return; } try { myService.setUserCredentials(userName,userPassword); printAclList(myService); if (userToShareWith != null) { addAccessControl(myService,userToShareWith,CalendarAclRole.FREEBUSY); updateAccessControl(myService,userToShareWith,CalendarAclRole.READ); deleteAccessControl(myService,userToShareWith); } } catch ( IOException e) { System.err.println("There was a problem communicating with the service."); e.printStackTrace(); } catch ( ServiceException e) { System.err.println("The server had a problem handling your request."); e.printStackTrace(); } }
Instantiates a CalendarService object and uses the command line arguments to authenticate. The CalendarService object is used to demonstrate interactions with the Calendar data API's ACL feed.
public static XtremIOVolume isVolumeAvailableInArray(XtremIOClient client,String label,String clusterName){ XtremIOVolume volume=null; try { volume=client.getVolumeDetails(label,clusterName); } catch ( Exception e) { _log.info("Volume {} already deleted.",label); } return volume; }
Check if there is a volume with the given name If found, return the volume
@Override public Eval<Optional<T>> findFirst(){ return Eval.later(null); }
Perform an asynchronous findAny operation
public void edit(NewArray a) throws CannotCompileException { }
Edits an expression for array creation (overridable). The default implementation performs nothing.
@DSComment("Private Method") @DSBan(DSCat.PRIVATE_METHOD) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:57:24.285 -0500",hash_original_method="4FF06135DA529EA5945D38DB9DEC9B0E",hash_generated_method="B945D9D44581F68296FA3FBD6173A146") private void pushRun(int runBase,int runLen){ this.runBase[stackSize]=runBase; this.runLen[stackSize]=runLen; stackSize++; }
Pushes the specified run onto the pending-run stack.
public Histogram(DataSet dataSet){ if (dataSet.getVariables().size() < 1) { throw new IllegalArgumentException("Can't do histograms for an empty data sets."); } this.dataSet=dataSet; setTarget(dataSet.getVariable(0).getName()); }
This histogram is for variables in a particular data set. These may be continuous or discrete.
public static void createTable(SQLiteDatabase db,boolean ifNotExists){ String constraint=ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "\"IP_INFO\" ("+ "\"_id\" INTEGER PRIMARY KEY ,"+ "\"COUNTRY\" TEXT,"+ "\"COUNTRY_ID\" REAL,"+ "\"AREA\" REAL,"+ "\"AREA_ID\" REAL,"+ "\"IP\" REAL);"); }
Creates the underlying database table.
public PaletteSliderThumbIcon(Image[] images){ super(images); }
Creates a new instance. All icons must have the same dimensions. The array indices are used to represente the following states: [0] Enabled [1] Enabled Pressed [2] Disabled [3] Enabled Inactive [4] Disabled Inactive [5] Focus Ring If an array element is null, an icon is derived for the state from the other icons.
private void reset(){ isContent=false; finished=false; }
Reset internal state to repeat a query.
public Region(String value){ this(); setValue(value); }
Constructs a new instance with the given value.
protected void onUpdateTab(TabLayout.Tab tab){ tab.setCustomView(null); }
Override this method if you want to use custom tab layout
public CredentialsNotAvailableException(final String message){ super(message); }
Creates a new CredentialsNotAvailableException with the specified message.
public EventReader provide(Reader source) throws Exception { return provide(factory.createXMLEventReader(source)); }
This provides an <code>EventReader</code> that will read from the specified reader. When reading from a reader the character encoding should be the same as the source XML document.
public boolean doTriggerActions(){ return _triggersActions; }
If change of state of this object causes a change of state of the Conditional, should any actions be executed.
public void zeroDrAndCrAmounts(){ dramount=BigDecimal.ZERO; cramount=BigDecimal.ZERO; }
Sets both DR and CR amounts to zero.
public String encodedUsername(){ if (username.isEmpty()) return ""; int usernameStart=scheme.length() + 3; int usernameEnd=delimiterOffset(url,usernameStart,url.length(),":@"); return url.substring(usernameStart,usernameEnd); }
Returns the username, or an empty string if none is set.
@Override public boolean isActive(){ return amIActive; }
Used by the Whitebox GUI to tell if this plugin is still running.
protected final float curl(int idx){ float du_dy=(u[idx + totalWidth] - u[idx - totalWidth]) * 0.5f; float dv_dx=(v[idx + 1] - v[idx - 1]) * 0.5f; return du_dy - dv_dx; }
Calculate the curl at position (i, j) in the fluid grid. Physically this represents the vortex strength at the cell. Computed as follows: width = (del x U) where U is the velocity vector at (i, j).
public static boolean isDeflated(byte[] data) throws IOException { try { Compression.decompress(data); } catch ( DataFormatException e) { return false; } return true; }
Check for deflated.
public static final boolean isLocationProviderEnabledForUser(ContentResolver cr,String provider,int userId){ String allowedProviders=Settings.Secure.getStringForUser(cr,LOCATION_PROVIDERS_ALLOWED,userId); return TextUtils.delimitedStringContains(allowedProviders,',',provider); }
Helper method for determining if a location provider is enabled.
public void assertNotEqual(int expected,int actual,String errorMessage){ TestUtils.assertNotEqual(expected,actual,errorMessage); }
This method just invokes the test utils method, it is here for convenience
protected FloatControl(Type type,float minimum,float maximum,float precision,int updatePeriod,float initialValue,String units){ this(type,minimum,maximum,precision,updatePeriod,initialValue,units,"","",""); }
Constructs a new float control object with the given parameters. The labels for the minimum, maximum, and mid-point values are set to zero-length strings.
public SnmpOid toOid(){ long[] oid=new long[engineId.length + 1]; oid[0]=engineId.length; for (int i=1; i <= engineId.length; i++) oid[i]=(long)(engineId[i - 1] & 0xFF); return new SnmpOid(oid); }
Translates an engine Id in an SnmpOid format. This is useful when dealing with USM MIB indexes. The oid format is : <engine Id length>.<engine Id binary octet1>....<engine Id binary octetn - 1>.<engine Id binary octetn> Eg: "0x8000002a05819dcb6e00001f96" ==> 13.128.0.0.42.5.129.157.203.110.0.0.31.150
public void addClusterConnection(SimpleString name,TransportConfiguration[] tcConfigs,ClusterConnectionConfiguration config){ ServerLocatorImpl serverLocator=(ServerLocatorImpl)ActiveMQClient.createServerLocatorWithHA(tcConfigs); configAndAdd(name,serverLocator,config); }
add a locator for a cluster connection.
public boolean isVariableListEqual(int[] variables){ return Arrays.equals(variables,this.variables); }
Returns true iff the given variable list is equal to the variable list of this term.
@Ignore("This test needs an existing DOI registered with EZID plugged into it each time - test DOIs are periodically purged") public void testReuseAndReserveExistingRegisteredDoiEZID() throws Exception { AppConfig mockAppConfig=mock(AppConfig.class); DataDir mockDataDir=mock(DataDir.class); when(mockAppConfig.getDataDir()).thenReturn(mockDataDir); when(mockAppConfig.getResourceUri(anyString())).thenReturn(new URI("http://130.226.238.151:7010/ipt/resource?r=test2&v=3.0")); RegistrationManager mockRegistrationManagerEZID=mock(RegistrationManager.class); Organisation oEZID=new Organisation(); oEZID.setKey(ORGANISATION_KEY.toString()); oEZID.setAgencyAccountPrimary(true); oEZID.setName("GBIF"); oEZID.setDoiPrefix("10.5072/FK2"); oEZID.setCanHost(true); oEZID.setAgencyAccountUsername("apitest"); oEZID.setAgencyAccountPassword("apitest"); oEZID.setDoiRegistrationAgency(DOIRegistrationAgency.EZID); when(mockRegistrationManagerEZID.findPrimaryDoiAgencyAccount()).thenReturn(oEZID); when(mockRegistrationManagerEZID.get(any(UUID.class))).thenReturn(oEZID); ServiceConfig cfgEZID=new ServiceConfig("apitest","apitest"); EzidService ezidService=new EzidService(HttpUtil.newMultithreadedClient(10000,2,2),cfgEZID); when(mockRegistrationManagerEZID.getDoiService()).thenReturn(ezidService); action=new OverviewAction(mock(SimpleTextProvider.class),mockAppConfig,mockRegistrationManagerEZID,mock(ResourceManager.class),mock(UserAccountManager.class),mock(ExtensionManager.class),mock(VocabulariesManager.class),mock(GenerateDwcaFactory.class)); LOG.info("Testing EZID with test Prefix..."); action.setReserveDoi("true"); action.setResource(r); assertNull(r.getDoi()); assertEquals(IdentifierStatus.UNRESERVED,r.getIdentifierStatus()); assertNotNull(r.getEml().getCitation()); assertNull(r.getEml().getCitation().getIdentifier()); DOI existingDOI=new DOI("doi:10.5072/FK29OGDWW"); r.setCitationAutoGenerated(true); r.getEml().setCitation(new Citation("Replaced by auto-generated citation",existingDOI.toString())); r.setStatus(PublicationStatus.PUBLIC); action.reserveDoi(); assertEquals(0,action.getActionErrors().size()); assertNotNull(r.getDoi()); assertEquals(existingDOI.getDoiName(),r.getDoi().getDoiName()); assertEquals(ORGANISATION_KEY,r.getDoiOrganisationKey()); assertEquals(IdentifierStatus.PUBLIC_PENDING_PUBLICATION,r.getIdentifierStatus()); assertEquals(1,r.getEml().getAlternateIdentifiers().size()); assertEquals(r.getDoi().getUrl().toString(),r.getEml().getCitation().getIdentifier()); LOG.info("Existing registered DOI was reused successfully, DOI=" + existingDOI.getDoiName()); }
Test reserving an existing registered DOI (reusing an existing registered DOI). </b> Make it succeed by making the resource public and using the correct target URI.
public long forceGetValueAsLong(long defaultValue){ long[] l=getValueAsLongs(); if (l != null && l.length >= 1) { return l[0]; } byte[] b=getValueAsBytes(); if (b != null && b.length >= 1) { return b[0]; } Rational[] r=getValueAsRationals(); if (r != null && r.length >= 1 && r[0].getDenominator() != 0) { return (long)r[0].toDouble(); } return defaultValue; }
Gets a long representation of the value.
private static int hash(Object x){ int h=x.hashCode(); return ((h << 7) - h + (h >>> 9) + (h >>> 17)); }
Return hash code for Object x. Since we are using power-of-two tables, it is worth the effort to improve hashcode via the same multiplicative scheme as used in IdentityHashMap.
public void registerSerializer(Serializer serializer){ serializers.registerSerializer(serializer); }
Register <code>serializer</code>. <p> The class for with the serializer is being registered is directly extracted from the class definition.
@SuppressWarnings("ConstantConditions") public void addMapping(List<ClusterNode> nodes){ assert !F.isEmpty(nodes) : nodes; ClusterNode primary=nodes.get(0); int size=nodes.size(); if (size > 1) { Collection<UUID> backups=txNodes.get(primary.id()); if (backups == null) { backups=U.newHashSet(size - 1); txNodes.put(primary.id(),backups); } for (int i=1; i < size; i++) backups.add(nodes.get(i).id()); } else txNodes.put(primary.id(),new GridLeanSet<UUID>()); }
Adds information about next mapping.
public void gcspyGatherData(int event,TreadmillDriver tmDriver,boolean tospace){ if (tospace) toSpace.gcspyGatherData(tmDriver); else fromSpace.gcspyGatherData(tmDriver); }
Gather data for GCSpy
public void initElements(){ for (int i=0; i < pcms.length; i++) { pcms[i]=new GuiPCM(10,30 + 105 * i,i,this); } }
Inflate the GUI. This does everything from adding all the elements, to adding the background image and setting up the GUI. This is where most of the work is done, and is only called once: upon creation of the GUI.
public GrammarException(String message,int line){ super(MessageFormat.format("{0} (line {1})",message,line)); }
Constructs an exception indicating an error while parsing or processing grammars.
public void restartProxy(int hostNumber){ if (hostNumber != -1) { proxySet.get(currentType)[hostNumber - 1].restart(); } }
Restart proxy.
public void close() throws java.io.IOException { if (m_writer != null) m_writer.close(); flushBuffer(); }
Flush the internal buffer and close the Writer
public JSONStringer endArray() throws JSONException { return close(Scope.EMPTY_ARRAY,Scope.NONEMPTY_ARRAY,"]"); }
Ends encoding the current array.
public void startCDATA(){ theNextState=S_CDATA; }
A callback for the ScanHandler that allows it to force the lexer state to CDATA content (no markup is recognized except the end of element.
public final TestSubscriber assertNoValues(){ return assertValueCount(0); }
Assert that this TestSubscriber has not received any onNext events.
public Job createJobFromActivitiXml(String activitiXml,List<Parameter> parameters) throws Exception { jobDefinitionServiceTestHelper.createJobDefinitionForActivitiXml(activitiXml); return jobService.createAndStartJob(createJobCreateRequest(AbstractServiceTest.TEST_ACTIVITI_NAMESPACE_CD,AbstractServiceTest.TEST_ACTIVITI_JOB_NAME,parameters)); }
Creates a job based on the specified Activiti XML.
public static final long flipFlop(final long b){ return ((b & MAGIC[6]) >>> 1) | ((b & MAGIC[0]) << 1); }
flip flops odd with even bits
public void runTest() throws Throwable { Document doc; NodeList elementList; Node childNode; Node clonedNode; Node lastChildNode; String childValue; doc=(Document)load("hc_staff",true); elementList=doc.getElementsByTagName("sup"); childNode=elementList.item(1); clonedNode=childNode.cloneNode(true); lastChildNode=clonedNode.getLastChild(); childValue=lastChildNode.getNodeValue(); assertEquals("cloneContainsText","35,000",childValue); }
Runs the test case.
public void addBehaviour(Class<?> behaviour,URI type) throws ObjectStoreConfigException { List<URI> list=behaviours.get(behaviour); if (list == null && behaviours.containsKey(behaviour)) throw new ObjectStoreConfigException(behaviour.getSimpleName() + " can only be added once"); if (list == null) { behaviours.put(behaviour,list=new LinkedList<URI>()); } list.add(type); }
Associates this behaviour with the given type.
public boolean isStrict(){ return strict; }
This method is used to determine whether strict mappings are required. Strict mapping means that all labels in the class schema must match the XML elements and attributes in the source XML document. When strict mapping is disabled, then XML elements and attributes that do not exist in the schema class will be ignored without breaking the parser.
public final void testGetPublic02() throws InvalidKeySpecException { PublicKey pk=TestKeyPair.getPublic(); KeyPair kp=new KeyPair(pk,null); assertSame(pk,kp.getPublic()); }
Test #2 for <code>getPublic()</code> method<br> Assertion: returns public key (valid public key in this case)
public void restat(String path){ mStat=doStat(path); }
Perform a restat of the file system referenced by this object. This is the same as re-constructing the object with the same file system path, and the new stat values are available upon return.
boolean newLine(){ boolean p=shouldPrint(); numLines++; if (!p) return false; numLinesPrinted++; int msPerLine=LogInfo.msPerLine; if (numLines <= 2 || msPerLine == 0 || printAllLines || forcePrint) nextLineToPrint++; else { long elapsed_ms=watch.getCurrTimeLong(); if (elapsed_ms == 0) { nextLineToPrint*=2; } else nextLineToPrint+=(int)Math.max((double)numLines * msPerLine / elapsed_ms,1); } forcePrint=false; return true; }
Decide whether to print the next line. If yes, then you must print it.
public static int diffOfBits(long simHash1,long simHash2){ long bits=simHash1 ^ simHash2; int count=0; while (bits != 0) { bits&=bits - 1; ++count; } return count; }
count the number of bits that differ between two queries as a measure of dissimilarity. Also known as Hamming distance based on the bit population
public static <T extends Comparable<T>>Pair<Integer,T> max(T[] array){ return max(asList(array)); }
Find the argmax and max in a array of elements that can are ordered. If the list is empty, the function returns (-1, null).
@Override public int delete(Uri uri,String where,String[] whereArgs){ SQLiteDatabase db=getDbHelper().getWritableDatabase(); int count; switch (sUriMatcher.match(uri)) { case FORMS: Cursor del=null; try { del=this.query(uri,null,where,whereArgs,null); if (del.getCount() > 0) { del.moveToFirst(); do { deleteFileOrDir(del.getString(del.getColumnIndex(FormsColumns.JRCACHE_FILE_PATH))); String formFilePath=del.getString(del.getColumnIndex(FormsColumns.FORM_FILE_PATH)); Collect.getInstance().getActivityLogger().logAction(this,"delete",formFilePath); deleteFileOrDir(formFilePath); deleteFileOrDir(del.getString(del.getColumnIndex(FormsColumns.FORM_MEDIA_PATH))); } while (del.moveToNext()); } } finally { if (del != null) { del.close(); } } count=db.delete(FORMS_TABLE_NAME,where,whereArgs); break; case FORM_ID: String formId=uri.getPathSegments().get(1); Cursor c=null; try { c=this.query(uri,null,where,whereArgs,null); if (c.getCount() > 0) { c.moveToFirst(); do { deleteFileOrDir(c.getString(c.getColumnIndex(FormsColumns.JRCACHE_FILE_PATH))); String formFilePath=c.getString(c.getColumnIndex(FormsColumns.FORM_FILE_PATH)); Collect.getInstance().getActivityLogger().logAction(this,"delete",formFilePath); deleteFileOrDir(formFilePath); deleteFileOrDir(c.getString(c.getColumnIndex(FormsColumns.FORM_MEDIA_PATH))); try { ItemsetDbAdapter ida=new ItemsetDbAdapter(); ida.open(); ida.delete(c.getString(c.getColumnIndex(FormsColumns.FORM_MEDIA_PATH)) + "/itemsets.csv"); ida.close(); } catch (Exception e) { } } while (c.moveToNext()); } } finally { if (c != null) { c.close(); } } count=db.delete(FORMS_TABLE_NAME,FormsColumns._ID + "=" + formId+ (!TextUtils.isEmpty(where) ? " AND (" + where + ')' : ""),whereArgs); break; default : throw new IllegalArgumentException("Unknown URI " + uri); } getContext().getContentResolver().notifyChange(uri,null); return count; }
This method removes the entry from the content provider, and also removes any associated files. files: form.xml, [formmd5].formdef, formname-media {directory}
public static int beU2(byte[] data,int bci){ return ((data[bci] & 0xff) << 8) | (data[bci + 1] & 0xff); }
Gets an unsigned 2-byte big-endian value.
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (getUIClassID().equals(uiClassID)) { byte count=JComponent.getWriteObjCounter(this); JComponent.setWriteObjCounter(this,--count); if (count == 0 && ui != null) { ui.installUI(this); } } ArrayTable.writeArrayTable(s,clientProperties); }
Before writing a <code>JComponent</code> to an <code>ObjectOutputStream</code> we temporarily uninstall its UI. This is tricky to do because we want to uninstall the UI before any of the <code>JComponent</code>'s children (or its <code>LayoutManager</code> etc.) are written, and we don't want to restore the UI until the most derived <code>JComponent</code> subclass has been been stored.
public Builder withSocket(String socket){ this.disqueURI.connectionPoints.add(new DisqueSocket(socket)); return this; }
Set Disque socket.
@Override public void endTransaction(){ throw new UnsupportedOperationException("Transaction Unsupported."); }
end a application level transaction on this allocator. (it is a place holder)
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity,EntityPlayer aPlayer){ return false; }
a Player rightclicks the Machine Sneaky rightclicks are not getting passed to this!
public boolean isLogicalFunction(){ return false; }
X2 is not a logical function.
private File createMessageFile(VirtualFile root,final String message) throws IOException { File file=FileUtil.createTempFile(GIT_COMMIT_MSG_FILE_PREFIX,GIT_COMMIT_MSG_FILE_EXT); file.deleteOnExit(); @NonNls String encoding=GitConfigUtil.getCommitEncoding(myProject,root); Writer out=new OutputStreamWriter(new FileOutputStream(file),encoding); try { out.write(message); } finally { out.close(); } return file; }
Create a file that contains the specified message
public final CC shrinkPrio(int... widthHeight){ switch (widthHeight.length) { default : throw new IllegalArgumentException("Illegal argument count: " + widthHeight.length); case 2: shrinkPrioY(widthHeight[1]); case 1: shrinkPrioX(widthHeight[0]); } return this; }
Shrink priority for the component horizontally and optionally vertically. <p> For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.
@Override public int hashCode(){ return results.hashCode(); }
This is just a call to the hashcode method of the internal results list.
public Attribute classAttribute() throws Exception { if (m_Dataset == null) { throw new UnassignedDatasetException("Instance doesn't have access to a dataset!"); } return m_Dataset.classAttribute(); }
Returns class attribute.
protected void addOptionalPropertyDescriptor(Object object){ itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),getResourceLocator(),getString("_UI_FeatureType_optional_feature"),getString("_UI_PropertyDescriptor_description","_UI_FeatureType_optional_feature","_UI_FeatureType_type"),SGenPackage.Literals.FEATURE_TYPE__OPTIONAL,true,false,false,ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,null,null)); }
This adds a property descriptor for the Optional feature. <!-- begin-user-doc --> <!-- end-user-doc -->
public String correctDurationValue(String value){ if (value.matches("PT[0-9]+H")) { for ( MatchResult mr : Toolbox.findMatches(Pattern.compile("PT([0-9]+)H"),value)) { try { int hours=Integer.parseInt(mr.group(1)); if ((hours % 24) == 0) { int days=hours / 24; value="P" + days + "D"; } } catch ( NumberFormatException e) { Logger.printDetail(component,"Couldn't do granularity conversion for " + value); } } } else if (value.matches("PT[0-9]+M")) { for ( MatchResult mr : Toolbox.findMatches(Pattern.compile("PT([0-9]+)M"),value)) { try { int minutes=Integer.parseInt(mr.group(1)); if ((minutes % 60) == 0) { int hours=minutes / 60; value="PT" + hours + "H"; } } catch ( NumberFormatException e) { Logger.printDetail(component,"Couldn't do granularity conversion for " + value); } } } else if (value.matches("P[0-9]+M")) { for ( MatchResult mr : Toolbox.findMatches(Pattern.compile("P([0-9]+)M"),value)) { try { int months=Integer.parseInt(mr.group(1)); if ((months % 12) == 0) { int years=months / 12; value="P" + years + "Y"; } } catch ( NumberFormatException e) { Logger.printDetail(component,"Couldn't do granularity conversion for " + value); } } } return value; }
Durations of a finer granularity are mapped to a coarser one if possible, e.g., "PT24H" -> "P1D". One may add several further corrections.
public TaskSeries(String name){ super(name); this.tasks=new java.util.ArrayList(); }
Constructs a new series with the specified name.
@Override public void onUpdate(){ super.onUpdate(); checkOwnerFlute(); if (this.getIsBatHanging()) { this.motionX=this.motionY=this.motionZ=0.0D; this.posY=(double)MathHelper.floor_double(this.posY) + 1.0D - (double)this.height; } else { this.motionY*=0.6D; } if (isRecalled) { ItemStack batstack=ItemPocketedPetBat.fromBatEntity(this); if (batstack != null && owner != null) { ItemStack flute=PetBatMod.instance().removeFluteFromPlayer(owner,petName); if (owner.inventory.addItemStackToInventory(batstack)) { worldObj.playSoundAtEntity(owner,"mob.slime.big",1F,1F); setDeadWithoutRecall(); } else { owner.inventory.addItemStackToInventory(flute); } } } }
Called to update the entity's position/logic.
public DriverTask createVolumeClone(List<VolumeClone> clones){ LOG.info("Creating volume clone"); DellSCDriverTask task=new DellSCDriverTask("createVolumeClone"); StringBuilder errBuffer=new StringBuilder(); int createCount=0; for ( VolumeClone clone : clones) { try { StorageCenterAPI api=connectionManager.getConnection(clone.getStorageSystemId()); ScReplay replay=null; api.checkAndInitVolume(clone.getParentId()); if (clone.getSourceType() == SourceType.SNAPSHOT) { replay=api.getReplay(clone.getParentId()); } else { replay=api.createReplay(clone.getParentId(),5); } ScVolume scVol=api.createViewVolume(clone.getDisplayName(),replay.instanceId); clone.setProvisionedCapacity(SizeUtil.sizeStrToBytes(scVol.configuredSize)); clone.setAllocatedCapacity(0L); clone.setWwn(scVol.deviceId); clone.setNativeId(scVol.instanceId); clone.setDeviceLabel(scVol.name); clone.setAccessStatus(AccessStatus.READ_WRITE); clone.setReplicationState(ReplicationState.SYNCHRONIZED); createCount++; } catch ( DellSCDriverException|StorageCenterAPIException dex) { String error=String.format("Error creating clone of volume %s: %s",clone.getParentId(),dex); errBuffer.append(String.format("%s%n",error)); } } task.setMessage(errBuffer.toString()); if (createCount == clones.size()) { task.setStatus(TaskStatus.READY); } else if (createCount == 0) { task.setStatus(TaskStatus.FAILED); } else { task.setStatus(TaskStatus.PARTIALLY_FAILED); } return task; }
Create a clone of a volume.
public static void execStandalone(String invokeWith,String classPath,String className,String[] args){ StringBuilder command=new StringBuilder(invokeWith); command.append(" /system/bin/dalvikvm -classpath '").append(classPath); command.append("' ").append(className); Zygote.appendQuotedShellArgs(command,args); Zygote.execShell(command.toString()); }
Executes a standalone application with a wrapper command. This method never returns.
public static ClassificationDataSet generate3DimIn10(Random rand,int t0,int t1,int t2){ ClassificationDataSet cds=new ClassificationDataSet(10,new CategoricalData[0],new CategoricalData(4)); int cSize=40; for (int i=0; i < cSize; i++) { Vec dv=DenseVector.random(10,rand); dv.mutableDivide(3); dv.set(t0,5.0); dv.set(t1,5.0); dv.set(t2,0.0); cds.addDataPoint(dv,new int[0],0); } for (int i=0; i < cSize; i++) { Vec dv=DenseVector.random(10,rand); dv.mutableDivide(3); dv.set(t0,5.0); dv.set(t1,5.0); dv.set(t2,5.0); cds.addDataPoint(dv,new int[0],1); } for (int i=0; i < cSize; i++) { Vec dv=DenseVector.random(10,rand); dv.mutableDivide(3); dv.set(t0,5.0); dv.set(t1,0.0); dv.set(t2,5.0); cds.addDataPoint(dv,new int[0],2); } for (int i=0; i < cSize; i++) { Vec dv=DenseVector.random(10,rand); dv.mutableDivide(3); dv.set(t0,0.0); dv.set(t1,5.0); dv.set(t2,5.0); cds.addDataPoint(dv,new int[0],3); } return cds; }
Creates a naive test case where 4 classes that can be separated with 3 features are placed into a 10 dimensional space. The other 7 dimensions are all small random noise values.
private void determineBounds(){ double value, min, max; if (m_plotInstances != null && m_plotInstances.numAttributes() > 0 && m_plotInstances.numInstances() > 0) { min=Double.POSITIVE_INFINITY; max=Double.NEGATIVE_INFINITY; if (m_plotInstances.attribute(m_xIndex).isNominal()) { m_minX=0; m_maxX=m_plotInstances.attribute(m_xIndex).numValues() - 1; } else { for (int i=0; i < m_plotInstances.numInstances(); i++) { if (!m_plotInstances.instance(i).isMissing(m_xIndex)) { value=m_plotInstances.instance(i).value(m_xIndex); if (value < min) { min=value; } if (value > max) { max=value; } } } if (min == Double.POSITIVE_INFINITY) { min=max=0.0; } m_minX=min; m_maxX=max; if (min == max) { m_maxX+=0.05; m_minX-=0.05; } } min=Double.POSITIVE_INFINITY; max=Double.NEGATIVE_INFINITY; if (m_plotInstances.attribute(m_yIndex).isNominal()) { m_minY=0; m_maxY=m_plotInstances.attribute(m_yIndex).numValues() - 1; } else { for (int i=0; i < m_plotInstances.numInstances(); i++) { if (!m_plotInstances.instance(i).isMissing(m_yIndex)) { value=m_plotInstances.instance(i).value(m_yIndex); if (value < min) { min=value; } if (value > max) { max=value; } } } if (min == Double.POSITIVE_INFINITY) { min=max=0.0; } m_minY=min; m_maxY=max; if (min == max) { m_maxY+=0.05; m_minY-=0.05; } } min=Double.POSITIVE_INFINITY; max=Double.NEGATIVE_INFINITY; for (int i=0; i < m_plotInstances.numInstances(); i++) { if (!m_plotInstances.instance(i).isMissing(m_cIndex)) { value=m_plotInstances.instance(i).value(m_cIndex); if (value < min) { min=value; } if (value > max) { max=value; } } } if (min == Double.POSITIVE_INFINITY) { min=max=0.0; } m_minC=min; m_maxC=max; } }
Determine bounds for the current x,y and colouring indexes
public UnescapedCharSequence(char[] chars,boolean[] wasEscaped,int offset,int length){ this.chars=new char[length]; this.wasEscaped=new boolean[length]; System.arraycopy(chars,offset,this.chars,0,length); System.arraycopy(wasEscaped,offset,this.wasEscaped,0,length); }
Create a escaped CharSequence
private void processJournal() throws IOException { deleteIfExists(journalFileTmp); for (Iterator<Entry> i=lruEntries.values().iterator(); i.hasNext(); ) { Entry entry=i.next(); if (entry.currentEditor == null) { for (int t=0; t < valueCount; t++) { size+=entry.lengths[t]; } } else { entry.currentEditor=null; for (int t=0; t < valueCount; t++) { deleteIfExists(entry.getCleanFile(t)); deleteIfExists(entry.getDirtyFile(t)); } i.remove(); } } }
Computes the initial size and collects garbage as a part of opening the cache. Dirty entries are assumed to be inconsistent and will be deleted.
public static <E>E parse(String jsonString,Class<E> jsonObjectClass) throws IOException { return mapperFor(jsonObjectClass).parse(jsonString); }
Parse an object from a String. Note: parsing from an InputStream should be preferred over parsing from a String if possible.
public boolean isEmpty(){ return size() == 0; }
True if there are no entries in the counter (false does not mean totalCount > 0)
public boolean isSensitiveAction(SootMethod method){ if (!all_sys_methods.contains(method)) return false; if (spec_methods.contains(method)) return true; if (safe_methods.contains(method)) return false; if (spec_methods.containsPoly(method)) return true; if (safe_methods.containsPoly(method)) return false; if (banned_methods.contains(method)) return true; return false; }
Returns whether or not a method should be included in the spec. It returns true for any method in a system class (any class in Android.jar) that is not explicitly marked as safe in system_calls.txt (see safe_methods)
public static DrmConvertSession open(Context context,String mimeType){ DrmManagerClient drmClient=null; int convertSessionId=-1; if (context != null && mimeType != null && !mimeType.equals("")) { try { drmClient=new DrmManagerClient(context); try { convertSessionId=drmClient.openConvertSession(mimeType); } catch ( IllegalArgumentException e) { Log.w(TAG,"Conversion of Mimetype: " + mimeType + " is not supported.",e); } catch ( IllegalStateException e) { Log.w(TAG,"Could not access Open DrmFramework.",e); } } catch ( IllegalArgumentException e) { Log.w(TAG,"DrmManagerClient instance could not be created, context is Illegal."); } catch ( IllegalStateException e) { Log.w(TAG,"DrmManagerClient didn't initialize properly."); } } if (drmClient == null || convertSessionId < 0) { return null; } else { return new DrmConvertSession(drmClient,convertSessionId); } }
Start of converting a file.
public EventProcessorHost(final String hostName,final String eventHubPath,final String consumerGroupName,final String eventHubConnectionString,ICheckpointManager checkpointManager,ILeaseManager leaseManager,ExecutorService executorService){ EventProcessorHost.TRACE_LOGGER.setLevel(Level.SEVERE); if ((hostName == null) || hostName.isEmpty()) { throw new IllegalArgumentException("hostName argument must not be null or empty string"); } if ((consumerGroupName == null) || consumerGroupName.isEmpty()) { throw new IllegalArgumentException("consumerGroupName argument must not be null or empty"); } if ((eventHubConnectionString == null) || eventHubConnectionString.isEmpty()) { throw new IllegalArgumentException("eventHubConnectionString argument must not be null or empty"); } ConnectionStringBuilder providedCSB=new ConnectionStringBuilder(eventHubConnectionString); String extractedEntityPath=providedCSB.getEntityPath(); this.eventHubConnectionString=eventHubConnectionString; if ((eventHubPath != null) && !eventHubPath.isEmpty()) { this.eventHubPath=eventHubPath; if (extractedEntityPath != null) { if (eventHubPath.compareTo(extractedEntityPath) != 0) { throw new IllegalArgumentException("Provided EventHub path in eventHubPath parameter conflicts with the path in provided EventHub connection string"); } } else { ConnectionStringBuilder rebuildCSB=new ConnectionStringBuilder(providedCSB.getEndpoint(),this.eventHubPath,providedCSB.getSasKeyName(),providedCSB.getSasKey()); rebuildCSB.setOperationTimeout(providedCSB.getOperationTimeout()); rebuildCSB.setRetryPolicy(providedCSB.getRetryPolicy()); this.eventHubConnectionString=rebuildCSB.toString(); } } else { if ((extractedEntityPath != null) && !extractedEntityPath.isEmpty()) { this.eventHubPath=extractedEntityPath; } else { throw new IllegalArgumentException("Provide EventHub entity path in either eventHubPath argument or in eventHubConnectionString"); } } if (checkpointManager == null) { throw new IllegalArgumentException("Must provide an object which implements ICheckpointManager"); } if (leaseManager == null) { throw new IllegalArgumentException("Must provide an object which implements ILeaseManager"); } this.hostName=hostName; this.consumerGroupName=consumerGroupName; this.checkpointManager=checkpointManager; this.leaseManager=leaseManager; synchronized (EventProcessorHost.weOwnExecutor) { if (EventProcessorHost.executorService != null) { if (EventProcessorHost.weOwnExecutor) { EventProcessorHost.executorRefCount++; } } else { if (executorService != null) { EventProcessorHost.weOwnExecutor=false; EventProcessorHost.executorService=executorService; EventProcessorHost.autoShutdownExecutor=false; } else { EventProcessorHost.weOwnExecutor=true; EventProcessorHost.executorService=Executors.newCachedThreadPool(); EventProcessorHost.executorRefCount++; } } } this.partitionManager=new PartitionManager(this); logWithHost(Level.INFO,"New EventProcessorHost created"); }
Create a new host to process events from an Event Hub. This overload allows the caller to provide their own lease and checkpoint managers to replace the built-in ones based on Azure Storage, and to provide an executor service.
void transfer(Entry[] newTable){ Entry[] src=table; int newCapacity=newTable.length; for (int j=0; j < src.length; j++) { Entry e=src[j]; if (e != null) { src[j]=null; do { Entry next=e.next; int i=indexFor(e.hash,newCapacity); e.next=newTable[i]; newTable[i]=e; e=next; } while (e != null); } } }
Transfer all entries from current table to newTable.
protected void timeoutLinks(){ List<Link> eraseList=new ArrayList<Link>(); Long curTime=System.currentTimeMillis(); boolean linkChanged=false; lock.writeLock().lock(); try { Iterator<Entry<Link,LinkInfo>> it=this.links.entrySet().iterator(); while (it.hasNext()) { Entry<Link,LinkInfo> entry=it.next(); Link lt=entry.getKey(); LinkInfo info=entry.getValue(); if ((info.getUnicastValidTime() != null) && (info.getUnicastValidTime().getTime() + (this.LINK_TIMEOUT * 1000) < curTime)) { info.setUnicastValidTime(null); linkChanged=true; } if ((info.getMulticastValidTime() != null) && (info.getMulticastValidTime().getTime() + (this.LINK_TIMEOUT * 1000) < curTime)) { info.setMulticastValidTime(null); linkChanged=true; } if (info.getUnicastValidTime() == null && info.getMulticastValidTime() == null) { eraseList.add(entry.getKey()); } else if (linkChanged) { updates.add(new LDUpdate(lt.getSrc(),lt.getSrcPort(),lt.getDst(),lt.getDstPort(),getLinkType(lt,info),UpdateOperation.LINK_UPDATED)); } } if ((eraseList.size() > 0) || linkChanged) { deleteLinks(eraseList,"LLDP timeout"); } } finally { lock.writeLock().unlock(); } }
Iterates through the list of links and deletes if the last discovery message reception time exceeds timeout values.
public void testOnServerHealthy_doesNothingIfUsersAvailable(){ when(mTroubleshooter.isServerHealthy()).thenReturn(false); mController.init(); JsonUser user=new JsonUser("idA","nameA"); mFakeEventBus.post(new KnownUsersLoadedEvent(ImmutableSet.of(user))); when(mTroubleshooter.isServerHealthy()).thenReturn(true); mFakeEventBus.post(new TroubleshootingActionsChangedEvent(ImmutableSet.of(TroubleshootingAction.CHECK_PACKAGE_SERVER_CONFIGURATION),null)); verify(mMockUserManager,times(1)).loadKnownUsers(); }
Tests that users are not reloaded if the server becomes healthy and users are available.
public StrTokenizer reset(){ tokenPos=0; tokens=null; return this; }
Resets this tokenizer, forgetting all parsing and iteration already completed. <p> This method allows the same tokenizer to be reused for the same String.
public GroupFileTransferDeleteTask(FileTransferServiceImpl fileTransferService,InstantMessagingService imService,LocalContentResolver contentResolver,String chatId){ super(contentResolver,FileTransferData.CONTENT_URI,FileTransferData.KEY_FT_ID,FileTransferData.KEY_CHAT_ID,SELECTION_FILETRANSFER_BY_CHATID,chatId); mFileTransferService=fileTransferService; mImService=imService; }
Deletion of all file transfers that belong to the specified group chat.
public static void fill(short[] a,short val){ fill(a,0,a.length,val); }
Assigns the specified short value to each element of the specified array of shorts.
protected POInfo initPO(Properties ctx){ POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName()); return poi; }
Load Meta Data
public STGroupFile(URL url,String encoding,char delimiterStartChar,char delimiterStopChar){ super(delimiterStartChar,delimiterStopChar); this.url=url; this.encoding=encoding; this.fileName=null; }
Pass in a URL with the location of a group file. E.g., STGroup g = new STGroupFile(loader.getResource("org/foo/templates/g.stg"), "UTF-8", '<', '>');
public static void main(String[] args){ runFileSaver(new XRFFSaver(),args); }
Main method.
public static void muxArray(Object src,int[] dims,Object dst){ int len=getLength(dims); if (Array.getLength(dst) != len) throw new IllegalArgumentException("The length of src does not match the length of dst"); _fillMux(0,dims,src,dst,0); }
Multiplexes multi-dimension array into a single-dimension array
protected void removeAllPremoveDrops(){ for ( PremoveInfo info : premoves.toArray(new PremoveInfo[0])) { if (info.isPremoveDrop) { premoves.remove(info); } } }
Removes all of the premove drops from premoves.
private void checkPeerCertificatesPresent() throws SSLPeerUnverifiedException { if (peerCertificates == null || peerCertificates.length == 0) { throw new SSLPeerUnverifiedException("No peer certificates"); } }
Throw SSLPeerUnverifiedException on null or empty peerCertificates array
@Deprecated public final int addOperator(Operator o){ for ( ExecutionUnit process : subprocesses) { if (process.getNumberOfOperators() == 0) { process.addOperator(o); getLogger().warning("OperatorChain.addOperator() is deprecated! Use getSubprocess(int).addOperator(). I have added the operator to subprocess " + process.getName()); } } throw new UnsupportedOperationException("addOperator() is no longer supported. Failed to guess which subprocess was intended. Try getSubprocess(int).addOperator()"); }
Adds a new inner operator at the last position. The returned index is the position of the added operator with respect to all operators (including the disabled operators).
public RegisterServer2Response RegisterServer2(RequestHeader RequestHeader,RegisteredServer2 Server) throws ServiceFaultException, ServiceResultException { RegisterServer2Request req=new RegisterServer2Request(RequestHeader,Server); return (RegisterServer2Response)channel.serviceRequest(req); }
Synchronous RegisterServer2 service request.
public static String display(final String arg){ final StringBuilder sb=new StringBuilder(); sb.append("\""); for (int i=0; i < arg.length(); i++) { final Character c=arg.charAt(i); final String trans=REPLACE.get(c); if (trans != null) { sb.append("\\").append(trans); continue; } if (c >= 32 && c < 127) { sb.append(c); continue; } sb.append("\\u"); final String hexl=Integer.toHexString(c); final String hex=hexl.toUpperCase(Locale.getDefault()); for (int j=hex.length(); j < 4; j++) { sb.append("0"); } sb.append(hex); } sb.append("\""); return sb.toString(); }
Translate a string into a form where hidden escape characters etc. are explicitly displayed. The result should be able to be used as a literal in Java code. (it includes the quotes at the start and end).
public Input(InputStream inputStream){ this(4096); if (inputStream == null) throw new IllegalArgumentException("inputStream cannot be null."); this.inputStream=inputStream; }
Creates a new Input for reading from an InputStream with a buffer size of 4096.
@Override public int hashCode(){ long hash=classHash(); hash=hash * 31 + Double.doubleToLongBits(latCenter); hash=hash * 31 + Double.doubleToLongBits(lonMin); return (int)(hash >> 32 + hash); }
Returns a hash code value for this object.
public static DeterministicKeyChain watch(DeterministicKey accountKey){ return new DeterministicKeyChain(accountKey); }
Creates a key chain that watches the given account key.