method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
39c7cd0f-3d75-47a4-9db1-b93ac9c78e1a
1
public static Cliente convertToCliente(ClienteDTO clienteDTO) { if (clienteDTO == null) { return new Cliente(); } return new Cliente(clienteDTO.getId(), clienteDTO.getNome(), clienteDTO.getSobrenome(), clienteDTO.getEndereco(), clienteDTO.getCep(), clienteDTO.getDtNascimento(), clienteDTO.getTelefone()...
ebc96661-be1d-42e7-a8d1-9125a65441b6
1
public static long getCRC32(String filename) { // Attempt to read the file from disk try { RandomAccessFile file = new RandomAccessFile(filename, "r"); // Convert the file to a buffer byte[] buffer = new byte[(int)file.length()]; file.read(buffer); // Generate the CRC from the buffer CR...
d4cace2d-fb3b-4d8a-8ec5-c38acae95863
3
protected void revertButtonActionPerformed(@SuppressWarnings("unused") final ActionEvent arg0) { for (int i = 0; i < this.fileStateTable.getSelectedRows().length; i++) { final int rowIndex = this.fileStateTable.getSelectedRows()[i]; // We have to know the absolute path of the selected file // Indexes of file...
59297086-a624-45c9-b21e-8308981f2b5e
3
public HashSet<String> getIgnores(String player){ HashSet<String> ignorelist = new HashSet<String>(); sql.initialise(); ResultSet res = null; try { res = sql.sqlQuery("SELECT Ignoring FROM BungeeIgnores WHERE PlayerName = '"+player+"'"); } catch (SQLException e) { e.printStackTrace(); } try { wh...
0ed594e2-61fe-443d-8fcb-afa6a8ff7a5d
0
@Override public void speak() { System.out.println("The Rottweiler says (in a very deep voice) \"WOOF!\""); }
481eb3a6-6449-4958-a8b5-5c9d5d93cbee
9
public void run() { sendRulesToPlayers(); Connection activePlayer = players.get(0); while(true) { row = null; column = null; row = activePlayer.received.pollLast(); System.out.println("%%%%%"+row); column = activePlayer.received.pollLast(); System.out.println("%%%%%"+column); active...
14c996f6-4535-4bd3-8c51-a0392dc5c803
3
public ReleaseType getLatestType() { this.waitForThread(); if (this.versionType != null) { for (ReleaseType type : ReleaseType.values()) { if (this.versionType.equals(type.name().toLowerCase())) { return type; } } } return null; }
8e313142-e976-4eb1-bd65-cf5a8c1ee79d
5
public boolean contains(AABB other) { return minX <= other.minX && other.maxX <= maxX && minY <= other.minY && other.maxY <= maxY && minZ <= other.minZ && other.maxZ <= maxZ; }
1db57c1a-5a33-4836-a086-c48adad9e9a2
3
public static int poisson(double lambda) { if (!(lambda > 0.0)) throw new IllegalArgumentException("Parameter lambda must be positive"); if (Double.isInfinite(lambda)) throw new IllegalArgumentException("Parameter lambda must not be infinite"); // using algorithm given by...
969369e6-c156-48fa-a4ff-1335a53a2827
0
public CheckResultMessage checkF01(int day) { return checkReport.checkF01(day); }
74149528-3738-4162-bf1d-7dac2e0df55b
0
public static String sign(byte[] data, String privateKey) throws Exception { // 解密由base64编码的私钥 byte[] keyBytes = SecurityCoder.base64Decoder(privateKey); // 构造PKCS8EncodedKeySpec对象 PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); // KEY_ALGORITHM 指定的加密算法 KeyFactory keyFactory = KeyFac...
d4d68a9d-3e5c-4971-8d01-19ed94c076fa
5
@BeforeTest @Test(groups = { "Random BST", "Insertion" }) public void testRandomBSTInsertion() throws DuplicateKeyException { Integer count = 0; Reporter.log("[ ** Random BST Insertion ** ]\n"); try { timeKeeper = System.currentTimeMillis(); for (int i = 0; i < seed; i++) { randomBST.put(i, randomCha...
2f56c9d6-e807-43df-a63d-18a271f80fe4
9
*/ protected void getResponseBipolarDetail(String title) { if (title != null) { for (int i = 0; i < bipolarQuestionList.size(); i++) { if (bipolarQuestionList.get(i).getTitle().equals(title)) { if (!(bipolarQuestionList.get(i).getDescription() == null || bipolarQuestionList.get(i).getDescription(...
e25f2451-82d3-4af3-ac4d-da1137728c53
4
public Entry search_level(int slevel, String myid) { if (slevel > level) { return null; } if (slevel < 0) { // be defensive System.err.println("oops slevel<0 " + slevel); System.exit(1); } // go directly to right block: ArrayList<Entry> block = st.elementAt(level...
d9fb4369-9b57-4824-9719-b6f2f0b99986
3
private void start() { try { Connection connection; int i; int option; UI.printHeader(); System.out.println(connections.size() + " conexiones activas:"); System.out.println(""); for (i = 0; i < connections.size(); i++) { connection = connections.get(i); System.out.println((i + 1) + ") C...
51ed6a81-dc26-4cae-b02b-5c051f757178
1
private Connection initDBConnection() throws SQLException { try { Class.forName(CLASSNAME); con = DriverManager.getConnection(CONNECTIONSTRING); } catch (ClassNotFoundException e) { e.printStackTrace(); } return con; }
4d318388-10b8-4cd5-923d-b4cf001e6dba
5
public LinkedNode nthToLastElement(LinkedNode head, int elementToRemove){ //Can't remove negative element if(elementToRemove<0){ return head; } LinkedNode current = head; int size = 1; while(current.getNext()!=null){ current=current.getNext(); ...
12d5d76e-8730-4f66-89b7-71b9d20676c3
1
public static String addressFichier(String addresse, String str) { StringBuffer res = new StringBuffer(); for (int i = 0; i < addresse.length() - str.length(); i++) { res.append(addresse.charAt(i)); } return res.toString(); }
044dd24e-52b1-4db3-bf90-e66e0d4b2ee6
1
@RequestMapping(value = "/speaker-room-event-list/{speakerId}", method = RequestMethod.GET) @ResponseBody public RoomEventListResponse speakerRoomEventList( @PathVariable(value = "speakerId") final String speakerIdStr ) { Boolean success = true; String errorMessage = null; ...
67cb2821-20c1-4003-afdb-4077ff696ad3
3
public BeanLens(String fieldName, Class<A> theType) { for (Method m : theType.getMethods()) { if (m.getName().toLowerCase() .equals("get" + fieldName.toLowerCase())) { this.getMethod = m; } if (m.getName().toLowerCase() .equals("set" + fieldName.toLowerCase())) { this.setMethod = m; } ...
7e229292-4949-4605-be5c-52071b15344d
1
public static void main(String[] args) { InterfaceControlador ic; System.out.println("Controller object created"); try { ic = new Controller(); System.out.println("Binding controller " + ic); Naming.rebind("rmi://localhost/Controller", ic); ...
0b0e97cc-7f8d-4474-a272-9032f47cc368
8
public synchronized void publishLastSale(String product, Price p, int v) throws Exception { String thisClass = "publishers.LastSalePublisher#publishLastSale."; if (ExceptionHandler.checkString(product, thisClass) && ExceptionHandler.checkIntNegative(v, thisClass) && ExceptionHandler.chec...
2d0ac645-41d2-404a-9b68-098b8923ed52
4
@Override public void update(GameContainer container, int delta) throws SlickException { if (winner == null) { itemEffectHandler.processDelta(delta); players.forEach(p -> p.update(delta)); itemSpawnTimer += delta; if (itemSpawnTimer > TPBJGConfig.ITEM_SPAWN_TIME) { itemSpawnTimer ...
1d5a1d0e-676c-452e-b5a7-93c15de3377f
0
public void setAlgorythmType(String type){ algorythmType = type; }
3adf506f-1b37-4719-8d54-d622466841aa
2
public int getIndex(Weapon w) { for(int i = 0; i < this.getWeapons().length; i++) { if(this.getWeapons()[i] == w) { return i; } } return -1; }
16094527-ad28-4b14-90b6-8e48191cc53f
6
public PermutationIterator(List<T> list, int size){ outSize = size; totalSize = list.size(); index = new ArrayList<T>(totalSize); current = new ArrayList<Integer>(outSize); for(int i = 0; i < outSize; i++){ current.add(0); } map = new TreeMap<Integer, Integer>(); int i = 0; for(...
15f0e335-a884-448f-91bf-e805306de5a9
6
public static byte[] encrypt(byte[] data, byte[] key) { int lenght=0; byte[] padding = new byte[1]; int i; lenght = 8 - data.length % 8; padding = new byte[lenght]; padding[0] = (byte) 0x80; for (i = 1; i < lenght; i++) padding[i] = 0; byte[] tmp = new byte[data.length + lenght]; byte[] bloc = ...
078d4551-be7f-4cea-830d-c653e3fbbdd3
8
public static void writeMaze(PrintStream mazeStream, Set<Integer> knockdowns, int height, int width) { // draw maze except lower border for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { mazeStream.print("+"); // negative elements in knockdowns denote walls above ...
f347709b-9e14-4c46-be42-a8fb2c6e5a16
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Simulation other = (Simulation) obj; if (compute...
e1e7f9c0-5450-4549-8808-9763f53e16ef
8
public boolean exportSammellastschrift( List<DataLastschriftMandat> lastschriften, BeitragSammelLastschrift sl) { // Gibt an, ob bisher alle Sammellastschriften erfolgreich an Hibiscus // übergeben wurden boolean allSuccessful = true; SqlSession session = sqlSes...
516b931b-5961-4dc5-8af3-f1732ee5d099
4
@Override public void paint(Graphics g) { g.setColor(Color.BLACK); g.fillRect(0,0,getWidth(),getHeight()); Rectangle r = g.getClipBounds(); g.setColor(Color.WHITE); g.fillRect(r.x,0,KEYLENGTH,getHeight()); g.setColor(Color.BLUE); for (int y = 0, keyIndBase = 0; y < getHeight(); y += BARHEIGHT *...
b5ad5dbb-42f4-4127-9552-4076a9635a1d
7
private void writeNumber ( int side, int ln, long numb, boolean FF ) { long r = numb; byte[] g = new byte[ln]; for(int i=0, l=ln;l>0;l--) { if(side>0) r=(l==1? numb : numb>>((l-1)<<3) ); int b = (int)((FF && numb==-1) ? 0xff : (r & 0xff)); g[i++]=(byte)b; if(side==0) r>>=8; } try { fidx.write...
b399fcba-0e5f-4f38-856b-5f8a0b7311eb
4
public void putRunBits(int i, int len) throws IOException { for (int j = len - 1; j >= 0;) { if (bits_left != 0 || j < 8) { putBit(i); j--; } else { if (i == 0) out.write(0x00); else o...
dd4ec486-1ff3-4be5-a67b-7e1675c2d099
9
public static long projectEulerNumber43() { long sum = 0; long startNum = 1406357289; long endNum = 1406357289; for (long i = startNum; i <= endNum; i++) { if (!isPandigital(i)) { continue; } long d1 = i / 1000000000l; lo...
f4cadfa8-8979-4c92-9eea-43c19fc68803
7
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Get session object. HttpSession session = request.getSession(); // Attempt to get POJO stored inside session object. Video_27_POJO pojo = (Video_27_POJO)session.getAttribute("pojo"); ...
42c81f8e-8b11-4c52-b46c-b9f4bf60cf94
3
public String mahdollisetYhdistelmatToString(){ String s=""; ArrayList<Yhdistelma> y = mahdollisetYhdistelmat(); int ind=y.size(); for(int i=0; i<y.size(); i++){ s=s+(i+1)+" - "+y.get(i).getNimi()+": "+y.get(i).getPisteet()+"p"+"\n"; if(i==y.size()-1){ s=s+"---------------------yliviivaa--------------...
40d601eb-111d-4966-9e71-2bc19d0a55ca
7
public void add(Explorable e) throws ExplorationException { assert (e instanceof Conflict); Conflict c = (Conflict) e; /* * Relative ID should always be complete, it's an ID after all. * Therefore we throw an exception if it's too long. */ String relativeId = c.getRelativeId(); if (rel...
3d79378f-579b-4427-b811-5c40d0a6d2da
6
public int countBonusFromIngwer(GameBoard gb) throws Exception { int bonusCount = 0; try { bonusCount += getValue(gb, new Coordinates(1, 1)); bonusCount += getValue(gb, new Coordinates(boardSize, 1)); bonusCount += getValue(gb, new Coordinates(1, boardSize)); ...
ed0b0404-4d04-4325-924f-8dc2472dfe63
7
public static int addReverse(Node a, Node b, int carry, String work){ System.out.println("Work : " + work); if (a != null && b != null){ int digit = a.data + b.data + carry; int c = 0; if (digit >= 10){ digit = digit%10; } addReverse(a.next, b.next,c, Integer.toString(digit) + work); } if (a ...
ee92d2c1-7db7-4895-81da-b4c27b40a3b7
1
public void update() { mapX += velocityX; mapY += velocityY; velocityY -= 0.25f; if (pixelizeManager.checkForBlock(getCenterPoint()) != 0) { isDirty = true; } }
218486bf-d3c8-49d2-a84f-41ab23130fc9
2
public static List<Entreprise> selectEntreprise() throws SQLException { String query = null; List<Entreprise> entreprise = new ArrayList<Entreprise>(); ResultSet resultat; try { query = "SELECT * from ENTREPRISE order by ENTNOM"; PreparedStatem...
4d5b5ace-37ad-4e12-8f58-bbb7497d2371
3
private final static OSType determineOSType() { final String osName = System.getProperty("os.name"); if (osName.startsWith("Windows")) { return OSType.WINDOWS.setSubtype(osName.substring(8)); } else if (osName.startsWith("Unix") || osName.startsWith("Linux")) { return OSType.UNIX; } // } else if (osName...
c63a3499-9279-4585-9ef3-35977c991843
0
public float getVelocityY() { return dy; }
e374196e-43e8-4cbd-8da3-727d387b687d
9
public eState toContinue() { double relNorm = gNormLast / gNormInit; int size = values.size(); double newestVal = values.get(size - 1); double previousVal = (size >= 10 ? values.get(size - 10) : values.get(0)); double averageImprovement = (previousVal - newestVal) / size; // This i...
56ea57dc-be74-4c77-8795-8c17cc38c5d8
9
static final void method220(int i, int i_0_, float[] fs, int[] is, int i_1_, float[] fs_2_, int i_3_, int i_4_, int[] is_5_, int i_6_, int i_7_, int i_8_, int i_9_) { if (i_8_ == -5) { anInt221++; int i_10_ = i_9_ * i_1_ - -i_7_; int i_11_ = i * i_3_ + i_4_; int i_12_ = -i_0_ + i_1_; int i_13_ = -i_0_ ...
70612a13-c74d-4dea-8373-ac50b2585eb2
0
@Override public void windowClosed(WindowEvent e) { }
82f8b046-1e67-4cfe-82c8-c1fd63aab5bf
8
@Override public boolean equals(Object eql) { if (!(eql instanceof Parameters)) return false; // We are dealing with an Instance of Parameters: boolean areBlastParamsEqual = true; for (String blastDb : getBlastDbParameters().keySet()) { for (String iterKey : getParametersOfBlastDb(blastDb).keySet()) { ...
271241ae-51e1-47d0-aa18-856d24efd62b
6
protected int[] mapColumnsToProperties(ResultSetMetaData rsmd, PropertyDescriptor[] props) throws SQLException { int cols = rsmd.getColumnCount(); int[] columnToProperty = new int[cols + 1]; Arrays.fill(columnToProperty, PROPERTY_NOT_FOUND); for (int col = 1; col <= cols; c...
04a608e3-b69d-47a6-9339-a0048ec6a8f9
8
public void actionPerformed(ActionEvent arg0) { String command = arg0.getActionCommand(); System.out.println(command); String current = screen.getText(); current = current.replaceAll("\\s+", " "); if (current.contains("ERROR")) { current = ""; screen.setText(""); } if (command.e...
06f59608-f2ac-4fbc-8d5f-71960c2374ea
7
public static void randTest() { double labelCeil = 10.0; Double unLabel = new Double(1.0); double fracCon = 0.3; int numVertices = 10; int numLabels = 3; Random rand = new Random(1847860); HashMap<Integer,Double> ls = new HashMap<Integer,Double>(numLabels); for (int i=0; i < numLabels; ) { Integer ne...
4098a419-6bca-4af1-88f7-5ffb82a36aa2
1
public void setButtonGap(int gap) { if (this.buttonGap == gap) { return; } this.buttonGap = gap; installGUI(); }
3b382eee-ff81-4318-810d-14ee60df4d4f
4
public void unreadFrame() throws BitstreamException { if (wordpointer==-1 && bitindex==-1 && (framesize>0)) { try { source.unread(frame_bytes, 0, framesize); } catch (IOException ex) { throw newBitstreamException(STREAM_ERROR); } } }
090b45c6-bb96-4277-b35d-7a43f4438f7e
9
public boolean checkInterleave(int idx1, int idx2, int idx3) { if (idx1 == -1 && idx2 == -1 && idx3 == -1) return true; if (idx1 >= 0 && in1.charAt(idx1) == out.charAt(idx3) && checkInterleave(idx1-1, idx2, idx3-1)) return true; if (idx2 >= 0 ...
d303e4a0-e83f-429f-8907-3f400718cea7
4
public int maxProfit(int[] prices) { int profit =0; if(prices.length == 0) return 0; int up = prices[0]; int low = prices[0]; for (int i = 0; i < prices.length ;i++ ){ if(prices[i] > up){ up = prices[i]; profit = Math.max(u...
36c62edf-dec6-4a75-a21c-4b76de9e5f1b
1
public boolean method286(int arg0, int arg1, Entity entity, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10) { return entity == null || method287(arg0, arg7, arg10, arg8 - arg7 + 1, arg4 - arg10 + 1, arg5, arg1, arg6, entity, arg3, true, arg9, (byte) 0); }
8970ee1c-b654-498a-af82-15c18d7abe09
1
public ByteVector putLong(final long l) { int length = this.length; if (length + 8 > data.length) { enlarge(8); } byte[] data = this.data; int i = (int) (l >>> 32); data[length++] = (byte) (i >>> 24); data[length++] = (byte) (i >>> 16); data[length++] = (byte) (i >>> 8); data[length++] = (byte) i; ...
86912911-d24d-484c-81a4-7847319400e8
2
public String determineMatchWinner() { String winner = ""; if (wins == losses) { winner = "Tie"; } else if (wins > losses) { winner = "User"; } else { winner = "CPU"; } return winner; }
7ed72e17-642d-4440-81df-323e102048ab
3
@Override public void processWalks(final WalkArray walks, final int[] atVertices) throws RemoteException { try { pendingQueue.put(new WalkSubmission(walks, atVertices)); int pending = pendingQueue.size(); if (pending > 50 && pending % 20 == 0) { logger.inf...
f659a9d1-dd45-4c85-b286-64d29cfc3ce4
3
@Override public void objectReceived(Object o) { try { NetMessage n = NetMessage.parseFrom((byte[])o); System.out.println(n.getType().toString() + " message received"); switch (n.getType()) { case CHAT_MESSAGE: chatWindow.addMessage(n.getChatMessage()...
85ad316d-782c-4aa4-835e-d76c36a92041
0
public String getName() { return this.name; }
b8d24a0e-1dc5-4841-82de-fb8de7716dfa
0
@Basic @Column(name = "user_agent") public String getUserAgent() { return userAgent; }
b0228f7d-758d-4bec-820d-08e2cf497af9
5
public Object getAggregateColumnValue(String table, Column column, QUERY_TYPE aggregate) throws SQLException, NoValueException{ Object res = new Object(); Statement s = DBAccess.getConnection().createStatement(); String query = "SELECT " + aggregate + "(" + column.getColumnName() + ") FROM " + table +...
65bf4801-d779-4c46-afd9-09bafb043b06
2
private JsonObject readFiles() throws IOException { JsonObject json = new JsonObject(); Set<File> files = getsubFileList(this.config.getPath()); BufferedReader read = null; for(File file :files){ JsonObject fileData = new JsonObject(); read = new BufferedReader(new FileReader(file)); int i=...
5fb5464f-8d7f-477c-b2cf-09671ccbfa13
7
@Override public MOB determineMonster(MOB caster, int material) { final MOB victim=caster.getVictim(); final MOB newMOB=CMClass.getMOB("GenMOB"); int level=adjustedLevel(caster,0); if(level<1) level=1; newMOB.basePhyStats().setLevel(level); newMOB.basePhyStats().setAbility(13); newMOB.baseCharStats()...
ded5ef82-88f1-4a01-924b-a628d6892e29
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...
4cbfd5d2-c9f3-47ae-8350-76dc5c14f49b
3
public static String compressedToString(String str) { String strBuild=""; if(str.charAt(1) == '1') strBuild += "Ctrl + "; if(str.charAt(0) == '1') strBuild += "Shift + "; if(str.charAt(2) == '1') strBuild += "Alt + "; strBuild += KeyEvent.getKeyText(Integer.parseInt(str.substring(3))); return strBuild; }
c3d74787-4f16-45a8-99a2-ee4a8520842f
6
protected static byte[] decrypt(byte[] encryptedData, Algorithm algorithm, SecretKey secretKey, byte[] iv) throws JironException { Cipher cipher; try { cipher = Cipher.getInstance(algorithm.transformation); } catch (NoSuchAlgorithmException e) { throw new JironException("Encryption algorithm " + al...
24ca5e99-4935-4b8d-bb0d-4d7e7bae846a
9
/* */ public String attemptingToConnectNewAccount(String username, char[] password, char[] passwordConfirm) /* */ { /* 160 */ if (username.length() < 3) /* */ { /* 162 */ return "Your username must contain at least 3 characters."; /* */ } /* */ /* 165 */ if (password.lengt...
90996fd0-37d1-429e-8f79-3e6234ce1801
3
public Element insertChildren(int index, Collection<? extends Node> children) { Validate.notNull(children, "Children collection to be inserted must not be null."); int currentSize = childNodeSize(); if (index < 0) index += currentSize +1; // roll around Validate.isTrue(index >= 0 && inde...
779819a4-489b-405f-a325-1f3a436c2377
5
public static int findMagicIndex(int[] array, int i, int j){ //Since the array is sorted, we can perform a binary search in log(n) time //WHAT about if elements are not distinct? If elements are not distinct, this //algorithm will not work. Instead we must iterate through each element and search...
2dbc6708-27af-4303-8433-e65f34d07159
9
public void execute() throws MojoExecutionException, MojoFailureException { // Temp file File tempFile = null; try { this.getLog().info("Starting OpenCms Local Mojo..."); this.getLog().info( "OpenCms Zip File: " + this.getOpenCmsEnvironmentZipFile()); this.getLog().info( "Destory Environment...
f74e298e-c46d-44b0-ac5b-23bbba0207a5
5
protected static List<Card> getAllFlushCards(Set<Card> cardSet) { if (cardSet.size() < 5) { return null; } // Note that we could return more than 5 cards here. Map<Suit, List<Card>> suitMap = new HashMap<Suit, List<Card>>(); for (Card card : cardSet) { List<Card> flushLists = suitMap.get(car...
bb0565be-8edc-4b19-8b0f-1e637e2cdf76
1
public static int getShort(int num, int which) { if(which == 0){ num = num << 16; } num = num >>> 16; return num; }
9c5dd54f-fead-44cb-84aa-56bc6e54a3be
1
public static byte intToByte(int number){ return (byte) ((number<0?-number:number) & 0xff); }
2a8e2d34-a835-4e1f-9dfc-f7aadaaa25e5
4
@Override public void handleNotification(Object producer, String name, Object data) { if (name == TreeNotificationKeys.ROW_REMOVED) { for (TreeRow row : new TreeRowIterator((TreeRow[]) data)) { mSelectedRows.remove(row); if (row instanceof TreeContainerRow) { mOpenRows.remove(row); } if (mRow...
475db700-ec4a-4b14-b5cd-6ebc6ac494c5
4
private void leftMouseButtonClicked(int x, int y) { if (!isPaused && !gameOver) { if(this.currentPlayer!=null && this.currentSelectedBlock!=null){ setPlaceBlockFlag(true); } } }
71d2cdc8-7394-4ab5-ba9b-f06b24a53610
4
@Override public Class<?> loadClass(String name) throws ClassNotFoundException { Class clazz; try { clazz = getParent().loadClass(name); return clazz; } catch (ClassNotFoundException e) { } String classFileLocation = name.substring(name.lastIndexOf(".") + 1) + ".class"; Path p...
e11b329c-f414-44e9-a50c-c10913f7d03f
5
public void setLAN(Boolean x) { if(x!=null) { blLAN = x; } //Kill/Reset connection if(blLAN == true && conProt == null) { conProt = new RCEstablishConnection(true); conProt.setBase(me); conProt.setName(strName); } if(blLAN == false && conProt != null) { conProt.killCurrent(); conPro...
93b12dd1-c8cb-4962-aadf-4ccf5e64ac75
7
public GrupoVO[] consultar (GrupoVO grupo){ String query = "SELECT * FROM grupos WHERE"; Statement consulta = Conexion.getConexion().hacerConsulta(); boolean bandera = false; GrupoVO [] grupos = null; if(grupo.getEnAutorizado() != null){} if(grupo.getIdGrupo() != null){} if(grupo.getJefeGrupo(...
148bfd2b-afd2-48b3-97c2-94b6887db0e5
5
@Override public String toString() { String informacio = "[Mida: " + mida + ", num. fitxes jugador A: " + num_fitxes_a + ", " + "num. fitxes jugador B: " + num_fitxes_b + ", estat de les caselles:\n"; for ( EstatCasella[] fila : caselles ) { informacio = informacio + "\t"; for ( Est...
a5f0a2a5-0413-4d14-9498-efb7f5e66006
6
public static void main(String[] args){ try { String name = "main2"; int num_rand; ArrayList<JvnObjectImpl> array = new ArrayList<JvnObjectImpl>(); MonObjet o1 = new MonObjet("objet2"); JvnObjectImpl shared_object_2 = (JvnObjectImpl) JvnServerImpl.jvnGetServer().jvnCreateObject(o1); JvnServerImpl.jv...
a0e2b163-2657-4c19-963f-6bd4041a6ef1
5
private void waitSockClose(Sock sock) { boolean loop = true; Timing new_timer = new Timing(); while (loop) { if ((sock.getSocket() == null && sock.getIn() == null && sock.getOut() == null) || new_timer.getTime() > timeout) { loop = false; } } ...
f956adb8-c83b-494d-b459-415614a52111
5
private Model generateTerrain(String heightMap) { BufferedImage image = null; try { image = ImageIO.read(new File("assets/terrain/" + heightMap + ".png")); } catch (IOException e) { e.printStackTrace(); } int vertexCount = image.getHeight(); heigh...
78d7a131-f59d-4a69-a2cf-90a1a090ff5b
3
@Override public void actionPerformed(ActionEvent e) { OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(); OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode()); if (textArea == null) { return; } Node node = textArea.n...
ff65b5d7-119a-49bc-bf88-e3203f32c373
4
@Override public void messageHandler(String messageName, Object messagePayload) { if (messagePayload != null) { System.out.println("MSG: received by model: "+messageName+" | "+messagePayload.toString()); } else { System.out.println("MSG: received by model: "+messageName+" | No data sent"); } ...
d88ea139-eb14-4394-9fa3-d1aff74783c6
0
public void setId(Integer id) { this.id = id; }
6805ccbd-9952-406f-99af-31562ad5a8d5
4
protected Tile pickSample() { final int range = World.SECTOR_SIZE * 2 ; Tile picked = null ; float bestRating = 0 ; for (int n = 10 ; n-- > 0 ;) { final Tile s = Spacing.pickRandomTile(this, range, world) ; if (s == null || s.pathType() != Tile.PATH_CLEAR) continue ; float rating = s.h...
2bcb022f-a965-43b4-b5e8-6bca417fd997
6
public void tick(){ tickCount++; for(cell[] p1: bitMap.Map){ // foreach grade in grades for(cell q1: p1){ try{ q1.Resident.ready = 1; }catch(NullPointerException e ){ } }} for(cell[] p: bitMap.Map){ // foreach grade in grades for(cell q: p){ try{ q.Resident.ti...
8389edac-e3a0-4e05-b67c-1e5407adca5c
8
public static int countNeighbours(long world, int col, int row){ int total = 0; total = getCell(world, col-1, row-1) ? total + 1 : total; total = getCell(world, col , row-1) ? total + 1 : total; total = getCell(world, col+1, row-1) ? total + 1 : total; total = getCell(world, col-1, row ) ? total + 1 : total...
2d21b322-7791-478f-b14e-065a60991340
0
public static void main(String[] args) { split(" "); // Doesn't have to contain regex chars split("\\W+"); // Non-word characters split("n\\W+"); // 'n' followed by non-word characters }
92fdc96c-7d51-422a-a658-d0ed82a5af41
6
private String getFile(String link) { String download = null; try { // Open a connection to the page URL url = new URL(link); URLConnection urlConn = url.openConnection(); InputStreamReader inStream = new InputStreamReader(urlConn.getInputStrea...
3cd712c9-6e42-47fa-b99d-07fe7ddf9ef8
4
public static List<Archive> getPlugins() { List<Archive> plugins = new ArrayList<Archive>(); for (File file : DIRECTORIES[0].listFiles()) { String name = file.getName(); if (name.endsWith(".class")) plugins.add(new ClassFile(file)); else if (name.endsWith(".jar")) try { plugins.add(new JavaArc...
b5719893-5a72-49a3-a2ef-f7e1fceb0cdf
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...
45f6e88d-d74d-40b8-b259-1ba3a4a0d005
5
public static void borderize(MapView mv, Gob player, Coord sz, Coord border) { if (Config.noborders) { return; } Coord mc = mv.mc; Coord oc = m2s(mc).inv(); int bt = -((sz.y / 2) - border.y); int bb = (sz.y / 2) - border.y; int bl = -((sz.x / 2) - border.x); int br = (sz.x / 2) - border....
1143b1a4-1fe5-4964-9ee9-c7f168cef825
6
public SourceType getSourceType(Stmt sCallSite, InterproceduralCFG<Unit, SootMethod> cfg) { assert cfg != null; assert cfg instanceof BiDiInterproceduralCFG; // This might be a normal source method if (super.isSource(sCallSite, cfg)) return SourceType.MethodCall; // This call might read out sensitive da...
f8923421-a754-4a4b-926a-721e3bf146f5
8
public Object down(Event evt) { switch(evt.getType()) { case Event.VIEW_CHANGE: View view=evt.getArg(); handleView(view); break; case Event.SET_LOCAL_ADDRESS: local_addr=evt.getArg(); break; case ...
7182b4d0-df9a-4d6f-a7e0-b04ef0c4d653
5
public void checkCustomUp(Node node) { this.up = -1; // reset value to -1 // Prevent out of bounds (negative coordinates) if((node.getX()-2) >= 0) { if(checkWall(new Node( (node.getX()-2), (node.getY()) ))) { if(this.closedNodes.size()==0) this.up = 1; else { for(int i = 0; i < this.closedNod...
2cfb9d57-9038-4906-9ec3-09c387603421
6
@Override public boolean equals(Object other){ if(other == null || other.getClass() != getClass()) return false; if(other == this) return true; Movie otherMovie = (Movie)other; if(name.equals(otherMovie.name) && director.equals(otherMovie.director) && rating =...
e506fe94-7b1b-427f-ab24-be6f1493ade7
1
public int resend(int clientId, int originalMessageId, String message) throws CouldNotSendPacketException { synchronized(CONNECTION_LOCK) { Packet packet = Packet.createApplicationPacket(clientId, message); packet.setDuplicateSequenceNumber(originalMessageId); //if the client isn't connected then throw an e...
00c7e4ef-c571-4888-b7ca-3b03256b40ac
3
public void start() throws TooManyListenersException { if (isStarted()) { throw new TooManyListenersException(); } setStarted(true); Thread engine = new Thread() { @Override public void run() { Thread.currentThread().setPriority(Thread....