Acordei esta manhã e percebi o antigo almanaque do programador em Java quando estava entediado.
Endereço original da versão JS: Programador Lao Huang Li
Respeite o trabalho original ... hahaha (é nojento para pessoas que até copiam as notas?)
O código é o seguinte:
Snippet de código 1
pacote com.test; / ** * Enumeração de atividades * @Author xiao * */ public enum atividadesenum {atividades_1 ("escreva teste de unidade", "Escreva testes de unidade reduzirá os erros", "Escreva testes de unidade reduzirá seu desenvolvimento de eficiência de desenvolvimento," atividades), ", as atividades", ", tome um banho", "quantos dias você não tomou),"), "Will Out Expertation", "Tome Bath", "Quantos dias você não tomou um banho?", Muita energia, mas coma mais ", verdadeira), atividades_4 (" fumar "," fumar é bom para refrescar e aumentar sua agilidade do pensamento "," a menos que você tenha vivido o suficiente, não importa se você morre cedo ", verdadeiro), atividades_5 (" on -line durante o dia "," é seguro ir on -line hoje durante o dia "," pode causar catastróficos "," Fals), "Fals)," é seguro ir on -line hoje, "" into the quagmire", false), ACTIVITIES_7("Use %t", "You look more tasteful", "Others will think you are pretending", false), ACTIVITIES_8("Cross job", "Let go when it's time to let go", "Given the current economic situation, your next job may not be better than now", false), ACTIVITIES_9("Recruiting", "The person in front of you has the potential to become a great man", "Is this person able to write a program?", false), ACTIVITIES_10("Interview", "The interviewer is in a good mood today", "The interviewer is unhappy and will vent your anger", false), ACTIVITIES_11("Submit an application for resignation", "The company has found someone who is more capable than you, you should get out of here", "Given the current economic situation, your next job may not be better than now", false), ACTIVITIES_12("Apply for a salary increase", "The boss is in a good mood today", "The company is considering layoffs", false), ACTIVITIES_13("Work overtime at night", "The evening is the best time for programmers to be energetic", "", true), ACTIVITIES_14("Brave in front of girls", "Improve your short and poor image", "I will be seen through", true), ACTIVITIES_15("Masturbate", "Avoid buffer overflow", true), ACTIVITIES_16("Browse adult websites", "Regain confidence in life", "You will be restless", true), ACTIVITIES_17("Name variable %v", "", "", "", false), ACTIVITIES_18("Works to write more than %l lines", "Your code is well organized, it doesn't matter if it's longer", "Your code will be in a mess, you won't even understand it yourself", false), ACTIVITIES_19("Submit code", "The chance of encountering conflicts is the lowest", "The many conflicts you encounter will make you feel that you have traveled through time", false), ACTIVITIES_20("Code review", "The chance of finding important problems is greatly increased", "You can't find any problem, waste time in vain", false), ACTIVITIES_21("Settle meeting", "Relax and take a nap while writing code, good for health", false), ACTIVITIES_22("Dota", "You will be like God's help", "You will be abused very badly", true), ACTIVITIES_23("Let's go online at night", "The evening is the best time for programmers to be energetic", "You are exhausted during the day", false), ACTIVITIES_24("Fix the bug", "You have a great sense of smell about bugs today", "The new bugs will be more than fixed", Falso), Atividades_25 ("Revisão do Design", "A reunião de revisão de design se tornará um brainstorm", "Todo mundo está exausto, a revisão é apenas passada", falsa), atividades_26 ("Revisão da demanda", "" "", False), atividades ("Weibo", "você não pode perder o que aconteceu hoje", "hoje é o que está cheio de energia. Razão? "," O irmão Baiping está ofuscando seus olhos ", verdadeiro), atividades_29 (" Play flappybird "," A chance de quebrar o recorde hoje é muito alto "," a menos que você queira jogar até que você esmagasse seu telefone ", verdadeiro); nome de string privado; String privada boa; String privada ruim; fim de semana booleano privado; Atividadesenum (Nome da String, String Good, String Bad, Boolean Weekend) {this.SetBad (Bad); this.setGood (bom); this.setName (nome); this.setweekend (fim de semana); } public string getName () {return name; } public void setName (nome da string) {this.name = name; } public string getgood () {return Good; } public void setGood (string bom) {this.good = Good; } public string getBad () {return mal; } public void setbad (string bad) {this.bad = bad; } public boolean getweekend () {retornar fim de semana; } public void setWeekend (fim de semana booleano) {this.weekend = fim de semana; }}Snippet de código 2
pacote com.test; Public Enum SpecialSenum {Specials (2014, "Bad", "Fique com seu namorado (feminino) amigo", "deixe o crematório e junte -se ao grupo para garantir a segurança"); data inteira privada; tipo de sequência privada; nome de string privado; Descrição de String Private; SpecialSenum (data inteira, tipo de string, nome da string, string description) {this.setDate (data); this.setType (tipo); this.setName (nome); this.setDescription (descrição); } public integer getDate () {Data de retorno; } public void setDate (data inteira) {this.date = date; } public string getType () {return type; } public void setType (string type) {this.type = type; } public string getName () {return name; } public void setName (nome da string) {this.name = name; } public string getDescription () {return description; } public void SetDescription (String description) {this.Description = Descrição; }}Snippet de código 3
pacote com.test; importar java.text.simpledateFormat; importar java.util.arraylist; importar java.util.arrays; importar java.util.calendar; importar java.util.date; importar java.util.hashmap; importar java.util.list; importar java.util.locale; importar java.util.map; importar java.util.random; importar org.apache.commons.lang.stringutils; classe pública Programmercalendar {private Integer iDay = 0; private string [] weeks = new string [] {"dia", "um", "dois", "três", "quatro", "cinco", "seis"}; Private String [] direções = new String [] {"North", "Northeast", "Leste", "Sudeste", "Southwest", "Northwest"}; Private String [] Ferramentas = new String [] {"Eclipse Write Program", "MsOffice Write Documents", "Notepad Write Programs", "Windows8", "Linux", "MacOS", "IE", "Android Device", "IOS Device"}; Private String [] Varnames = new String [] {"Jieguo", "Huodong", "Pay", "Expire", "Zhangdan", "Every", "Free", "I1", "A" A "," Virtual "," AD "," Spider "," Mima "," Pass "," Ui "; String private [] bebidas = nova corda [] {"água", "chá", "chá preto", "chá verde", "café", "chá de leite", "cola", "leite fresco", "leite de soja", "suco", "soda de frutas", "água de refrigerante", "bebidas esportivas", "yogurt", "vinho"}; public integer getiday () {return iDay; } public string [] getDirections () {return direções; }/*** Nota: O "aleatório" neste programa é todos conceitos pseudo-aleatórios, com o dia atual como semente. */ Public Integer Random (Integer Dayed, Indexseed inteiro) {Inteiro n = semeado % 11117; for (int i = 0; i <100+indexseed; i ++) {n = n * n; n = n % 11117; // 11117 é um número primo} retornar n; } public string getTodayString () {calendário calendário = calendar.getInstance (); calendário.setTime (new Date ()); retornar "hoje é" + calendar.get (calendar.year) + "ano" + (calendar.get (calendar.month) + 1) + "mês" + calendar.get (calendar.day_of_month_month) + "dia e semana" + semanas [calendar.get (calendar.dayof_wek) - 1]; } public string star (número inteiro) {string result = ""; int i = 0; while (i <num) {resultado += "★"; i ++; } while (i <5) {resultado += "☆"; i ++; } resultado de retorno; } private boolean isweekend () {loce.setDefault (Locale.china); Calendário calendário = calendário.getInstance (); Retornar calendário.get (calendar.day_of_week) == 1 || calendar.get (calendar.day_of_week) == 7; } Lista pública <ActivitiesEnum> filter () {list <itivsenum> thisEnum = new ArrayList <Activiliesenum> (); // para fins de semana, apenas fim de semana = evento verdadeiro if (isweekend ()) {for (atividades e: atividadesenum.values ()) {if (e.getweekend ()) {thisenum.add (e); }} retornar estenum; } Retorne o novo ArrayList <ActiviesEnum> (Arrays.aslist (atividadesenum.values ())); } public void pickTodaysLuck () {List <Attivityenum> _Activities = filter (); Número inteiro numgood = aleatório (iday, 98) % 3 + 2; Número inteiro numbad = aleatório (dia, 87) % 3 + 2; List <map <string, string >> eventArr = pickRandomActivity (_activities, numgood + numbad); Inteiro [] SpecialSize = PickSpecials (); System.out.println ("Sim:"); para (int i = 0; i <numGood; i ++) {System.out.println ("" + eventarr.get (i) .get ("name") + (stringutils.isnotblank (eventarr.get (i) .get ("bom")? ":" + eventarr.get (i) .get ("good"); } System.out.println ("Não é adequado:"); para (int i = 0; i <numbad; i ++) {System.out.println ("" + eventarr.get (numgood + i) .get ("name") + (stringUtils.isnotblank (eventarr.get) (numgood + i) .get ("Bad")? ":" + EventR.get (numgood); }} / ** * Selecione aleatoriamente os tamanhos da matriz * @param tamanho * @return * / Lista privada <AttiviesEnum> PickRandom (List <Attivityenum> _Activities, tamanho inteiro) {list <AttiviesEnum> resultado = new ArrayList <Activilies> (); para (atividades Ae: _Activities) {result.add (ae); } para (int i = 0; i <_Activities.size () - size; i ++) {int index = aleatória (dia, i) % resultado.size (); resultado.remove (índice); } resultado de retorno; } / ** * Selecione aleatoriamente os tamanhos da matriz * @param tamanho * @return * / Lista privada <String> pickrandomdrinks (tamanho inteiro) {list <stroc> resultado = new ArrayList <String> (Arrays.asList (bebidas)); for (int i = 0; i <bebidas.length - tamanho; i ++) {int index = aleatória (dia, i) % resultado.size (); resultado.remove (índice); } resultado de retorno; } // Selecione aleatoriamente Lista pública <mapa <string, string >> PickRandomActivity (List <Attivityenum> _Activities, tamanho inteiro) {List <Attivesterenum> picked_events = pickrandom (_activities, tamanho); List <map <string, string >> mapList = new ArrayList <map <string, string >> (); para (int i = 0; i <picked_events.size (); i ++) {mapList.add (parse (picked_events.get (i))); } retornar mapList; } / ** * analisa o espaço reservado e substitua -o por conteúdo aleatório * @param ae * @return * / public map <string, string> parse (atividadesenum ae) {map <string, string> map = new hashmap <string, string> (); map.put ("name", ae.getName ()); map.put ("bom", ae.getgood ()); map.put ("Bad", ae.getbad ()); if (map.get ("name"). indexof ("%v")! = -1) {map.put ("name", map.get ("nome"). replaceall ("%v", varnames [aleatoriamente (dia, 12)%varnames.length])); } if (map.get ("name"). indexof ("%t")! = -1) {map.put ("name", map.get ("nome"). replaceall ("%t", ferramentas [aleatório (dia, 11)%ferramentas.length]); } if (map.get ("name"). indexof ("%t")! = -1) {map.put ("nome", map.get ("nome"). replaceall ("%l", (aleatório (dia, 12)%247 + 30) + "" "); } mapa de retorno; } public Integer [] PickSpecials () {Integer [] SpecialSize = new Integer [] {0, 0}; para (SpecialSenum SE: SpecialSenum.Values ()) {if (dia == SE.getDate ()) {if (dia == SE.getDate ()) {if (SE.getType (). Equals ("Good")) {Specialize [0] ++; } else {Especialize [1] ++; } System.out.println ("Nome:" + SE.getName () + "Descrição:" + SE.getDescription ()); }} retornar especialize; } public ProgrammerCalendar () {SimpleDateFormat sdf = new SimpleDateFormat ("yyyymmdd"); tente {iDay = Integer.parseint (sdf.format (new Date ())); } catch (Exceção e) {e.printStackTrace (); // Estou com preguiça de me referir a log}} public static void main (string [] args) {programercalendar hl = novo programercalendar (); System.out.println ("Hoje é:" + hl.getTodaysTring ()); System.out.println ("Orientação do assento: voltada" + hl.directions [hl.random (hl.getiday (), 2) % hl.getDirections (). Comprimento] + "Programa de gravação, com os mínimos erros"); System.out.println ("Drink de hoje:" + stringutils.join (hl.pickrandomdrinks (2), ",")); System.out.println ("Índice de proximidade da Deusa:" + hl.star (hl.random (hl.getiday (), 6) % 5 + 1)); hl.picktodaysluck (); }}Resultados em execução:
Hoje é: hoje é domingo, 25 de setembro de 2016. Orientação de assentos: escrevendo programas para o oeste, com os menos bugs.
Bebida de hoje: Coca -Cola, Índice de proximidade da deusa do suco: ★★ ☆☆☆
deve:
Exercite seu corpo e trabalhe horas extras à noite: a noite é a melhor hora para os programadores navegarem em sites adultos: não é apropriado recuperar a confiança na vida:
Jogando DOTA: Você será abusado tanto em ab: irmão homem ping cega seus olhos
O acima é o conteúdo inteiro deste artigo. Espero que o conteúdo deste artigo tenha certo valor de referência para o estudo ou trabalho de todos. Se você tiver alguma dúvida, pode deixar uma mensagem para se comunicar. Obrigado pelo seu apoio ao wulin.com.