method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
12c19b21-ecfd-4c29-8cf4-c1f494f8900b
9
private long[] readCPU(final Process pc) throws Exception { try { long[] returnCPUInfo = new long[2]; pc.getOutputStream().close(); InputStreamReader inputReader = new InputStreamReader(pc.getInputStream()); LineNumberReader lineNumberInput = new LineNumberReader...
62498037-759b-4063-a762-28c0f4a314ae
0
@Transactional public void finishById(Integer id) { tasksDao.setFinishedById(id, true); }
a437099a-d61e-4247-a8d4-334809e56ff1
9
@Test public void testCheckDefeat() { GameController gc = new GameController(paddle1,paddle2,ball,view,padq1,ballq1); int radius = Ball.getSize(); //ball is not near paddle zone boolean b = gc.checkDefeat(); if(b) fail("Failure Trace: "); //ball y=300 ball.setPosition(250, 300, 0); b= gc.checkDef...
9c9aa119-d8bd-4853-8139-325b3c1072fb
1
public void testAdd_DurationFieldType_int2() { MutableDateTime test = new MutableDateTime(TEST_TIME1); try { test.add((DurationFieldType) null, 0); fail(); } catch (IllegalArgumentException ex) {} assertEquals(TEST_TIME1, test.getMillis()); }
fe394487-7f22-4e6d-8ca6-93ea38829562
8
public int characterAt(int at) throws JSONException { int c = get(at); if ((c & 0x80) == 0) { return c; } int character; int c1 = get(at + 1); if ((c1 & 0x80) == 0) { character = ((c & 0x7F) << 7) | c1; if (character > 0x7F) { ...
ff170ca4-a853-491d-a246-1797122ede27
2
public void mousePressed(MouseEvent e) { // Selects to create a handler for resizing if (!graph.isCellSelected(cell)) { graphContainer.selectCellForEvent(cell, e); } // Initiates a resize event in the handler mxCellHandler handler = graphContainer.getSelectionCellsHandler().getHandler( cel...
75caaf9a-d7e8-43d4-b588-7443e618998b
3
@Override public List<Editor> listAll() { Connection conn = null; PreparedStatement pstm = null; ResultSet rs = null; List<Editor> editores = new ArrayList<>(); try{ conn = ConnectionFactory.getConnection(); pstm = conn.prepareStatement(LIST); ...
5b0bc91f-c4bd-4a8d-8832-70e1a76aca5c
8
private static void sendCommand(String cmd) { boolean com = false; cmd = cmd.substring(1); if (cmd.contains(" ")) { String cmdPar[] = cmd.split(" "); for(int i = 0; i < commands.length; i++) { for(int j = 1; j < commands[i].length; j++) { if(cmdPar[0].equalsIgnoreCase(commands[i][j])) { run...
13158570-c357-46ea-bd24-0bfbae2bc495
5
public static Unit findHighPriorityTargetIfPossible(Collection<Unit> enemyBuildings) { for (Unit unit : enemyBuildings) { UnitType type = unit.getType(); if (type.isSporeColony() || type.isMissileTurret() || type.isBase()) { if (isProperTarget(unit)) { return unit; } } } return null; }
6902da15-efc4-4655-8853-fc83619568dc
4
public Level() { if (!(this instanceof LevelEditor) && JOptionPane.showOptionDialog(null, "Skip tutorials?", "Tutorial", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null) == JOptionPane.YES_OPTION) { try { maxLives = Integer.parseInt(JOptionPane.showInputDialog(null, "How...
12f78c5f-5867-4fd7-9627-15071ec03fdd
1
synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { __typeCode = pgrid.service.corba.PeerReferenceHelper.type (); __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (pgrid.service...
d978c7e7-d71e-4ed6-ab48-79c951a4dbfa
7
@Override public int compareTo(BString other) { // same object if (other == this) return 0; int p = start; int pOther = other.start; while (true) { // same length, all bytes matched if (p == end && pOther == other.end) return 0; // a...
e622a625-d9a9-4d8d-b65c-e689659eddb2
5
public boolean contains(T test) { if (test == null) { for (int i = 0; i < array.length; i++) if (array[i] == null) return true; } else { for (int i = 0; i < array.length; i++) if (test.equals(get(i)))...
c05f621e-83e4-4588-bb93-898db834eb7b
2
@Deprecated public void draw(int screenX, int screenY, int xStart, int yStart, int xStop, int yStop){ for (int x = xStart; x < xStop; x++){ for (int y = yStart; y < yStop; y++){ contents[x][y].draw(screenX + (x * Standards.TILE_SIZE), screenY + (y * Standards.TILE_SIZE)); } } }
c7602018-2b0f-42da-b791-8a1b9b8b0f6f
8
private static void solve70(){ double small = 2.0; for (int i = 2000; i < 5000; i++) { for (int j = 2000; j < 5000; j++) { if (i != j && i*j < 1_000_000_0) { if (isPrime(i) && isPrime(j)) { int phi = (i - 1) * (j - 1); if (small > (double) (i * j) / phi) { if (isPermutable(i * j, phi...
c239fad7-cb9f-4751-b1fd-abf167e588e2
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 fe...
1b391032-2437-47eb-8b34-ca0d37a7e96f
6
private int strcmp(String s1, int i1, String s2, int i2) { int l1 = s1.length() - i1; int l2 = s2.length() - i2; int len = l1; boolean diff = false; if (len > l2) { len = l2; } while (len-- > 0) { if (s1.charAt(i1++) != s2.charAt(i2++)) { diff = true; break; } } if (diff == false ...
90875678-b6f8-40d0-b42d-31004a66d057
5
private void analisaRegistro() { System.out.println("ENTROU22"); if (!acabouListaTokens()) { nextToken(); if (tipoDoToken[0].equals("Identificador")) { nomeRegistro = tipoDoToken[1]; if (!acabouListaTokens()) { nextToken(); ...
c464d1c4-bbc5-43b0-a055-ee9023f8cd2b
4
private String[][] createScoreList(String string){ if (string==null){ return null; } else { int savedScores = numbersOfSymbols(string, DATA_DIVIDER2); String temp[][] = new String[savedScores][2]; for (int a=0; a < savedScores; a++){ for (int b=0; b < 2; b++){ String indexThingie=D...
92d09ce1-5969-4fe1-b802-53cbc86dc449
2
public static CommandManager getInstance(){ if (instance == null){ synchronized (CommandManager.class) { if (instance == null){ instance = new CommandManager(); } } } return instance; }
73fb9db8-2a6a-4d62-a299-9f64aa85d3da
3
private int compareFitness(int particle1, int particle2){ double p1 = fitness.get(particle1); double p2 = fitness.get(particle2); if(maximum){ if(p1 > p2){ return particle1; }else{ return particle2; } }else{ if(p1 < p2){ return particle1; }else{ return particle2; } } }
a2f86da4-0caa-45c3-8901-8a82e499de28
1
public static void main(String[] args) { BinaryTree BT = new BinaryTree(); Scanner in = new Scanner(System.in); int n = in.nextInt(); Node root = null; for (int i = 0; i < n; i++) { root = BT.addToTree(root, in.nextInt()); } System.out.println(findPredecessor(root, root.left).v); }
904af87e-236b-40e4-9004-490a3489f1f7
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Curso)) { return false; } Curso other = (Curso) object; if ((this.id == null && other.id != null) || (this.id !...
a00a5e97-11c3-4600-b676-ca36ed822a84
1
public ResultSet select(String query){ try{ Statement stm = this.con.createStatement(); ResultSet rs = stm.executeQuery(query); // stm.close(); return rs; } catch(SQLException e){ LogHandler.writeStackTrace(log, e, Level.SEVERE); return null; } }
e25d31ae-c724-4a5f-9f9b-f40b2ed5b81a
1
private boolean jj_2_3(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_3(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(2, xla); } }
eaa4029f-21f7-422f-9de0-ffe99c57a2ad
4
public int searchForEmployeeIndex(String firstName, String lastName) { if (arrayDirty) { insertionSort(); } final int count = employees.size(); for (int i = 0; i < count; ++i) { final Employee employee = employees.get(i); if ( lastName.equalsIgnoreCase(employee.getLastName()) && firstName.equalsIgn...
074a0dd7-2678-4d3d-8989-10c656a3ffef
9
@Override public void setMiscText(String text) { super.setMiscText(text); final Vector<String> V=CMParms.parse(text); dayFlag=false; doneToday=false; lockupFlag=false; sleepFlag=false; sitFlag=false; openTime=-1; closeTime=-1; lastClosed=-1; Home=null; shopMsg=null; for(int v=0;v<V.size();v+...
7fb75a81-c1f5-438d-9d0a-ef1708dc07fc
3
public boolean write(int id, byte... file) { synchronized(this) { try { byte header[] = new byte[6]; int length = file.length; int position = (int) ((data.length() + 519L) / 520L); // writing the header[0] = (byte) (length >> 16); header[1] = (byte) ...
d43e2b31-079e-4dca-b343-6d8e7c3e36a3
6
private void initializeBoard(int bl, int wa, int pi) { // Put the blocks on the board. int k= 0; // invariant: k blocks have been added. while (k < bl) { int xx = JManApp.rand(0, width-1); int yy = JManApp.rand(0, height-1); if(isEmpty(xx, yy)) { ...
0598b279-5ade-471f-86a8-8f2942f16f3c
5
public static void jar(File directory, File jarfile) { try { final URI base = directory.toURI(); final Deque<File> queue = new LinkedList<File>(); queue.push(directory); final OutputStream out = new FileOutputStream(jarfile); Closeable res = null; final JarOutputStream zout = new JarOutputStream(...
90229820-0a28-459a-8472-ba9f935c8310
9
public JavaSerializer(Class cl, ClassLoader loader) { introspectWriteReplace(cl, loader); if (_writeReplace != null) _writeReplace.setAccessible(true); ArrayList primitiveFields = new ArrayList(); ArrayList compoundFields = new ArrayList(); for (; cl != null; cl = cl.getSuperclass...
df1758cf-d843-450d-92f7-41afb603f0fc
9
private void checkForNumber() { int offs = this.currentPos; Element element = this.getParagraphElement(offs); String elementText = ""; try { // this gets our chuck of current text for the element we're on elementText = this.getText(element.getStartOffset(), elemen...
453083a9-20da-4c0a-9dd8-a95627ef21fa
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the ...
e964cfc6-73df-4e32-b2df-a4b04254773c
5
@Override public void mousePressed(MouseEvent e) { if ( ! toolBar.isAddingLink() && ! toolBar.isEditingLink() && ! toolBar.isRemovingLink()) { try { if (tree.getSelectedSquare() != null) { this.clickX = ((e.getX() - (lblMap.getWidth() - 32 * map .getWidth()) / 2) / 32); this.clickY ...
6244b53d-b3fe-42df-bb34-746e131b3400
9
private boolean execEstimateUsingFeatureFrequencies(VectorMap queryParam, StringBuffer respBody, DBAccess dbAccess) { try { int clntIdx = queryParam.qpIndexOfKeyNoCase("clnt"); String clientName = (String) queryParam.getVal(clntIdx); int ftrsIdx = queryParam.qpIndexOfKeyNoCa...
4748f009-69f9-490c-867b-dfe8e27a7fcf
5
public boolean drawShape(mxGraphicsCanvas2D canvas, mxCellState state, mxRectangle bounds, boolean background) { Element elt = (background) ? bgNode : fgNode; if (elt != null) { String direction = mxUtils.getString(state.getStyle(), mxConstants.STYLE_DIRECTION, null); mxRectangle aspect = computeA...
df2f0435-3836-49f3-ab6f-cc267c111f68
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Album)) { return false; } Album other = (Album) object; if ((this.albumid == null && other.albumid != null) || ...
02de1c85-7681-4cd4-afc3-74b2f871aa19
1
private static String getStringFromDocument(Document doc) { try { DOMSource domSource = new DOMSource(doc); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); ...
bbc29c99-3d50-4387-a065-6de9f7d0b7e1
0
public TextViewPanel(Grid initGame){ super(); setBackground(Color.BLACK); game = initGame; this.setFont(new Font(Font.MONOSPACED, Font.BOLD, 22)); }
6c401aef-6af2-4cf6-b906-73721b3ea50d
4
static public int extractZipToFolder(File pZipFile, File pDestinationDirectory) throws ZipException, IOException { if(!pDestinationDirectory.isDirectory()){ throw new ExInternal(pDestinationDirectory.getAbsolutePath() + " is not a valid directory"); } ZipFile lZipFile = new ZipFile(pZipFi...
ce7fee9f-5f04-446d-b3f4-06adec77856d
7
Operation transactOperation(Operation src, boolean updated) throws OperationServiceException { Account account = src.getAccount(); BigDecimal repositoryBalance; if (updated) { repositoryBalance = getRollbackBalance(src); } else { repositoryBalance = account.getBal...
305b149c-0466-4be9-a21f-d918007c171e
0
public String getApellido1() { return apellido1; }
8482d43d-fd5f-473f-89ea-d4bb62767771
8
public Explorer() { String date = (new SimpleDateFormat("EEEE, d MMMM yyyy")).format(new Date()); m_LogPanel.logMessage("Weka Explorer"); m_LogPanel.logMessage("(c) " + Copyright.getFromYear() + "-" + Copyright.getToYear() + " " + Copyright.getOwner() + ", " + Copyright.getAddress()); m_LogPanel....
6d26761d-3221-4855-80a8-5d865f2a4835
5
@SuppressWarnings("unchecked") public Class<Reducer<Writable, Writable, Writable, Writable>> loadClass () throws IOException, ClassNotFoundException { /* Load Jar file */ String jarFilePath = this.task.getJarEntry().getLocalPath(); if (MapReduce.Core.DEBUG) { System.out.println("DEBUG RunReducer.loadCla...
b425d2ba-b9dc-448f-a4a4-d2b1fbf05f71
6
@Override public void load(String input) { StringBuilder sb = new StringBuilder(); ImagePanel imgPanel = MainWindow.MAIN_WINDOW.getImagePanel(); for(String str : input.split("\n")) { if (str.startsWith("img")){ sb.setLength(0); sb.append(str+"\n"); } else if (str.startsWith("anim")) { sb.set...
c62c90c0-dd59-4cd7-a32d-4c236e630187
1
public CtClass getSuperclass() throws NotFoundException { String supername = getClassFile2().getSuperclass(); if (supername == null) return null; else return classPool.get(supername); }
64f51adb-17ec-497e-bc1a-42c1b5115eb6
2
@Override public boolean delete(int prenodeid, int nownodeid) { boolean flag = false; System.out.println(prenodeid + " " + nownodeid); Timenode prenode = getTimenode(prenodeid); Timenode nownode = getTimenode(nownodeid); prenode.setNextnode(nownode.getNextnode()); nownode.setDisplay("false"); if (update(...
0a10e369-7767-4641-85cf-dd028f0219a0
5
public static boolean isName(String name) { if (isNull(name)) { return false; } for (char c : name.trim().toCharArray()) { if (((!isChar(c)) && (!Character.isWhitespace(c))) || (c == CharPool.COMMA)) { return false; } } return true; }
f5220cfa-d04b-4eca-99c1-8a3874a3c26a
4
@Override public void execute(CommandSender sender, String[] arg1) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (plugin.allMuted) { plugin.allMuted = false; for (ProxiedPlayer data : plugin.getProxy().getPlayers()) { data....
df6e27e7-763f-483a-96f2-6e6b3ed0959b
8
protected void downloadEagerResources() { synchronized (this) { if (eager_resources_started_flag) return; } //update the flag synchronized (this) { eager_resources_started_flag = true; } List<CacheResource> eagerResources = new ArrayList<CacheResource>(); f...
91e313f1-aab9-4dfa-b294-2b645ec8fb11
1
public void run() { BufferedImage image = null; try { URL imgUrl = new URL(link); image = ImageIO.read(imgUrl); ImageIO.write(image, "png", new File(filename)); } catch(Exception ex) {} System.out.println("Downloaded to " + filename); }
6238c515-e7da-437c-b2b9-e0f5e1ff5b54
9
protected List<PhysicalAgent> loadMobsFromFile(Environmental scripted, String filename) { filename=filename.trim(); List monsters=(List)Resources.getResource("RANDOMMONSTERS-"+filename); if(monsters!=null) return monsters; final StringBuffer buf=getResourceFileData(filename, true); String thangName="null"...
0655411f-f3df-4fa6-b9e6-096430731385
8
public static String capitalFirst(String input) { String[] table = input.split(" "); String output = ""; for (int i = 0; i < table.length; i++) { if (i > 0) { output += " "; } if (table[i].equalsIgnoreCase("and") || table[i].equalsIgnoreCase("or") || table[i].equalsIgnoreCase("with") || table[i].equa...
0fca5154-aad7-4d2d-b325-cb658705be6d
6
private void battle() throws IOException { boolean end =false; String line = null; while(!end && !closed){ //все что в цикле сугубо для того чтоб комп не вис) line = inputStream.readUTF(); if(line.equals("$lost$")){ ...
d3c2f742-e841-44d6-9a60-b2756c4f394b
0
public void pause() { pause = true; timer.cancel(); timer.purge(); }
2e3239fe-f217-4fba-92a6-699fd03fb089
3
private void getClassAndMethod() { try { Throwable throwable = new Throwable(); throwable.fillInStackTrace(); StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter( stringWriter ); throwable.printStackTrace( printWri...
c4dabec2-96a4-40fe-836a-3a188424a16c
1
public void setPWFieldFontsize(int fontsize) { if (fontsize <= 0) { this.pWFieldFontSize = UIFontInits.PWFIELD.getSize(); } else { this.pWFieldFontSize = fontsize; } somethingChanged(); }
0652c138-da15-46db-804c-a0edaa6c0bad
7
public String toString() { String ret = ""; int roundheight = (int)Math.ceil(height); int roundwidth = (int)Math.ceil(width); for(int j = 0; j < roundheight; j++) { for(int i=0; i < roundwidth; i++) { if((i == 0) || (j == 0) || (i == (roundwidth-1)) || (j == (roundheight-1))) { ret += f...
ea75de51-8faf-4945-8655-fe888d4dde94
8
public void comment(String s) { if (inStartTag) { maybeWriteTopLevelAttributes(); inStartTag = false; write(">"); newline(); } if (!inText) indent(); write("<!--"); int start = 0; level++; for (;;) { int i = s.indexOf('\n', start); if (i < 0) { ...
7adc9ea5-2981-4ff1-880a-a8296b34c6f5
3
private boolean checkWordForDuplicate (String motherLangWord, String translation) throws SQLException { boolean hasDuplicate = false; Connection conn = null; try { conn = DriverManager.getConnection(Utils.DB_URL); PreparedStatement motherLangWordPStat = conn.prepareStatem...
690222ca-2259-421d-b72a-b8ca6b9878b7
2
private void addDataEx(){ /* SensorDao dao = new SensorDao(); Sensor sensor = dao.getOne(1); */ Sensor sensor = new Sensor(); sensor.setAddDate(new Date(System.currentTimeMillis())); sensor.setUnity("s"); sensor.setStatementFrequency(1222); sensor.setName("Sensor_Test"); sensor.setSensorType(Sensor...
c7e91faf-6ed7-444c-a7a5-b15d3e2cbc88
1
public void warn(final String msg) { if(disabled) return; else logger.warning("" + route_name + "-" + connection_id + "[warn]: " + msg); }
8d6c37dd-dd72-41c7-acbe-a5183df9aed9
6
public static Cons parseColumnSpecs(Stella_Object relconst, Stella_Object columnspecs, Object [] MV_returnarray) { if (!(Stella_Object.consP(columnspecs))) { { OutputStringStream stream000 = OutputStringStream.newOutputStringStream(); { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get(); ...
18465ac7-6b60-4c37-91c2-3d5d9945c334
5
public boolean deleteTestEmployees(Connection con) { boolean didItWork = true; ArrayList<Integer> empno = new ArrayList(); String SQLString1 = "SELECT medarbejderno " + "FROM medarbejder " + "WHERE navn = 'test'"; ...
3b1a1167-a4e4-42f6-9465-87fc929ac740
3
public boolean hasErrorOrWarning() { return isErrorProteinLength() || isErrorStartCodon() || isErrorStopCodonsInCds() // Errors || isWarningStopCodon() // Warnings ; }
cee160a9-ba16-4681-a8da-5f2a334b060b
2
public startGui(boolean bol, String ip, int Port){ //Manual_Server = bol; catalogue.setmanualServer(bol); if(!bol){ getServerNames(); } else{ Server = new ServerList(ip, Port); serverlist = Server.getServerList(); } StartGui(); ...
6a4bc749-4004-4bd8-9a9d-068a438023ca
6
* @param terminal New terminal to be used. * @param source Specifies if the new terminal is the source or target. * @param constraint Constraint to be used for this connection. */ public void cellConnected(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint) { if (edge != null) ...
30fef9cd-7d7c-4918-8510-00e83c6601f5
5
private List<String> replaceInUnescapedSegmentsInternal(Pattern pPattern, String pReplacement, int pReplaceLimit){ List<String> lReplacedStringsList = new ArrayList<String>(); int lReplaceCount = 0; for(ScriptSegment lSegment : mSegmentList){ if(lSegment instanceof UnescapedTextSegment) { ...
8e19345a-7086-4060-b059-237111f229f2
2
private void initializeThread() { Thread outputter = new Thread(new Runnable() { @Override public void run() { while (true) { String message = packetFactory.receiveMessage().trim(); if (message.startsWith("/m/")) { ...
1a02b3a1-1e9e-4ad1-ba51-33594c7ff44f
5
public int next_tick( int tick, boolean key_on ) { tick = tick + 1; if( looped && tick >= loop_end_tick ) { tick = loop_start_tick; } if( sustain && key_on && tick >= sustain_tick ) { tick = sustain_tick; } return tick; }
7ef7792c-eb63-463e-bb3d-07e2e55b4268
2
static public CycList convertMapToPlist(final Map map) { final CycList plist = new CycList(); if (map != null) { for (final Iterator<Map.Entry> i = map.entrySet().iterator(); i.hasNext();) { final Map.Entry entry = i.next(); plist.add(entry.getKey()); plist.add(entry.getValue()); ...
2da02efb-182d-477f-b391-3564612ed2f7
7
void connectGenerator (Synthesizer synth) throws SynthIfException { Generator freq = ((Input)inputs.elementAt (0)).getGenerator(); Generator phase = ((Input)inputs.elementAt (1)).getGenerator(); if (phase == null) synth.add (phase = new Constant (synth, 0)); Generator amp = ((Input)inputs.el...
ed9d3c36-3e4d-4d03-8cd9-5d06fb6423ee
6
public void start(String args[]) { // TODO quit if wrong arguments try { this.host = args[0]; this.tcpPort = Integer.parseInt(args[1]); this.analyticServerRef = args[2]; } catch(NumberFormatException e) { logger.error("Seconds argument has to be an integer"); } catch(ArrayIndexOutOfBoundsExceptio...
3c9db3b8-6059-440a-ac29-ca678b1e4cb2
8
public boolean setSize(int players, int mapSize) { boolean condition = false; //added for validation if(players >= 2 && players <= 4) { while(mapSize < 5 || mapSize > 50) { System.out.print("Size of map should be between 5 and 50. Please re-enter size : "); mapSize = keyboard.nextInt(); } ...
f4443a5d-fca1-4677-82f3-f27ad3f1016d
8
private boolean loadNetwork(String file, boolean forDraw){ boolean loaded = false; Network net = null; //Try to load from a file if (file != null){ File f = new File(file); if (f.isFile()){ try{ net = new Network(file); loaded = true; } catch (Exception e){ System.out.println("Warni...
4e3d21e3-59ce-4a9c-8527-98d8e6280039
4
@Override public Void call() { final String timestamp = this.writer.timestamp.format(new Date()); this.markers.clear(); for (final World world : this.writer.plugin.getServer().getWorlds()) { for (final Ocelot ocelot : world.getEntitiesByClass(Ocelot.class)) { if ...
b4084c8e-b7f8-4215-82a7-554cb5582faa
9
public boolean updateModel(Piece piece, PossibleTile pt) { for (Piece p : this.gm.getBoard().getPieces()) { if (p instanceof Pawn) { Pawn pawn = (Pawn) p; pawn.setPossibleToPassant(false); } } Board b = this.gm.getBoard(); if ( b.isWhiteTurn() == piece.isWhite() && b.isWhiteTurn() == this.is...
13f5e4a6-86c8-4afa-af8c-8d7d563a3b48
7
public static boolean deletEvent(String eventName) { ResultSet rs=null; Connection con=null; PreparedStatement ps=null; boolean result=true; try{ String sql="DELETE FROM EVENTS WHERE UPPER(NAME)=(?)"; con=ConnectionPool.getConnectionFromPool(); ps=con.prepareStatement(sql); ps.setString(1, event...
dd23b6d5-7488-4874-b7cf-80eb417745f6
9
@Override public void draw(Graphics2D g2d) { AffineTransform at = new AffineTransform(); at.translate(loc.x - turrets[upg].getWidth() / 2, loc.y - turrets[upg].getHeight() / 2); if (isFailing()) g2d.drawImage(turrets[0], at, null); else { if (faction == 1) { g2d.drawImage(turrets[upg], at, null)...
ae3fc17e-82ee-4850-a77e-3c2f0145f175
9
public static synchronized boolean checkConnection() { if (closed) return false; final int timeout = 5000; try { if (conn != null && conn.isValid(timeout)) return true; } catch (SQLException e) { // Consider as broken connection } final String url; { String url_ = "jdbc:mysql://" + Connec...
12860ed9-d358-4be0-b8ec-717d03173349
1
public void draw(Graphics page) { planeImage.drawImage(page, xLocation, yLocation);//Draws the plane on the component //Draws the collision Border if(this.getBorderVisibility()) { drawCollisionBorder(page,xLocation,yLocation,planeImage.getWidth(),planeImage.getHeight()); } }
5248113c-d8d3-4ddb-807d-7ccda0d4f038
3
private void carregaClientes(){ ClienteDAO daoCliente = new ClienteDAO(); try { listaClientes = daoCliente.listarTodos(); } catch (ErroValidacaoException ex) { Logger.getLogger(frmVenda.class.getName()).log(Level.SEVERE, null, ex); JOptionPane.showMessage...
52b781e3-2d96-467c-b7ac-bd7228e7ef8f
3
public void selectIndex(){ if (index >= 0) { if (index > commands.size()) index = commands.size() - 1; if (commands.size() - index >= 0) { log("ConsoleUpClicked"); msg = commands.get(commands.size() - index); } } }
b9959a86-4627-4dae-97d8-52ce30a380cd
8
private void process(ArrayList<Gridspot> path , int max, pair<Gridspot,Gridspot> a) { ArrayList<Gridspot> revise = new ArrayList<Gridspot>(path); ArrayList<Gridspot> state ; boolean flag = true; assignQuacks(a); Gridspot temp ;//= revise.get(revise.size()-2); for(int i =0; i < path.size(); i++) { temp ...
cfd34c7f-7ac9-4339-9f60-7198996b80db
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HttpResponseEvent that = (HttpResponseEvent) o; if (request != null ? !request.equals(that.request) : that.request != null) return false; ...
3e405ad3-2ce4-4be1-9a85-abcc018e64a2
8
@Override public void handle(KeyEvent event) { final KeyCode keyCode = event.getCode(); switch(keyCode) { case UP: if(moveDirection != Direction.DOWN) nextMoveDirection = Direction.UP; break; case DOWN: ...
7495d78e-4626-4909-9853-747baa99caed
7
public void adjustColors(int redOff, int greenOff, int blueOff) { for (int i = 0; i < pallete.length; i++) { int red = pallete[i] >> 16 & 0xff; red += redOff; if (red < 0) { red = 0; } else if (red > 255) { red = 255; } int green = pallete[i] >> 8 & 0xff; green += greenOff; if (green <...
5e642b75-754f-4aa0-901a-643e49494484
0
public void addTreasureBox(double x, double y, double width, double height, String note) { Element treasureBoxModule = doc.createElement("treasurebox"); campaignModule.appendChild(treasureBoxModule); Element coordinatesModule = doc.createElement("coordinates"); treasureBoxMo...
a475fe33-5be7-46b6-ab38-5a29904e7e14
1
private int calculateNeighbourhoodBest(int i, int k, int j){ if(maximum){ return maxBest(i,j,k); }else{ return minBest(i,j,k); } }
1f9af1eb-098e-4233-aca6-da0ac3320af8
1
public String toString() { try { return this.toJSON().toString(4); } catch (JSONException e) { return "Error"; } }
0e99e2d2-f3e1-4658-8745-ef0eb45af529
7
public String getPlayerClass( Player p ) { if ( perm == null ) { RegisteredServiceProvider<Permission> permissionProvider = getServer().getServicesManager().getRegistration( net.milkbowl.vault.permission.Permission.class ); if ( permissionProvider == null ) { System.out.println( "Vault plugin was ...
7502838a-05df-43f3-97ef-fb114860d625
3
@Override public void Write(IOClient p, Server server) { PacketPrepareEvent event = new PacketPrepareEvent(p, this, server); server.getEventSystem().callEvent(event); if (event.isCancelled()) return; Player player; if (p instanceof Player) { player = (Player)p; } else return; try { ByteBuff...
98cf7e1a-0992-414c-8a2c-fb6d8655d735
0
public CheckResultMessage checkFileName() { return report.checkFileName(); }
de091edd-0d96-4e03-83a1-eb754c6f0aae
7
public void rotarAdelanteIzquierda() { if (direccion.equals(Direccion.derecha)) { rotar(tipoTrans.enZ, 135); } else if (direccion.equals(Direccion.adelante)) { rotar(tipoTrans.enZ, 45); } else if (direccion.equals(Direccion.atras)) { rotar(tipoTrans.enZ, -135)...
60a6d9c3-a7d9-4f56-acac-707086a818ce
8
public void setFrequency (CommandSender sender, String inputString) throws IOException{ if (new File("plugins/CakesMinerApocalypse/").mkdirs()) { System.out.println("Frequencies file created"); } File myFile = new File("plugins/CakesMinerApocalypse/frequencies.txt"); if (myFile.exists()){...
18bf63e1-ca6a-433c-8fe9-529a2810f196
5
public ArrayList<String> findAllDictWords(ArrayList<String> excluded){ //iterates through all words in the dictionary, checking them against excluded and checking if they are on the board Iterator<String> iter=dict.iterator(); String word; ArrayList<String> foundWords=new ArrayList<String>(); boolean isExclud...
da88b7b8-d3cc-4e82-bb4d-d956dd0e6a30
2
public void paintComponent(Graphics g) { Rectangle visible = getVisibleRect(); int height = ARROW_LENGTH + icons[0].getIconHeight(); int max = icons.length - 1 - visible.y / height; int min = icons.length - 1 - (visible.y + visible.height) / height; try { min = Math.max(min, 0); g = g.create(); ...
304c3536-516e-4ad8-912a-f5bdb5f5b269
1
public String dealWith(Long testObject) { if (testObject > 3) { return "大于3退出了!"; } return "全部通过了!"; }
067d18ec-5922-4b86-9a75-441a83259453
1
private void writeColFields( Column col ) { flds.append( SPACE ); flds.append( "private " ); String fldType = col.getFldType(); flds.append( fldType ); flds.append( makeSpace( FLD_SPACE, fldType ) ); flds.append( col.getFldName() ); flds.append( ";" ); ...
10ec159d-ea65-4310-af0c-d474582ed2cc
9
@Override public void setupTest(JavaSamplerContext context) { super.setupTest(context); String hbaseZK = context.getParameter("hbase.zookeeper.quorum"); conf = HBaseConfiguration.create(); conf.set("hbase.zookeeper.quorum", hbaseZK); if (table == null) { String tableName = context.getParameter("tableName"...