method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1be32fed-312b-4124-a09f-6a67462dd96c
3
@Override public List<Consulta> listAll() { Connection con = null; PreparedStatement pstm = null; ResultSet rs = null; List<Consulta> consultas = new ArrayList<>(); try { con = ConnectionFactory.getConnection(); pstm = con.prepareStatement(LIST); ...
ab1d4e99-d155-4200-9128-76847366e610
6
@Test(timeout = 350) public void testReceiveMultipleDiscardOldest() { int noOfMessages = 5; int queueSize = 2; try { consumer = new AbstractMessageConsumer(mockTopic, queueSize, MessageDiscardPolicy.DiscardOldest) { }; assertNotNull(mockTopic.getTopicSubscriber()); HashSet<Message> messages = ne...
b4e03ca7-2e3f-4b68-8b8d-ac3231c88d10
9
@SuppressWarnings({ "rawtypes", "unchecked" }) public List<Object> getObjectListOr(final String entityName, final int pageNum, final int countOfOnePage, final List<String> orderby, final List<String> conditionQuestion, final List<Object> conditionAnswer) throws Exception { List list = null; try { list ...
df626484-0c24-4413-8f85-6ba2021a028a
0
public void setLevel_debt(double level_debt) { this.level_debt = level_debt; }
87ff2d38-1336-447f-b5a6-1a69af54a8c1
3
public void petAnimal(Player p , Entity e){ animalUtility au = new animalUtility(plugin); if(au.isAnimalOwner(p, e)){ this.animalNoise(e, p); if(this.isPet == true){ au.playAnimalSound(e, p); this.addHeartPoint(.02); if(e instanceof Pig){ this.addHeartPoint(.03); } this.setIsPet(false...
173e2c26-b25f-4de8-acf6-596acae2f995
6
public String handle(String xml) throws Exception { if (xml == null || xml.trim().isEmpty()) return Constant.NULL_STRING; if (xml.contains(Constant.TEXT_MSG_SIGN)) { List<String> list = illegalMessageHandler.splitTextMsgTo3Parts(xml); boolean isIllegal = illegalMessageHandler.if...
7d1932e4-3a78-4cee-a9e0-604e9187c509
3
public void actionPerformed(ActionEvent event) { if (buttonCount == 1) { buttonCount = 2; Red = Color.red; Yellow = Color.black; Green = Color.black; revalidate(); repaint(); ...
dd773288-31ac-4a9c-98cb-ae61c261a1b1
6
void initInputFrame(final ClassWriter cw, final int access, final Type[] args, final int maxLocals) { inputLocals = new int[maxLocals]; inputStack = new int[0]; int i = 0; if ((access & Opcodes.ACC_STATIC) == 0) { if ((access & MethodWriter.ACC_CONSTRUCTOR) == 0) ...
3edb3ceb-6563-42b4-be00-784868e4336b
2
private TypeNode getImplementsNode(final Type type) { final GraphNode node = implementsGraph.getNode(type); if ((node == null) && type.isObject()) { this.addClassNamed(type.className()); } return ((TypeNode) implementsGraph.getNode(type)); }
fad47780-6b19-450c-8dfd-846e5b552270
6
private boolean versionCheck(String title) { if(type != UpdateType.NO_VERSION_CHECK) { String version = plugin.getDescription().getVersion(); if(title.split(" v").length == 2) { String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ...
74028fa6-ea27-4497-a34f-a3c8972737bb
8
public static boolean addFood(String string,String photoUrl,String PhotoId) { Connection conn = ConnectionFactory.getConnection(); PreparedStatement pst = null; int i = 0; // 用来判断创建菜品时是否包含了食堂或者类型 String canteenString = ",f_canteen"; String typeString = ",f_type"; String haveCanteen = ",?"; String haveT...
98314fb0-7c4a-4220-8042-7f493503fb2e
0
public void mouseDragged(MouseEvent event) { state.setPoint(event.getPoint()); getView().repaint(); }
23fa4cb7-d3f3-4104-a861-3f574c769801
4
@Override public void finished() { if (outFile != null) { outFile.flush(); outFile.close(); } if (transmissionFile != null) { transmissionFile.flush(); transmissionFile.close(); } if (allEventsFile != ...
42aa0d85-26b6-4e3c-818f-467197175524
7
protected void paintComponent(Graphics g) { int c1 = (this.disabled ? COLOR_STATE_DISABLED : ((this.hovered || this.grabFlags != GRABBING_NONE) ? COLOR_STATE_HOVER : COLOR_STATE_NORMAL)); int c2 = (this.disabled ? COLOR_STATE_DISABLED : COLOR_STATE_DEPRESSED); // Regions Rectangle rect = this.getRegionBounds()...
18c6a3f3-1dda-4c9a-9f6c-518c71a35dd1
3
@Override public boolean equals(Object card) { return super.equals(card) || card instanceof Card && ((Card) card).value == value && ((Card) card).suite == suite; }
21f92164-6d0d-403a-a078-2e460dc22543
6
private static char getDirectByAction (final char action) { final char direct; switch (action) { case ACTION_UP: direct = DIRECT_UP; break; case ACTION_DOWN: direct = DIRECT_DOWN; break; case ACTION_LEFT:...
bd9f154d-695c-4d59-95a0-02dfec4eea1c
7
void addCondition(Condition cndStore) { if (vctConditions.size() == 0) engGame.vctCheckConditions.addElement(this); else { Condition cndStore2; int i = 0; while (i<vctConditions.size()) { cndStore2 = (Condition)vctConditions.elementAt(i); if (cndStore2.strName.equalsIgnoreCase(cndStore.str...
ca9726c8-2a34-4f95-a035-0cfd3caa6093
7
public IGame getGame(String GameURI){ boolean ack; Game g = new Game(null, null); Vector<Vector<String>> triples; String xml = kp.queryRDF(Config.NAME_SPACE + GameURI, null , null, "uri", "uri"); ack = xml_tools.isQueryConfirmed(xml); if(!ack) System.err.println ("Error during RDF-M3 query"); else { ...
2f3cf151-2d8f-4d72-b423-a5d184d6c752
9
@Override public boolean equals(Object o) { if (o == null) { return false; } if (!(o instanceof Pair)) { return false; } else { Pair<?, ?> oP = (Pair<?, ?>) o; return (key == null ? oP.getKey() == null : key.equals(oP.getKey())) && (value == null ? oP.getValue() == null : value.equals(oP ...
658dbf0f-f0af-4197-b5f1-1163e0d1033a
7
private Piece pieceType(String line, Piece newPiece) { String piece = ""; Matcher placeVerifier = PIECE_PLACING_VERIFIER.matcher(line); if(placeVerifier.matches()) { String pieceType = placeVerifier.group("pieceType").toLowerCase(); if(pieceType.equals("k")) { piece = "King"; n...
7d526744-c4e4-4556-b506-4f504f82849b
1
void run() { try { in = new Scanner(new File("nhl2010-11")); out = new PrintWriter(new File("output.txt")); } catch (Exception e) { throw new Error(e); } try { solve2(); } finally { out.close(); } }
cefcb2fd-972f-46f8-8809-8937dffb40b7
3
private void isGameStable() { if (play.getGameStatus().equals(GameResult.GameStable)) engine.startNight(); if (play.getGameStatus().equals(GameResult.MafiaWins)) engine.endGame(GameResult.MafiaWins); if (play.getGameStatus().equals(GameResult.VillagerWins)) engine.endGame(GameResult.VillagerWins...
9181c6f2-2a82-44b3-9025-103417828e88
7
@Override public void characters(char[] ch, int start, int length) throws SAXException { String text = new String(ch, start, length); if (this.isName) { this.name = text; this.isName = false; } else if (this.isState) { this.state = text; this.i...
e162e8f3-9c13-4ffb-876a-237e18526954
1
public boolean ModificarAplicacion(Aplicacion p){ if (p!=null) { cx.Modificar(p); return true; }else { return false; } }
51da6b03-d946-42e0-9db0-808f77277821
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final PeopleCPPK other = (PeopleCPPK) obj; if (this.id != other.id && (this.id == null || !this.id.equals(other...
931789f4-827e-454c-b4d0-05ddfb765a8b
9
public void graphs(Metrics metrics) { // Custom Graphs. Sends data to mcstats.org try { //graph1 Metrics.Graph graph1 = metrics.createGraph("auto-update"); //Sends auto-update data. if auto-update: is true it returns 'enabled'. String s = getConfig().getString("update"); ...
f62bfa56-3fde-4d1b-8825-ec2dc6bf6043
3
public GameController(int numPlayers){ //creates players and adds them to the list also adds state change listeners for listener updating for (int i = 0; i<numPlayers; i++){ players.add(new Player(BOARD_WIDTH, BOARD_HEIGHT, this, "Player " + (i+1))); players.get(i).addStateChangeListener(new PlayerStateLis...
bf37022b-995c-4bf1-a631-b195ef6d5cad
4
private Vector3D getAcceleration(Body body1, Vector3D position){ Vector3D aTotal = new Vector3D(); for (int i=0; i < bodies.size(); i++) { Body body2 = bodies.get(i); if (body1 == body2) { break; } double rSquared = position.clone().distSquared(body2.position); if (rSquared == 0 || body1.mass == ...
36de3d85-2137-4c18-af8b-aa4acb2a4297
9
private void initTileMap(String s) { InputStreamReader inputStreamReader = new InputStreamReader(this.getClass().getResourceAsStream(s)); try (BufferedReader br = new BufferedReader(inputStreamReader)) { mapWidth = Integer.parseInt(br.readLine()); //reads first line mapHeight = I...
0e9772db-5dfd-4873-b78b-611c4660f9f2
3
public static Membre creerMembreConsole(String pseudo){ Scanner sc = new Scanner(System.in); System.out.println("Création d'un nouveau membre."); String nom = Covoiturage.entreeNonVide("Nom : "); boolean coordOK = false; String email = ""; String tel = ""; while(!coordOK){ System.out.print("Email ...
ad6e8767-29b2-4fac-89a2-23ea75f50a80
6
@Override public Node latLongQuery(double longitude, double latitude) throws IOException { // System.out.println("Calling latLongQuery."); Node node = new Node(); String input = null; try { StringBuilder sb = new StringBuilder("latLongQuery\n"); sb.append(ProtocolParser.encodeDouble(longitude)); sb...
315b9d1c-6c46-46ff-aee1-6a3544a49228
9
public void run() { //init for word kickstartWord(); while (true) { hangmanCanvas.displayWord(charArrToString(maskedWord)); for (int i = 0; i < maskedWord.length; i++) { print(maskedWord[i]); } println(); print("Enter letter: "); String userInput = readLine(); ch...
5a05fca7-5099-40ec-912a-cb2c9460618f
7
public void tickBlock() throws Exception { for(int Par1 = 0; Par1 < Blocks.size(); Par1++) { tempBlock = Blocks.get(Par1); if(tempBlock.getBounds().intersects(Main.Character.getBounds(Main.Frame.getWidth(), Main.Frame.getHeight()))) { if(tempBlock.getName() == "closedChest") { SoundManage...
1c471e18-d5a2-4e3e-b82b-34ccac5d8950
1
public GetStopWordsList() { File file=new File(System.getProperty("user.dir")+"/doc/stop words/uniq_stop_words.txt"); try { reader=new BufferedReader(new InputStreamReader(new FileInputStream(file))); } catch (FileNotFoundException e) { e.printStackTrace(); } list=new ArrayList<>(); }
0ca95f21-e85e-48a8-9d79-9ca4e71e95d2
6
public void niveau() { int max = 0; ListeSommets liste = new ListeSommets(); Fenetre.leGraphe.source.niveau = 0; liste.add(Fenetre.leGraphe.source); for (int i = 0; i < liste.size(); i++) { liste.addAll(liste.elementAt(i).getSuccesseurs()); Iterator<Sommet> it = liste.elementAt(i).getSuccesseurs() ...
fcd5955c-5328-482c-8ea0-74428f7b0aad
3
public static void queens(int col) { if (col == 9) System.arraycopy(board, 1, allSol[nsol++], 1, 8); else for (int row = 1; row <= 8; row++) if (check(row, col)) { board[col] = row; queens(col + 1); } }
c2fb3502-ec57-461a-a3ef-e908b7875137
4
@Override public void run() { for(int i = 0; (!handshakeReceived) && (i < 900000); i++) { try { synchronized(obj) { obj.wait(10); } } catch(InterruptedException e) { e.printStackTrace(); } } if(!handshakeReceived) { stop(); log.fine("Shutting down : No Handshake!"); ...
19d4e7b0-293f-4844-80fd-a7b64039e145
4
private String tryNewUser(List<String> tokens) { if (user != null) { // if user is already defined return error("You have already registered as " + user.name); } else if (tokens.size() == 2 && isValidUsername(tokens.get(1))) { if (!ServerMain.userIsRegistered(tokens.get(1))) { ...
d2bd4bab-86ae-43e3-8811-d0a4b82949f8
4
public int toDegree(Object to, boolean excludeSameVertexEdges) { int count = 0; Object[] vertices = verticesToNeighbors.keySet().toArray(); for (int i=0; i<vertices.length; i++) if (hasEdge(vertices[i], to) && (!vertices[i].equals(to) || !excludeSameVertexEdges)) count++; return count; }
43e87a2e-b858-4272-bbd4-5bc99c45e50f
9
@Override public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { Input input = gc.getInput(); Transition t = new FadeOutTransition(); if(easyArea.isMouseOver()){ if(input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) { Settings.setDifficulty("Easy"); sbg.enterS...
32a90a18-b878-4c35-a821-3547d288e391
3
public void updateFilters() { try { sizeFilterText.commitEdit(); } catch (ParseException ex) { // sizeFilterText.setValue(new Integer(0)); // Logger.getLogger(MovieViewerPanel.class.getName()).log(Level.SEVERE, null, ex); } RowFilter<DefaultTableModel, Object> titleFilter = null; RowFilter<Defau...
57f779fd-93da-4723-a3a3-822d22ac56c9
3
public static String getData() { String data = ""; for ( int i = 0; i < histogramDatas.size(); i ++ ) { HistogramData histogramData = histogramDatas.get(i); data += ",{y:" + histogramData.data_y + ",color:colors[" + i +"],drilldown:{ name: '" + histogramData....
0b5b93cc-c1d8-4376-8cd9-4d2b6808d268
3
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out=response.getWriter(); Connection conn; Statement stmt; ResultSet rs; HttpSession hs=request.getSession(true); hs.setAttribute("...
f23b8ba4-ef7f-4a52-a2ec-d20c628e11f7
5
public long getExpirationTime(String method, Map<String, String> params) { method = method.toLowerCase(); if (method.contains("weekly")) { if (!method.contains("list")) return params.containsKey("to") && params.containsKey("from") ? Long.MAX_VALUE : cacheRecentWeeklyCharts; else return cacheRecentWeek...
2e7e8224-ac10-4821-8906-1dfd82ecf6ed
3
public void sort(T[] a, int lo, int hi) { // Sort a[] into increasing order. for (int i = lo; i <= hi; i++) { // Exchange a[i] with smallest entry in // a[i+1...hi]. int min = i; // index of minimal entr. for (int j = i + 1; j <= hi; j++) if (less(a[j], a[min])) min = j; exch(a, i, min); // Th...
1e7579a1-f1b4-47d1-9d00-b52c58ac295f
1
@Override public boolean dispatchKeyEvent(KeyEvent event) { Command action = MAP.get(KeyStroke.getKeyStrokeForEvent(event)); if (action != null) { action.adjust(); } return false; }
2ec25df1-8f08-446b-8234-0fb82a9d08b9
7
@Override protected Void call() throws Exception { while(!isCancelled()) { try { if(removeUsers.size() > 0) { app.setLoading(true); for(String name : removeUsers) { app.getClient().removeWatchedUser(name); } removeUsers.clear(); app.setLoading(false); } if(addUsers.size() > 0)...
06b9a497-6cde-4eb7-b52f-6cd30e60f2ec
8
public void actionPerformed(ActionEvent event) { JButton source = (JButton) event.getSource(); String s = source.getName(); //Get coordinates of label Integer colourSel = this.gui.getInputToUse(); char[] coordinates = s.toCharArray(); int xCoordinate = coordinates[0] - 48; if (source.getText().co...
b56eda2f-32ab-4b26-a8c1-5516cc50489b
7
@Override public void unInvoke() { if(!(affected instanceof MOB)) return; final MOB mob=(MOB)affected; if(canBeUninvoked()) doneTicking=true; super.unInvoke(); if(canBeUninvoked()) { if((mob.location()!=null)&&(!mob.amDead())) { final CMMsg msg=CMClass.getMsg(mob,null,CMMsg.MSG_NOISYMOVEME...
2cc62d82-76cc-4f17-b388-329e78a98722
6
public static String showBorad() //trying to make it look decent { StringBuffer s = new StringBuffer(); int j = 0; // String white = "\u25CB", black = "\u25CF", empty = "\u2212"; String white = "W", black = "B", empty = "-"; s.append("\n"); s.append(" | | | ...
1208e46e-a0fb-4d61-ab90-86bc3d293695
1
public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters) { this.messageConverters = messageConverters; }
b182229a-def5-449a-bfd3-e41f0336a2e8
8
public void AccessAcquisitionService() { System.out.println("---------------------------------------------------------------"); System.out.println("AccessAcquisitionService started... "); try { String serviceURL = AcquisitionServiceUrl; com.aquarius.DataAcquisition.AQAcquisitionService aqAcquisitionservi...
57497400-5850-4b92-95a6-cd2358a7f067
8
@Override public boolean setNecklace(Wearable necklace) throws NoSuchItemException, WrongItemTypeException { if (necklace != null) { if (necklace instanceof Necklace) { if (necklace.getLevelRequirement() > level || necklace.getStrengthRequirement() > stats[0] || necklace.getDexterityRequirement() > stat...
9bff234e-55b9-4c10-b121-b4fef181778b
8
public void renderItemIntoGUI(FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5) { if (par3ItemStack != null) { IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par3ItemStack, INVENTORY); if (customRen...
8e914e0f-3c28-4906-b56d-43779203ebb4
2
public void cargarTablaHorarios(){ //borra toda la tabla primero for(int i=0;i<((DefaultTableModel)scheduleT.getModel()).getRowCount();){ ((DefaultTableModel)scheduleT.getModel()).removeRow(i); } for(int i=0;i<horarios.size();i++){ ((Default...
d47cec37-ae34-4ce3-ad70-6dcca5691422
6
@Override public void play(Game game) { Random ran = new Random(); while(true){ while(true){ int m = ran.nextInt(3); int n = ran.nextInt(3); if(game.gridPlate[m][n] == null){ game.setPiece(m, n, Game.MARU); break; } } while(true){ int m = ran.nextInt(3); int n = ran.nex...
c1c5c94b-f799-430c-9abe-b90493d5bf2b
3
@SuppressWarnings("SleepWhileInLoop") private boolean deleteAndWait(GitHubClient gitHubClient, Repository repository) throws IOException { Properties properties = ApplicationProperties.getProperties(); RepositoryService repositoryService = new RepositoryService(gitHubClient); gitHubClient.de...
67d459e8-0874-4c2a-924a-31e1246428b7
2
@Override public List<Role> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException { int pageSize = 10; List paramList = new ArrayList<>(); StringBuilder sb = new StringBuilder(WHERE); String queryStr = new QueryMapper() { @Overri...
6ff17f1a-506e-4176-aa0c-a23fae8c90dd
1
public static void main(String[] args) { CommandLine cmd = getCommandLine(args); if (cmd.hasOption("c")) { System.out.println("Enter the unsorted array"); @SuppressWarnings("deprecation") String[] a = In.readStrings(); sort(cmd.getOptionValue("s"), a); } else { Comparable[] a = new Comparab...
002e476e-b1a2-45c6-aea5-7149bfbc6031
0
public static void main(String[] args){ System.out.println("Hello"); }
2220279e-f730-4ea1-866a-77210bd6f187
1
public static void main(String[] args) { Funcion fun = new Funcion() { @Override public double f(double x) { return 0; } @Override public double f(double x, double y) { return x + y - 1; } @Over...
888036e0-8e54-4b0f-a5e3-d45764fd0370
2
public static void copy(JoeTree tree, OutlineLayoutManager layout) { NodeSet nodeSet = new NodeSet(); JoeNodeList nodeList = tree.getSelectedNodes(); for (int i = 0, limit = nodeList.size(); i < limit; i++) { Node node = nodeList.get(i).cloneClean(); node.setDepthRecursively(0); nodeSet.addNode(node); ...
6c36dfb9-4288-4490-b2c5-5f2ec0de624c
0
@Transactional(readOnly=false,propagation=Propagation.REQUIRED) @TriggersRemove(cacheName="findAllBlogCache",when=When.AFTER_METHOD_INVOCATION,removeAll=true) public Blog saveBlog(Blog pBlog) { return (Blog) this.blogModelDao.save(pBlog); }
6ea07703-9299-4328-a5ee-0b56018f046a
2
private static int toNumFromString(String binary){ int sum = 0; char[] all = binary.toCharArray(); for(int i = 0; i < all.length; i++){ if(all[i] == '1'){ sum += binary(all.length - 1 - i); } } return sum; }
2628cccb-cfee-4ad6-84aa-4682d696bea9
4
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(sender instanceof Player) { Player player = (Player) sender; if(command.getName().equalsIgnoreCase("create")) { player.sendMessage("api"); //BarAPI.setBar(player.getLocation(), 5, 3); }else if(command...
fe3e7dbc-d2c1-4860-b91d-4f4b116d8437
8
@Override protected void readAll(List<Address> members, String clustername, Responses responses) { try { List<String> objects = rackspaceClient.listObjects(container); for(String object: objects) { List<PingData> list=null; byte[] bytes = rackspaceClie...
304c73e1-4e0e-415a-8d91-e045fa1fc6d4
4
public PairXmlDriver(String xmlStr) throws DocumentException, XmlTypeErrorException { super(); if (!isPairXml(xmlStr)) { throw new XmlTypeErrorException("not a valid pair Xml"); } document = DocumentHelper.parseText(xmlStr); cubeIdentifier = document.selec...
04e7076a-a288-49c7-9004-5b02f3322950
4
private static void sendMessages() { for (final Player player : Bukkit.getOnlinePlayers()) { player.sendMessage(MessagesHandler.convert("Gamestart.All").replace("%map%", Lobby.votedMap)); if (isTraitor(player)) { player.sendMessage(MessagesHandler.convert("Gamestart.Traitor")); } else if (isDetective(pla...
8116cd5d-2d79-4682-bee1-b9f2f51a675b
0
public void automataStateChange(AutomataStateEvent event) { stateChange(event); }
efc743d2-04f8-4920-9c34-6432961dd6e5
9
protected byte[] findBasesByName(String name, boolean tryVariants) { if (rsFile == null || !rsFile.isIndexed()) return null; ReferenceSequence sequence = null; if (fastaSequenceIndex != null) if (fastaSequenceIndex.hasIndexEntry(name)) sequence = rsFile.getSequence(name); else sequence = null; ...
c5bded4f-8929-46a1-aae5-8b3421775754
9
public int[] nucleobase(){ //count the a's, c's, g's and t's, and highlighted the letters in different colors int[] count = new int[4]; //a, c, g, t for (int i=12; i<DNA_analyse.w.result.length()-14; ++i){ if (DNA_analyse.w.result.charAt(i)=='<') { i+=3; continue; } switch (DNA_analyse.w.result.charAt(i)){ ...
35b195b6-f738-4923-a535-b61b23f1f6ff
1
public List<Object> getContent() { if (content == null) { content = new ArrayList<Object>(); } return this.content; }
dab8eb93-fa93-4161-8acb-fadf47632951
0
private BusinessObjectDAO() { }//constructor
3d2b9da7-d78f-4791-b20d-3aeaef09dc9b
4
public boolean contains(int x, int y) { if(location.x+radius >= x && location.x-radius <= x) { if(location.y+radius >= y && location.y-radius <= y) { return true; } } return false; }
ecd9167c-efbf-40f5-9dc2-08ab4e26fbc2
2
public static Connection getConnection() { if (conn == null) { try { conn = DriverManager.getConnection(baseURL, "app", null); } catch (SQLException ex) { JOptionPane.showMessageDialog(null, "Нет доступа к базе данных!"); System.exit(1); ...
38da7461-c05e-49e1-926a-e2495fcb06e5
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...
e03a9a23-f1d1-446b-ba67-f01f7154641c
1
public Background(String s, double ms, boolean isStatic, int scrollSpeed) { try { image = ImageIO.read(getClass().getResourceAsStream(s)); moveScale = ms; } catch (final Exception e) { e.printStackTrace(); } this.isStatic = isStatic; speed = scrollSpeed; }
622553dd-3645-4a63-a424-ca7980cd7283
5
public Map obtenerAgenda(){ Map<Object, List> infoAgenda = new HashMap<Object, List>(); int siguienteCapitulo[] = new int[2]; for (Serie serie : seguidas) { siguienteCapitulo = siguienteCapituloParaVer(serie); if (siguienteCapitulo[0] != -1){ // B...
10af2a42-eae4-447a-9644-69792090b038
0
public PermissionConsole getConsole() throws DataLoadFailedException { return dataHolder.getConsole(); }
4614a67f-f3e6-47f5-bf21-4dbe633c3d20
4
@Test public void testAliasMethod() { final float[] weights = initWeights(1000); ChiVertex<Integer, Float> vert = new ChiVertex<Integer, Float>(0, new VertexDegree(0, weights.length)) { public Float getOutEdgeValue(int i) { return weights[i]; } @...
ef4fb5fe-15ad-41df-937f-4e23b4594e86
1
public Renderer() { try { batch = new SpriteBatch(); font = new BitmapFont("assets/graphics/ui/font/characters.png"); } catch(Exception e) { System.out.println("Renderer creation failed!"); e.printStackTrace(); } }
0959168c-3deb-4855-b379-fe48b729736b
5
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = ""; response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); PrintWriter writer = response.getWriter(); String dbDriver = "org.postgresql.Driver"; ...
b9e368df-3e5d-4e50-98ca-c0064122ddaa
8
public static void main(String[] args) { // TODO Auto-generated method stub p_dao = DaoFactory.getInstance().getProject_eXceedDAO(); while (true) { System.out .print("Add Project(ap) / Find Project(f) / Remove Project(rp) / Find All Project(fa) / clearDB (clear) : "); String mode = sc.nextLine(); i...
67fd31cf-bf78-4c3d-ac80-bbe5685735a8
6
private void JBListarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JBListarActionPerformed this.zerarModelo(); try { this.listaConsulta = ConsultaController.obterInstancia().listar(); this.listaMedico = MedicoController.obterInstancia().listarMedico(); ...
287a0810-bbbe-4e35-b78c-12c155711ad6
9
public static void main(String[] args) { /* The Switch Statement * You can use a switch statement to compare the value of a variable with multiple values. * For each value within the switch statement, you can determine a set of statements to execute. */ in...
1d3b059b-d0f3-48a2-a8b9-6b7b7e0da354
1
public ArrayList<String> getAnswers() { ArrayList collectedAnswers = new ArrayList(); for (int i = 0; i < table.getModel().getRowCount(); i++) { collectedAnswers.add(tableModel.getValueAt(i, 0)); } return collectedAnswers; }
5402b1ba-e57b-4c5a-957d-021fafe2b410
4
private long getCPtrAddRefTradeDataNym(TradeDataNym element) { // Whenever adding a reference to the list, I remove it first (if already there.) // That way we never store more than one reference per actual contained object. // for(int intIndex = 0; intIndex < elementList.size(); intIndex++) { Object theObject =...
68b8922a-d698-47fc-91ad-15dd601a993c
1
private void LoadContent() { try { //set the car image and its size URL carImgUrl = this.getClass().getResource("/raceresources/resources/images/car.png"); carImg = ImageIO.read(carImgUrl); carImgWidth = carImg.getWidth(); carImgHeight = carImg.getHeig...
778109ce-fc95-4ffe-a766-32b23a09d5ba
5
public void keyReleased(KeyEvent e) { // set back to 0 if (gameOn == true) { if ((e.getKeyCode() == 37) || (e.getKeyCode() == (39))) { overrideLR(0); } else if ((e.getKeyCode() == (38)) || (e.getKeyCode() == (40))) { overrideUD(0); } } }
7ad18a16-5d2b-4212-8793-3f06a0efc4e0
1
public Iterator getAttributes() { if (unknownAttributes != null) return unknownAttributes.values().iterator(); return Collections.EMPTY_SET.iterator(); }
79a5cc0e-cd19-4404-8fa9-5bbe857d71b8
5
public double getForce(SpringAttachable ball) { double force = 0; if ((a_end == null) || (b_end == null)) return force; if ((ball != a_end) && (ball != b_end)) return force; double a_pos = getAendPosition(); double b_pos = getBendPosition(); stretch = Math.abs(b_pos...
82a35e78-d470-43d6-82ab-6d0937f15276
1
private void sortKills(final List list) { Collections.sort(list, new Comparator() { public int compare(final Object a, final Object b) { if (a == b) { return 0; } final int ka = ((Kill) a).key(); final int kb = ((Kill) b).key(); return ka - kb; } }); }
407373ab-c8f0-4737-bca9-446a1d92351e
9
static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[60]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 0; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { ...
17ba40a2-ad3c-405a-9adc-6f3393d30811
9
private void addButtons() { play = new JButton("Play"); play.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (dt == 0) { dt = CustomOptionMenu.doubleInput("Enter dt."); ...
681af504-7721-49d1-8d90-ff124acf7e77
8
public Tile getTile(int x, int y) { if (x < 0 || y < 0 || x >= width || y >= height) { return Tile.voidTile; //out of boundarys preventer } if (tiles[x + y * width] == Tile.planks.color_code) { return Tile.planks; } if (tiles[x + y * width] == Tile.bricks_...
516500f7-2e37-4882-b18e-c377e64a5c90
4
public static int getSelectedIndex() { if (Main.selectedId != -1) { RSInterface rsi = Main.getInterface(); if (rsi.children != null) { for (int index = 0; index < rsi.children.size(); index++) { if (rsi.children.get(index) == Main.selectedId) { return index; }/* else { RSInterface chil...
b71b3ff6-7b8a-48ba-84e9-3eb29a246dc6
8
private void drawString(String line, float xPos, float yPos, float charWidth, float charHeight, float xGap) { renderEngine.bindMaterial(fontMaterial); if (isRotated) { glPushMatrix(); glTranslatef(((xPos + getStringWidth(line)) / 2), ((yPos + charHeight) / 2), 0); if ...
05bbd04f-bb46-4418-84e1-6f4269d9e3e7
8
public String winner(String[] bracket, String results) { // fill in code here // String ret = ""; if (results == "") { // return bracket[0] / the non-bye? if (bracket[0] != "bye") { return bracket[0]; } else { return bracket[1]; } } if (bracket.length == 2) { if (results == "H") { r...
97ca0e0e-9806-4dde-b14f-d15a11167113
0
public int getLength() { return index; }
89a86508-4a32-42b5-8244-46f913d78b6c
3
public static void addMap(){ Map a = new Map(20, 14, 0); try { a.readMap("src/client/data/map/map4.txt"); } catch (IOException e) { e.printStackTrace(); } String sql = ""; for (int i = 0; i < a.getY(); i++) { for (int j = 0; j < a.getX(); j++) { sql += "INSERT INTO RPG372DB_Cell VALUES("+j+","+...