method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9cb19987-3418-4113-8a0a-65f7491cc19f
4
public final void onAdded(Level level, int x, int y, int z) { for(int var7 = x - 2; var7 <= x + 2; ++var7) { for(int var5 = y - 2; var5 <= y + 2; ++var5) { for(int var6 = z - 2; var6 <= z + 2; ++var6) { if(level.isWater(var7, var5, var6)) { level.setTileNoNeig...
f2bf68f0-c64d-474b-ad14-4b858128dcd6
5
public void addAssembly(String fileName, String baseFileName) throws Throwable { Scanner sc = new Scanner(new File(baseFileName)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8")); while(sc.hasNextLine()) { String line = sc.nextLine(); // example line:...
6d971bcd-59a4-460b-ab16-c976679aee8e
4
public void method560(int file, int cache) { if (clientInstance.cacheIndices[0] == null) { return; } if (files[cache][file] == 0) { return; } if (fileStatus[cache][file] == 0) { return; } if (anInt1332 == 0) { return...
e2592e87-da37-44c1-9778-198bc93bb43a
4
@Override public boolean containsByte(String name) { JOSObject<? , ?> raw = this.getObject(name); if(raw == null) return false; if(raw.getName().equalsIgnoreCase(BYTE_NAME)) return true; return false; }
254e68a0-1e98-4fa3-bada-a997e7e2e672
1
public boolean opEquals(Operator o) { return o instanceof GetFieldOperator && ((GetFieldOperator) o).ref.equals(ref); }
9ebc8511-2d86-48be-a464-26f9df263404
1
public void drawHorizontalLine(byte[] screen, int width, int x1, int x2, int y){ int X1ByteIndex = 0; int X2ByteIndex = 0; int bytesPerLine = width/8; int startIndexY = y*bytesPerLine; X1ByteIndex = startIndexY + x1/8; X2ByteIndex = startIndexY + x2/8; int x1OffsetInByte = x1%8; int x2OffsetInB...
962dcef7-6d8f-4ada-b8f1-ef6ba96a85bf
9
public void calculaJugada() { this.verbose = "La mano es: "; for (Carta carta : cartas) { this.verbose += carta.toString() + ", "; } this.verbose += "\n- Mejor Jugada: "; if (this.esEscaleraDeColor()) { } else if (this.esPoker()) { } else if (this.es...
68290a7b-fdf9-4871-939c-0beca5ff41d2
0
public void setFoo(Object foo) { this.foo = foo; }
2353c08f-5115-4a0f-971f-026ce8dd70d8
8
public static void main(String[] args) { String stopWordsFile; String trainingDataFile; String trainingLabelFile; String testDataFile; String testLabelFile; String resultsFile = "results.txt"; //Parse the command line arguments if(args.length < 5){ ...
f1953981-2862-4618-ad2b-1aaa346e416c
2
private int target(Value v) { // -2 signifies temporary inserted to resolve phi cycles if(v.getColor() == -2) { return t2; } if(isSpilled(v)) { // then this value has been spilled, will need to be put home later return t1; } int reg = m...
53b054dd-013e-42bf-9e2e-08ae7dc3d357
1
public static float getFloat() { if (random == null) { init(); } return random.nextFloat(); }
9f13cb2a-e759-481c-95a1-44155e6ee194
8
public void stop() { sequencer.kill(); countDownThread.kill(); int highestNumberOfCheese = -1; for (MouseRepresent mouseThread : sequencer.getInstances()) { if (highestNumberOfCheese == -1) { highestNumberOfCheese = mouseThread.getMouseController().getNumberOfCheese(); } else { Mou...
bce93ddd-b898-48d9-8e09-8b936fa1cefd
5
public void handleMessage(String msg) throws IOException { int type = parseType(msg); String text = msg.substring(msg.indexOf(' ')).trim(); switch (type) { case MessageProtocols.TERMINATE: { polling = false; } break; case MessageProtocols.REGISTER: { registerUser(text); } br...
44e659e7-c70a-443f-b3ec-13203310c880
8
protected boolean pawnCanMoveForward(int finalX, int finalY) { int abs_Y_diff = Math.abs(finalY - this.y); int Y_diff = finalY - this.y; Piece[][] board = this.player.myGame.gameBoard.boardArray; if(((this.player.playerColor == Color.WHITE && Y_diff < 0 && abs_Y_diff == 1 ) || ...
a3b60d20-6f65-45be-9063-d5347300065e
8
public boolean getDados() { preenchido = true; String msg = bundle.getString("Os Campos: "); nome = txtNome.getText(); preco = (double) spPreco.getValue(); localizacao = txtLocalizacao.getText(); desc = txtaDesc.getText(); descIng = txtaDescIng.getText(); //ret...
e221c735-697b-4e53-bfc7-f8504cb7aa7a
7
public void actionPerformed(ActionEvent e) { int x = -1; int y = -1; Object o = getValue("x"); if (o instanceof Integer) { x = ((Integer) o).intValue(); } o = getValue("y"); if (o instanceof Integer) { y = ((Integer) o).intValue(); } final JDialog dialog = new JDialog(JOptionPane.getFrameForComp...
e40db1ac-0ee6-4df6-ae80-bde833c9ed62
8
public static void afficherMenu() throws IOException{ Interaction.IOmenu(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s=""; try { s = br.readLine(); } catch (IOException e) { e.printStackTrace(); } int i = Integer.parseInt(s); switch(i){ case 1 : In...
93f61424-bcc6-4a0a-9b0f-e7c41f883397
7
public static PieceType fromInteger(int x) { switch (x) { case 0: return PIECE_L; case 1: return PIECE_J; case 2: return PIECE_S; case 3: return PIECE_Z; case 4: return PIECE_T; case 5: return PIECE_SQUARE; case 6: return PIECE_LINE; } return null; }
c9dca298-f736-4fdb-82d2-40725f8d99ef
0
public JButton getjButtonChercher() { return jButtonChercher; }
21585c4b-10bf-4b2f-8c8c-3f38d73f6f7a
1
public void atualizar(Pesquisador pesquisador) throws Exception { String sql = "UPDATE pesquisador SET nome=?, nome_cientifico=?, email=?, sexo=?, classe=?, titulacao=?, curso_vinculado=?, areaformacao=?, curriculo_lattes=? WHERE id=?"; try { PreparedStatement stmt = ConnectionFactory.getConnection().prepar...
14a65394-c0de-49d3-b7e3-97a0e01a1c42
0
public void setCurrentState(State state) { myCurrentState = state; }
e9efb35f-25b4-4698-a0b2-72dd6fb4ee7c
1
public void setFirstElement( T newFirst ) { if ( newFirst == null ) { throw new NullPointerException(); } this.firstElement = newFirst; }
a06299f7-6224-402a-8667-546f8e6a4c0d
1
public ContinueBlock(LoopBlock continuesBlock, boolean needsLabel) { this.continuesBlock = continuesBlock; if (needsLabel) continueLabel = continuesBlock.getLabel(); else continueLabel = null; }
c8b331b1-4a92-4c4b-853b-80c1eb727e12
4
public void releaseKitchenTool(Dish dish) { Vector<KitchenTool> dishTools= dish.getDishTools(); for (int i= 0; i < dishTools.size(); i++) { boolean found= false; int location= 0; for (int j= 0; ((!found) && (j < this._availableTools.size())); j++) { found= (this._availableTools.elementAt(j)).isSameTool...
8fd4fcb0-8be6-4b6b-bf11-1efbb32a8015
5
public void prefetch() throws MediaException { if(state == UNREALIZED){ realize(); } if(state == PREFETCHED || state == STARTED) return; if(state == CLOSED) throw new IllegalStateException(); try{ prefetchImpl(); } catch(Exception e){ ...
4bad8aa1-f99f-4efd-b2b4-2a174fd8aceb
4
private void update() { /* bug : 347422 listGauche.clear(); listDroite.clear(); */ String code = null ; for (int i = 0; i < data.getRowCount() - 1; i++) { code = data.getID(i); if (!data.getUse(i)) { ...
47598770-8cc8-416e-a358-4e4e103611bf
7
private boolean r_particle_etc() { int among_var; int v_1; int v_2; // (, line 54 // setlimit, line 55 v_1 = limit - cursor; // tomark, line 55 if (cursor < I_p1) { return false; } cursor = I_p1; v_2 = limit_backward; limit_backward = cursor; cursor = limit - v_1; // (, line 55 // [, li...
4b97d7b4-f328-41a2-a698-0631c9159191
2
public void addProperty(String section, String line) { int equalIndex = line.indexOf("="); if (equalIndex > 0) { String name = section + '.' + line.substring(0, equalIndex).trim(); String value = line.substring(equalIndex + 1).trim(); if (map.containsKey(name)) map.remove(name); map.put(name, value); ...
4f5834f5-75a9-4638-9a1e-608d61ae2a7f
1
public void setNumber(int number) { if (number <= 0) { throw new IllegalArgumentException("Number should be bigger than zero."); } this.number = number; }
946cf48d-f3e0-4c25-b84e-e4450bef12a1
2
public Operator getUnaryOperator(String literal) { int operatorCount = this.unaryList.size(); for(int i = 0;i<operatorCount;i++) { Operator currentOperator = this.unaryList.get(i); String currentText = currentOperator.getLiteral(); boolean isMatchingExpression = literal.equals(currentText); if (isMatc...
dcd26081-1e23-47fd-b56b-42f4d45d3b14
6
private static double euklidSimilarity(List<double[]> vector1, List<double[]> vector2) { double diff = 0; int listSize = Math.max(vector1.size(), vector2.size()); for (int i = 0; i < listSize; ++i) { double[] ds1 = vector1.size() <= i ? new double[0] : vector1.get(i); dou...
2ae9e3c2-fd68-4b7d-97dc-83e6b30fda6d
1
private boolean jj_3_47() { if (jj_3R_67()) return true; return false; }
2e1674ad-51c4-4805-9119-9cd70a9a75b2
9
private static int bellmanFord(Vertex pOrigin, int pRoads, int width, int height) { HashMap<Vertex, Vertex> predecessors = new HashMap<Vertex, Vertex>(); HashMap<Vertex, Integer> distances = new HashMap<Vertex, Integer>(); HashSet<Vertex> visited = new HashSet<Vertex>(); int i, j, result = 0; for(i = 0;...
ff5328e8-fdad-4b20-86fe-d268cff28183
2
private void initialiserJoueurs() { List<Pion> listePions = new LinkedList<Pion>(); Random generateurDeNombresAleatoires = new Random(); for (Pion pion : Pion.values()) listePions.add(pion); for (int i = 0; i < this.nombreDeJoueurs; i++) { int numeroDuPion = generateurDeNombresAleatoires.nextInt(list...
694d404f-643e-4673-9a80-cc0e9c44a9eb
5
@Override public double getCenterY() { if(isLeaf()) return 0; if(y == 0) { double minY = 0; for(final BUNode n : getChilds()) { final double ty = n.getCenterY(); if(ty < minY) { minY = ty; } } for(final BUNode n : getChilds()) { n.y = minY; ...
e25431e7-a2df-4ab3-9350-8a51180535a0
5
private void cmbBoxLimitActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_cmbBoxLimitActionPerformed {//GEN-HEADEREND:event_cmbBoxLimitActionPerformed switch (cmbBoxLimit.getSelectedIndex()) { case 0: switchLimitation = Integer.MAX_VALUE; br...
604f4c4f-0031-4f1f-865e-7c7f7fdec097
8
private static int step(int dir, int rows, int cols, int[] dx, int[] dy, int[] xy, int[][] m) { dir++; if (dir > 3) { dir = 0; } final int xc = xy[0]; final int yc = xy[1]; int x = xc + dx[dir]; int y = yc + dy[dir]; int turns = 0; whil...
0a944472-ada5-4777-8c02-d6d3685fa6e5
2
public void requestPlayEight(Card card, int suite) { if (playRequest == null && this.canPlay(card)) { playRequest = card; eightSuiteRequest = suite; } }
fa83c23d-43d8-4697-8268-f513de8146f1
7
public int mostVisitedAction() { int selected = -1; double bestValue = -Double.MAX_VALUE; boolean allEqual = true; double first = -1; for (int i=0; i<children.length; i++) { if(children[i] != null) { if(first == -1) fi...
038e0e63-a5c0-48b1-ae68-1de6c8108bdf
8
public static void main(String[] args) { int[][] matResult = new int[mat.length][mat[0].length]; int[][] matTemp; int i, j; print("Vecteur:"); printVector(vect); print("Matrice:"); printMatrix(mat); for(i = 0; i < vect.length; i++) matResult...
44c632aa-5860-46af-ba05-6a0be6cc1728
2
@Override public void init() { if(Configuration.hasParameter("S4Node/simpleDraw")) { try { simpleDraw = Configuration.getBooleanParameter("S4Node/simpleDraw"); } catch (CorruptConfigurationEntryException e) { Tools.fatalError("Invalid config field S4Node/simpleDraw: Expected a boolean.\n" + e.getMessag...
57c0780f-6f14-436b-8228-fc4f512126bd
7
@Override public boolean equals(Object obj) { if (obj == null) return false; if (obj == this) return true; if (obj.getClass() != this.getClass()) { return false; } else { Quaternion other = (Quaternion) obj; if (this.get...
990f594a-9dde-47cb-a118-56e824d5568f
8
public boolean stand(Hero hero, Player player) { if (lock) { return false; } if (hero.getColor() == color) { hero.setInCastle(this); setHero(hero); if (player instanceof PlayerHuman) { gui.WindowStack ws = gui.WindowStack.getLastInstance(); if (ws != null) { gui.WindowCastle wc = new g...
58dc96a5-69fd-44f8-9313-d95ff8edcb58
5
@Override public <T> T retrieveData(String query, Map<Integer, Object> params, Class<? extends Object> cls) { // TODO Auto-generated method stub try { con = getConnection(); pstmt = con.prepareStatement(query); if(params != null){ for(Integer key : params.keySet()){ pstmt.setObject(key, params...
dda8fe9b-c7bb-4bbd-8c74-ed9d733614ae
3
private boolean validate(final String xmlFile, final SAXReader reader) throws IOException { XMLErrorHandler errorHandle = new XMLErrorHandler();// 错误处理类实例 reader.setErrorHandler(errorHandle);// 向 XML 阅读器注册一个实例 // File file = new File(xmlFile); InputStream is = null; // if (file.exists() && file.isFile()) { tr...
6603ff97-4421-47fe-b2e4-5ce43f4aa2b2
9
private void updateGUI() { // Clear all fields dirClimbBox.setSelectedIndex(-1); dirBox.setSelectedIndex(-1); destX.setText("0"); destY.setText("0"); style.setText("0"); flagField.setText("0"); textPtr.setText("$0"); if (door == null) { typeBox.setEnabled(false); dirClimbBox.setEnabled(false); ...
9a5cd81b-77b5-4542-bcf9-c0f76824cae8
1
public void stop(){ start = 0; if(updcallback != null){ updcallback.run(this); } TimerController.getInstance().save(); }
67d09f21-9b38-4e9c-ac3c-6b88ea944072
5
public SIPEntry buildSIPEntry(ResultSet rslSet) { SIPEntry sip = new SIPEntry(); try { sip.setSipId(rslSet.getString("sipId")); sip.setSipName(rslSet.getString("sipName")); sip.setSipPageid(rslSet.getString("sippageid")); ResultSet rslSet1 = dbMgr.executeQuery("select memberId,moderator from sipMember w...
5dec68fd-f8fe-456c-8f69-58a8c93f504c
7
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof OFAction)) { return false; } OFAction other = (OFAction) obj; if (length != othe...
19556073-b5ea-46ee-9cd8-b55937149ab9
3
public static AbstractTableModel getUnBoundProperties(final CSProperties p) throws ParseException { final List<String> arr = keysByNotMeta(p, "bound"); return new AbstractTableModel() { @Override public int getRowCount() { return arr.size(); } ...
a445d051-dcdf-4de5-84b5-9a77a4486fac
4
public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { //first goal is to be able to receive and process //a well formatted XML move piggybacked on a POST //this gives me a raw stream to payload of Post reque...
8946d9fa-3c19-4dbc-af8b-c7cdd0df8f0d
9
protected void paintComponent(Graphics g) { super.paintComponent(g); if (value >= previousValue) { g.setColor(beadColour); initialPosition = 0; for (int x = 0; x < previousValue; x++)// Draw the beads left up { g.fillOval(0, initialPosition, diameter, diameter); initialPosition += diameter;...
01697428-e403-4675-abb0-6554bec1ba10
8
private void loadFile(String file) { BufferedReader buf = null; String line; try { buf = new BufferedReader( new InputStreamReader( new FileInputStream(file))); while((line=buf.readLine()) != n...
e168f937-e200-440f-8086-f4e1fbf3dc57
7
public SimObject getObject(Vec2 point) { for (SimObject obj : this.allObjects.descendingSet()) { if (!obj.isMoveable()) continue; if (obj instanceof Gate) { // Do the collision math Vec2 center = ((Gate)obj).getPosition(); Vec2 dir = MathHelper.polar(1.0f,(float) obj.getStartAngle()); Vec2 diff ...
8e183e63-aacb-45f6-8005-538e51be7b6d
9
public void run() { Machine.interrupt().disable(); ThreadedKernel.scheduler.setPriority(KThread.currentThread(), priority); // Make sure threadState exists ThreadQueue waitQueue = ThreadedKernel.scheduler.newThreadQueue(true); waitQueue.waitForAccess(KThread.currentThread()); ...
5cfa2a4c-69da-4f4c-abb5-cb2dc625d538
5
public void removeFile(String person, String path) { User theOne = new User(); SignatureFile thePath = null; try { ArrayList<User> users = DataBase.getInstance().getUsers(); for (Iterator it = users.iterator(); it.hasNext();) { User user = (User) it.next()...
761fa014-8d23-4ae1-a65c-0e4a51b48408
4
protected void chardata (String text) throws IOException { int l = text.length (); for (int i = 0; i < l; i++) { char c = text.charAt (i); switch (c) { case '<': write(LESS_THAN_EN...
ec1f4c7f-6ee8-4583-8667-5529135d7966
0
public String getParameterName() { return this.parameterName; }
f1680ad4-e739-4ad7-ac80-29ac03d50a5a
2
public void unobfuscateProject() { if (variablePanel.getVariableListSize() == 0) { MessageDialog.displayMessageDialog(this, "INFORMATION_DIALOG", "NO_VAR_TO_UNOBF"); return; } if (!destinationDirectory.equals("")) { setActionButtonsEnabled(false); tabbedPanel.setSelectedComponent(variablePanel); Th...
1cc61f49-b190-41a6-a882-bd234b38f47f
0
@Test public void findHandFromCardSet_whenThreeFoursTwoJacksTwoKingsExist_returnsFullHouseFoursOverKings() { Hand hand = findHandFromCardSet(foursFullWithTwoJacksAndTwoKings()); assertEquals(HandRank.FullHouse, hand.handRank); assertEquals(Rank.Four, hand.ranks.get(0)); assertEquals(Rank.King, hand.ranks.get(1...
12aa7c94-ead9-4700-970c-4af10c4c469b
9
private void turn(TURN_DIR dir) { if (dir == TURN_DIR.LEFT) { switch (this.direction) { case NORTH: this.direction = DIRECTION.WEST; break; case WEST: this.direction = DIRECTION.SOUTH; break; case SOUTH: this.direction = DIRECTION.EAST; break; case EAST: this.direction = DIRECTION.NORTH; break; } ...
ac3dfc9e-3a10-45aa-933c-c618a226f8d5
9
private boolean expandCluster(DataObject dataObject) { List seedList = database.epsilonRangeQuery(getEpsilon(), dataObject); /** dataObject is NO coreObject */ if (seedList.size() < getMinPoints()) { dataObject.setClusterLabel(DataObject.NOISE); return false; } ...
559ceff6-fed3-4c74-afde-dc95ec85512e
5
public void tick() { x = 0.0D; y = 0.0D; if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { game.finished = true; } if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { x -= movementSpeed; } if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) { x += movementSpeed; } if (Keyboard.isKeyDown(Keyboard.KEY_U...
585fff38-246b-482d-a334-8db17d487f07
0
public String getUnprocessedInput() { return myUnprocessedInput; }
0bb83c1d-04bb-44ba-8ac7-0a47291c01ce
7
public static <T extends DC> Set<Set<Pair<T,T>>> getAllPhis(Set<T> star, Set<T> stop) { Set<Set<Pair<T,T>>> allPhis=null; if(star==null || stop==null) { return allPhis; } else//star!=null && stop!=null { Set<Pair<T,T>> allPairs=star.getAllPairs(stop); if(allPairs.size()==1) { return ...
226fa158-a82a-4185-b51e-b9e357e42f54
0
public void update() { inputProcessor.processInput(); loadedWorld.update(); }
f264662a-66fd-48fe-98a0-792a9490bbe7
0
public static void main( String[] args ) throws IOException { Game game = new Game(); Screen screen = new Screen( game ); screen.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); screen.setVisible( true ); screen.setTitle( "D-Star" ); screen.pack(); screen.setResi...
d105603b-a4c8-472f-b10a-a3efd0006bba
2
private void notifyObservers() { if(observers != null) for(PositionChangedObserver o : observers) { o.update(this); } }
83eb8726-8b78-4440-a3b9-fbb6a3d93b82
3
private boolean setGameType(int gameType) { boolean conGame; if(gameType == OTHELLO || gameType == CONNECT || gameType == TICTACTOE){ m_Game = gameType; conGame = true; } else { conGame = false; } return conGame; }
55808284-db26-4b6d-9c1c-1c3b975d3e44
1
@Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; }
1c22a4dd-853e-4dfb-978e-6215b68eeef0
5
public String getPassword() { String username = ""; if (type == 0 || type == 1) { if (menuComponents != null) { if (menuComponents.get(1) != null) { try { username = ((MenuTextBoxV2) menuComponents.get(1)) .getSubmitted(); } catch (Exception e) { } } } } return usern...
73f92e8d-b908-4d4f-8b58-0b3cb21c4db4
7
public void GetInput() { if(madeMove){ return; } mouseX = Mouse.getX(); mouseY = Mouse.getY(); //swiping if(currentClick == true && hasSwiped == false){ double swipeDistance = Math.sqrt( Math.pow((double)(mouseY-startY),2) + Math.pow((double)(mouseX-startX),2) ); if( swipeDistance > cardSize){...
5e95ff68-8aa2-4cbf-87b2-6d99afccaead
0
public Document toDOM(java.io.Serializable structure) { Automaton automaton = (Automaton) structure; originalAutomaton = automaton; Document doc = newEmptyDocument(); Element se = doc.getDocumentElement(); se.appendChild(createAutomatonElement(doc, automaton, AUTOMATON_NAME)); // Return the completed docum...
e7e0432b-46e2-4ead-af8d-813b3552a28a
3
@Override public void action() { if(agente.getPasso() == 2){ System.out.println("Passo 2 AI"); //agente.iniciarMapaMelhorProposta(); DFAgentDescription template = new DFAgentDescription(); ServiceDescription sd = new ServiceDescription(); sd.setType("venda-de-cupons"); template.addServices(s...
fdaf594e-5c88-453b-b7e1-0ca055c70d7a
9
public void begin(String server, int port) throws ParseException, IOException { this.server = server; this.port = port; authenticated = false; // Try to open a socket with server try { // Set keySt...
e1c71f2a-6acb-4107-930b-2535a2cf5542
9
final public String projectexpr() throws ParseException { /*@bgen(jjtree) PROJ */ SimpleNode jjtn000 = new SimpleNode(JJTPROJ); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token t; String s; String proj = ""; try { t = jj_consume_token(PROJECT); proj += t.image.toString(); ...
e92c4757-bff9-41fe-8290-b0985e79ceed
6
@EventHandler public void SilverfishBlindness(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.getSilverfishConfig().getDouble("Silv...
8c7253f4-f4ad-47d8-a1f7-c61291f73469
1
public void startMove() { PhysicsComponent ownPC = (PhysicsComponent)getOwningActor().getComponent("PhysicsComponent"); if(ownPC != null) { moving = true; ownPC.setTarget(targetX, targetY); } }
a37e7967-d238-49cd-b0ab-df2199801773
4
public void renderTiles(Graphics2D graphics2D) { graphics2D.setColor(Color.BLACK); for (int i = 0; i <= 40; i++) { for (int j = 0; j <= 24; j++) { if (tiles[i][j] == Tiles.WALL) { graphics2D.setColor(Color.BLACK); graphics2D.fillRect(...
6eabd7ff-6135-47e3-9ce6-25bce2ab4646
3
public boolean contains(int x, int y) { return (x > _x && x < (_x + getWidth()) && y > _y && y < (_y + getHeight())); }
41ef0c2d-a55d-4026-a349-59af48b98f3e
1
public synchronized void soften(CtClass clazz) { if (repository.isPrune()) clazz.prune(); classes.remove(clazz.getName()); softcache.put(clazz.getName(), clazz); }
d39d05c2-ab8b-494b-98ff-f0c6a699d58b
9
public int getCount(int maxR, int maxG, int maxB, int startR, int startG, int startB, int d1, int d2) { int res = 0; for (int i=0; i<maxR;i++) for (int j=0; j<maxG;j++) for (int k=0; k<maxB;k++) if (((Math.abs(i-startR) <= d2) && (Math.abs(j-startG) <= d2) && (Math...
25939a89-04ea-41be-a3d0-ea80ae1a1d7c
7
public ArrayList<JobPosting> findBestMatches(User u, ArrayList<JobPosting> jobsList){ ArrayList<JobPosting> matchingFieldsList = new ArrayList<JobPosting>();//This stores the jobPostings that have the users desired job field //Picks out the job postings that are in the area of interest of the user System.ou...
46189022-f722-4d7e-a81d-cf9c99aabd83
9
private void extend(Object component, Object lead, Object row, boolean recursive) { Object anchor = get(component, ":anchor"); if (anchor == null) { set(component, ":anchor", anchor = lead); } char select = 'n'; boolean changed = false; for (Object item = get(component, ":comp"); // anchor - row item != ...
0f9f7be4-ffa8-4495-95ee-66f3abbe0e82
4
private ConnectionUtil(){ if( dbType.equals("mysql")){ try { Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(urlMysql); } catch (Exception e) { e.printStackTrace(); } }else if( dbType.equals("oracle")){ try { Class.forName("oracle.jdbc.driver.OracleDriver");...
1abbf2fc-9a5a-48f8-86fc-7a7b55e3f9ba
4
public void selectPreviousRow() { int rowCount = timeListModel.getRowCount(); if (previousRow >= 0 && rowCount > 0) { if (rowCount > previousRow) { tblTimes.getSelectionModel().setSelectionInterval(previousRow, previousRow); } else if (rowCount == previousRow) { tblTimes.getSelectionModel().setSele...
dce9126d-6f16-4f29-a282-9ae7682ed7f2
7
public static byte[] addText(byte[] bImg, byte[] bVal, int offset) { try { //check of de tekst niet te groot is voor de foto if (bVal.length * 8 > bImg.length - offset) { throw new IllegalArgumentException("Message is too big for this image!"); } ...
69faecce-78b0-4a51-805b-86dd3215f813
6
@Override public void actionPerformed(ActionEvent e) { // If user clicks login button, then log the user in. if (e.getSource() == loginView.loginButton) { handleLogin(); } else if(e.getSource() == addUser.addButton){ User user = new User(); user.Insert(addUser.getModel()); } // If user cl...
f26abfa9-ac76-4e0f-b99c-d904d9dc22ae
0
public void setPercent(double percent) { this.percent = percent; }
24e98262-9005-4a7f-8350-41aa6800d1c2
9
public static void add(CommandSender sender, String [] args){ //If user allowed if(sender.hasPermission("battlegrounds.team.player.add") || TeamsManager.getInstance().isAdminOf(args[3], args[4])){ //team + player + add + player + team if(args.length < 2+3){ sender.sendMessage(ErrorMessage.MissingPa...
c310ce69-bef4-48e5-acc9-928a869a983e
2
public BufferedImage loadAsset(String Name) { for(Asset asset : Assets) { if(asset.getName().equals(Name)) { return asset.getImage(); } } return null; }
34a1e234-60a7-42d0-b48c-276ca0c50ac5
9
public CPublicMsg(byte[] data, ClientThread _client) { super(data); _from = readS(1, 10).trim(); _msg = readS(11, data.length - 12); System.out.println("waidomosc publiczna od :" + _from + " o tresci: " + _msg + ". "); try { if (_msg.charAt(0) == '\\') { if (!CommandHandler.getInstancec().Execude(_...
62d826db-b62b-4779-9629-c60e41227fac
0
public void SetOffBusTicks(int offBusTicks) { //set the tick time person got off the bus this.offBusTicks = offBusTicks; }
a027c579-72b9-4152-a8e2-0c798b7b0bac
9
void setStateID(byte id) { switch (id) { case UserAction.XADD_ID: xAddAtomMenuItem.setSelected(true); break; case UserAction.YADD_ID: yAddAtomMenuItem.setSelected(true); break; case UserAction.ZADD_ID: zAddAtomMenuItem.setSelected(true); break; case UserAction.XMOL_ID: xAddMoleMenuItem.se...
6ad7df36-8856-4864-8457-1f4767b01dd0
5
private void saveCut() { if (txtSleevesMade.getText().trim().isEmpty()) { String message = "Please input sleeves cut"; JOptionPane.showMessageDialog(this, message, "Error", JOptionPane.ERROR_MESSAGE); } else { int amountCut = Integer.parseI...
863517aa-5fcb-4f43-9e49-31f3acca2a8a
5
public void addWord (String word) { if (word == null || word.length() == 0) { return; } TrieTree curNode = this; int pos; char c; for (int i = 0; i < word.length(); i++) { c = word.charAt(i); pos = c - 'a'; if (curNode.child[pos] == null) { curNode.child[pos] = new TrieTree(c); } i...
f42ba18a-9fa2-4a93-b9d5-cde2afec1bca
1
static void urlConnector() { URL url; HttpURLConnection connection = null; String lResponseMessage = ""; String targetURL = "http://staging.webchat.a-cti.com:8082/js/action/eventToTalkAction.do?"; String urlParameters = "method=sendJSONRequest&open=submitClickToTalkForm&formName=TestScheduleForm&eventToTalk...
6432bd3d-ff95-4b05-9083-b830db974227
1
public final boolean collidesWith(MovingObjectModel obj) { double separationDistance = Math.sqrt( Math.pow(pos[0] - obj.pos[0], 2) + Math.pow(pos[1] - obj.pos[1], 2) ); if (separationDistance < hitRad + obj.hitRad) return true; return false; }
ef28009c-6543-412a-ab3e-e1ec5ae50afc
9
public static Command createCommand(String line){ try{ ArrayList<String> fields = new ArrayList<String>(4); fields.add(Command.CREATE_COMMAND,"create"); fields.add(Command.REMOVE_COMMAND,"remove"); fields.add(Command.READ_COMMAND,"read"); fields.add(Command.WRITE_COMMAND,"write"); boolean nocommand ...
31b32241-b989-4e98-a35e-da6227ea0e2b
5
public void toBytecode(DataOutputStream out) throws CannotCompileException, IOException { try { if (isModified()) { checkPruned("toBytecode"); ClassFile cf = getClassFile2(); if (gcConstPool) { cf.compact(); ...