method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
eda2c4dc-28d9-4b49-91f3-fe27b25feb77
0
void start() { getContentPane().remove(canvas); getContentPane().add(new GameScreen(this), BorderLayout.CENTER); }
5584efb6-6a8e-406d-ab1e-10e253eb2c77
9
private void recursiveAddDirAsProject(File dir, ProjectConf conf, int deepLevel) { if (!dir.isDirectory()) throw new BugError("Auto-add project should be a directory: " + dir); File[] subf = dir.listFiles(); if (subf != null) { boolean hasLessFiles = false; for (File current : subf) { if (current.isD...
756c0aa3-93e5-43dd-af0b-6c957b4a0a6f
3
private JsonObject getPagesStats() { if(pages.size() == 0) return new JsonObject(); String[] conf = new String[4]; conf[0] = "action=query"; conf[1] = "prop=info"; conf[2] = "redirects=1"; String titles = "titles="; for(Page page: pages) { titles += page.getFullName(true) + "|"; } if(pages.size()...
4e7e5ada-6445-48ee-8106-a718610c46f3
2
public static String getKey(String key) { // CHROME WEBSOCKET VERSION 8中定义的GUID,详细文档地址:http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10 String guid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; key += guid; log.info(key); try { MessageDigest md = M...
1f507585-5f32-4d5f-8559-e2defbc846c6
1
public Images() { initComponents(); jTextPane1.setContentType("text/html"); StringBuilder buildSomething = new StringBuilder(); buildSomething.append("<html>"); buildSomething.append("<img src=\"").append(ChatBox.imgList.get(imgIndicator)).append("\" height=\"630\" width...
f3398d75-90d6-4875-ad28-fc05782046b6
2
@Override protected void process_attach (IEngine engine_) { assert (engine_ != null); // Create the pipe if it does not exist yet. if (pipe == null && !is_terminating ()) { ZObject[] parents = {this, socket}; Pipe[] pipes = {null, null}; int[] hwms =...
4e7bafa0-02b8-47fe-9946-47e979f62054
1
public void NewLine() throws IOException { if (flag) out.println(); }
eb69c41c-71e6-498e-a936-c5766a699e7b
3
public static Glyf getGlyf(ByteBuffer data) { short numContours = data.getShort(); Glyf g = null; if (numContours == 0) { // no glyph data g = new Glyf(); } else if (numContours == -1) { // compound glyf g = new GlyfCompound(); ...
8ee63e13-a917-4585-9e0f-34e674868340
7
private void jsonToScore(String jsonString) { jsonString = jsonString.substring(jsonString.indexOf('[') + 2, jsonString.indexOf(']') - 1); String[] jsonStringArray = jsonString.split("(\\},\\{)"); for (int i = 0; i < jsonStringArray.length; i++) { String s = jsonStringArray[i]; ...
8229bb02-db5a-4317-b0b5-b582202d1aa5
0
public logout() { this.requireLogin = true; }
7e9c0f55-6a90-470a-962f-9a16f44712e2
3
@Override public void refresh(RefreshEvent event) { ScoresModel sm = (ScoresModel) event.getSource(); scoreDialog.setTitle(sm.getAskedScores()+" best scores"); scoreDialog.setVisible(true); Iterator<Score> itr = sm.getBestScores().iterator(); int number = 0; while (it...
f0ae52fd-e8ff-4bc3-b6d1-291d4fa28e4b
8
private void setHandles() { if (handleNW == null) { handleNW = new Rectangle(x - 3, y - 3, 6, 6); } else { handleNW.x = x - 3; handleNW.y = y - 3; } if (handleNE == null) { handleNE = new Rectangle(x + width - 3, y - 3, 6, 6); } else { handleNE.x = x + width - 3; handleNE.y = y - 3; } ...
f90b5b6b-563a-42ad-9cb4-933a974fe513
5
private static void write(AccountNumber next, PrintWriter writer) { if (next.isValid()) { writer.println(next.toString()); } else if (next.hasOneOtherSolution()) { writer.println(next.firstPermutation().toString()); } else if (next.isAmbiguous()) { writer.prin...
90b81a87-1e0a-4eb2-9cbe-79b54a1c6c7f
8
private static byte encodeMessageType(MessageType messageType) { switch(messageType) { case APPLICATION: return Packet.MESSAGE_TYPE_APPLICATION; case PING: return Packet.MESSAGE_TYPE_PING; case PING_RESPONSE: return Packet.MESSAGE_TYPE_PING_RESPONSE; case CONNECT_REQUEST: return Packet.MES...
6bef4683-8f5e-4cd9-8166-79df7c51d190
3
private Type resolveClassInfo(String info) throws BadBytecode { CtClass clazz = null; try { if (info.charAt(0) == '[') { clazz = Descriptor.toCtClass(info, classPool); } else { clazz = classPool.get(info); } } catch (NotFoundEx...
6a022955-f3c2-4dee-8ffd-841065bef3c1
1
public static void main(String[] args) throws Exception { if (args.length != 1) { System.err.println("Usage: java javassist.tools.framedump <class file name>"); return; } ClassPool pool = ClassPool.getDefault(); CtClass clazz = pool.get(args[0]); ...
7e26dbc0-2337-48ac-b384-84233926c012
1
public void create(Openchatroomsmessage entity) { EntityManager em = PersistenceManager.createEntityManager(); try { em.getTransaction().begin(); em.persist(entity); em.getTransaction().commit(); } finally { if (em.getTransaction().isActive()) em.getTransaction().rollback(); em.close(); } }
bc67e57a-b91d-4883-95f2-24e3629a8140
2
public int[] pivot(){ double[] max = this.maximumElement(); int maxI = (int)max[1]; int maxJ = (int)max[2]; double[] min = this.minimumElement(); int minI = (int)min[1]; int minJ = (int)min[2]; if(Math.abs(min[0])>Math.abs(max[0])){ maxI = minI...
791d1cf3-f82e-442a-a8f4-711b701f63ed
2
@Override public void onDisable() { if(mSyncThread != null) { try { mSyncThread.abort(); mSyncThread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } }
aa1ffbaa-79fe-4b3e-b0c1-1851561cef8a
1
private final void buildCodetable() { for (K symbol : this.symbols.keySet()) { this.codes.put(this.symbols.get(symbol), symbol); } }
0139358b-2f2f-4a98-8fa6-b7199b4eae4d
9
private Node insert(Node h, Key key, Value value, int ht) { int j; Entry t = new Entry(key, value, null); // external node if (ht == 0) { for (j = 0; j < h.m; j++) { if (less(key, h.children[j].key)) break; } } // internal node else { for (j = 0; j < h.m; j++) { if ((j + 1 == h.m) ...
c19b55a3-6443-48d3-a459-abaf4a79aeb7
7
public void saveOrder() throws Exception{ orderSQL="INSERT INTO ORDERS(BUYER_NAME,"; orderSQL += " SHIPPING_ADRESS, SHIPPING_ZIPCODE, SHIPPING_CITY)"; orderSQL += " VALUES(?,?,?,?)"; try{ // load the driver and get a connection Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnecti...
af7568ab-bf77-4b2c-8a88-ebe2fb2ba13d
5
public static ArrayList<Lavarropas> getAllLavarropas(int montoMin,int montoMax,char consumo) { ArrayList<Lavarropas> colElectrodomestico=new ArrayList<Lavarropas>(); String sqlFiltros=""; if(montoMin>0) sqlFiltros=sqlFiltros.concat(" and preciobase>"+montoMin+" "); if(montoMax>0) sqlFiltros=sqlFiltros.co...
84e59a15-135d-4d94-849e-770cce42b605
6
public void run() { ServerSocket serversocket = null; Socket s; InputStreamReader input; BufferedReader b; PrintWriter p; String message = null; boolean done = false; try { serversocket = new ServerSocket(Utils.FAULTMNGR_PORT, 1); /* backlog is 1 */ serversocket.setSoTimeout(0); } catch ...
29afceb9-e09a-4a93-9fb3-e2f29704371d
3
private void collide(List<Entity> entities) { for (Entity firstEntity : entities) { Box firstEntityBounds = firstEntity.desiredLocation(); for (Entity secondEntity : entities) { Box secondEntityBounds = secondEntity.desiredLocation(); if (firstEntityBounds...
5d107062-fc60-424f-bc3a-679a110b6200
0
public void setSpecialityList(final List<Speciality> specialityList) { this.specialityList = specialityList; }
f1cf7f87-49df-4f76-8ae0-cb6fec140b0e
8
private void commandGet(String[] parameters) { POPXY popxy = POPXY.getInstance(); if (parameters.length < 2) { this.answer(ConfigurationProtocol.getInvalidArgumentMsg()); return; } Stats s = null; if (parameters[1].equalsIgnoreCase("-g")) { s = User.getGlobalStats(); } else { if (popxy.existing...
9e4b7b1e-ad0d-4777-ac12-32522390f262
8
public static void main(String[] args) throws IOException { BufferedReader bInputStream = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(bInputStream.readLine().trim()); int[][] mSquare = new int[n][n]; for (int i = 0; i < n; i++) { String[] ar...
3944d45f-efc3-41f9-8f2e-9f260862f46e
5
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Word word = (Word) obj; if ((value == null) ? (wo...
7f82384c-70d1-4e6a-8d54-e72e8864d53c
9
public final GalaxyXLinkingParser.expression_return expression() throws RecognitionException { GalaxyXLinkingParser.expression_return retval = new GalaxyXLinkingParser.expression_return(); retval.start = input.LT(1); int expression_StartIndex = input.index(); CommonTree root_0 = null; ...
970dacc3-e32b-4134-b928-7714de2f8faf
4
public void savePicture() { BufferedImage img = this.getBufferedImage(); JFileChooser fc = new JFileChooser(); FileNameExtensionFilter fnef = new FileNameExtensionFilter("Images", "png"); fc.setFileFilter(fnef); int returnVal = fc.showSaveDialog(body); if (returnVal == JFileChooser.APPROVE_OPTION) { File...
50c16ee1-3cb0-4f9a-a4ad-55a2943f48b6
3
private void resaveParamsCitySelected(SessionRequestContent request) throws ServletLogicException { String page = (String) request.getSessionAttribute(JSP_PAGE); String editDirectionPage = ConfigurationManager.getProperty("path.page.editdirection"); String searchingPage = ConfigurationManager.ge...
6cda7f15-bc45-4b0b-ab4a-323013e747dd
7
public void agregarAPedido(int id , int cant){ if(id>productosDisponibles.size()){ JOptionPane.showMessageDialog(null, "No existe ese producto"); return; } if (cant>productosDisponibles.get(id-1).getCantidadDisponible()){ JOptionPane.showMessageDialog(null...
2230fceb-7bdf-4193-82e1-191c0e2bf15c
0
public void load(int[] aInt, float[] aFloat, String[] aString ){ this.aInt = aInt; this.aFloat = aFloat; this.aString = aString; }
9054cdb3-9d5e-4a0c-bee3-129388d6b59c
4
protected void drawWeeks() { Calendar tmpCalendar = (Calendar) calendar.clone(); for (int i = 1; i < 7; i++) { tmpCalendar.set(Calendar.DAY_OF_MONTH, (i * 7) - 6); int week = tmpCalendar.get(Calendar.WEEK_OF_YEAR); String buttonText = Integer.toString(week); ...
029ba362-5dec-4bee-bb28-c725e862a6df
6
protected void renderName(EntityPlayer var1, double var2, double var4, double var6) { if(Minecraft.isGuiEnabled() && var1 != this.renderManager.livingPlayer) { float var8 = 1.6F; float var9 = 0.016666668F * var8; float var10 = var1.getDistanceToEntity(this.renderManager.livingPlayer); ...
e2831105-254f-43d6-992e-21cf6b98c7df
7
public static ListNode reverseKGroup(ListNode head, int k) { if (head == null) return head; ListNode dummy = new ListNode(-1, null); ListNode current = dummy; dummy.next = head; while(true) { ListNode indexer = current.next; ...
cb6e0b03-c9c3-4dd1-b499-23e4f74c0a48
4
@Override public boolean contains(E e) { setIn = new Node(e); current = root; while(current != null){ if(setIn.object.compareTo(current.object)==0){ return true; }else if(current.object.compareTo(setIn.object)<0){ current = current.right; }else if(current.object.compareTo(setIn.object)>0){ c...
a8e8b08c-a2b7-4f27-b530-4ccb90f1c18c
3
public String createDomain() { date = false; for ( Column col : table.getColumns() ) { writeColFields( col ); getsSets.append( writeGet( col ) ); getsSets.append( writeSet( col ) ); if ( col.getFldType().equals( "Date" ) && date != true ) { ...
718492eb-297b-4b50-a96c-56a017b3530f
8
public boolean iterateOverReadOnly(String query, ResultSetHandler rsh) throws SQLException { boolean good = true; Connection connection = null; Statement statement = null; try { Class.forName(driver); connection = DriverManager.getConnection(url, username, passwd); statement = connection.createState...
a90702cb-cc45-4e2a-9839-477dbe6d37be
4
public void generateReferenceModel(){ m_allWordFrequency = 0; for(_Doc d: m_corpus.getCollection()){ _SparseFeature[] fv = d.getSparse(); for(int i=0; i<fv.length; i++){ int wid = fv[i].getIndex(); double val = fv[i].getValue(); m_allWordFrequency += val; if(m_wordSstat.containsKey(wi...
9d42de71-781d-4ad9-96d0-595051c6366a
4
public void walk(){ switch (walktype) { case GO_LEFT: speedX = DEFAULT_SPEED_LEFT; speedY = 0; break; case GO_RIGHT: speedX = DEFAULT_SPEED_RIGHT; speedY = 0; break; case GO_UP: speedX = 0; speedY = DEFAULT_SPEED_UP; break; case GO_DOWN: speedX = 0; speedY = DEFAULT_SPEED_DOWN...
ea684c26-cfb5-4051-a966-5de660740aea
0
public IntegerArray(int kit, int length, int chars){ this.kitSize = kit; this.length = length; this.chars = chars; createStructure(); }
4fbb7556-2487-479c-a98f-09d3b735abdf
6
public void getMaxPalindromic () { for (int i = 1000000; i > 999; i--) { if (this.checkPalindromic(i)) { for (int j = 9999; j > 100; j--) { if ( (i % j == 0) && (i / j > 100) && (i / j < 999)) { System.out.println(i); ...
2c4df5f1-4832-41ba-92a7-de70b25897d4
7
public boolean updateText(int selectedParam) { StringBuilder sb = new StringBuilder("<html>"); int paramCount = pc.getParamCount(); for (int i=0; i<paramCount; i++) { if (i==selectedParam) { sb.append("<b>"); } // Some parameter types may have chars in them unfriendly to HTML // (such as type p...
3dd3dd71-a13e-435a-b98a-761a53ca84c2
0
public void AddOp(String channel) { OpChannels.add(channel); }
ddccede2-c28e-492a-ba97-32d963aa4051
1
public void appendError(String error) { if (errors == null) { errors = new ArrayList<String>(); } errors.add(error); }
a76f915c-6a2e-4c6b-ba4a-5f7b00c8e6db
7
public void execCommandGetResult(Session session){ StringBuilder result = new StringBuilder(); result.append(String.format("======== [ %s ] execute Command: ' %s ', The Result is:\n",ip,command)); try { ChannelExec channelExec = (ChannelExec)session.openChannel("exec"); c...
8e8e6554-1a92-4498-85bf-7eb19a22ea33
5
void filterCR() { int i, j; readBufferOverflow = -1; loop: for (i = 0, j = 0; j < readBufferLength; i++, j++) { switch (readBuffer[j]) { case '\r': if (j == readBufferLength - 1) { readBufferOverflow = '\r'; ...
a405018c-1d88-4a1a-b53d-7df63d6c1c2b
7
public List<String> completeLimbNameSet(Environmental E) { final Vector<String> V=new Vector<String>(); if(!(E instanceof MOB)) return V; final MOB M=(MOB)E; final int[] limbs=M.charStats().getMyRace().bodyMask(); for(int i=0;i<limbs.length;i++) { if((limbs[i]>0)&&(validamputees[i])) { if(limb...
91bdd4ce-ff40-4527-9f80-bcd6212504bf
1
public void addTreasureLocation(TreasureLocation loc) { if(possibleLocations.contains(loc)) return; possibleLocations.add(loc); }
8104d234-81c0-4a3a-b617-8178890e698f
7
public void affect(Actor a) { // // Impose penalties/bonuses to various attributes, if still symptomatic- final float progress = a.traits.traitLevel(this), response = 0 - a.traits.effectBonus(this), symptoms = progress - response ; if (reportEffects && I.talkAbout == a) { I...
f62cf8c6-e303-4624-96dc-afa91d6cbe06
0
public void startGame(){ this.load(); this.continueGame(); this.started = true; }
acac6339-9ccf-4d82-a337-1e501179f33a
9
public float read(float[] leftBuf, float[] rightBuf, int readRate) { if (buf.length != leftBuf.length) buf = new float[leftBuf.length]; if (sounds.size() > maxChannels) { Collections.sort(sounds); } Arrays.fill(leftBuf, 0); Arrays.fill(rightBuf, 0); ...
edd75f9c-a58d-4875-9d1b-859b62bbde0d
6
public static void initialize() { for (String imageName : IMAGES_NAMES) { Image image = new Image(Config.class.getResourceAsStream(IMAGE_DIR+imageName)); if (image.isError()) { System.out.println("Image "+imageName+" not found"); } images.add(image...
0232ed71-a858-46ae-b5c0-3ba37ca89e87
8
public void run() { String line; Event event = null; try { while((line = eventSocketReader.readLine()) != null) { if (!line.isEmpty()) { if (event == null) event = new Event(); event.add(line); } else if (event != null) { if (event.getName() != null) eventListener.handleEvent...
a72f39a9-6975-41bb-b4f8-8957a214798a
0
protected void bite() { print("bite"); }
778ba931-73cd-40e7-9cdd-0444d4bb9d12
3
public static String getCardName(String atr) throws IOException { String cardModel = "Desconhecido"; FileReader fr = new FileReader(Constants.SC_BASE_SMARTCARDLIST_TXT); BufferedReader in = new BufferedReader(fr); String str; while ((str = in.readLine()) != null) { ...
f4461317-205c-4d3c-aaba-2656297407d4
5
private spaceExplorer() { Board game = null; try { game = new Board(); } catch (IOException e) { e.printStackTrace(); } catch (UnsupportedAudioFileException e) { e.printStackTrace(); } catch (LineUnavailableException e) { e.pri...
dcd4bf9c-a329-4173-909d-c2306ee08696
4
public void run(){ try{ while(serverOn){ System.out.println("Waiting for changes"); ObjectInputStream in = new ObjectInputStream(socket.getInputStream()); try { String type = (String) in.readObject(); ...
3ce53172-2b21-45b4-b2fc-8cb5c4d09bb4
7
public void inserir(Usuario u) { Statement st; Connection con; try { Class.forName("org.postgresql.Driver"); } catch (ClassNotFoundException ex) { Logger.getLogger(JanelaLogin.class.getName()).log(Level.SEVERE, null, ex); } try { con = ...
2b78af54-3da2-49db-be15-ef472a0e2975
7
public void keyReleased(KeyEvent e) { if ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0) { if (e.getKeyCode() == KeyEvent.VK_C) { scene.notifyStop(); } else if (e.getKeyCode() == KeyEvent.VK_UP) { // scene.increaseFPS(10); } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { // scene.decreaseFPS(10); ...
3db8e91f-bc74-4daa-a806-77facafa222e
0
public void setAutomaton(Automaton newAuto) { automaton = newAuto; }
2c964eb1-a8cd-4bee-9b3d-114be5b35dd3
3
public AcctsRecMastRec get() throws Exception { AcctsRecMastRec result; if(Ghost != null){ result = Ghost; Ghost = null; } else { try { String name = sc.next(); int balance = sc.nextInt(); result = new AcctsRecMastR...
678b327d-7c95-4e2c-920e-f220481b33ba
6
private void listenForMapSpecificRequests() { JsonObject config = container.config(); byte startChannel = ((Number) config.getNumber("startChannel")).byteValue(); byte endChannel = ((Number) config.getNumber("endChannel")).byteValue(); byte world = ((Number) config.getNumber("world")).byteValue(); for (byte i...
3d92dc0f-b0d9-4668-9d65-3c5f36b2a66f
2
public void wakeUp() { if (getState() == STATE_NORMAL && getVelocityX() == 0) { setVelocityX(-getMaxSpeed()); } }
e8861439-412c-4b2f-b75a-7682bf2234c0
7
@Override public ArrayList<Map<String, String>> getAuctionsByUser(String userid) { ArrayList<Map<String, String>> auctions = new ArrayList<Map<String,String>>(); TypedQuery<Auction> auctionsByUserQuery = emgr.createNamedQuery( "Auction.findAllAuctionsByUser", Auction.class); auctionsByUserQuery.setParameter(...
085b5398-4e83-4410-8651-79b3c2223f84
5
public void gather(BufferedReader bufferedReader) throws IOException, HttpException { //token map HashMap<String, String> headers = new HashMap<String, String>(); //get status line String statusLine = bufferedReader.readLine(); if (statusLine == null) throw new HttpException("Missing status line", Stat...
7f33cb0c-a750-4d91-84a1-75788c58e6f5
9
private void decodeHeader(BufferedReader in, Map<String, String> pre, Map<String, String> parms, Map<String, String> headers) throws ResponseException { try { // Read the request line String inLine = in.readLine(); if (inLine == null) { ...
25987bbf-a460-4763-b7c5-9a2820de028c
1
private void createScenarioPanel() { this.scenarioPanel = new JPanel(); this.scenarioPanel.setLayout(new BoxLayout(this.scenarioPanel, BoxLayout.PAGE_AXIS)); File folder = new File(SCENARIO_FOLDER); scenarioFiles = folder.list(new FilenameFilter() { @Override public boolean accept(File dir, String name...
477b9a53-f1fa-4f9c-b555-5079846ca9b6
5
protected void updateView(String machineFileName, String input, JTableExtender table) { ArrayList machines = this.getEnvironment().myObjects; Object current = null; if(machines != null) current = machines.get(0); else current = this.getEnvironment().getObject(); if(current in...
5136028c-d835-42f0-87ac-3eafef363089
0
public double popOperand(){ return operandStack.pop(); }
14f86e9c-da6f-4b15-a979-df6a92669ec4
1
public void visitNegExpr(final NegExpr expr) { if (expr.expr == from) { expr.expr = (Expr) to; ((Expr) to).setParent(expr); } else { expr.visitChildren(this); } }
eac6f380-9be6-4c57-9f5a-9b4a1b8469b6
6
final int[] method3042(int i, int i_2_) { anInt9336++; int[] is = ((Class348_Sub40) this).aClass191_7032.method1433(0, i); if (i_2_ != 255) return null; if (((Class191) ((Class348_Sub40) this).aClass191_7032).aBoolean2570) { for (int i_3_ = 0; i_3_ < Class348_Sub40_Sub6.anInt9139; i_3_++) { int i_4_ = a...
0d6779c5-1736-4c1b-aa49-9eee270f8d91
7
protected int getStateFromNeighbours(int currentState, int[] neighbours) { int total = 0; for (int neighbour : neighbours) { total += neighbour; } int next = 0; if (currentState == 0 && total == 3) { next = 1; } else if (currentState == 1 && total < 2) { next = 0; } else if (...
dd5a8f1b-1cc6-48e0-b705-89ddfb982028
9
private void cargarTable(){ try { if(tipoLista.equals(LISTA_CLIENTES)){ jButton2.setText("Ver Programas"); jButton2.setVisible(true); model = new ClienteTableModel(Factory.getClienteDAO().getAll()); } if(tip...
c31df010-b696-4845-84a9-680b7cf3da41
2
public static List<Material> getBlacklist() { List<String> whitelist = conf.getStringList("blacklist", new ArrayList<String>()); List<Material> result = new ArrayList<Material>(); for (String materialString : whitelist) { Material material = Material.getMaterial(materialString); if (material == null) { B...
a033cba9-da4f-40c6-9510-40db30e12c3c
0
public WindowApropos() { this.setTitle("À propos - Jame of life"); JEditorPane txtHelp = new JEditorPane("text/html", ""); txtHelp.setText("<h1>Jame of Life</h1>" + "<h2>À propos</h2>" + "<p>Jame of Life est une implémentation en Java de <i>Conway's Game of Life</...
dde6d592-6dea-4c17-b8fa-d714b3246739
8
public static String executeHttpGet(String baseUrl) { String result = null; URL url = null; HttpURLConnection connection = null; InputStreamReader in = null; try { url = new URL(baseUrl); connection = (HttpURLConnection) url.openConnection(); connection.setConnectTimeout(60000); connection.setRead...
5b0bef9c-5008-498f-b2d6-ddb5521be58d
7
public String parseSince(String str) { long seconds = 0; String strRemainder = str; // Add days in seconds if (strRemainder.contains("d")) { String[] strSplit = str.split("d"); seconds += Integer.parseInt(strSplit[0]) * 24 * 60 * 60; strRemainder = (strSplit.length == 2) ? strSplit[1] : ""; } ...
58086c1d-3c7b-4873-8765-c3fa7c49303a
1
public static int DBUpdate(PreparedStatement stmt) { int rs = 0; try { rs = stmt.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } return rs; }
6fd8e7bf-4cd9-4de6-a9ed-b885e58a3aa0
4
public static Tile readTile(Class<?extends Game> gameClass,char c, Board board, Location location) throws NoFactoryFoundException { if(tileFactories.containsKey(new T2<Class<?extends Game>, Character>(gameClass,c))) return tileFactories.get(new T2<Class<?extends Game>, Character>(gameClass,c)).buildTile(board, lo...
408e6d76-5cab-41b6-ab89-ec5636930a1e
1
public String readURL(String url) throws MalformedURLException, IOException { String txt = ""; BufferedReader rd = new BufferedReader(new InputStreamReader((new URL(url)).openStream(), "UTF-8")); String line = null; int linecount = 0; for(line = rd.readLine(); line != null;line = rd.readLine()){ txt +...
ee29d812-d133-42a5-ac77-2e40b07f3a26
6
private boolean checkMonitor() { FLAG_ENABLE_BILL_TYPES = false; if (EnableBillTypesMonitorThread == null) return true; Thread.State monStat = EnableBillTypesMonitorThread.getState(); if (monStat.equals(Thread.State.RUNNABLE) || monStat.equals(Thread.State.TIMED_WAITIN...
c311bb81-eb0a-400a-a4d1-b844b2f2cbd7
1
public final Filterer createCustomFilter(final String implementor, final String[] params) throws CustomFilterException { Class<Filterer> customClassToCreate = Filterer.class; Filterer custom = customClassToCreate.cast(createCustom(implementor, params, customClassToCreate)); if (custom == null) { throw new Cust...
a2bdaa3d-a3cd-4795-a7e7-e5bb984d4524
8
protected void buildDefinition() { StartEvent startEvent = getStartEvent(); EndEvent endEvent = getEndEvent(); if (startEvent == null || endEvent == null) { throw new ASFModelException("The definition must have a StartEvent and a EndEvent."); } for (Flow flow : fl...
b7da9679-cc68-4416-888b-3286dd43cada
0
public CheckResultMessage checkG09(int day) { return checkReport.checkG09(day); }
4d8babd5-c8c1-473b-bef7-2cf2857fd227
1
@Override public void display(List<Player> players) { for (Player player : players) { playersNameList.addElement(player.getName()); playersRoleList.addElement(player.getRole()); } }
53af3a93-2be5-4121-b896-b38f9817b3e4
5
private static void parseJstatMetrics(String wholeJstatText, JvmUsage jvmUsage) { String[] lines = wholeJstatText.split("\\n"); if(lines.length < 5) return; String dateStrSec; if(!lines[0].trim().startsWith("NGCMN")) return; String[] gccapacity = lines[1].trim().split("\\s+"); if(gccapacity.le...
03dcb716-098f-488a-89a6-bdd66d85347a
3
private void setHoverCardComponent(CardComponent component) { if (component == hoverCardComponent) { return; } if (component != null) { component.getColorAnimator().clear(); component.setColor(ProjUtils.saturate(component.getTrueColor(), 0.5f), true); ...
d7737672-a861-461e-8618-b707ee215248
0
public String name() { return getClass().getSimpleName(); }
ab2114d5-c2d7-4d70-bc40-6eedb2bdea86
5
public static boolean validateUrl(String url) { Iterator iter = startOfUrlList.iterator(); if (url == null) { return false; } if("".equals(url.trim())){ return false; } if(urlBlackList.contains(url)){ return false; } while (iter.hasNext()) { String part = (String) iter.next(); if (!url.tr...
8c7434cc-862e-4d79-86fa-9a588c93c2c8
1
public void visitTryCatchBlock(Label start, Label end, Label handler, String type) { super.visitTryCatchBlock(start, end, handler, // type == null ? null : remapper.mapType(type)); }
2adf240e-378f-44aa-9049-a747657c2955
1
public void prepare(RState rs) { this.rs = rs; if(next != null) next.prepare(rs); }
97c993e1-6d24-4cc8-a047-4c0288d1b725
6
private static void runBenchmark(Settings settings) { Graph graf = new Graph(); try { graf.loadFromFile(settings.graphFileName); } catch (FileNotFoundException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } GraphColoringProble...
0ef1c427-8942-42cb-adca-4ecbb09c79a7
9
private void testFailure() { try { tests++; printDebugInfo("Failure test", "Press 'enter' to continu..."); commandLineWait(); printDebugInfo("Failure test", "Login three new nodes to the network and press 'enter' to continu..."); commandLineWait(); HashMap<Integer, Node> nodeList = server...
c7767f29-ce77-48bb-a8f0-472c95202c3b
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PermessoAccesso other = (PermessoAccesso) obj; if (nomePermesso == null) { if (other.nomePermesso != null) return false; } else if (!nom...
f9f2b9e3-2a22-4501-97fa-1f1d03f580cb
7
public int commonPrefix(ArrayList<String> input) { if(input.size()>1) { boolean end=false; int charPosi =0; int min=input.get(0).length(); int listIndex=0; Character currentFirst; for(int i=1;i<input.size();i++) { if(input.get(i).length...
8f1bec56-8fb5-467c-919c-47059d163908
8
protected Neuron(Element neuronE, NeuralLayer layer) { m_layer = layer; m_ID = neuronE.getAttribute("id"); String bias = neuronE.getAttribute("bias"); if (bias != null && bias.length() > 0) { m_bias = Double.parseDouble(bias); } String width = neuronE.get...
949b539f-f6ae-4f2f-9b2e-d399ecb073ae
6
public static ArrayList<Task> parseGenericHttpClientRequest(String httpRequest) { ArrayList<Task> tasksList = new ArrayList<>(); String result = ""; try { result = java.net.URLDecoder.decode(httpRequest, "UTF-8"); } catch (UnsupportedEncodingException ex) { ...