method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f5ebc531-c088-43a2-bd45-223ca2e01e4d
0
public void writeLine(String text) { write(text + "\n"); }
bb31bffa-6f84-452d-a7fe-626063926570
3
private void parseReference(Element parentNode, String sectionName, int level) throws TemplateException { try { // look for section XPath xPath = XPathFactory.newInstance().newXPath(); NodeList nodeList = (NodeList) xPath.evaluate("/grammar/define[@name='" + sectionName + "']...
4c2faf46-a3d6-45c9-b63e-7b668d0e6ba5
1
public void resetIfVersionMisMatch(String module, int version) { if (getVersion(module) != version) { startBatch(); removePreferences(module); setVersion(module, version); endBatch(); } }
5596ba72-e31d-4f86-a0e1-c244e927c80a
9
public boolean isValidTilePlacement(int row, int column, int rotation) { int row2 = board.getAdjacentRow(rotation, row); int column2 = board.getAdjacentColumn(rotation, column); if (!board.isValidHex(row, column) || board.getHex(row, column).getColor() != Board.VACANT || !board.isValidHex(row2, column2) ...
68d8d4e5-9396-4240-ae47-2784d4fa2adb
5
@Action public void run() { int n = Integer.parseInt(jFormattedTextField1.getText()); if (n > 15 || n < 0) { jTable1.setModel(new javax.swing.table.DefaultTableModel()); if (errorReport == null) { JFrame mainFrame = DemoApp.getApplication().getMainFrame(); ...
d3b67fc8-d25e-4c78-8826-e8098f3a51b6
4
private static boolean _isTrimable(char c, char[] exceptions) { if ((exceptions != null) && (exceptions.length > 0)) { for (int i = 0; i < exceptions.length; i++) { if (c == exceptions[i]) { return false; } } } return Character.isWhitespace(c); }
e846e897-8169-4e69-9a22-be74c91c46d2
4
public static void main(String[] argsv) { // Setting op a bank. Bank christmasBank = new Bank(); christmasBank.addAccount(new BankAccount(BigInteger.valueOf(100))); christmasBank.addAccount(new BankAccount(BigInteger.valueOf(50), BigInteger.valueOf(-1000))); BankAccount theAccou...
3735cadf-8815-4c31-a742-3ea146fc5ebb
6
protected SgfInstance constructGame() { SgfInstance game = new SgfInstance(); Move lastMove = game.getRoot(); Stack<Move> parents = new Stack<Move>(); while (index < contents.length()) { char c = getChar(); if (c == '(') { if (parents.size() == 0) { if (nextChar() == ';') ...
88fa2617-4c2b-4c0b-9d3e-14bb4e20767c
7
public ConnexionReclassifierRaster(){ arrayy.clear(); geomms.clear(); Connection con = null; try{ Class.forName("org.postgresql.Driver"); con = DriverManager.getConnection("jdbc:postgresql://"+ConnexionBaseDonnees.getHote()+":"+ConnexionBaseDonnees.getPort()+"/"+ConnexionBaseDonnees.getNomBase(),Connexi...
a03360b1-1fb3-44c4-89b3-efca98cc60b4
2
public String toString() { int a = bits; String s = ""; for(int i = 0 ; i < 32 ; i ++){ if((a & 0x1) == 0x1){ s = "1" + s; } else{ s = "0" + s; } a = a >> 1; } return s; }
656c8146-b65c-49d7-87a0-30451124e575
8
@Override protected void paintComponent(Graphics graphics) { super.paintComponent(graphics); //luodaan taustalle mustat neliöt niin että palikan sivut erottuvat graphics.setColor(Color.BLACK); int ykoordinaattiNeliot=0; graphics.fillRect(65, 1, 64, 257); graphics.fill...
fbbff1c2-36ab-4272-a790-44a2adbce72f
1
private void getIconArt() { try { boxSelectIcon = ImageIO.read(getClass().getResource("icons/I_BoxSelectTool.png")); brushIcon = ImageIO.read(getClass().getResource("icons/I_BrushTool.png")); eraserIcon = ImageIO.read(getClass().getResource("icons/I_EraserTool.png")); lineIcon = ImageIO.read(getClass().ge...
c375a929-fa13-40bd-9c31-2d0a5fa176ee
0
public void setAge(int age) { this.age = age; }
45e3ada6-cf40-47bc-ae7a-c68a398be19f
9
public void setElectionColumns2() { if( chckbxSubstituteColumns.isSelected()) { chckbxSubstituteColumns.doClick(); } for( VTD b : featureCollection.vtds) { b.resetOutcomes(); b.has_election_results = true; } for( VTD f : featureCollection.features) { f.resetOutcomes(); double[] dd = new d...
328e4e2b-1d43-465b-9f69-189e07fec104
1
public ResultSet runQuery(String sql) { try { rs = stat.executeQuery(sql); } catch (SQLException ex) { Logger.getLogger(SQLHelper.class.getName()).log(Level.SEVERE, null, ex); } return rs; }
1b763e11-16f5-433b-95ea-8507a83e31cb
1
@Override public boolean unsubscribeObserver(Observer observer) { boolean removed = false; if (readers.contains(observer)) { removed = readers.remove(observer); } return removed; }
291b7e1a-407a-4d90-94dd-a319e1aab284
5
public void actionPerformed(java.awt.event.ActionEvent e) { String command = e.getActionCommand(); if (myButtonListener != null) { if (command.equals("0")) myButtonListener.processButton(0); else if (command.equals("1")) myButtonListener.processButton(1); else if (command.equals("2")) myButton...
eef208e8-485c-4b4a-a89b-c2ce650b0f86
8
protected void updateArc() { // arc was fully matched - save it addToPath( arc ); boolean extended = false; if ( arc.to != forbidden ) { ListIterator<Arc> iter = arc.to.outgoingArcs(); while ( iter.hasNext() ) { Arc a = iter.next(); if ( a.versions.intersects(versions) &&a.to.isPrintedO...
38930f01-0b76-4457-8273-f46561b0533a
5
public int[] sortArrayWithHashMaps(int[] arr) { class ArrEl { int value; int freq; int first; @Override public boolean equals(Object o) { return this == o || o instanceof ArrEl && value =...
1f071c72-0389-49ae-8b50-cdb2b854ee0d
0
@SuppressWarnings("unchecked") public List<Film> getDostepneFilmy() { return em.createNamedQuery("film.dostepny").getResultList(); }
ded96e98-f7c0-4922-9d1b-be0af5c6b414
5
@Override public void actionPerformed(ActionEvent act) { // if the user presses exit game in the in-game menu if (act.getActionCommand().equals("menuExitGameBtn")) { exitGame(); } // if the user presses help in the in-game menu if (act.getActionCommand().equals("menuHelpBtn")) { JOptionPane.showMessa...
593965c8-4845-4768-9a0f-3aa17f7d351c
8
private void getConnection(Element connectElement) { String room1Name=""; String room2Name=""; String exit1=""; String exit2=""; Element el; NodeList nl = connectElement.getElementsByTagName("room1"); if(nl != null && nl.getLength() > 0) { el = (Element)nl.item(0); room1Name=el.getAttribute(...
0988c44c-5cc2-4acf-81ee-3ec1a24a489d
2
@Override public void run() { for(int i = 0 ; i < 20 ; i ++) { try { Thread.sleep((long)Math.random() * 1000); } catch (InterruptedException e) { e.printStackTrace(); } SampleCalc.increase(); } }
d52279c6-ea8d-4801-af5f-f992c65cfcb2
1
public Element toElement(Ticket ticket) { Element element = new Element("ticket"); try { element.setAttribute("row", Integer.toString(ticket.getPlace().getRow().getNumber())); element.setAttribute("place", Integer.toString(ticket.getPlace().getNumber())); element.setAttribute("price", Double.t...
7a0aabfa-46ab-455b-8f1c-915bd43eeb08
0
public void setTyyppi(EsteenTyyppi tyyppi) { this.tyyppi = tyyppi; }
5770702f-b896-4782-8b05-e6ffee90f1fd
6
@Override protected Class<?> loadClass(String name, boolean resolve) { try { if ("watermelon.sim.Player".equals(name) || "watermelon.sim.seed".equals(name) || "watermelon.sim.Point".equals(name)||"watermelon.sim.Pair".equals(name)) return parent.loadClass(name); else return super.loadClass(na...
1b8602a4-8e07-4e31-9d43-db910822fbae
8
private void checkCollision() { for (int i = 0; i < collisionRange.size(); i++) { if (getRectangle().intersects(collisionRange.get(i))) { // Kollision Unten if (collisionRange.get(i).getY() > this.getY() && collisionRange.get(i).getY() <= this.getY() + this.getHeight()) { this.jump = fal...
c2bd83a3-9234-4644-8c01-b1dff940242e
3
public final void setLedSize(final double LED_SIZE) { double size = LED_SIZE < 10 ? 10 : (LED_SIZE > 50 ? 50 : LED_SIZE); if (null == ledSize) { _ledSize = size; } else { ledSize.set(size); } }
8cfe7d51-4231-4dad-8972-4f84f9943db7
8
private String possibleTurns(int x, int y) { String turns = ""; if (x > 0) { if (!maze.getTileAt(x - 1, y).equals(ETile.WALL)) { turns += EDirection.LEFT.getSymbol(); } } if (x < maze.getWidth() - 1) { if (!maze.getTileAt(x + 1, y).equ...
d5d5f8c8-93e6-43e2-bf2c-3a8ef4fcc8a5
1
private int computeExpectation(int[] pref, int[] dist, int nfruits, int bowlsz) { double exp = 0; for (int i = 0; i != 12; ++i) { double p = 1.0 * dist[i] / nfruits; exp += (p * pref[i] * bowlsz); } return (int)exp; }
80e85e2f-796f-444c-9250-1b1741c5bdca
5
public void onBlockRemoval(World var1, int var2, int var3, int var4) { super.onBlockRemoval(var1, var2, var3, var4); if(!var1.multiplayerWorld) { var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID); var1.notifyBlocksOfNeighborChange(var2, var3 - 1, var4, this.blockID); ...
9d553022-7ec9-4927-8768-fabdff9ca686
3
public static boolean validateWeapon(String weapon){ if(weapon.equals("laser") || weapon.equals("mortar") || weapon.equals("droid")){ return true; } return false; }
3ebd4e56-25a3-45e2-879d-9bbf2cf2f918
9
public void MainClick(int button, int x, int y){ if((x>(width/8*5) && y>height/4*3)) { if(button==0){ System.exit(0); } } // //starting the game //This first section is for AI singleplayer. if((x<(width/4) && y>height/2)) { if(but...
f8355a4f-91f1-4911-a727-6eb293003262
1
private boolean jj_2_18(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_18(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(17, xla); } }
a9a5cd02-1b25-48c5-b3ea-7e3bcfcbcee3
5
public ArrayList<ArrayList<Integer>> levelOrderBottom(TreeNode root) { ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>(); if (root == null){ return result; } ArrayList<ArrayList<Integer>> rLeft = levelOrderBottom(root.left); ArrayList<ArrayLis...
7879dcd6-120d-485f-ae1d-1cce825d5783
0
private void sendSensorData() { SmartDashboard.putBoolean("Tomahawk forward?", tomahawk.isForward()); SmartDashboard.putBoolean("Tilter at top?", tilter.isTopLimitTriggered()); SmartDashboard.putNumber("String-pot", tilter.readStringPot()); }
27a1f0de-7c13-4f00-81bc-973d8fbe9de3
2
@Override public Map<String, Object> getAuctionById(String auctionId) { Map<String, Object> auctionMap = new HashMap<String, Object>(); Auction auction = emgr.find(Auction.class, Integer.parseInt(auctionId)); if (auction != null) { String auctionName = auction.getAuctionName(); String auctionDescription = ...
70fdaba2-6934-4e8c-8cde-4908fba7882e
7
@Override public boolean equals(Object obj) { if(obj instanceof ScreenCharacter == false) return false; ScreenCharacter other = ((ScreenCharacter)(obj)); return character == other.getCharacter() && getForegroundColor() == other.getForegroundColor() && ...
ccfc4b49-1c2d-4aab-aed0-58f27d56e372
2
public boolean hasSameData(ZFrame other) { if (other == null) return false; if (size() == other.size()) { return Arrays.equals(data, other.data); } return false; }
d300425e-20f4-4e35-830b-edbd11dc2c96
7
public static void main(String[] args) { String FileName = args[0]; In in = new In(FileName); int size = in.readInt(); Point Points[] = new Point[size]; for (int i = 0; i < size; i++) { Points[i] = new Point(in.readInt(), in.readInt()); } // read in the input file for (int i = 0; i < size - 3;...
23dbefc0-2236-42c4-bf01-18b60f9b9e3d
3
@Override public boolean undo(CardGame game, CardPanel panel) { Hand hand = game.getHand(); List<List<Card>> board = game.getBoard(); List<Card> fromHandList = hand.getList(); //Must be the last one as was just done Card fromHand = fromHandList.remove(fromHandList.size() - 1)...
3a418be0-86c2-495a-bd59-d5eb1ce3e51c
8
@Test public void FAMasiva() { try { log.debug("Sleeping for "+sleepTime+" secs due to ESPHORA reconnection problem"); int sleepMillis = sleepTime * 1000; Thread.sleep(sleepMillis); log.debug("Generando Lote Facturas A iva discriminado"); List<FA> facturasA = new ArrayList<FA>(); FA fa = ne...
e74f358f-9e0f-4123-9592-0be51056f1c8
7
public boolean copy() { LOGGER.info("LogWriter: copying : src=" + this.srcFile.getName() + " -> dest=" + this.destFile.getName()); LOGGER.info("LogWriter: copying : src=" + this.srcFile.getAbsolutePath() + " -> dest=" + this.destFile.getAbsolutePath()); // Reader Buffe...
20e92e8b-59ab-433b-b49c-44eda106fafa
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
9d62682a-798a-433e-88d2-a1ab39b9e740
1
public static pgrid.service.corba.repair.RepairIssue[] read (org.omg.CORBA.portable.InputStream istream) { pgrid.service.corba.repair.RepairIssue value[] = null; int _len0 = istream.read_long (); value = new pgrid.service.corba.repair.RepairIssue[_len0]; for (int _o1 = 0;_o1 < value.length; ++_o1) ...
eed7cf63-f484-421c-b669-23d52d6c77b8
8
private void selectionSimulationStep(double[] previous, double[] next, SelectionStrengthModel[] ssm, double time) { boolean fixFlag =true; boolean zeroFlag =true; // lots of class v set from the calling function. for (int d =0; d < ndeme; d++) { if (sizes[d] == PopulationSizeModel.NULL_POPULATION) cont...
91c79424-10e6-4509-8dee-93ab4952a37e
5
public Server(ServerDataHandler dataHandler){ this.dataHandler = dataHandler; try{ serverSocket = new ServerSocket(PORT); }catch(IOException ioe){ System.out.println("Could not create server socket on " + HOST + ":" + PORT); System.exit(0); } ...
a8406a10-3dbd-41c3-bf53-05ae4c8b063e
7
private static char[] multiply(char[] number1, char[] number2, boolean minus) { char[] result = new char[] {'0'}; char[] reversedNumber1 = reverse(number1); char[] reversedNumber2 = reverse(number2); for(int i=0;i<reversedNumber2.length;i++) { int num2 = reversedNumber2[i] - '0'; int carry = 0; char...
e633fb12-c29e-4e1f-924f-5a5e850c53e2
5
public static void main(String[] args) { try { for (String[] command : convertMultipleConsoleCommands(args)) { try { Process process = new ProcessBuilder(command).start(); BufferedReader in = new BufferedReader(new InputStreamReader( ...
0cb3165e-f137-496c-98f4-32ffb16bf157
4
public static String formatMethodName(String s){ if (s.toLowerCase().equals("resume")) return "unpause"; if (s.toLowerCase().equals("quit to menu")) return "quitToMenu"; String r[] = s.split(" "); for(String w : r) w = w.substring(0, 1).toUpperCase() + w.substring(1).toLowerCase(); r[0] = r[0]....
9b0b1e5e-f16d-46b3-8a16-abe230f2ac97
9
public long getDateField(String name) { String val = valueParameters(get(name),null); if (val==null) return -1; if (_dateReceive==null) { _dateReceive=(SimpleDateFormat[])__dateReceiveCache.get(); if (_dateReceive==null) { ...
2ac1ded4-7e98-486b-9475-0367c0b41124
2
@Override public void actionPerformed(ActionEvent action) { super.actionPerformed(action); // TODO Auto-generated method stub switch(action.getActionCommand()) { case "clear": //ClearCell(activeX, activeY); break; case "random": RandomAssign(5); repaint(); break; } }
b04667ad-6910-47fe-9424-c28189de254a
7
public static boolean correct(String dni)throws NullPointerException, NumberFormatException, StringIndexOutOfBoundsException,IllegalArgumentException{ boolean valor=false; if(dni.length()==0){ throw new NullPointerException(); } else if(dni.length()!=9){ valor=false; throw new StringIndexOutOfBound...
0f554a7c-580f-42d5-afcc-ef6d089be4a4
8
public static int[][] unMap(int[] solution) throws FileNotFoundException { if (solution == null) { System.out.println("There is no solution for this puzzle."); return sudokuPuzzle; } // 345 = row 3, column 4, box contains a 5 //variables used for determining row...
0d4485ab-20ad-4218-b8e3-1b75e4c82d29
3
public void run() { while (iSAlive) { if (!missileQueue.isEmpty()) { notifyMissile(); } else { synchronized (this) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } }
19d4ffc8-f1f4-4097-9d6d-1f5c2fdf388a
4
private void paivitaMaxY(){ double maxY = Double.NEGATIVE_INFINITY; for (KentallaOlija osa : osat){ if (osa.getMaxY() > maxY){ maxY = osa.getMaxY(); } } if (getSuojakilpi()){ if (getY()+getSuojakilvenHalkaisija()/2 > m...
53c4dae5-62b9-4c96-ace1-de87b751e8a0
1
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException { // Taking one line at a time and tokenizing the same String line = value.toString(); StringTokenizer tokenizer = new StringTokenizer(line); // Iterating through all the words availa...
f8e61d99-2d51-4db6-b0a6-e7c99da4175e
1
public String getString(int index) throws JSONException { Object object = get(index); return object == JSONObject.NULL ? null : object.toString(); }
bf3174fb-65ad-4bd3-a877-63048491c52e
1
private String nString(String s,int i){ String result=""; for(;i>0;i--){ result += s; //for appending strings } return result; }
e8124a18-2fc5-4d20-ab5c-bde5052fe17f
6
public static Float valueOf(Object o) { if (o == null) { return null; } else if (o instanceof Float) { return (Float)o; } else if (o instanceof Double) { return (Float)o; } else if (o instanceof Byte) { return (float)(Byte)o; } else...
74582073-94d7-42ad-a443-d7e02587a53b
6
private void makefile(){ if(pType.getText().length() > 0 && prio.getText().length() == 1 && tot.getText().length() > 0 && prescrArea.getText().length() > 0){ if(notes.getText().equals("") || notes.getText().equals("Inserisci le tue note.")) MainPanel.prescr.setNotes("-"); ...
5b222522-d9f8-4c4c-a98c-fa6e48e73aa0
3
void sendByteArray(int pNumBytes, byte[] pBytes) { int checksum = 0; sendHeader(); //send the packet header for(int i=0; i<pNumBytes; i++){ outBuffer[i] = pBytes[i]; checksum += pBytes[i]; } //calculate checksum and put at end of buffer outBuffer[pNumBytes] = (byte)(0x100 - (...
c30663c5-cd62-433f-a21a-04d8af7dc57f
4
public void testForInterference() { //check for packets that are interferred //PS: only check the packets for interference that are still alive // dead packets are still "int the air" as the sender does not know that it is disturbed. activePacketsIterator.reset(); while(activePacketsIterator.hasNext()){ ...
0d62f8b4-6a8e-4391-8865-fafa7d7a628c
4
public RandomListNode copyRandomList(RandomListNode head) { if(head == null) return null; HashMap<RandomListNode, RandomListNode> map = new HashMap<RandomListNode, RandomListNode>(); RandomListNode newHead = new RandomListNode(head.label); map.put(head, newHead); RandomLis...
13d173b9-214c-4588-ad72-58f1f8994833
7
final void method2633(int i, int i_50_, r var_r, int i_51_) { anInt4120++; r_Sub1 var_r_Sub1 = (r_Sub1) var_r; i_51_ += ((r_Sub1) var_r_Sub1).anInt10474 + 1; i_50_ += 1 + ((r_Sub1) var_r_Sub1).anInt10468; if (i != 287) method2634(-49, -3, 16, -9, -115); int i_52_ = i_50_ + ((Class330) this).anInt4113 * i_51_...
563c0792-f2f6-456b-91ee-b5ec378d9c9a
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
55a3b188-7fa1-4525-80ce-d90fe9ecc25e
0
public T get(){ return this.t; }
a3100ffa-fe8a-4290-ab7b-6c2af3e4f672
3
public char nextClean() throws JSONException { for (;;) { char c = next(); if (c == 0 || c > ' ') { return c; } } }
dc4b6d69-a458-42a7-ad75-bd85944d61b3
1
public void write_buffer(int val) { int k = 0; int rc = 0; rc = outWave.WriteData(buffer, bufferp[0]); // REVIEW: handle RiffFile errors. /* for (int j=0;j<bufferp[0];j=j+2) { //myBuffer[0] = (short)(((buffer[j]>>8)&0x000000FF) | ((buffer[j]<<8)&0x0000FF00)); //my...
d9950ad7-d20c-427a-bcd0-1568b1400c30
9
void input() { Properties prop = new Properties(); FileInputStream in = null; File f = null; File propertiesDir = Initializer.sharedInstance().getPropertyDirectory(); if (propertiesDir != null && propertiesDir.exists()) { f = new File(propertiesDir, "locationhistory.properties"); if (f.exists()) { ...
d4702a54-9191-4c54-8fb9-9eee8dfc2057
7
public static void main(String[] args) { List<Integer> numbers = new ArrayList<Integer>(); Collections.addAll(numbers, new Integer[] {1, 2, 3, 4, 5, 6, 7, 8, 9}); long startTimeMillis = System.currentTimeMillis(); List<Integer> products = new ArrayList<Integer>(); // Code is zero based, so position - 1 f...
ae2ab417-c152-4a8c-b7ad-dd142b1f4b9c
4
public void setCampus(Campus campus) { if (this.campus != null && this.campus.getDocenten().contains(this)) { this.campus.removeDocent(this); } this.campus = campus; if (campus != null && !campus.getDocenten().contains(this)) { campus.addDocent(this); } }
a017602f-c110-4b77-9f95-db062cae5316
9
@Test public void test() { //Set up connection //MongoHelper.setDB("iCrossFit"); MongoHelper.setDB("iCrossFit"); //Clear out DB MongoHelper.getCollection("gyms").drop(); MongoHelper.getCollection("users").drop(); MongoHelper.getCollection("trainingClasses").d...
accbfb88-d3db-4ffb-98d7-cc9d91d57afa
2
public Estoque Abrir(int id) throws ErroValidacaoException,Exception{ try{ PreparedStatement comando = conexao .getConexao().prepareStatement("SELECT * FROM estoques"); ResultSet consulta = comando.executeQuery(); comando.getConnection().commit(); ...
cd0de8be-6b94-4a20-979a-bd57e15b70cf
5
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if (args.length == 0) { long firstseen = player.getFirstPlayed(); @SuppressWarnings("static-a...
40dc53cc-6c82-4e5a-910c-6ba2587be602
6
public ReportHighScoresPanel(FreeColClient freeColClient, GUI gui, String prefix) { super(freeColClient, gui, Messages.message("reportHighScoresAction.name")); // Display Panel reportPanel.removeAll(); List<HighScore> highScores = getController().getHigh...
040f661d-1a03-4419-b31b-9400e70637ac
6
@Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) { HttpRequest request = (HttpRequest) e.getMessage(); HttpResponseStatus status = OK; String stringResult; String phpResult; File filePath = new File(getURIRequest(request)); if(fileP...
8dfb6b17-cf72-429c-9aaf-81bb0701eccd
3
public static GameObject getGameObjectFromFile(String filePath) { Document doc = getDoc(filePath); final String type = doc.getDocumentElement().getNodeName(); switch (type) { case "item": return getItem(doc); case "mob": return getMob(doc); case "player": return getPlayer(doc); default: System...
1dbd6630-9560-4c70-ac40-e484e22ea960
8
private boolean verifyChapPassword(String plaintext) throws RadiusException { if (plaintext == null || plaintext.length() == 0) throw new IllegalArgumentException("plaintext must not be empty"); if (chapChallenge == null || chapChallenge.length != 16) throw new RadiusException("CHAP challenge must be 16 bytes...
d1676fd7-bdf5-435c-95a3-ca76c227b119
6
public static int longestRepeatingSubstr(String str) { int currLen = 1; int maxLen = 1; int prevIndex = 0; int[] visited = new int[256]; for (int i = 0; i < visited.length; i++) { visited[i] = -1; } visited[str.charAt(0)] ...
57d8cde9-a02e-4aac-9250-27d080b59c15
1
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { List<BankDeposit> deposits = ReaderFactory.getInstance().getStAXReader() .readXML(DataPath.XML_FILE); request.setAttribute("type...
c759df9e-6a9e-4bdb-9bdf-7d0c89aba6d7
8
public void turnLeft() { assertMe(); if(x == 0 && y == 1) { x = 1; y = 0;} else if(x == 1 && y == 0) { x = 0; y = -1;} else if(x == 0 && y == -1) { x = -1; y = 0;} else if(x == -1 && y == 0) { x = 0; y = 1;} assertMe(); }
5eb40c78-c547-4377-aea2-67bc784b03eb
1
public List<CategoryEnum> getCategorys() { if (categorys.isEmpty()) { categorys.addAll(Arrays.asList(CategoryEnum.values())); } return categorys; }
cd07630f-3159-4408-8003-1cb6175bfd42
2
public void setWidth(int w){ if(w == 0) w = 1; //System.out.println("Setting Width: " + w); for(int i = 0; i < anim.getFrames().size(); i ++){ Image image = ((AnimFrame)anim.getFrames().get(i)).image; image = image.getScaledInstance(w, image.getHeight(null), 0); ((AnimFrame)anim.getFram...
27e6c277-7b8d-4314-bcb7-2eaaf7ecaee3
8
public Date ceil(Date date, int field) { Calendar cal = Calendar.getInstance(); cal.setTime(date); for (int currentField : fields) { if (currentField > field) { if (currentField == Calendar.DAY_OF_MONTH && (field == Calendar.WEEK_OF_MONTH || field == Calendar.WEEK_OF_YEAR)) { continue; } ...
fc8a6151-dc4d-4fce-8cc3-3eac7050fdc7
5
@Override public MapConnector<String, Integer> forceSynchronization() throws Exception { try (Connection con = getConnectorInfo().getConnection()) { forceClear(); int n = 0; StringBuilder values = new StringBuilder(); String stm; for (String s : ge...
4affbc4b-504c-4cf5-be1b-fcd8cb990e78
4
public static boolean isAvaible(URLConnection connection) { if(connection instanceof JarURLConnection) return true; if(connection instanceof HttpURLConnection) try { return ((HttpURLConnection) connection).getResponseCode() == HttpURLConnection.HTTP_OK; } catch (IOException e) { e.printStackT...
583b5599-7331-4d46-87d2-e888ee1690b1
9
private boolean verticalMove(int fromY, int toY, int x) { Board board = getBoard(); // define the direction by coordinates boolean isUpDirection = toY >= fromY; // bottom to top if (isUpDirection) { for (int i = fromY; i <= toY; i++) { if (exitFlag || Thread.currentThread().isInterrupted()) return f...
d7b3a914-3ad6-4386-a1f8-0224aec65662
5
private void removeExternalEntry(TrieEntry<K, V> h) { if (h == root) { throw new IllegalArgumentException("Cannot delete root Entry!"); } else if (!h.isExternalNode()) { throw new IllegalArgumentException(h + " is not an external Entry!"); } TrieEntry<K,...
d6d78476-23f9-4a99-85fd-e10020787e07
7
private String DecisionChart(Packet p) { // check in case it is a login packet being returned if (!Global.gLoggedIn) { return HandlePacketsWhenLoggedOut(p); } else { char destination = 'r'; char source = 'r'; if (p.GetDestination() == Global.gU...
8f52a692-668a-4449-a6b3-b17b4975b514
6
private boolean upToDate (File verFile) { String storedVersion = getStoredVersion(verFile).replace(".", ""); int storedVersion_ = -1; if (!storedVersion.isEmpty()) { try { storedVersion_ = Integer.parseInt(storedVersion); } catch (NumberFormatException e) ...
40bcee50-d5cd-441f-b2fa-14995a18d607
5
@Override public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("New")){ }else if(e.getActionCommand().equals("Add File")){ }else if(e.getActionCommand().equals("Add Folder")){ }else if(e.getActionCommand().equals("Open")){ }else if(e.getActionCo...
8f118c0f-70bf-4210-a3f4-473c0c5b2786
8
private void handlePhysicalInteract( PlayerInteractEvent event ) { if ( event.isCancelled() ) return; Location l = event.getClickedBlock().getLocation(); l.setY( l.getY() - 2 ); if ( l.getBlock().getState() instanceof Sign ) { Sign s = (Sign) l.getBlock().getState(); String[] msg = s.ge...
83cb6870-b085-437a-be4b-557915630964
2
public static void unpack(Stream buffer) { Sound.aByteArray327 = new byte[0x6baa8]; Sound.buffer = new Stream(Sound.aByteArray327); Soundtrack.method166(); do { int j = buffer.getUnsignedShort(); if (j == 65535) { return; } Sound.sound[j] = new Sound(); Sound.sound[j].method242(buffer); So...
0aa01c4b-d93b-42eb-99eb-57a0dcabcfce
8
@Override public Question findOutlier() { //sort the list boolean done = false; int i = 1; while(i < eval.getDatapoints().size() && !done) { done = true;//gets changed IF a swap occurs for(int j = 0; j< eval.getDatapoints().size() - (i); ...
b2dbeee5-4685-44c8-b1f7-9cd56dd297b5
3
public HSQLDBRecordingManager(){ super(); _recordings = new ArrayList<Recording>(); try { Class.forName("org.hsqldb.jdbcDriver"); } catch (ClassNotFoundException ex){ return; } try { conn = DriverManager.getConnection("jdbc:hsqldb:file:" + _DB, "SA", ""); // conn.setAuto...
b985e567-89e6-4a36-a87d-696d7a46d12e
6
public boolean isColliding(GameObject object2) { if (!this.active || !object2.isActive()) { return false; } int x, y; for (int i = 0; i < object2.drawShape.npoints; i++) { x = object2.drawShape.xpoints[i]; y = object2.drawShape.ypoints[i]; ...
2a58ee77-f8f7-422e-9773-526449413c25
0
@Override public void documentRemoved(DocumentRepositoryEvent e) {}
368d1ed2-c4e0-4229-b241-4dbffa144229
2
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); ejbUsuario=new EjbUsuario(); ejbUsuario.getUsuario().setContrasenia(request.getParameter("passwo...
f3018e56-66b0-4fde-871d-6064caf0a5ef
9
public ClassHolderType getClassHolderType() { if (rawClass == null) { // rawClass == null in the generic case such as T variable; return SINGLE; } else if (Collection.class.isAssignableFrom(rawClass)) { if (typeParams.size() > 0) { ClassHolderType innerType = typeParams.get(0).getClassHolderType(); ...