method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
81a2c4c2-044c-42c5-b8e8-d7c2715b211b
9
private void postPlugin(final boolean isPing) throws IOException { // The plugin's description file containg all of the plugin data such as name, version, author, etc final PluginDescriptionFile description = plugin.getDescription(); // Construct the post data final StringBuilder data =...
d827e60e-e3c2-4f1d-b746-e6c102761e33
3
@EventHandler public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { if (event.getPlayer().getItemInHand().getType() == Material.STRING) { if (event.getRightClicked() instanceof Wolf) { Wolf wolf = (Wolf) event.getRightClicked(); plugin.debugMessage...
f8d0727a-085a-4cf3-8adb-ff25d1697a73
3
@Override public MedTypeDTO getMedTypeById(Long id) throws SQLException { Session session = null; MedTypeDTO medType = null; try { session = HibernateUtil.getSessionFactory().openSession(); medType = (MedTypeDTO) session.load(MedTypeDTO.class, id); } catch (Ex...
a5a8c3bc-37c1-4a15-b138-535902140cb3
8
public static double GetTrainingLikelyhood(int i, int j, int f, boolean isFaceClass) { if(f == 1 && isFaceClass) { return isFaceProbilities[i][j]; } else if(f == 0 && isFaceClass) { return 1 - isFaceProbilities[i][j]; } else if(f == 1 && !isFaceClass) { return nonFaceProbilities[i][j]; } e...
db219ee1-2ab6-4529-a46c-6a218e042c02
3
private void addNeighbors(int i, int j) { for (int k = i - 1; k <= i + 1; k++) for (int m = j - 1; m <= j + 1; m++) if (existNeighbor(k, m)) board[i][j].addNeighbor(board[k][m]); }
f1c5309d-4384-44d8-b607-e888282742ba
5
public Gestion() { Restaurant r = new Restaurant(); Table gestion[] = r.restaurantCreate(); do { System.out.println("If you want to sit down press 1, to leave press 2, to display the restaurant state press 3,to close the programm press 4"); choice = scan.nextInt(); switch(choice) { case ...
c4aae314-8257-4531-bedd-95770a6df14c
7
protected StandardTile[][][] makeTiles(JSONObject dataRoot) throws JSONException, DataFormatException { JSONObject dataSize = dataRoot.getJSONObject("size"); int sizeZ = dataSize.getInt("z"); int sizeX = dataSize.getInt("x"); int sizeY = dataSize.getInt("y"); if (sizeZ <= 0 || sizeX <= 0 || sizeY <= 0) { ...
a4628c3a-b789-4c30-95a0-9d3a969b99ef
8
public Mesh(Vector3d[] verts, Triangle[] tris, Color3f a, Color3f d, Color3f s, Color3f e, float shininess, Shape3D shape) { this.shape = shape; vertices = new ArrayList<Vector3d>(verts.length); edges = new ArrayList<Edge>(verts.length); triangles = new ArrayList<Triangle>(tris.length); for (int i = 0; i < v...
465f7771-855b-4354-bd90-d457bbaebc2c
8
private void setEvents(){ dataTf.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent focusEvent) { if(!controlDate){ JOptionPane.showMessageDialog(centerPanel, "Por favor, digite uma data no formato Brasileiro dia/mês/an...
875fce8b-d943-4a8e-b851-d874c6f82fe0
5
public boolean checkReset(){ int counter = 0; for (int i=0; i < model.getWidth(); i++){ for (int j=0; j < model.getHeight(); j++){ if (buttons[i][j].isEnabled()){ counter++; } } } log.fine("Resetting of the gamefield is " + ((counter == 0) ? "valid" : "invalid" )+ "."); System.out.println(c...
0c54dfea-b318-4fb8-8f06-e1604ec94ec6
9
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if(sender instanceof Player){ player = (Player)sender; if(args.length >= 1){ if(player.hasPermission("")){ player = _plugin.getServer().getPlayer(args[0]); if(player...
306274ac-f9b4-4c95-905b-43670e9915b9
3
@Override public void paintComponent(Graphics g) { super.paintComponent(g); if(paused) { g.setColor(Color.BLACK); g.fillRect(1, 1, getWidth()-1, getHeight()-6); g.setColor(Color.WHITE); g.setFont(new Font("Monospaced", Font.BOLD, 15)); g.drawString("Click to resume", 100, 200); } else if(gameOver)...
75a74d6c-f8ae-4803-952d-fd94b5004a62
1
@Override public void push(T item) { if (first == null) { first = new Node<T>(null, item); last = first; } else { last = setToNext(first, item); } size++; }
d22f6bb4-e7f3-4990-8eb9-00880c390923
6
public static void shortPrintStackTrace(final Throwable main, final Throwable throwable, final Object cause) { final StackTraceElement[] causedTrace = main.getStackTrace(); final StackTraceElement[] trace = throwable.getStackTrace(); int m = trace.length - 1, n = causedTrace.length - 1; while (m >= 0 && n >= 0...
f42316c5-0f70-4aa8-bebb-a29fb7271f79
8
private void jBListarIncidentesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBListarIncidentesActionPerformed // TODO add your handling code here: int comuna = combo_comuna_reportetriple.getSelectedIndex(); int tipo = combo_tipo_reportetriple.getSelectedIndex(); int...
86114ef7-d87b-4274-b6bb-e69a84c70ec6
7
Class367_Sub2(NativeOpenGlToolkit class377, IndexLoader class45, Class269 class269) { super(class377); try { aClass377_7296 = class377; aClass269_7294 = class269; if (class45 == null || !aClass269_7294.method2039(100) || !((NativeOpenGlToolkit) aClass377_7296).aBoolean9923) aClass193_7293 = null; ...
8f9a2eee-2792-412d-a626-519088b1c0a3
0
@Test public void twoVerticesCompareCorrectly() { Vertex v = new Vertex(0, 1); Vertex w = new Vertex(0, 1); Vertex u = new Vertex(0, 2); assertTrue(v.compareTo(u) < 0); assertTrue(u.compareTo(v) > 0); assertTrue(w.compareTo(v) == 0); }
c2d5ad45-1ea3-4427-b37a-a51169a080ca
4
static void plot() { //Simulating a service running in the background //It can force plot the calculator after a timer runs out! while(true) { try{Thread.sleep(1);}catch(Exception e){} if(delayInt>0){ delayInt--; if(delayInt...
9912b81c-8827-4a82-8ac1-de60196647b5
1
@Override public boolean contains(int x, int y) { int radbor = getSelect() ? CIRCLE_BORDER_RAD_SELECT : CIRCLE_BORDER_RAD_NOSELECT; int xx = x - radbor, yy = y - radbor; return (xx * xx) + (yy * yy) <= (radbor * radbor); }
2dd12f50-ff58-430c-bdbb-25e5943ba55a
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 Survey)) { return false; } Survey other = (Survey) object; if ((this.id == null && other.id != null) || (this.i...
e9bc8d60-951c-4202-8b5e-b1cc6490dca2
3
static boolean isUniueCharBitVector(String s) { if (s.length() > 256) { return false; } int checker = 0; for (int i=0; i<s.length(); i++) { int val = s.charAt(i) - 'a'; if ((checker & (1 << val)) > 0) { return false; } ...
1882ab8c-9b80-4b44-90d3-66aee3e6a661
6
private void loadProperties() { properties = new HashMap<String, String>(); try { BufferedReader reader = new BufferedReader(new FileReader(configFilePath)); String line = reader.readLine(); while(line != null) { if (line.length()>0 && (! line.startsWith("#"))) { String[] toks= line.split...
fe3b4696-4942-4ee7-8882-316b330426e8
9
@Override public void computeShortestPath() throws IllegalStateException { PriorityQueue<CostPath> nextCostPathQueue = new PriorityQueue<CostPath>(); if (startID == -1 || graph == null || weighing == null) throw new IllegalStateException(); costMap = new HashMap<Integer, C...
8ac9bc85-d6fb-4103-ada0-d53193da66c3
6
@EventHandler public void EnderDragonSlow(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getEnderDragonConfig().getDouble("EnderDr...
4adffaac-760b-4843-b1d9-61b28aa4817a
9
public static void deleteResource(int resourceID) { // Find in list int listIndex = 0; int listSize = resourceList.size(); for (int i = 1; i <= listSize; i++) { if (resourceList.get(i - 1).intID == resourceID) { listIndex = i - 1; } } Resource resourceToDelete = resourceList.get(listIndex); //...
100fc8d5-61fb-485f-b9f1-3013b0a9fc68
3
public void close() { try{ if(connection!=null && !connection.isClosed()) { connection.close(); connection=null; } }catch(SQLException ex) { ex.printStackTrace(); } }
988a8b1e-f610-44d9-ad83-d6ce22eb1376
7
public String AddCart() { ProductService service = new ProductService(); try { // if quantity mentioned on checkout.jsp is 0 display error message // without adding item to the shopping cart. if (item.getQuantity() != 0) { Item item_temp = service.getItem(item.getCategory(), item.getTitle(), it...
7f06f3d1-d08c-4de8-94f1-eead1bf2c043
9
public Bullet updateControl(final Input input) { if (input.isKeyDown(Input.KEY_A) || input.isKeyDown(Input.KEY_LEFT)) { this.angle -= Constants.THRUST_ANGLE; } else if (input.isKeyDown(Input.KEY_D) || input.isKeyDown(Input.KEY_RIGHT)) { this.angle += Constants.THRUST_ANGLE; } if (input.isKeyDown(Input.KEY...
2cecaf20-792a-4459-b25f-abd2f49df0f3
5
public boolean populate(OggPacket packet) { // TODO Finish the flac support properly if (type == OggStreamIdentifier.OGG_FLAC) { if (tags == null) { tags = new FlacTags(packet); return true; } else { // TODO Finish FLAC support ...
e68e4c1e-e22f-4851-888b-bc31acc44f24
7
private synchronized void messageReceivedWithTimestamp(int node, Message msg, long timestamp, boolean plot) { if (slave != null && msg instanceof SnoopBCMsg) { SnoopBCMsg sm = (SnoopBCMsg) msg; //Logger.getLogger(Datasource.class.getName()).log(Level.INFO, String.format("Msg from %d", sm...
8aa9aa92-0a99-46aa-91bf-4dcf3d63dfed
9
public void compile() throws IOException { GlobalAppHandler.getInstance().disableBackButton(); File folder = new File(FileUtilities.getUnintegratedDirectory() + File.separator + "notes"); Logger.getInstance().log("Folder path: " + folder.getAbsolutePath()); List<File> files = new ArrayList<File>(); FileUtilit...
e5007f3f-ef09-47e5-9f12-a3707aafb9ba
3
public Type pop() { size--; if (size < 0) throw new IndexOutOfBoundsException("No more items in the stack!"); Type data = stack[size]; stack[size] = null; if (size > 0 && size == stack.length / 4) resize(stack.length / 2); return data; }
0651b01e-973b-4ead-b8af-ce5c1151884a
0
public void setCache(Cache cache) { this.cache = cache; }
e0ba96ac-8943-4ded-b3e1-0637786e182a
9
private int numKings( int player ) { int total = 0; if( player == 1 ){ //counts how many pieces are player ones for( int row = 0 ; row < 8 ; row++ ) { for( int column = (row + 1) % 2 ; column < MAX_COLUMNS ; column += 2 ) { if( isPlayerOne( new Coordinate( column, row) ) ){ ...
a0070bfa-2ef0-4bc3-a384-e3c86005ed77
7
public void valueChanged(ListSelectionEvent __event) { try { Object source = __event.getSource(); ListModel listmodel; Vector contents; Class selection; int val; int _MAX; if (sou...
97f5999a-2ccd-4bd7-bf5a-593d67718646
9
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) { this.plugin = plugin; this.type = type; this.announce = announce; this.file = file; this.id = id; this.updateFolder = plugin.getServer().getUpdateFolder(); final File pluginFile...
8f146d87-4935-48f9-a11b-725d87b0feb5
9
public static void parse(String filename, int n) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename))); String line = null; // drop the header line line = br.readLine(); int abs_min = Integer.MAX_VALUE, abs_max = Integer.M...
ba159757-1bfb-41e2-bf41-6efdcb3b7b36
7
public Vector<String> enumDatabases () { Vector<String> instances = new Vector<String>(); Connection session = null; try { // connect to management database session = connect ("postgres", "postgres", "postgres"); if (session == null) { errMsg = "Can't connect to management database"; return inst...
768fa883-cefb-4343-982d-59b840593122
4
public static void printSpiral(int[][] spiral) { for (int y = 0; y < spiral.length; y++) { for (int x = 0; x < spiral.length; x++) { int value = spiral[x][y]; String start = ""; if (value < 100) { start += " "; } if (value < 10) { start += " "; } System.out.print(start + valu...
78be8bbf-2ac0-4fec-a0f0-ef7c74487c81
1
void moveY(boolean down) { if (down) y += speed; else y -= speed; }
14e1b779-01e1-46a1-834e-9c63f761ffdb
4
@Override protected boolean isProgramRunning(String programName) throws IOException, InterruptedException { logger.detailedTrace("Obtaining information about running instances of " + programName); Process process = new ProcessBuilder("wmic", "Path", "win32_process", "Where", command...
3ac918d9-92cc-4a0c-a511-8917342ea640
4
private int indexOf(Vertex v) { Vertex r; if (v != null) { for (int i = 0; i < adjacencyList.getSize(); i++) { r = adjacencyList.get(i).min(); if (r != null) { if (r.equals(v)) { return i; } ...
00a3dd76-743d-4e6d-ad53-3b64d6f7ee40
0
public MyStatusAdapter(ApplicationConfParser applicationConfParser) throws FileNotFoundException, UnsupportedEncodingException{ //hbaseConfModel = applicationConfParser.getHbaseConfModel(); mediaConfModel = applicationConfParser.getMediaConfModel(); newBuffer(); }
b762c4d0-8ce4-481d-b9ea-2bfc6c30b04a
4
@Override public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException { super.startElement(uri, localName, name, atts); if (numLayers > 0) { if (secondElementName.equalsIgnoreCase(localName)) { if (shouldRecord(uri, localName, name, atts)) { numLayersForR...
747e2d21-9f7b-429e-9fd7-4a3e041cf9b5
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; FPSectionNode other = (FPSectionNode) obj; if (node == null) { if (other....
2ca5d9d6-0548-48f8-8743-6b18b9557be3
8
public void processEvent(Event event) { if (event.getType() == Event.COMPLETION_EVENT) { System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle()); return; } System.out.println(_className + ".processEvent: Received Login Response.....
c541299d-c943-4e4f-957a-c008172a387d
0
public static GeneralValidator isLessThan() { return LESS_THAN_VALIDATOR; }
4c4d5c26-fe03-4a40-a1db-ec29ed59baf1
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(!CMLib.flags().canSpeak(mob)) { mob.tell(L("You can't speak!")); return false; ...
04593b46-6275-4816-a6de-d919fb5ed793
5
public List<PaidVo> getUnPaidOutDetail(int oid, Date from, Date to, int uid) { List<InDetail> result = inDetailDao.queryInDetail(-1, oid, -1, -1, from, to, uid); //Collections.sort(result); //Collections.reverse(result); Map<Integer, Double> shouldPaid = new HashMap<Integer, Double>(); ...
743c8e29-4530-4bb4-946b-9b36588ef1ba
5
public static void resetTimer(String timerName, JProgressBar bar) { for (Timer t : timerList) { if (t.getName().equals(timerName)) { if (t.isNormalTimer()){ t.setStartingTime(System.currentTimeMillis()); bar.setForeground(Color.black); } else if (t.getDurationTotal() == DAY_LENGTH){ ...
8e1bc1e2-45f5-4630-abf6-98b15e2b4ece
1
@Override protected void setReaction(Message message) { String result = executeCmd(message.text.replaceAll(" ", ""), message.author); if(result != null) reaction.add(result); }
d88c8252-e121-44f6-a947-6a66a55dee49
7
public void atualizar() { jComboBoxEdicao.removeAllItems(); jComboBoxAnoPublicacao.removeAllItems(); jComboBoxAutor.removeAllItems(); jComboBoxEditora.removeAllItems(); jComboBoxCategoria.removeAllItems(); jComboBoxPublico.removeAllItems(); jComboBoxFormato.remove...
458e58c4-5510-4d1f-b033-936ef533f264
7
protected static List<Class> getSupers(Class type) { if (type.isAssignableFrom(Model.class)) throw new IllegalArgumentException(EXC_NOTAMODEL); Class[] interfaces = type.getInterfaces(); List<Class> sC = new ArrayList<Class>(); boolean subclass = true; for (Class i : interfaces) if (i.equals(Model....
99819bc5-ee32-4935-9e6b-f10c9a8c21ce
3
private void fireActionListeners(ActionEvent e) { if (this.listeners == null) { return; } for (int a = 0; a < this.listeners.size(); a++) { ActionListener l = this.listeners.get(a); try { l.actionPerformed(e); } catch (Exception e2)...
730bb0b9-f22b-4fb9-a854-fbdd0fdd1cc5
5
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); int nCases = Integer.parseInt(in.readLine().trim()); for (int nCase = 0; nCase < nCases; nCase++) { in.readLine(); int[] mn = readI...
481d8bbd-eee0-4a41-8505-121a56736cb5
2
public static String doCensor(String input) { System.currentTimeMillis(); char dest[] = input.toCharArray(); Censor.method495(dest); String censoredInput = new String(dest).trim(); dest = censoredInput.toLowerCase().toCharArray(); String s2 = censoredInput.toLowerCase(); Censor.method505(dest); Censor.m...
2a6bb4c2-a6e4-40f2-bba3-d561226fc667
1
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dateTime == null) ? 0 : dateTime.hashCode()); return result; }
6c42e770-023e-4560-8e69-0a71ee08f52b
0
public Queue() {}
b722ca39-c217-44e5-82ee-4f44c44b6e69
1
public void updateTable() { myXYZPanel.remove(myXYZDisplay); myXYZDisplay = new JTable(1, myLemma.getW().length()); myXYZDisplay.setEnabled(false); String s = myLemma.getW(); for(int i = 0; i < s.length(); i++) myXYZDisplay.setValueAt(s.substring(i, i + 1), 0, i);...
211717c4-0ac7-4cef-a400-5088bfdccf5a
3
@SuppressWarnings("unchecked") private Map<OrderField, String> getMarketOrderPaths(Document doc) { Map<OrderField, String> toReturn = new HashMap<OrderField, String>(); for (OrderField f : OrderField.values()) { String path = f.getPath(); if (path != null) { List<DefaultElement> list = doc.selectNo...
25516261-91e6-4692-b4c5-b064635ba55b
0
public void addAttempt(String attempt) { myAttempts.add(attempt); }
f90cf0c0-6d2c-454b-9e5e-06241257e562
4
public static Team getTeamFromJson(JSONObject obj){ if(obj ==null) return null; Team team = new Team(); Object value; JSONArray jsonArray; JSONObject tmpObj; User tmpUser; value = obj.get("id_team"); if(value!=null) { team.setId_team(Integer.parseInt(value.toString())); } jsonArray ...
ae1a0c85-9805-4ea3-b40b-d5336047a239
0
public String getNumber() { return number; }
dd7926c1-4ce9-4806-b03b-d9e5aea28425
5
@Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); switch (cmd){ case CMD_LOGIN: String login = loginField.getText(); String pass = getHash(new String(passwordField.getPassword())); if (login.isEmpty()...
37525e2d-288c-4c29-9c36-8c718cfb62ff
0
public MandelbrotPanel() { left = BigDecimal.valueOf(-2.5); right = BigDecimal.valueOf(1); top = BigDecimal.valueOf(-1); bottom = BigDecimal.valueOf(1); }
88e34941-3c59-454a-8684-0483fe9bf95c
1
public List<Rectangle> generate() { data.getMainRectangle().setX(100); data.getMainRectangle().setY(100); rectanglesToDraw.add(data.getMainRectangle()); data.sort(); data.getSecondaryRectangles().get(0).setX(data.getMainRectangle().getX()); data.getSecondaryRectangles().get(0).setY(data.getMainRectang...
20098e17-d60f-4d21-ba6b-a314a37a464e
0
public final int getCurrentServerIndex() { return serverBox.getSelectedIndex(); }
0625a6c2-b73d-4a6a-8ce3-9e838275fecd
6
public String stComposeEmailForGmailEmailService(int dataId,int ExpVal,String flow ) { int actVal=1000; String returnVal=null; hm.clear(); hm=STFunctionLibrary.stMakeData(dataId, "ExternalEmail"); String to = hm.get("To"); String subject = hm.get("Subject"); // String message = hm.get("Message")...
03753ad2-8b08-4bab-a40f-f943242f1e80
2
public ArithmeticDecompress (String inputFileName, boolean codeCbCr) throws IOException { this.codeCbCr = codeCbCr; binList = new ArrayList<>(); for (int color = 0; color < 3; color++) { binList.add(new LinkedList<Byte>()); } arithmeticDecompressProcess(binList.get(0), inputFil...
4fffd3f0-53c6-4e4c-8ee6-440d9117dc91
2
public void mouseClicked(MouseEvent e) { //Запоминаем событие для обработки кнопки ev = e; //Получаем выбраную строку в таблице int selectedRowIndex = creditProgramTable.getSelectedRow(); if (selectedRowIndex != -1) { //Получаем значения ...
13b5dd8b-b171-4e8f-bcba-b022db8663ba
0
public CheckResultMessage checkF07(int day) { return checkReport.checkF07(day); }
5fca3dc1-7320-49c4-8b4c-90972c6c8408
0
public PagePinnedException(Exception e, String name){ super(e, name); }
dedcf3a1-b9ff-47ac-8cbf-141db80202ca
8
public static synchronized void geneject(Class<? extends GenejectorProblem> problem) { byte[] mortalBytes; if (instanceRole == InstanceRole.PROJECT) { // Finalize settings Settings.getSettings().setProblemClassName(problem.getCanonicalName()); Settings.getSettings().addClass(problem.getCanonicalName(),...
804f2e2e-961c-4519-8573-037472dc8d18
3
public void mouseClick(Point point) { if(exitButton.getBounds().contains(point) || !window.contains(point)) { setVisible(false); return; } else if(moneyButton.contains(point)) { log.logp(Level.FINE, getClass().getSimpleName(), "mouseClick()", "Setting money to add..."); setMoneyToAdd(50000); log.logp(Le...
dd75463f-edb6-4d70-be85-2e00dad60181
0
@Override public String getServletInfo() { System.out.println("a"); return "Short description"; }
ea3dbd52-3f7d-4477-b4a1-755b28fe5ee5
2
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed ProdutoDAO dao = new ProdutoDAO(); Produto editado = null; try { editado = dao.Abrir(this.idDoProdutoSelecionado ); } catch (ErroValidacaoException ex) { ...
94dfb990-3587-4abc-9a3b-6f528da2c88d
0
public void setUsuarioidUsuario(Usuario usuarioidUsuario) { this.usuarioidUsuario = usuarioidUsuario; }
3a55027b-71f9-4e5b-b323-8df61d749d81
2
public Room getRoom(int id) { Room room = null; try { PreparedStatement ps = con.prepareStatement("SELECT * FROM rooms WHERE id=?"); ps.setInt(1, id); ResultSet rs = ps.executeQuery(); if( rs.next() ) { room = getRoomFromRS(rs); } ps.close(); } catch (SQLException e) { // T...
395aaebd-e4e0-420e-a1c0-9faad91c11ff
2
public boolean removeEntity(int x, int y) { if (state != null) { throw new IllegalStateException("game currently ticking"); } boolean success = thisTick[x][y] != null; log(Level.INFO, "Removing %d at (%d, %d)", success ? thisTick[x][y].id : -1, x, y); thisTick[x][y] =...
60c3858d-a872-468a-87fc-3e4183adcab2
8
static public Object[] toArray(Object coll) throws Exception{ if(coll == null) return EMPTY_ARRAY; else if(coll instanceof Object[]) return (Object[]) coll; else if(coll instanceof Collection) return ((Collection) coll).toArray(); else if(coll instanceof Map) return ((Map) coll).entrySet().toArray(); else ...
0974f851-3d36-49a0-a9a2-c0ed2b1cf151
0
protected Icon getIcon() { java.net.URL url = getClass().getResource("/ICON/default.gif"); return new javax.swing.ImageIcon(url); }
1243816b-1f42-4e9f-be02-9ea46c25876d
8
public void drawRect(int xPos, int yPos, int width, int height, int color) { if (xPos > this.width) xPos = this.width - 1; if (yPos > this.height) yPos = this.height - 1; if (xPos + width > this.width) width = this.width - xPos; if (yPos + height > this.height) height = this.height - yPos; width -...
92a970ba-3708-483a-90db-34d99e225204
5
public static void keyPress(KeyEvent e){ Ship ship = gameObjects.getShip(); int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_UP){ ship.forwardThrust(true); } if (keyCode == KeyEvent.VK_DOWN){ //No reverse } if (keyCode == KeyEvent...
953eafd9-a782-4599-b0c3-8640c09482e2
8
public static Set<ClassFile> analyzeProject(ClassReference mainClass, File classPath, final Set<ClassReference> notFound) { final RootReference root = mainClass.getRootReference(); Set<ClassHolder> classHolders = new HashSet<ClassHolder>(); classHolders.add(new ClassHolder(mainClass...
cc507c64-016d-4c9c-8d83-d7c546c28f06
6
protected String legalMove(Board b, String move) { // get source pos and target pos if (move != null) { Position src, tgt; int srcRow, srcCol; int tgtRow, tgtCol; srcRow = b.getRowNumber(move.substring(1, move.indexOf(' '))); if (reverse) { src...
4695d826-566e-4326-9188-f8c902fd2886
2
public void consume() throws InterruptedException { Random random = new Random(); while (true) { synchronized (lock) { while (list.size() == 0) { lock.wait(); } int value = list.removeFirst(); System.out.pri...
a7c5fcca-6d6e-4417-95ee-f3eae26a194f
8
void processLoginResponseMessage(Event event) { OMMItemEvent ie = (OMMItemEvent)event; OMMMsg ommMsg = ie.getMsg(); short ommMsgType = ommMsg.getMsgType(); String ommMsgTypeStr = OMMMsg.MsgType.toString((byte)ommMsgType); System.out.println("<-- " + _className + "Received " +...
09d7d304-eccd-4d1a-8149-ae3899f3b87b
5
static final Class171 method459(int i, OpenGlToolkit var_ha_Sub2, String string, boolean bool) { try { anInt861++; int i_6_ = OpenGL.glGenProgramARB(); OpenGL.glBindProgramARB(i, i_6_); if (bool != false) return null; OpenGL.glProgramStringARB(i, 34933, string); OpenGL.glGetInte...
98d63b79-80f2-4f98-a434-e849cae879d0
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...
1baf60e6-c8c6-4a8f-9867-0892665b736b
4
public void WGPwd(String sender, String login, String hostname, Command command) { if(command.arguments.length == 2) { User user; for(Game game : games.values()) { user = getUser(game, sender, login, hostname); if(user != null) { user.s...
dc0e86ef-91b9-4d5c-8529-13430e958d0e
4
public ParkMain() { setTitle("\u505C\u8F66\u573A\u7BA1\u7406\u7CFB\u7EDF"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); JMenuBar menuBar = new JMenuBar(); JMenu m1 = new JMenu(); m1.setFont(new Font("微软雅黑", Font.PLAIN, 12)); m1.setText("\u7CFB\u7EDF\...
f6bcb69c-9d69-4e7e-bc98-39663fd73142
4
@EventHandler(priority = EventPriority.HIGH) public void onPlayerEnteredArena(PlayerEnteredArenaEvent evt) { if (!evt.isCancelled()) { Player evtPlayer = evt.getPlayer(); if (!evtPlayer.isDead() || evt.getMethod() == MoveMethod.RESPAWNED) { evtPlayer.getInventory().clear(); addItems(evtPlayer); add...
b7ca7fa2-8b56-45de-8439-08e3aaa28e52
0
public JButton getjButtonClose() { return jButtonClose; }
25dc879a-b325-49c9-b820-a2f2c425d91c
2
private boolean jj_3_37() { if (jj_3R_55()) return true; if (jj_3R_56()) return true; return false; }
6b297c20-21e7-40f3-8701-3876b9e9ee27
0
public StudentTableModel(LinkedList<Student> students) { this.showStudents(students); }
f0788609-2e9d-4c56-bbf7-968cef24b9ce
6
public void runAway(int fromX, int fromY) { if (dead || sleeping || exciting || angry) { return; } int toX, toY; if (x > fromX) { toX = Terrarium.MAX_X; } else { toX = 0; } if (y > fromY) { toY = Terrarium.MAX_Y; } else { toY = 0; } moveTo(toX, toY); clearActions(); scare = tr...
89d4e124-31ad-41de-aa69-ed022ccb2d12
9
public double getEnvironmentMult(Player player) { Environment env = player.getWorld().getEnvironment(); String envString; double envMult = 1.0; if (env.equals(Environment.NORMAL)) { envString = getMBR().getConfigManager() .getProperty(MobBounty...
5a1244de-42e4-4919-9d35-ad180449e1e7
2
private void getRequest(HttpExchange he) throws IOException { try { String path = he.getRequestURI().getPath(); int lastIndex = path.lastIndexOf("/"); if (lastIndex > 0) { int id = Integer.parseInt(path.substring(lastIndex + 1)); response = fac...
b4989c12-c638-4c01-a79f-d2d89890fc64
8
protected void configureShell(Shell shell) { GridLayoutFactory.fillDefaults().margins(0, 0).spacing(5, 5).applyTo( shell); shell.addListener(SWT.Deactivate, new Listener() { public void handleEvent(Event event) { /* * Close if we are deactivating and have no child shells. If we * have child sh...
3324194e-d4d1-467e-aa10-06b6ec965669
1
public RacketView(int x, int y) { BufferedImage img = null; try { img = ImageIO.read(new File("src\\jark\\racket.png")); _elementSprite = new Sprite(img, x, y); _elementSprite.setSpeed(0, 0); } catch (IOException e) { e.printStackTrace(); }...