method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
acbebc7f-e2d8-476c-9583-c3bcefebda89
8
public default Map<FanType, Integer> getFans(WinInfo winInfo) { // 先parse和牌units getAllWinTypes().forEach(winType -> winType.parseWinTileUnits(winInfo)); // 如果没parse出来,说明不和牌,直接返回空map if (winInfo.getUnits() == null || winInfo.getUnits().isEmpty()) return Collections.emptyMap(); // 算番 Map<FanType, Integer...
6c71b34c-7dda-48dd-aee9-56c74c780e54
7
public int edmons_karp(int s, int t) { int u, e; mf = 0; this.s = s; Arrays.fill(p, -1); while (true) { f = 0; Queue<Integer> q = new LinkedList<Integer>(); int[] dist = new int[V]; Arrays.fill(dist, INF); dist[s] = 0; q.offer(s); Arrays.fill(p, -1); while (!q.isEmpty())...
d0bfeb1a-6e10-4663-aacd-84c0f625d3c4
7
private void remove(InteractiveObject entity) { for (int x = entity.tileLeft; x <= entity.tileRight; x++) { for (int y = entity.tileTop; y <= entity.tileBottom; y++) { Ground tile = groundArray[entity.z][x][y]; if (tile != null) { for (int e = 0; e < tile.entityCount; e++) { if (tile.interactive...
b3ec6f13-0cb8-4845-b49e-2b4c455c001f
0
public void setTypePraticien(TypePraticien unTypePra2) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }
f640d8a1-fa97-4282-adf7-95c2250de30c
9
public void changeDirection(){ int d = -1; if (facingLeft) {d = 1; } facingLeft = !facingLeft; int max = body.getFixtureList().size; float w1; PolygonShape shape; if(max >=3) if(body.getFixtureList().get(2).getUserData().equals("interact")){ w1 = w + INTERACTION_SPACE; shape = (PolygonSh...
aec2030f-c709-4bf0-91e6-242314c4a894
2
@Test public void testDeal() { // deal the cards, this also selects the solution first game.deal(); // set to store all cards the players and solution has Set<Card> cards = new HashSet<Card>(); for (Player p : game.getPlayers()) { for(Card c : p.getCards()) { cards.add(c); } } Card person = new...
f8e41fbd-334c-4d82-b7ae-6f7333c99d70
1
public SalesSystemUI(SalesDomainController domainController) { this.domainController = domainController; this.model = new SalesSystemModel(domainController); // Create singleton instances of the tab classes historyTab = new HistoryTab(model); stockTab = new StockTab(model); purchaseTab = new Pu...
5c38583c-0005-491f-b9c1-f84c468ac936
5
public void updateGameState( SavedGameParser.SavedGameState gameState ) { SavedGameParser.ShipState shipState = gameState.getPlayerShipState(); String newString = null; newString = generalPanel.getString(SHIP_NAME).getText(); if ( newString.length() > 0 ) { gameState.setPlayerShipName( newString ); shipS...
8cd03dbf-1cd6-461c-8d67-abbea3a85aad
7
protected void applyHighlighting(String content, int line) throws BadLocationException { int startOffset = m_RootElement.getElement(line).getStartOffset(); int endOffset = m_RootElement.getElement(line).getEndOffset() - 1; int lineLength = endOffset - startOffset; int contentLength = content.leng...
4f4af0d0-a0d2-4e8f-ab9d-9cc2553a2274
9
public void hitGold(){ if((player.posx < gold.x + 50 && player.posx > gold.x)||(player.posx + 50 > gold.x && player.posx + 50 < gold.x + 50)) { if((player.posy < gold.y + 50 && player.posy > gold.y)||(player.posy + 50 > gold.y && player.posy + 50 < gold.y + 50)) { bar.goldAmount += 1 * upgrades.goldMultiplicat...
680793e8-a166-4cb7-9e79-d0d33f110de5
3
private void redTeamScoreFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_redTeamScoreFocusLost // TODO add your handling code here: try{ Integer.parseInt(redTeamScore.getText()); } catch(Exception e){ redTeamScore.setText("0"); } ...
c6273825-4dd1-46b9-b186-36bab22999bb
0
public void setValue(V value) { this.value = value; }
886f623a-2c02-494f-a264-1d5f0c637fbb
4
protected final short get_reduce(int state, int sym) { short tag; short[] row = reduce_tab[state]; /* if we have a null row we go with the default */ if (row == null) return -1; for (int probe = 0; probe < row.length; probe++) { /* is this entry labeled with our Symbol or...
2862c9f3-2f8d-445a-968c-f799dad71e20
7
public void testCopyRecursivelyFiles() throws IOException { Debug.println("fileio", "my tmpdir = " + tmpDir); File thisTestWorkDir = new File(tmpDir, "testFrom"); File foo = null, bar = null; File targetCopyDir = null; File newFoo = null, newBar = null, bleah = null; try { ...
e7e5ba0c-c26c-40ac-94b1-ed69325dd293
1
public EmptyTile(boolean color){ setImage(color ? white : black); this.setBorder(BorderFactory.createEmptyBorder()); }
4133d300-5bc8-4bd8-bd68-f4e7b8631ebc
8
public List<Byte> getByteList(String path) { List<?> list = getList(path); if (list == null) { return new ArrayList<Byte>(0); } List<Byte> result = new ArrayList<Byte>(); for (Object object : list) { if (object instanceof Byte) { result....
61e6cff2-d289-4024-8f27-f87dde9806d5
9
public static Point[] smallestSeam(double[][] costMap){ Point[] p=new Point[costMap.length]; //array to store the least costly seam Point currentPoint=null; //find the starting point of the seam (the lowest cost point) double firstmin=Double.MAX_VALUE; for(int j=0;j<costMap[costMap.length-1].length...
86a3dde1-5e89-4d87-86eb-37fa8cc0dc65
0
public String getAuthorId() { return authorId; }
a7ee5e40-4ea5-418e-ba30-bb04d36c166e
8
@Override public void pre_serialize() { Class<T> t = (Class<T>) this.getClass(); Field[] fields = t.getFields(); for( int i = 0; i < fields.length; i++) { Field f = fields[i]; String name = f.getName(); if( name.indexOf("_json_") == 0) { continue; } Type type = f.getType(); try { if( ty...
d9e7880c-f35e-4ba4-844a-975efcf1e535
9
public String guessName() { if (shadow != null) { while (shadow.shadow != null) { shadow = shadow.shadow; } return shadow.guessName(); } if (name == null) { Enumeration enum_ = hints.elements(); while (enum_.hasMoreElements()) { Hint hint = (Hint) enum_.nextElement(); if (type.isOfType(...
5ae12db0-17fe-4cc0-b4a8-1b8d443cb2f2
4
public static TerminalPosition getCursorPosition(List<Character> currentMatching) { if(currentMatching.isEmpty()) return null; if(currentMatching.get(0) != KeyMappingProfile.ESC_CODE) return null; String asString = ""; for(int i = 1; i < currentMatching.size...
c06a1c9b-248f-4674-9ffa-f1b81919cb5c
4
public void actionPerformed(ActionEvent ae){ ArrayList<ChatChannel> channels = new ArrayList<>(); for (int i = 0; i < jlstChannels.getModel().getSize(); i++) { channels.add(jlstChannels.getModel().getElementAt(i)); } boolean channelExists = false; ChatChannel channel = new ChatChannel(-1, "public", j...
88d414d3-f4bb-479e-86c6-d59c440b51d8
7
private void doMain(BufferedReader reader, PrintStream writer) throws Exception { int n = Integer.parseInt(reader.readLine()); for (int icase = 0; icase !=n; ++icase) { int c = Integer.parseInt(reader.readLine()); int itemsNum = Integer.parseInt(reader.readLine()); String itemsLine = reader.read...
6331716f-b255-4c6c-81f2-889df47d16ba
2
public ArrayList viewBookingStatus() { ArrayList temp = new ArrayList(); Query q = em.createQuery("SELECT t from BookingEntity t"); for (Object o : q.getResultList()) { BookingEntity p = (BookingEntity) o; if (p.getAccount().getId() == userId) { temp.add(...
70983883-a587-42bc-8aa5-d5331e67155e
1
private void endFormals() { if (seenFormalParameter) { declaration.append('>'); seenFormalParameter = false; } }
ac8b5824-0970-44b8-bae7-83e3ee33727e
7
public void solve(char[][] board) { int m = board.length; if(m==0) return; int n = board[0].length; for(int i = 0;i<m;i++){ change(board, i, 0); change(board, i, n-1); } for(int i = 1;i<n-1;i++){ change(board, 0, i); ...
9fdcc71c-9195-4b3e-a44e-10cd4661d33f
7
public List<Employee> getEmployeeDetails(Employee employee){ connect(); PreparedStatement pstmt = null; ResultSet rs = null; List<Employee> employees = new ArrayList<Employee>(); try { pstmt = connection.prepareStatement("SELECT ID,NAME,DESIGNATION,SALARY,DEPARTMENT FROM EMP.EMPLOYEE WHERE ID = ?"); pst...
8f310481-c5f4-450e-a6b4-4b52964f60cf
9
public static void gtmr_mcu_run() { int mcu_command = mcu_ram.READ_WORD(0x0010); int mcu_offset = mcu_ram.READ_WORD(0x0012); int mcu_data = mcu_ram.READ_WORD(0x0014); if (errorlog!=null) fprintf(errorlog, "CPU #0 PC %06X : MCU executed command: %04X %04X %04X\n",cpu_get_pc(),mcu_command,mcu_offset,mcu_dat...
18aa3110-9101-4272-8048-d58e4fa81a9e
1
public void visitStaticFieldExpr(final StaticFieldExpr expr) { expr.visitChildren(this); genPostponed(expr); if (expr.isDef()) { method.addInstruction(Opcode.opcx_putstatic, expr.field()); stackHeight -= expr.type().stackHeight(); } else { method.addInstruction(Opcode.opcx_getstatic, expr.field()); ...
a2ebca6c-c7cd-4bb6-8644-266531f7681c
7
private void FixupOutPolygon(OutRec outRec) { // FixupOutPolygon() - removes duplicate points and simplifies consecutive // parallel edges by removing the middle vertex. OutPt lastOK = null; outRec.bottomPt = null; OutPt pp = outRec.pts; for(;;) { if(pp.prev == pp || pp.prev == pp.next) { outRec.pts ...
77476165-68b5-415f-8bed-af06f3164bbb
2
private String getGeneratedPhrase(CycObject cycObject, boolean precise, CycObject languageMt) throws UnknownHostException, IOException, CycApiException { //// Preconditions if (cycObject == null) { throw new NullPointerException("cycObject must not be null"); } final NLFormat nlf = NLFor...
b6ef8ff1-81c5-4060-8fce-da2d44540738
9
private List<Entry> readEntries(String obj){ // create an instance of HtmlCleaner HtmlCleaner cleaner = new HtmlCleaner(); // take default cleaner properties CleanerProperties props = cleaner.getProperties(); // customize cleaner's behaviour with property setters props.setOmitDoctypeDeclaration(true...
2b4a4180-6565-491d-961b-d367b756f714
0
public static void changeFocusToTextArea(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { tree.setComponentFocus(OutlineLayoutManager.TEXT); tree.clearSelection(); layout.draw(currentNode,OutlineLayoutManager.TEXT); }
38942f87-411b-4614-8df7-9efe1e4e7091
9
@Override public void run() { try { // Check if we know if it is a server or client if (socket.getInputStream().read() == 1) { connectedToServer = true; logger.debug("Start handling new connection from: " + socket.getInetAddress().getHostAddress() + " ...
36886295-218c-49e2-9236-001b3e7a8f1f
5
public boolean readFinish(){ return this.fileReceiver == null ? ((this.dataSizeLeftInt <= 0 ? true : false) && (this.dataSizeLeftLong <= 0 ? true : false)) : ((this.fileReceiver != null && this.fileReceiver.finishWrite())); }
cbc8b8c1-af48-4d22-af02-5823c3a15d52
8
public static void main(String[] args) { /* * Intro message */ System.out.println(" WELCOME TO"); for(int i=0;i<echo_ascii.length();i++){ System.out.print(echo_ascii.charAt(i)); try { Thread.sleep(10); } catch (InterruptedException e) { // TODO Auto-generated catch block e.pri...
c44d6066-b08c-41cc-a667-c8baba9a8d95
1
public void connect() { System.out.println("Attempting to connect to server..."); try { connect("1.1.1.1", 9876); } catch (CouldNotConnectException e) { System.out.println("Could not connect: " + e.getMessage()); } }
5cb4adea-57b9-440e-83a0-afd1220320bb
3
@Override public Point getNextLocation(int ix, int iy, int fx, int fy) { int dx = fx - ix; int dy = fy - iy; if (dx != 0) { dx = (int)Math.round(Math.max(Math.abs(dx*MAGIC_RATE_CONSTANT), 1))* ProjUtils.getSign(dx); } if (dy != 0) { dy = (int)Math.rou...
f6f71f28-34aa-4175-aa93-cc2b1a2005b4
7
public Scanner parseHeader() { // this method endows this Header object with all of its instance // variables by parsing the header of the source code file if (sc.hasNextLine()) { this.type = sc.nextLine().substring(0,6); if (DEBUG == 1) { System.out.println("Type: " + t...
b2b90599-bf70-4a6d-96d1-7f455db39b4f
0
private static void updateMainProjectView() { getInstance().mainProjectTitleL.setText("Main Project: " + getInstance().mainProject.getProjectName()); getInstance().mainProjectScreensCBL.setListData(getScreenCheckBoxes(getInstance().mainProject, true)); getInstance().mainProjectScreensCBL.cl...
65076d58-647e-44c1-8bf9-255b654ba713
0
public void setFullName(String fullNameText) { this.fullNameText.setText(fullNameText); }
ef44f9e3-94ca-45ac-8ae6-34d033c311ec
9
public int calcRisk() { int r=0; if (isIP()) { r+=1; } if (change>2000) { r+=2; } if (change<-500) { r+=2; } if (usernamespace()&&username!=articlename()) { r+=1; } if (editsummary.length() == 0) { r+=1; } if (newpage && change<25) { r+=2; } if (vandalismchanne...
6d9ea7e0-ad2c-4f12-9a4f-447734ff42b5
3
public int buildUniqueID() { int[] subHashCodes = new int[] { _andereSpieler.hashCode(), _items.hashCode(), _katze ? 1 : 0, _maus ? 1 : 0, _moeglicheAusgaenge.hashCode(), _raumID, }; int hashCode = 1; for(int code : subHashCodes) { hashCode = hashCode * 31 + code; } return hashCode; }
ac2dcbeb-1ea4-4309-88cb-da77a0d87d05
2
@Test public void testRollNumber() { RollNumberRequest request=new RollNumberRequest(1, 0); ServerModel aGame=gamesList.get(1); try { moves.rollNumber(request, cookie); } catch (InvalidMovesRequest e) { assertEquals("Should have thrown 'Error: invalid roll number request'","Error: invalid roll number ...
f0131fa9-fab9-4410-a605-e8cf265c6bce
9
private void cleanUpImports() { Integer dummyVote = new Integer(Integer.MAX_VALUE); SortedMap newImports = new TreeMap(comparator); List classImports = new LinkedList(); Iterator iter = imports.keySet().iterator(); while (iter.hasNext()) { String importName = (String) iter.next(); Integer vote = (Intege...
237774ef-facf-47a1-b79a-fc97f4fb7722
7
public void consY() { int totalTilesNum = 0; for( int i = 0; i < this.tiles.length; i++ ) { totalTilesNum += this.tiles[i].oCount; } tilesId = new int[totalTilesNum]; tilesX = new int[totalTilesNum][]; tilesY = new int[totalTilesNum][]; tilesCh = new char[totalTilesNum][]; int index = 0; i...
f1d597aa-bda1-425e-9296-c1e90da2a062
9
public int loadFromFile() { try { BufferedReader in = new BufferedReader(new FileReader("settings")); String a = ""; while ((a=in.readLine()) != null) { String[] args = a.split("="); if (args.length == 2) { try { if (args[0].equals("display_width")) this...
770579a6-2c49-4a05-8de3-b488bf148dd3
5
public byte[] paste(InputStream is, int fStart, FrameBuffer frame_buffer ) throws Exception{ if( frame_buffer.get_buffer_len() == 0){ throw new Exception("Error: buffer is empty!!"); } int fEnd = fStart + frame_buffer.get_buffer_len() - 1; int cont = 0; ...
57d81652-089c-4d16-8a43-6224b8c3ad4e
8
protected void oneMoreStoryChar(){ if(curStory.isEmpty()&&curPStory.isEmpty()){ timer.stop(); storyDiscription=""; pStoryDiscription=""; storyCharIndex=0; pStoryCharIndex=0; return; } if(!curStory.isEmpty()){ ...
3e0e95df-9d2b-4d14-b2ab-39141de5b0b7
3
public synchronized void callEvent(ChunkyEvent event) { SortedSet<RegisteredChunkyListener> eventListeners = listeners.get(event.getType()); if (eventListeners != null) { for (RegisteredChunkyListener registration : eventListeners) { try { registration.ca...
e4812b5b-2b5f-4a90-b8d3-daa9e43e5ca4
1
public void visit_f2l(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 2; }
84fbfe1e-8bb6-4520-a0f4-e63b25257bd5
1
@Test() public void Return() throws BeanstreamApiException { CardPaymentRequest paymentRequest = getCreditCardPaymentRequest( getRandomOrderId("PEDRO"), "90.00"); PaymentResponse response = beanstream.payments().makePayment(paymentRequest); if (response.isApproved()) { response = beans...
6f119119-184c-46c9-ac3b-1eb3ae139297
0
public static void main(String[] args) { application = new RoyalFlushApplication(new DefaultApplication(), args); //Not engine forced but you can process String[] args for passed in parameters. parseCommandLineArgs(args); application.startApplication(800, 600, false, false, "Deafult Game"); }
7b4ccc97-bd71-44b2-a881-042be440414b
2
public Player whoBettedOn(Block block) { Set<Player> betsKeys = bets.keySet(); for(Player key : betsKeys) { if(bets.get(key).contains(block)) return key; } return null; }
3ad593db-0ac4-4835-9432-6d9bfc602ee7
0
public void setNomBd(String nomBd) { this.nomBd = nomBd; }
775c66b1-00c5-45f4-b505-4cd8635aa0de
6
public void calibrate(double[][] independentVars, double[][] targetVars) { if (stopped) { stopped = false; epoch = 0; sampleCount = independentVars.length; targetCount = targetVars[0].length; error = new double[targetCount]; startTime = nan...
e07d5c27-4771-4bdb-9c4e-7b9f52c50d24
2
public void setSegundo(int segundo) { this.segundo = (segundo >= 0 && segundo < 60) ? segundo : 0; }
fecd5a75-e472-4001-9d7d-61c871f2af26
2
public byte getAt(int ix) { if((ix<0)||(ix>=this.index)) throw new IndexOutOfBoundsException("AutoAllocatingByteBuffer.get() called for invalid buffer index"); return this.buf[ix]; }
b7e8b976-ac6d-4289-9281-f6affffd95e2
1
protected void readAttributes(ConstantPool constantPool, DataInputStream input, int howMuch) throws IOException { int count = input.readUnsignedShort(); unknownAttributes = null; for (int i = 0; i < count; i++) { String attrName = constantPool.getUTF8(input.readUnsignedShort()); final int attrLength = in...
d5bde66d-f849-47aa-a94b-93962aa4f029
9
public LinkedList<Node> astar(int startnode, int endnode) { int id, newDis; int maxValue = (int) (Integer.MAX_VALUE - Math.sqrt(World.width * World.width + World.height * World.height)); for(int i = 0; i < nodes.size(); i++) { int absx = nodes.get(i).getX() - nodes.get(endnode).getX(); int absy = nodes.g...
e421d37b-ddca-4f8d-a5cf-a802c0b0a055
9
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("ok") || e.getSource() == bacString) { if (!sha1.isSelected()) { if (bacString.getText().length() == 0) { bacValue = null; } else { bacValue = bacString.getText().getBytes(); } } else { try { MessageDiges...
ea7450fb-ee3b-4cd6-b116-6bb8cceb5589
5
public static void showMessages(CRUD_Enum type, int count) { switch (type) { case Add: System.out.println("添加了" + count + "条记录。"); break; case Delete: System.out.println("删除了" + count + "条记录。"); break; case Update: System.out.pr...
40dbec0a-f5e8-4365-9682-a66765901428
2
private static void measure(Benchmark run) { for (int i = 0; i < WARMUP_REPEATS; i++) { run.run(); } long time = 0; for (int i = 0; i < ITERATIONS; i++) { final long startT = System.nanoTime(); run.run(); time += System.nanoTime() - startT; } System.out.printf("%1$s: %2$,d nannos/run (total: %3$s...
e1c8885b-44b3-4403-9c65-838e22dc96c8
0
public String getEncoding() { return _charset; }
4aa1f449-0fcc-452d-8a89-d0f906891471
2
public int xCoordToColumnNumber(int x) { Insets insets = getInsets(); if (x < insets.left) return -1; double colWidth = (double)(getWidth()-insets.left-insets.right) / columns; int col = (int)( (x-insets.left) / colWidth); if (col >= columns) return columns; else ...
68e1d770-c868-4749-bd5f-2cf8b61fda9e
0
@Override public Item copyItem() { return armorItem; }
d128aab7-664b-4051-ae56-9699e8354728
4
private static void parseMetrics(String wholeMetricsText, Task task) { String[] lines = wholeMetricsText.split("\\n"); for (String line : lines) { if (line.length() == 0 || line.charAt(0) == '#') continue; String parameters[] = line.trim().split("\\s+"); if (parameters.length == 16) // 16 parameters...
06098082-4375-4c4b-a706-9f5187250f7b
7
@Override public List<Point> findWay(Node<Point> start, Node<Point> goal, ListGraph<Point> graph) { this.closedList = new LinkedList<Node<Point>>(); // Min-Heap based on the F values this.openList = new PriorityQueue<>((n1, n2) -> { return (int) (n1.getF() - n2.getF()); ...
004a6691-3725-4338-88e0-0b9dc8245390
8
public boolean onSceneClickEvent(final MouseEvent pMouseEvent) { final Scene childScene = this.mChildScene; if(childScene != null) { final boolean handledByChild = this.onChildSceneClickEvent(pMouseEvent); if(handledByChild) { return true; } ...
bfe46733-8d34-4b4c-aa88-1ab0dbb5aa27
0
protected String addWGameFeatures() { myWDisplay = new JTextArea(1, 20); myWDisplay.setEditable(false); return new String(DESCRIBE_W); }
220dcfe9-619a-469c-8a24-0b67992eff32
1
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); txt_num_estado = new javax.swing.JTextField(); txt_num...
abc599b2-6f9a-4f1d-9054-655346b3a099
1
public void refreshView() { if(options.isVerbose()) System.out.println("[GameView] Refreshing view..."); panel.repaint(); hud.update(); statusBar.setText(getStatusBarText()); model.getShop().update(); model.getPortal().update(); }
b6307298-5081-4b2c-ae3d-ba7763f7e157
1
@SuppressWarnings("deprecation") public void testConstructor_RP_RP5() throws Throwable { YearMonthDay dt1 = null; YearMonthDay dt2 = null; try { new Period(dt1, dt2); fail(); } catch (IllegalArgumentException ex) {} }
04dc4ac5-aad7-4045-9a80-8f8922ae6fc7
8
@Override public void paintComponent(Graphics g2) { Graphics2D g = (Graphics2D) g2; // Create Graphics Object super.paintComponent(g); // Paint Background //move circle to centre of JPanel g.translate(thickness/2, thickness/2); if(fill==true) { if(fill_type<=0 || fill_type>=3)//if f...
f35e0926-6741-4107-8774-49f4a3f679cc
2
public static EncryptableObject fromByteArray(byte[] array){ try{ ByteArrayInputStream bis = new ByteArrayInputStream(array); ObjectInput in = null; in = new ObjectInputStream(bis); Object o = in.readObject(); try{ bis.close(); in.close(); }catch(Exception e){System.out.println("A Memory Le...
4e6e3a96-a63e-448d-ae3a-3ea3b0b5dde9
6
@EventHandler public void WolfInvisibility(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.getWolfConfig().getDouble("Wolf.Invisibi...
53fe3f04-60b1-4bea-91d6-2973ff3ff171
5
public static String getRequestPath(String request) throws BadRequestException { int pathStart = request.indexOf(" ") + 1; int pathEnd = request.indexOf(" ", pathStart); int httpStart = request.indexOf("HTTP", pathStart); if (pathEnd + 1 != httpStart) { throw new BadRequestE...
4a97f228-56d7-411d-851f-bf6a3e2d111a
1
protected Object fireReceiveQueryEvent(ReceiveQueryEvent evt) throws Exception { if (receiveQuery != null) { return receiveQuery.OnReceiveQueryEvent(evt); } else { return null; } }
fbb1041c-a49f-451e-ac49-9f02f832bb44
5
public static void saveWorld(int ID) { if (ID < 0 || ID > 4) { if (ChristmasCrashers.isDebugModeEnabled()) System.err.println("Failed to save world " + ID + " - invalid world ID (must be between 0 and 4, inclusive)."); return; } if (worlds[ID] == null) { if (ChristmasCrashers.isDebugModeEnabled()) ...
619738dd-e343-476f-ae8d-2c690d79a4d6
1
public void redirectOutput(Writer w) { if (w == null) { throw new NullPointerException("w"); } stdout = w; }
2afc36b6-6ece-4d6b-a92a-0375ac716283
9
@Override public void preInstantiateSingletons() throws BeansException { if (this.logger.isInfoEnabled()) { this.logger.info("Pre-instantiating singletons in " + this); } Map< String , BeanInitializer > initializers = new HashMap< String , BeanInitializer >(); for (Stri...
00eeacd2-7b75-4cc1-a243-9ef5c27e4a14
6
public int strStr(String haystack, String needle) { if (haystack == null || needle == null) { return -1; } for (int i = 0; i <= haystack.length() - needle.length(); i++) { int j = 0; while (j < needle.length() && haystack.charAt(i + j) == needle.charAt(j)) { ...
4dab3967-2356-4b6e-856a-829703d7de54
4
@Override public void register() throws ServiceRegistrationException { try { POA rootPOA = POAHelper.narrow(orb_.resolve_initial_references("RootPOA")); ExchangeHandlePOA exchangeServant = provider_.get(); rootPOA.activate_object(exchangeServant); String[] ID ...
63f5d57b-44b4-4fbf-86c6-9740ec2143d6
5
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; if (this.backgroundImage == null) { g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); g2.setFont(new ...
04d7f262-a7d7-42f7-bd8d-d618e9a184e0
6
public static String defineDnType(HashMap<String,List<String>> pDictionary) { // DataNode type List<String> dnTypeList = pDictionary.get("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); if (dnTypeList.toString().contains("Rna")) {allVars.put("dnType", "Rna");} else if (dnTypeList.toString().contains("Pa...
9e8c4000-6672-4eee-bec2-1eb66c8fa658
8
public boolean stateEquals(Object o) { if (o == this) return true; if (o == null || !(o instanceof MersenneTwisterFast)) return false; MersenneTwisterFast other = (MersenneTwisterFast) o; if (mti != other.mti) return false; for (int x = 0; x < mag01.length; x++) ...
4b83a280-1b2d-4b57-a101-92895122159f
7
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Ok")) { if ((!al.getJfKeyText().equals("")) && (!al.getJfValueText().equals(""))) { // System.out.println(al.getJfKeyText() + "\n" + al.getJfValueText()); if (al.jd_add.getTitle...
7525c2e5-ba2e-475d-9fe1-f2e9faacd9a8
8
@Override public MultiMenuPlaceStartingForcesChoices doSelection(Factory factory) { updateState(); while (state != -1) { Menu<?> menu = getMenu(state, factory); switch (state) { case 1: unitPlaceRemoveChoice = (StaticChoice) menu.selectChoice(false); break; case 2: chosenUnit = (Unit) menu...
c9401188-235c-44c4-a5ea-9111d8c06c44
7
public void connect(TreeLinkNode root) { if(null == root) return; TreeLinkNode temp = root.next; while(temp != null) { if(temp.left != null) { temp = temp.left; break; } if(temp.right != null) { temp = temp.right; break; } temp = temp...
58782f2a-37f0-4114-8267-71ba0973c5e0
0
public int getNumero() { return this.numero ; }
193ddd90-ec25-41f5-9ce8-bc4ed16e0ff2
1
public PowerFailure(Position position) { if (position == null) throw new IllegalArgumentException("The given position is invalid!"); hoveringElements = new HashSet<>(); this.position = position; }
42dc8c87-e55d-48a3-98a0-7a83c1c466d9
3
public static List<String> decodeList(List<String> listIn) { Map <Byte, Byte> replaceMap = new HashMap<Byte, Byte>(); replaceMap.put(new Byte((byte)'y'), new Byte((byte)'a')); replaceMap.put(new Byte((byte)'n'), new Byte((byte)'b')); replaceMap.put(new Byte((byte)'f'), new Byte((byte)'c')); replaceMap.put(n...
cb661e20-c4aa-4287-8310-c908ae6b9a2c
7
private void txtcedulaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtcedulaKeyTyped char caracter = evt.getKeyChar();//Validacion del campo cedula if (caracter >= '0' && caracter <= '9' || caracter == 8 || caracter == KeyEvent.VK_BACK_SPACE || caracter == KeyEvent.VK_CAPS_LOCK || caracter ...
100c2b15-cc9c-4643-9a7f-79f8e1184fd0
6
private boolean wincheck1() { for (int column = 0; column < (gv.getColSize()-THREE); column++) { for (int row = 0; row < gv.getRowSize(); row++) { if (cells[row][column].getValue() != 0 && cells[row][column].getValue() == cells[row][column + 1] ...
38d81096-0eb0-44ba-a765-9fda3c9fb2db
9
public boolean delete(String gNumber) { // no nodes if (top == null) { return false; } // 1 node and gNumbers match else if (top == tail && (top.getData().gNumber.equals( gNumber))) { top = tail = null; count = 0; return true; } // 1 node and no match else if (top == tail && !top.getD...
67a0a5fc-05bd-4939-ab64-e23020345c3c
4
public void recordOnline() { if (playerlist!=null && !playerlist.isEmpty()) { for (ASPlayer player:playerlist.values()) { if ( plugin.getServer().getPlayer(player.getName()) != null) { player.curPeriod.addOnline(); plugin.info(player.getName() + " Online"); } } } }
3684040d-1189-4f32-beaa-2ed960b77471
9
final public static boolean isIntersecting( final String[] a, final String[] b ) { if ( ( a == null ) || ( b == null ) ) { return false; } if ( ( a.length < 1 ) || ( b.length < 1 ) ) { return false; } for( int i = 0; i < a.length; ++i ) { final...
85262ae6-035d-4a20-8332-d2551c8c4880
0
public void setKey(K key) { this.key = key; }
f9332291-5c19-47a2-bf60-b55313f297da
4
public static void returnBook(Messagable ui, String name, String username) { MemberAccount acct = MemberAccount.getAccount(username); Book item = Book.getBook(name); boolean itemReturned = true; //Reject if Member Account or Item Doesn't exist if(acct == null){ itemReturned = false; ui.sendMessage("ERRO...
250e050c-5f1c-4e4a-8915-afc4d8ea9e9b
2
public static String toString(AbstractInsnNode n) { if (n == null) { return "null"; } if (n.getOpcode() == -1) { return ILLEGAL_OPCODE; } return OPCODE_NAMES[n.getOpcode()]; }