This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String name = Thread.currentThread().getStackTrace()[1].getMethodName(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if ((screen.width < 1024) && (screen.height < 768)) | |
| { | |
| document.write("<link rel='stylesheet' type='text/css' href='template/sunflower/styles_only.css' />") | |
| } | |
| else | |
| { | |
| document.write("<link rel='stylesheet' type='text/css' href='template/sunflower/styles_tri.css' />") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.math.BigDecimal; | |
| public class Arith | |
| { | |
| /** | |
| * 由于Java的简单类型不能够精确的对浮点数进行运算,这个工具类提供精 确的浮点数运算,包括加减乘除和四舍五入。 | |
| */ | |
| //默认除法运算精度 | |
| private static final int DEF_DIV_SCALE = 10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) throws IOException | |
| { | |
| Analyzer analyzer = new PaodingAnalyzer(); | |
| // String indexString = "被子U盘你平方米包的关于番禺供/电局增加乙类工作票签发人的请示西班牙语能源部九阳兔毛高筒雪地靴"; | |
| String indexString = "九阳"; | |
| StringReader reader = new StringReader(indexString); | |
| TokenStream ts = analyzer.tokenStream(indexString, reader); | |
| CharTermAttribute charTermAttribute = ts.addAttribute(CharTermAttribute.class); | |
| while (ts.incrementToken()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public V standardRemove(@Nullable Object key) | |
| { | |
| Iterator<Entry<K, V>> entryIterator = entrySet().iterator(); | |
| while(entryIterator.hasNext()) | |
| { | |
| Entry<K, V> entry = entryIterator.next(); | |
| if(Objects.equals(entry.getKey(), key)) | |
| { | |
| V value = entry.getValue(); | |
| entryIterator.remove(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * <li>{@code padStart("7", 3, '0')} returns {@code "007"} | |
| * <li>{@code padStart("2010", 3, '0')} returns {@code "2010"} | |
| */ | |
| public static String padStart(String string, int minLength, char padChar) | |
| { | |
| checkNotNull(string); | |
| if(string.length() >= minLength) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static String nullToEmpty(@Nullable String string) | |
| { | |
| return (string == null) ? "" : string; | |
| } | |
| public static @Nullable String emptyToNull(@Nullable String string) | |
| { | |
| return isNullOrEmpty(string) ? null : string; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @visibleForTesting static String format (String template, @Nullable Object... args) | |
| { | |
| template = String.valueOf(template); | |
| StringBuffer builder = new StringBuffer(template.length() + 16 * args.length); | |
| int templateStart = 0; | |
| int i = 0; | |
| while(i < args.length) | |
| { | |
| int placeholderStart = template.indexOf("%s", templateStart); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static <T> T checkNotNull(T reference) | |
| { | |
| if(reference == null) | |
| throw new NullPointerException(); | |
| return reference; | |
| } | |
| public static <T> T checkNotNull(T reference, @Nullable Object errorMessage) | |
| { | |
| if(reference == null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Object o; | |
| StringBuffer sbuf; | |
| if(! o.getClass().isArray()) | |
| { | |
| safeObjectAppend(sbuf, o); | |
| } | |
| private static void safeObjectAppend(StringBuffer sbuf, Object o) |