method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
7d368b6e-d9f9-4b2a-8b77-f24112dfab89
1
public synchronized void deleteWay(int pos, long wayId){ if (ways.size()>pos) ways.get(pos).remove(wayId); }
8abc6ce5-bdb1-4bf7-bb00-4e696f296b8c
7
public int minDistance(String word1, String word2) { int a = word1.length(); int b = word2.length(); int [][]tem = new int[a+1][b+1]; for (int i=0;i<=a;i++){ tem[i][0] = i; } for (int i=1;i<=b;i++){ tem[0][i] = i; } for (int i = 1;i...
499176db-e263-453d-904c-1bd285a14775
1
public void setPreviewimage(Path image) { try { this.skin.setImage(image); this.skin.setSkinChanged(true); } catch (IOException e) { Main.showProblemMessage(e.getMessage()); } }
50a43b88-c518-4171-8b40-08f3a66b8469
9
private static Set<EEnum> getAllEEnumerations(EClass sysmlClass, LinkedHashSet<EEnum> linkedHashSet) { for (EAttribute eAttribute : sysmlClass.getEAllAttributes()) { if (eAttribute.getEType() instanceof EEnum) { EEnum eEnum = (EEnum) eAttribute.getEType(); linkedHashSet.add(eEnum); } } for (ERef...
46e1bc76-1b14-4b08-af21-3e8cbe7d7297
9
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
43f63d31-187f-4ded-b38f-13195f02c5e0
2
public void close() { try { this.bufferWriter.close(); } catch (IOException ex) { System.out.println(ex); for (StackTraceElement el : ex.getStackTrace()) { System.out.println(el); } } }
db980c23-e9eb-49fb-899e-0a8ae3b0a63d
4
public int getNewLineIndex(byte[] bytes, Charset charset) { String firstBytes = new String(bytes, charset); String separator = "\r\n"; int index = firstBytes.indexOf("\r\n"); int indexCR = firstBytes.indexOf("\r"); int indexLF = firstBytes.indexOf("\n"); if (indexCR != -1...
5e460a9e-1874-4737-ae11-647c16f1580b
4
private void createTopPanel(){ JPanel topPanel = new JPanel(); topPanel.setOpaque(false); topPanel.setPreferredSize(new Dimension(180, 420)); // fill out inventory label add(Box.createVerticalStrut(50)); slotPanel = new JPanel(); slotPanel.setOpaque(false); slotPanel.setLayout(new FlowLayout(FlowL...
89d307b3-9ace-4e96-b33c-4ccd80b3f994
5
protected int readBlock() { blockSize = read(); int n = 0; if (blockSize > 0) { try { int count = 0; while (n < blockSize) { count = in.read(block, n, blockSize - n); if (count == -1) break; n += count; ...
e99c0d7f-bba6-4fd4-87df-acb3d0247fbb
7
public void undoLastMove() { if (moveHistorySokoX.size() > 0 && moveHistorySokoY.size() > 0 && Direction.size() > 0) { if ((Direction.elementAt(Direction.size() - 1) == left)) { undoBaggMove(LEFT_COLLISION); } if ((Direction.elementAt(Direction.size() - 1) == right)) { undoBaggMove(RIGHT_COLL...
77e294e7-824a-4f6f-abac-8950e2af91f8
0
final public byte[] load(String frameId,int dataLen,RandomAccessFile openFile) throws IOException { offset = new Long(openFile.getFilePointer()); this.frameIdentifier=frameId; this.dataLength=dataLen; return this.load_from_current_position(frameId, dataLen, openFile); }
96fae1d3-22af-40b7-9e6b-bec0a32c1b75
4
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: String nome, cod, cnpj, desc; nome = txt_nomeforn.getText(); cod = txt_codforn.getText(); cnpj = txt_cnpjforn.getText(); ...
b621ea94-dcca-4787-81e9-1bff9aff4664
0
public PanelGrille getPanelGrid() { return pnlGrid; }
c87a0e46-2c6a-4578-9ace-3dc5e8b340dd
3
protected void loadPlays(Position position, Player cpu,int largestCapture){ FactoryOfPlays factory = new FactoryOfPlaysForPiece(position,cpu.getBoard()); int bestEvalution=-100; // valore inizializzato a -inf. for(AbstractPlay play:factory){ int evaluation = evaluate(play,cpu,largestCapture); if(evaluation>...
1148f4d9-2ef6-4ee9-bcde-94e110a6cc7c
9
public List<GeneratedImage> buildCreatedFiles() throws IOException, InterruptedException { boolean error = false; final List<GeneratedImage> result = new ArrayList<GeneratedImage>(); for (File f : dir.listFiles()) { if (error) { continue; } if (f.isFile() == false) { continue; } if (fileToP...
0eb2a348-5fa6-44e5-a2be-19733a18f342
4
@Test public void testRemover(){ try { facade.remover(1); Assert.assertEquals(facade.listarProdutos().size(), 3); } catch (FacadeException e1) { Assert.fail(e1.getMessage()); } try { facade.remover(5); Assert.fail("devia lanÁa uma execeÁ„o"); } catch (FacadeException e1) { // tem que lanÁa ...
bc282d70-b2f5-4440-b20b-fda37351cd97
5
public Component getComponent(int r1, int c1, int r2, int c2) { for (Component c : components) { if ( c.getEndPt1().equals(terminals[r1][c1]) && c.getEndPt2().equals(terminals[r2][c2]) || c.getEndPt2().equals(terminals[r1][c1]) && c.getEndPt1().equals(terminals[r2][c2]) ) { ...
076416f6-9590-4f6b-b0e1-4c559cad666d
7
public double get(int i, int j) { if (0 <= i && 0 <= j && i < s.length && j < s.length) { if (i == j) { return 1.0; } else if (i > j) { return s[i][j]; } else if (i < j) { return s[j][i]; } } return Double.NaN; }
4c5deea9-0018-4849-83e7-15b06f7014c5
7
private void setOptions(String[] options, int selectedOption) throws IllegalArgumentException { if ((selectedOption < 0) || (selectedOption > options.length - 1)) { throw new IllegalArgumentException("invalid selection"); } if ((options == null) || (options.length == 0)) { throw n...
523edf7f-b62d-4670-b4dd-4c40bdfb9948
1
public void zombie(Boolean mode){ if (mode != null){ zombie = mode; }else{ zombie = true; } }
7076b2c1-2ebf-4763-adab-896055bb644c
4
public static boolean verificaUsuario(String nome, String senha) throws SQLException{ nome = nome.toUpperCase(); Connection con = null; nomeTabela = "login"; boolean retorno = false; try { con = ConexaoMySQL.getConexaoMySQL(); Statement stmt = con...
d55aa783-df70-47ba-a937-2aa36069ad58
8
@Override public void uploadAttendance(Scanner sn) { System.out .println("You can enter attendance from a barcode scanned CSV file"); System.out.println("Please enter the file name"); String csvFile = sn.next(); BufferedReader br = null; String line = ""; String cvsSplitBy = ","; String[] headers; ...
2206442e-e15d-431e-ba2a-8da198cb270f
3
public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) { if(!(Commands.isPlayer(sender))) return false; Player p = (Player)sender; String pName = p.getName(); if(args.length != 0) return false; if(PlayerChat.plugin.getConfig().getBoolean("AdminChat.Enabled", true)) {...
7a0df257-69ee-4e4f-a411-fa55639bb932
7
@Command(cmd = {"ftc", "fairytailcraft", "ft", "fairytail"}, firstArg = {"cast"}) public boolean setCastMagic(CommandSender sender, String cmd, String[] args) { if (sender instanceof Player) { Player sent = (Player) sender; String magic = Util.getPlayerConfig(sent).getMageType();...
2d23e97a-1e66-4b85-a813-e6fd95dc1294
2
public void testPropertySetCopyDay() { LocalDateTime test = new LocalDateTime(1972, 6, 9, 10, 20, 30, 40); LocalDateTime copy = test.dayOfMonth().setCopy(12); check(test, 1972, 6, 9, 10, 20, 30, 40); check(copy, 1972, 6, 12, 10, 20, 30, 40); try { test.dayOfM...
7937f102-a2ee-4785-869e-0a63842bdbfe
7
public int firstMissingPositive(int[] A) { for (int i = 0; i < A.length; i++) { while (A[i] != i + 1 && A[i] > 0 && A[i] <= A.length && A[i] != A[A[i] - 1]) { int temp = A[A[i] - 1]; A[A[i] - 1] = A[i]; A[i] = te...
4e7b16a8-0a9e-45d8-b7b9-7f1659377094
2
public void load(ResultSet rs) throws Exception{ if(rs.next()){ setPersonID(rs.getInt("personid")); setLastName(rs.getString("lastname")); setFirstName(rs.getString("firstname")); setEmail(rs.getString("email")); setPersonType(rs.getString("persontype"...
231f6282-46e8-43c7-b47c-ca9ec2afb359
1
private static boolean isCollection(Object object) { return (object == null ? false : Collection.class.isAssignableFrom(object.getClass())); }
fb2f53cd-a127-4e7f-8fa8-18c348a4cd08
2
public boolean isInCooldown(UUID uidz) { if (!kewlDowwwwn.containsKey(uidz)) { return false; } else if (kewlDowwwwn.get(uidz) > System.currentTimeMillis()) { return true; } else { kewlDowwwwn.remove(uidz); return false; } ...
2dc63ee0-e609-4fac-b9b1-c0888421d785
4
private void calculateFitness() { for(int i = 0; i < numberOfParticles; i++){ double currentfitness = objectiveFunction.CalculateFitness(positions[i]); if(maximum){ if(currentfitness > fitness.get(i)){ fitness.put(i, currentfitness); updatePersonalBest(i); } }else{ if(currentfitness < f...
00d35985-8499-4973-aa3b-6f6b413e8ac0
0
public Point getFirstpoint() { return firstpoint; }
efbdfc0f-5b89-494b-bd0f-bf3e7492738d
1
public void setFloatformat(String format) { fformat = (!format.startsWith("%")) ? ('%' + format) : format; }
c020d557-2593-4429-8eae-f42c5e828c47
0
@Override public void endSetup(Attributes atts) { super.endSetup(atts); }
55de04c6-e1ca-46b6-918b-afc85caecd77
5
public void run() { byte[] buffer = new byte[1024]; try { group = InetAddress.getByName("224.0.0.31"); //Broadcast group on Inet 130.0.0.1 broadcast - client match } catch (UnknownHostException e) { System.err.println("Unknown Host - Reduce error"); e.printStackTrace(); } while(true){ //Continuous Ex...
e9ecdb99-9fcb-43ed-ba86-49234b24234c
4
public byte[] parsePacket(byte[] packet) throws IOException { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); // byte[] preamble = new byte[5]; //Always "DATA " byte[] checksum = new byte[16]; byte filenameLength = packet[16]; byte[] filename = new byt...
0f7c0be2-5611-4e3f-8fe8-082b130524fe
4
@Override public boolean equals( Object that ) { if ( that == this ) return true; if ( that == null || !getClass().equals( that.getClass() ) ) return false; Row other = (Row) that; return option.equals( other.option ) && description.equals( other.description ...
21d5567e-6cd9-4f2e-bbba-a636274a82d9
1
public ItemKey<? extends Box> getSource() { return source; }
f113095e-5927-4b38-87f4-a279cc77a716
8
public boolean isValid() { return isValidGivenName() && isValidSurname() && isValidAddress() && isValidEmail() && isValidAddress() && isValidCountry() && isValidState() && isValidPoscode() && isValidCreditNo(); }
385efec7-16f8-4cf2-862c-49af370984f6
1
public void combine(StatsCollector collector) { Assert.notNull(collector); Assert.isTrue(Math.abs(min - collector.min) < 0.000001); Assert.isTrue(Math.abs(range - collector.range) < 0.000001); Assert.isTrue(numBuckets == collector.numBuckets); instances += collector.instances; mean = ((numObs * mean) + (col...
2b5bb24e-9384-4bd8-bcf7-b521fe2de5a9
9
private static List<String> makeIPAddresses(String str, int count) { if (str==null || str.isEmpty()) { return null; } List<String> answer = new ArrayList<>(); if (count==4) { if (Integer.parseInt(str)>255) { return null; } else { answer.add(str); return answer; } } for (int i=0...
d7512479-a331-4d6c-9973-35fb635212d5
4
public List<Book> getBooksByParameters(String name, String authorName,String year, String bookType, String series, String availibility) { boolean available = false; int yearInt = 0; if (!IntegerUtil.isInteger(year) || year.equals("")) { yearInt = 0; } else { yearInt = Integer.parseInt(year); } ...
7e852e2f-be01-4a2c-8352-d5440020fecd
8
public static boolean verifieGroupePheromone(List<int[]> groupePheromone){ int taille = groupePheromone.size(); boolean isValide = true; for(int i=0; i<taille-1; i++){ int[] compare1 = groupePheromone.get(i); int x1 = compare1[0]; int y1 = compare1[1]; for(int j=i+1; j<taille; j++){ int[...
c6dc845e-76a4-4924-9544-c9576343ac48
3
public static PDFAction getAction(PDFObject obj, PDFObject root) throws IOException { // figure out the action type PDFObject typeObj = obj.getDictRef("S"); if (typeObj == null) { throw new PDFParseException("No action type in object: " + obj); } ...
8ab3faec-05bc-4d5f-8f40-4e98bc739bf4
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Cell other = (Cell) obj; if (super.getX() != other.getX()) { ...
967efe2b-243c-455b-bd26-1adea808fd89
1
public Item peek() { if (isEmpty()) throw new NoSuchElementException("Queue underflow"); return first.item; }
8ffb037d-d81a-4d16-95b7-eebc9789d0a6
3
public static String normalize(String buffer) { if (buffer != null) { buffer = buffer.trim(); if (buffer.length() > 0 && buffer.charAt(0) == '+') { buffer = buffer.substring(1); } } return buffer; }
d22bf3bc-02e2-4a2a-84b8-2f5809c1d8a9
3
private synchronized void removeClassFile() { if (classfile != null && !isModified() && hasMemberCache() == null) classfile = null; }
86ecf6ba-81f9-4e54-95d5-a1feee15733f
6
public static LinkedListNode appendLastKNodes(LinkedListNode head, int k) { if (head == null) return null; LinkedListNode slow = head; LinkedListNode fast = head; for (int i = 0;i < k;i++) { if (fast == null) return null; fast = fast....
5e1a666c-c85b-4f8f-a673-9fd3a2d38396
4
public void update(){ key.update(); if(key.up)y--; if(key.down)y++; if(key.left)x--; if(key.right)x++; }
d392f21f-97b0-4c1d-94a2-c0afa1d9bc03
9
private short processInternalAuthenticate(APDU apdu, boolean protectedApdu) { if (!hasInternalAuthenticationKeys() || (hasMutualAuthenticationKeys() && (!protectedApdu || !hasMutuallyAuthenticated()))) { ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED); } ...
595e5400-a0de-4ebf-b70f-fc135f1970f3
4
private int getOtherToken(String content, int startOffset, int endOffset) { int endOfToken = startOffset + 1; while (endOfToken <= endOffset) { if (Character.isWhitespace(content.substring(endOfToken, endOfToken + 1).charAt(0))) break; endOfToken++; } String token = content.substring(startOffset,...
734d8cab-9bf7-4be5-a7a8-b97541891cc2
7
final void method3500(int i) { int i_56_ = 0; if (i != 700) method3509(120, true, false, 4, -12, 14, -33, -109); for (/**/; (((Class361) this).anInt4437 ^ 0xffffffff) < (i_56_ ^ 0xffffffff); i_56_++) { for (int i_57_ = 0; ((Class361) this).anInt4443 > i_57_; i_57_++) { if (i_56_ != 0 && (i_57...
5c58ad07-b4da-4fb1-a53a-c1f89e7e6963
9
public void itemStateChanged(ItemEvent e) { CheckboxMenuItem menu = (CheckboxMenuItem)e.getSource(); if (menu.getState()) { String label = menu.getLabel(); if(label.equals(CLEAR)){ }else if(label.equals(TWEET)){ this.model.enablePostField(); }else if(label.equals(ONLY_MENTION)){ ...
095131bb-48ec-401e-a294-6d5dc3bd2e87
3
public ArrayList<MatchScheduling> scheduleFinal() throws SQLException { ArrayList<MatchScheduling> matches = new ArrayList(); ArrayList<Team> f1Teams = new ArrayList(); for (int k = 0; k <= 1; k++) { int homeTeamId = getById(listByMatchRound(8).get(k).getId()).getHomeTe...
7bc39ddb-643f-4088-a0dc-256c62b23cfc
8
private void AutoGolo_CheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AutoGolo_CheckBoxActionPerformed //Atualiza Jogador_ComboBox Jogador_ComboBox.removeAllItems(); if(Equipa1_RadioButton.isSelected()) { if(!AutoGolo_CheckBox.isSelected()) { ...
57c9c953-9281-4967-b699-4b63375c465a
8
public void run() { try { Synthesizer synthesizer = MidiSystem.getSynthesizer(); synthesizer.open(); channel = synthesizer.getChannels()[0]; while (true) { // get 8 notes & check if in major scale // additionally play root note for (int iEight = 0; iEight < 8; iEight++) { pause = 0; ...
30a19277-c239-4e30-add1-48991c6d4ceb
0
public AddressPopup(final Stage parentStage, String titleText, String addressType) throws MalformedURLException { this.root = new StackPane(); this.root.autosize(); this.scene = new Scene(root, AppSettings.getDoubleValue("address.popup.width"), AppSettings.getDoubleValue("address.popup.height"), ...
bbe5395e-149c-48bf-be09-0215186f9dbc
7
public boolean compare(Predicate.Op op, Field val) { StringField iVal = (StringField) val; int cmpVal = value.compareTo(iVal.value); switch (op) { case EQUALS: return cmpVal == 0; case NOT_EQUALS: return cmpVal != 0; case GREATER_THAN: return cmpVal > 0; case GREATER_THAN_OR_EQ: return cm...
a8d3bc9c-6885-46a3-abbd-4353b2119887
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Usuario other = (Usuario) obj; if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) { ...
9f69fd3e-0b28-48b0-9f61-7e4f2ddf424e
5
private String createAuction() { if (user.isOnline()) { int duration = 0; String describtion = ""; try { duration = Integer.parseInt(stringParts[1]); if (duration <= 0) { return "Error: The duration has to be > 0!"; } for (int i = 2; i < stringParts.length; i++) { desc...
c8b0d7a9-cfcd-45e3-b0d1-f6568ea8d937
5
public int victoryCond() { int result = 0; boolean fullCond = false; //0 = nothing, 1-3 = Rows, 4-6 = Columns, 7&8=Diags, 9 = full if(result == 0) { result = checkAcross(); } if(result == 0) { result = checkDown(); } if(result == 0) { result = checkDiag(); } if(result == 0) { fullCond = ch...
6204b5b3-fccc-4ff8-8df5-1cbf4f0e5611
9
private void gridInitialize() { for (int i = 2; i <= 3; i++) { for (int j = 0; j < 5; j++) { gameGrid[i][j] = 1; node[i][j].setPlayer(1); gameGrid[i + 3][j] = 3; node[i + 3][j].setPlayer(2); } } for (int i = 0; i <= 1; i++) { for (int j = 0; j < 5; j++) { if (i == 0) { if (j % 2 ...
80a3d7a0-5589-4403-b754-3eabd31a9ff4
5
public byte[] getSpecialSequence(int function) { byte[] sequence = null; switch (function) { case TerminalIO.STORECURSOR: sequence = new byte[2]; sequence[0] = ESC; sequence[1] = 55; // Ascii Code of 7 break; case ...
b77792fa-2bd8-4d61-af40-dbc1f4958982
5
public static String getAssetTypeName(String assetTypeID, String serverID) { String name = otapiJNI.OTAPI_Basic_GetAssetType_Name(assetTypeID); if (Utility.VerifyStringVal(name)) { return name; } if (!Utility.VerifyStringVal(otapiJNI.OTAPI_Basic_LoadAssetContract(assetType...
5ad5c712-c684-439f-8bd3-a606180cf078
8
@Override public LoginResult createCharacter(String login, Session session) throws IOException { final SessionStatus status=session.getStatus(); final LoginSessionImpl loginObj=new LoginSessionImpl(); loginObj.acct=null; loginObj.login=login; loginObj.mob=null; final MOB prevMOB=session.mob(); LoginResu...
f3d488c1-1693-4d7c-9e0d-db0fd1c6c4c9
7
public static Matrix loadARFF(String filepath) throws IOException { BufferedReader in = new BufferedReader(new FileReader(filepath)); Matrix matrix = new Matrix(); boolean isProcessingData = false; String line; while ((line = in.readLine()) != null) { li...
c83740ea-77e6-4575-a8c2-354f5b0759dd
5
public List<Reservation> getReservationsByCustomerId(int customerid){ List<Reservation> res=new ArrayList<Reservation>(); Connection con=null; Statement stmt=null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverMan...
79047a8f-0455-452a-adb9-3f58f535cd18
3
public static void main(String[] args) { // If the system tray isn't supported... Exit. if (!SystemTray.isSupported()) { JOptionPane.showMessageDialog(null, "SwiftSnap isn't compatible with your computer."); return; } // Get the OS system tray. Sy...
21a2c673-f2ce-4e68-a5e9-9df7e6cd34da
6
public void califLetra () { if (getCl() >= 'A' && getCl() <= 'D') { System.out.println("Bajo rendimiento"); } else { if ( getCl() =='E' || getCl() == 'F') { System.out.println("Rendimiento aceptable"); } ...
5da01512-f825-4713-a64d-8ea222e4082f
3
public void print(){ System.out.println(); for (int i = 0; i < d.length; i++) { for (int k = 0; k < d.length; k++) { if(d[i][k]>100000) System.out.print("* "); else System.out.print(d[i][k]+" "); } System.out.println(); } }
a765eab0-b7c2-40ea-9840-423480029a74
9
@Override public void onBrowserEvent(Event event) { if (!event.getCurrentEventTarget().cast().equals(getElement())) { super.onBrowserEvent(event); return; } if (width == -1) { determineSizes(); } boolean mouseEvent = false; int type = DOM.eventGetType(event); switch (type) { case Event.ONMOU...
c29266cb-77f4-419f-868f-7be7008ee4d0
7
public void tryMove() { for(BB bb : level.collidables) { if(bb.pointIntersects(this.x + this.xa, this.y)) { if(this.x < bb.getX()) { this.x = bb.getX(); } else if(this.x > bb.getX() + bb.getWidth()) { this.x = bb.getX() + bb.getWidth(); } this.xa = -this.xa; } if(bb.pointIn...
ac731a01-c899-4799-acad-d85a479f0843
2
public static double density(double temperature){ double[] tempc = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 60, 65, 70, 75, 80, 85, 90, 95, ...
1dc3871e-c8b8-4d02-8ff8-367c5bb09ff4
1
public void addLoop(int loopNum) { //Making the button ImageButton loopImage = new ImageButton(parent, "Loop " + loopNum, 50 + (loopNum - 1) * 120, screenHeight - 32, 100, 25, 1) { @Override public void onMousePress(int x, int y) { //Opens loop menu if not open already if (!loopMenuOpen) { ...
890c5251-090e-40b4-a3dd-6fde4332003b
4
@Override public void deserialize(Buffer buf) { teleporterType = buf.readByte(); if (teleporterType < 0) throw new RuntimeException("Forbidden value on teleporterType = " + teleporterType + ", it doesn't respect the following condition : teleporterType < 0"); int limit = buf.read...
21bec6aa-3c71-46fb-8b4e-30d2ba40d760
7
public static void main(String[] args) { String line; if (args.length == 0) { System.out.println("CCalculator v0.1"); System.out.println(); System.out.println("Input a combination of numbers, basic arithmetic operators and brackets, then press <Enter> to g...
5f6819de-59d4-45bc-9597-b04340d69420
9
private void checkForKeyPress() { if(moving) { if(Mouse.isButtonDown(0) && currentReloadTime == 0) { bullets.add(new Bullet(getX(), getY(), 2, direction, 3, true)); currentReloadTime = maxReloadTime; } if(!Mouse.isButtonDown(0) && currentReloadTime > 0) { currentReloadTime-...
27344ecf-d7b3-4216-b22e-ed9086e41194
8
public String toString() { StringBuffer sb = new StringBuffer(); sb.append(negative ? "N" : "n"); sb.append(overflow ? "V" : "v"); sb.append(direct_page ? "P" : "p"); sb.append(break_flag ? "B" : "b"); sb.append(half_carry ? "H" : "h"); sb.append(indirect_master ? "I" : "i"); sb.append(zero...
c0cf42e6-8541-4437-bca3-6cf03d3e9d1b
1
private void drawPauseScreen(Graphics page) { if(pause) { //Screen Fade out page.setColor(new Color(0,0,0,150)); page.fillRect(0,0,this.getWidth(), this.getHeight()); //Middle Box page.setColor(new Color(255,255,255,40)); page.fillRoundRect(160, 50, 670, 325,25,25); //Pause Sign page.setCol...
3af924cb-0d25-4c05-9b49-142fa7f8bc45
9
@Override public List<AssemblyLine> generate(Context context) { final List<AssemblyLine> lines = Lists.newLinkedList(); Data value = getValue(context, lines); if (context.getAddress(ident) == null) { Context.error("Try to assign a non-existent variab...
000344e9-6398-42b8-9b6d-9a8531aebc91
7
@EventHandler public void GhastBlindness(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.getZombieConfig().getDouble("Ghast.Blindne...
947ede18-bc26-40c5-9084-307f000c6507
6
private void copyRGBtoBGRA(ByteBuffer buffer, byte[] curLine) { if(transPixel != null) { byte tr = transPixel[1]; byte tg = transPixel[3]; byte tb = transPixel[5]; for(int i=1,n=curLine.length ; i<n ; i+=3) { byte r = curLine[i]; by...
4705a250-e084-4af8-87f7-4bd36029a065
7
public void keyPressed2(KeyEvent w) { int code = w.getKeyCode(); if (code == KeyEvent.VK_SPACE) { if (I == 0) { //Looking Left if (nS == 1) { x = X; y = Y; stop = false; shoot = true; ...
6e79d24c-5ba4-410b-9494-3ae43c758514
9
@Override public void handleCommand(CommandMessage m) { String[] args = m.getArgs(); if (args.length == 1) { String nick = m.getNick(); if (pozdravy.containsKey(nick)) { ph.sendMessage(nick + ": " + pozdravy.get(nick)); } } else if (args.length ...
ddce4181-34bc-4212-91f5-bd9dd2c6082b
4
public void addModulesFromPackage(String packageName, ClassLoader classLoader, Class<?>... ignores) throws Exception { for(Class<? extends Module> clazz : ReflectionsUtilities.getSubtypesOf(Module.class, packageName, classLoader, ignores)) { try { modules.add(clazz.newInstance()); ...
f31ea6bf-c5ac-45ff-aea6-83e064ae81b8
5
static final public void terme() throws ParseException { facteur(); label_9: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case ET: case MUL: case DIV: ; break; default: jj_la1[19] = jj_gen; break label_9; } opMul(); fa...
d26df52e-8237-44b7-819e-84d1593697df
9
private double getCustomScore(String token1, String token2, int minNumTokens){ try{ int t1 = Integer.parseInt(token1); int t2 = Integer.parseInt(token2); if(t1 != t2){ return 2; } else{ return 1; ...
43bbeee4-c682-47a0-921b-266247ddc057
0
protected void onVoice(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient) {}
f2dfad47-a92a-47dd-bd40-2c503b6b3961
5
protected Behaviour getNextStep() { if (numLookups > MAX_LOOKUPS) return null ; if (topic == null) topic = pickResearchTopic(actor, archive) ; if (topic == null) return null ; final float persist = actor.traits.scaleLevel(STUBBORN) ; if (numLookups > (BASE_LOOKUPS * persist)) { if (Rand.i...
671cc268-2d5c-4239-8895-e055b368587a
7
public int largestRectangleAreaII(int[] height) { if (height == null || height.length == 0) return 0; int area = 0; Stack<Integer> stack = new Stack<Integer>(); for (int i = 0; i <= height.length; i++) { int h = i < height.length ? height[i] : 0; if (stack.empty() || height[stack.peek()] < h) { sta...
7ad91359-a1f1-48ca-abdb-01624fd67818
4
private void getNodeVariableList(ParseTree node) { if (node.attribute.equals("DECLARE")) if (!containsVariable(node.children.get(0).value)) variableList.add(new VariableInformation(node.children.get(0).value, node.children.get(1).value)); //Iterate children for (int i = 0; i < node.children.size(); i...
4f5873fa-7a7a-4124-99b2-6965add0efdd
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Player other = (Player) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return fa...
565f5b9b-323c-4aea-affc-18dd30bc018c
5
private static List<byte[]> generatePossiblePasswordBytes( String passwordString) { final List<byte[]> possibilties = new ArrayList<byte[]>(); for (final PasswordByteGenerator generator : PASSWORD_BYTE_GENERATORS) { byte[] generated = generator.generateBytes(passwordString); ...
e5afe2f8-b0f2-43fa-9eb7-faf29779e1ff
4
public void Traitement() { try { ServerSocket serveur = new ServerSocket( port ); System.out.println( "Serveur echo en ligne. " ); System.out.println("Ce serveur utilise le port : " + port); while(true) { if (NbrConnexion < ...
a0448e1b-a25c-46b8-97f2-e7c1fdecc5fc
1
public String toString() { try { return this.toJSON().toString(4); } catch (JSONException e) { return "Error"; } }
fced615c-6e42-401e-a9ee-ac4a7dd5206a
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; User other = (User) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(...
5a523745-4ded-44d2-96ba-4a28f4889825
5
public static String findCentroidEditDistance(String[] queries) { HashMap<String, Float> hm = new HashMap<String, Float>(); float max = Float.MIN_VALUE; String centroidQuery = null; for (int i = 0; i < queries.length; i++) { String query = queries[i]; float[] distances = new float[queries.length]; for ...
a18d7e33-83d5-4ca1-aa33-03a8c6e142f6
4
private void loadUserPrefVariables() { Variables.setSetting("launch.UseXmxArgument", "true"); Variables.setSetting("launch.XmxArgument", MemoryField.getText()); Variables.setSettingPriority("launch.XmxArgument", "int:largest"); if (!JavaPathField.getText().equalsIgnoreCase("defa...
b4539c78-4dba-446b-95b6-7571505426f0
3
public static void main(String[] args) throws Exception { Command command = processArgs(args, "VorbisComment"); VorbisFile vf = new VorbisFile(new File(command.inFile)); if (command.command == Commands.List) { listTags(vf.getComment()); } else { ...
0244de34-0d23-4f8f-b481-bbd9ff2c883f
0
public boolean isBusiness() { return business; }