/** * Create cache. * * @param maxsize Maximum number of entries in cache. * @param timeout Entry timeout in milli-seconds. */ public LRUCache2(int maxsize, long timeout) { this.environment = new DefaultEnvironment(); this.timeout = timeout; this.cache = new LRULinkedHashMap(maxsize); }
public static UUID maxTimeUUID( long ts ) { byte[] uuidBytes = new byte[16]; uuidBytes[10] = ( byte ) 0xFF; uuidBytes[11] = ( byte ) 0xFF; uuidBytes[12] = ( byte ) 0xFF; uuidBytes[13] = ( byte ) 0xFF; uuidBytes[14] = ( byte ) 0xFF; uuidBytes[15] = ( byte ) 0xFF; setTimestamp( ts, uuidBytes, 0x3FFF, 0x1FFF ); return uuid( uuidBytes ); }
/** * @param s * @return */ public static byte[] ascii( String s ) { if ( s == null ) { return new byte[0]; } return bytes( s, ASCII_ENCODING ); }
/** * The start time of this operation as represented by the timestamp embedded in the type-1 UUID of the opTag * property */ public long getStart() { return UUIDUtils.getTimestampInMillis( opTag ); }
/** * @param obj * @return */ public static UUID uuid( Object obj ) { return uuid( obj, UUIDUtils.ZERO_UUID ); }
/** * @param bytes * @return */ public static String string( byte[] bytes ) { if ( bytes == null ) { return null; } return string( bytes, 0, bytes.length, UTF8_ENCODING ); }
/** * Delegates to {@link #sendMail(java.util.Properties, String, String, String, String, String)} with null as the * 'plainText' argument to such. */ public void sendHtmlMail( Properties props, String to, String from, String subject, String html ) { sendMail( props, to, from, subject, null, html ); }
public Map<String, String> getPropertiesMap() { if ( properties != null ) { return asMap( properties ); } return null; }
public static String camelCase( String lowerCaseAndUnderscoredWord, boolean uppercaseFirstLetter, char... delimiterChars ) { return Inflector.INSTANCE.camelCase( lowerCaseAndUnderscoredWord, uppercaseFirstLetter, delimiterChars ); } }
public HashMapBuilder<S, T> map( S key, T value ) { put( key, value ); return this; } }
@Override public boolean equals( Object toCompare ) { // Compare pointers if ( toCompare == this ) { return true; } // Compare types if ( !( toCompare instanceof Version ) ) { return false; } return compareTo( ( Version ) toCompare ) == 0; }
@Override public int compare( final UUID o1, final UUID o2 ) { return UUIDUtils.compare( o1, o2 ) * comparator; } }
@Override @SuppressWarnings("all") public Inflector clone() { return new Inflector( this ); }
/** * @param uuid * @return */ public static byte[] uuidToBytesNullOk( UUID uuid ) { if ( uuid != null ) { return bytes( uuid ); } return new byte[16]; }
/** * @param uuid * @return */ public static UUID uuid( byte[] uuid ) { return uuid( uuid, 0 ); }
/** * @param bytes * @param offset * @param length * @return */ public static String string( byte[] bytes, int offset, int length ) { return string( bytes, offset, length, UTF8_ENCODING ); }
/** * @param s * @return */ public static byte[] bytes( String s ) { return bytes( s, UTF8_ENCODING ); }