method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
93d347b1-412c-4498-9021-54d87b5d1c98
5
@Override public int mover() { if(salud > 0){ Partida.Pantalla pantalla = Partida.getPantalla(); //Si se sale por los bordes rebotará short aux = 1; if (x + xv < pantalla.getX()){ //izquierda xv = aux; } else if ...
79fd14c9-d64f-4e32-8043-86ffbb7b89b1
1
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try { searchDepthField.commitEdit(); } catch (ParseException ex) { Logger.getLogger(SearchOptionsFrame.class.getName()).log(Level.SEVERE, null, ex); } Number num = (Number) searchDepthField.getV...
4254bf45-02cc-4b22-b22e-a5add9037e0d
5
public int getRed(int row, int col) { if (row >=0 && row < rows && col >= 0 && col < columns && grid[row][col] != null) return grid[row][col].getRed(); else return defaultColor.getRed(); }
2265d6b9-70aa-4e70-a2ac-7de115d269a6
5
@GET @Path("/geojson") @Produces( MediaType.APPLICATION_JSON ) public OriginalJsonResponse getGeoJson() { URL url; HttpURLConnection conn; try { // alternativa: http://bicimad.herokuapp.com/bicimad.json url = new URL("http://5.56.56.139:16080/functions/get_all_estaciones.php"); conn = (HttpURLConnect...
e36e7f5e-5abc-42ec-8499-53691ad82839
0
public void setjLabel2(JLabel jLabel2) { this.jLabel2 = jLabel2; }
c0a36de6-7e7f-4292-92ee-6be1dedb202b
8
private void start(String props, InetAddress bind_addr, int port, int min_threads, int max_threads, long rpc_timeout, long caching_time, boolean migrate_data, boolean use_l1_cache, int l1_max_entries, long l1_reaping_interval, int l2_max_entries, long...
19e81cba-eb56-4e5a-aa15-3f1e7aa4204b
8
public ChannelBuffer encode(ChannelBuffer channelBuffer) throws Exception { int length = channelBuffer.readableBytes(); //System.out.println("message length :"+length); ChannelBuffer header = ChannelBuffers.buffer(headLength); //System.out.println(channelBuffer.order()); switch (headLength) { case 1:...
540b5b76-594f-4e65-ac5f-6abd4bcb306f
8
@Override public void getPartialMatches(Set<String> partialMatches, char[] searchArr, int searchArrOffset) { // there are existing children. binary search them to see if there are any with // matching prefixes int lower = 0; int upper = children.length - 1; char keyPrefixFirst = searchArr[searchAr...
743d93d1-59e4-4e3c-a588-81c31926f712
3
protected void processGISResourceARList(Sim_event ev) { if (ev == null || ev.get_data() == null) { return; } Integer id = (Integer) ev.get_data(); int tag = AbstractGIS.GIS_INQUIRY_RESOURCE_AR_RESULT; /***** // Debug info System.out.println(super.get_n...
bde728ea-1c3d-4dbd-a56c-37fd31596b0b
0
TrackerService(String version, ConcurrentMap<String, TrackedTorrent> torrents) { this.version = version; this.torrents = torrents; }
494b4ac7-afda-4a37-ad17-9bd01edd56f7
4
public static void main(String[] args) { long start = System.nanoTime(); primes.add(2); boolean found = false; int odd = 3; while (!found) { if (isPrime(odd)) { primes.add(odd); } else if (!isPrime(odd) && !isGoldbachs(odd)) { found = true; } odd += 2; } System.out.println(odd - 2); ...
7d510e66-85b7-4d92-a228-2c02ad388621
0
public boolean getLeft(){ return moveLeft; }
c2347fe7-67be-476e-a2d5-aec83ed3e893
8
Class280(NativeToolkit var_ha_Sub3) { anInt3626 = 0; aClass318_Sub9_Sub2ArrayArray3632 = new Class318_Sub9_Sub2[1600][64]; anIntArray3631 = new int[8191]; aClass318_Sub9_Sub2ArrayArray3642 = new Class318_Sub9_Sub2[64][768]; anIntArray3636 = new int[1600]; aClass130_3637 = (var_ha_Sub3.method3812 (0, ...
3c02506a-fccd-4e8e-85b8-78aea1a23a4b
0
@Override protected void onTextMessage(CharBuffer text) throws IOException { getWsOutbound().writeTextMessage(text); }
9b54717d-d794-4c6d-bf34-d5fdf8f5be52
7
private void musterShip(MouseEvent e){ Territory water = gameOfThronesComponent.getTerritory(e.getX(),e.getY()); if(water instanceof Water &&((Water) water).canRecruitShipHere(playerChoices.getRelatedTerr()) && model.checkSupplyLimits(getSeatNum(),water)){ //recruitement water.setFamily(playerChoices.getRelat...
2e55cf73-3a58-42c2-bd65-75c31fc6b3f0
5
public void addConnection(PlayerMP player, Packet00Login packet) { boolean alreadyConnected = false; for (PlayerMP p : this.connectedPlayers) { if (player.getUsername().equalsIgnoreCase(p.getUsername())) { if (p.ipAddress == null) { p.ipAddress = player.ip...
6a544fc5-18b1-412c-843a-e2cafaf79153
5
public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("day")) { if (popup.isVisible()) { dateSelected = true; popup.setVisible(false); if (((Integer) evt.getNewValue()).intValue() > 0) { setDate(jcal...
764e5546-d1b4-40ca-9648-8ba09fc1aded
1
public void run() { while (true) { HW.waitCustomerButton(); int qNum = mon.customerArrived(); HW.printTicket(qNum); } }
d0d74507-4269-47c2-935a-5ffa3e3ee477
4
@Override public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) { log(event); Entity damager = event.getDamager(); if(damager instanceof Player && !teamHandler.checkIfPlayerIsInRespawn((Player)damager)) { event.setCancelled(true); return; } Entity entity = event.getEntity(); if(en...
0318e130-1a2d-4d46-b1de-9142f14bb4a0
3
public static void startMatch(){ matchPlaying = true; match.setState(MatchState.PLAYING); Bukkit.getScheduler().cancelTask(taskToCancel); taskToCancel = Bukkit.getScheduler().scheduleSyncRepeatingTask(Bukkit.getPluginManager().getPlugin("COB"), new Runnable() { int x = 0; int numberOfMaxTNTs = 4; @Over...
dce483aa-d653-44ca-abae-4dfbf47742b0
0
@Override public void sendMessage(String msg) { chatCore.sendMessage(msg); }
33854742-2ae0-4f2b-8708-f1901631b5a4
3
public boolean removeCard(Card card) throws Exception { for (int i = 0; i < cards.size(); ++i) { if (card.sign == cards.get(i).sign && card.value == cards.get(i).value) { cards.remove(i); return true; } } throw new Exception("Card not in deck"); }
ae9b9568-45e8-4b16-a941-2db46df5c9a2
3
public static void addNode(Node n){ nodes.addNode(n); Global.customGlobal.nodeAddedEvent(n); if(Global.isGuiMode){ try { GraphPanel gp = Main.getGuiRuntime().getGUI().getGraphPanel(); if(gp != null){ //force the graph panel to redraw on next paint (do not call paintNow, because this draws the pane...
2ecdcb24-39b5-4822-9635-54c53b622774
6
public void complExpRelacional() { //ok //<compl_exp_rel> ::= <op_relacional> <exp_aritmetica> | <op_rel_igualdade> <termo_igualdade> //<op_relacional> ::= “<=” | “>=” | “<” | “>” //<op_rel_igualdade> ::= “!=” | “==” // if (!acabouListaTokens()) { // nextToken(); Sys...
7c042796-8961-43e8-a005-17a27182a5a5
1
public void fireUndoQueueEvent(Document doc, int type) { undoEvent.setDocument(doc); undoEvent.setType(type); for (int i = 0, limit = undoQueueListeners.size(); i < limit; i++) { ((UndoQueueListener) undoQueueListeners.get(i)).undo(undoEvent); } // Cleanup undoEvent.setDocument(null); }
fa62b543-d665-4141-958b-3fe8ac514907
7
private void saveHasOne(Object obj, String column, Map<String, Object> primaryKey) { PreparedStatement stmt = null; Connection connection = null; try { PropertyDescriptor[] pd = handler.getPropertyDescriptors(obj .getClass()); StringBuilder sb = new StringBuilder(); StringBuilder values = new S...
5adc768f-0d49-464b-bd4a-d82e4fc92398
6
public void isMonocromo() { monocromo = true; int red, green, blue; for (int i = 0; i < imagen.getWidth(); i++) { for (int j = 0; j < imagen.getHeight(); j++) { red = getRedPoint(i, j); green = getGreenPoint(i, j); blue = getBluePoint(i, j); if ((red != green) || (red != blue) || (green != b...
3fece477-e936-4aa8-8974-d686c5de36bd
4
private GenericTreeNode<T> auxiliaryFind(GenericTreeNode<T> currentNode, T dataToFind) { GenericTreeNode<T> returnNode = null; int i = 0; if (currentNode.getData().equals(dataToFind)) { returnNode = currentNode; } else if (currentNode.hasChildren()) { i = 0; while (returnNode == null && i < curr...
56adadea-7366-47ca-9d7c-6916ba8f4774
5
public void run() { if (bot.hasPrivateMessage()) { message = bot.getPrivateMessage(); } if (message.startsWith("~login")) { tokenize(false, 6, message); try { encryptor = MD5.getInstance(); users.load(new FileInputStream("conf...
d350c32a-ebb0-4578-8032-be72742241a7
5
public static String makeValidConstantName(String candidateName) { String answer = candidateName; for (int i = 0; i < answer.length(); i++) { char c = answer.charAt(i); if (Character.isLetterOrDigit(c) || c == '-' || c == '_' || c == '?') continue; StringBuffer answerBuf = new StringBu...
04f6a219-7b7c-4e5d-9ab4-feff4e2fcd5d
5
protected void generateEnvelope(){ audioData = new byte[samples]; double t=0; int i=0; double amp=0; for(; i<samples; i++){ //attack if(DEBUG&&i%50==0) System.out.println(t+" : time amplitude base:"+ amp); amp=generateAmplitude(t,amp); if(DEBUG&&i%50==0) System.out.println("New Amplitu...
82d678e9-91c0-4292-9b28-121c9e141c28
0
public void removeItem(int id){ inv[id].type = 0; }
5c2cde9e-c858-46cf-8566-6f401e758490
5
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; ...
9b34eb1b-0f25-4a29-b498-6ad1cafe508c
6
private static List<Integer> findPoss(Board b, int x, int y) { List<Integer> list = new ArrayList<Integer>(); for (int i = 1; i <= 9; i++) { list.add(i); } for (int i : getRow(b, y)) { list.remove(list.indexOf(i)); } for (int i : getColumn(b, x)) { if (list.contains(i)) list.remove(list.indexO...
bcb4246f-5503-444c-a987-6576266d3559
0
public String getKey() { return key; }
edc94a92-5f24-45cd-9489-06e34e01c686
1
public void addCodeToHistory() { if(!recentCodes.contains(getCode())) { recentCodes.add(getCode()); codeBox.setModel(codeBoxModel); } }
dc5cc82d-661b-43b0-be6f-6915e772c28d
2
private void setTimerSpawnEnemy() { switch (lvl) { case 1: timerSpawnEnemy = new CountdownTimer(1000, 0); break; case 2: timerSpawnEnemy = new CountdownTimer(1000, 0); break; default: break; } }
e82417db-413b-47f0-9cdc-8ac1fd38877b
5
public Command getCommand() { String inputLine = ""; // holds the full input line String command = null; // holds the first word of the input line, if any String[] parameter = null; // holds the second word of the input line, if any // print out the prompt System.out.print("> ...
41426f9c-681f-4214-a472-f96f13c3100c
8
public boolean tileMatch(int t1an, int t2an, int t1sp, int t2sp, String t1c, String t2c, int invoker) { //tileMatch(getT1_array_num(), getT2_array_num(), getT1_slider_position(), getT2_slider_position(), getT1_character(), getT2_character(), 1); int tilePairs = jslideMatchPairs.getValue(); ...
8e5ced66-23f3-4364-bf29-1b9e399d4d37
5
private String invert(String path) { String invertedPath = ""; for (int i = path.length() - 1; i >= 0; i--) { char symbol = path.charAt(i); if (symbol == EDirection.UP.getSymbol()) { invertedPath += EDirection.DOWN.getSymbol(); } else if (symbol == E...
f170569b-f882-4c80-98ca-88ee8e217ec8
2
public static void tryInit(ServletContext sc) { if (OK) { return; } final String fmt = "/index/uliss18_%s"; int i = 0; streams = new ArrayList<>(); InputStream is = sc.getResourceAsStream(String.format(fmt, i)); while (is != null) { streams...
8934b35b-9f4a-4a8c-9869-ebca64d82a81
4
private void initMenuBar(){ menu = new JMenuBar(); menu.setSize(frame.getWidth(), 25); JMenu menuFile = new JMenu("File"); ImageIcon openIcon = new ImageIcon(Main.icoPath + "folder_open_icon.png"); JMenuItem itemOpen = new JMenuItem("Open new dictionary ",openIcon); it...
0f2869d0-5f40-4781-ac17-805d4900d84e
0
public void setDashboardData(RODashboardData newDashboardData) { dashboardData = newDashboardData; }
bd40b606-f17b-46ba-9727-56be8b7693cc
8
@Override public boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking,tickID)) return false; if(!(affected instanceof Room)) return true; final Room R=(Room)affected; if((invoker()!=null)&&(canBeUninvoked())) { if(!R.isInhabitant(invoker())) unInvoke(); return false; } f...
e947a572-cc78-4034-a636-c6f600cdda11
5
public void parseJobSites(boolean includeEmailAddresses){ if (!mWorkerQueue.isEmpty()) { final Observer o = new Observer(); o.registerObserver(this); for (final AbstractJobSite site : mWorkerQueue) { final JobParser jobParser = new JobParser(site, o); ...
a07a4184-57d4-4148-8bf6-25eaebc072a4
1
public void setSound(String s, boolean l) { stopSound(); soundClip = new SoundClip(s); if (l) { soundClip.setLooping(true); } }
a34286e8-d985-442e-93ff-853866821c8c
8
private void editPlaceOrRoom(Appointment edit) { if (edit.getPlace() != null){ System.out.println("The appointment will currently take place at the place of " + edit.getPlace()); }else System.out.println("The appointment will currently take place in the room named " + Room.getByID(edit.getRoomId()).getRoomNumber...
86dee706-055c-4dcf-935a-b940a23b0706
4
public ChessController() { try { // Set cross-platform Java L&F (also called "Metal") UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (UnsupportedLookAndFeelException e) { // handle exception } catch (ClassNotFoundExcepti...
41bb7bcf-661b-44c7-9769-2fabd608520f
1
public static void toggleMoveableText(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree); toggleMoveableForSingleNode(currentNode, undoable); if (!undoable.isEmpty()) { undoable.setName("Toggle Moveability for Node"...
d567bcb3-1348-4a2c-943d-85f4db74e1a2
3
public String getExtension(File f) { if (f != null) { String filename = f.getName(); int i = filename.lastIndexOf('.'); if (i > 0 && i < filename.length() - 1) { return filename.substring(i + 1).toLowerCase(); }; } return null; ...
d387765f-7643-41ed-9863-0afff52b7136
3
public <T> List<T> getCapabilities( CapabilityName<T> name ) { if( graph == null ) { return Collections.emptyList(); } List<T> result = new ArrayList<>(); for( GraphItem item : graph.getItems() ) { T capability = item.getCapability( name ); if( capability != null ) { result.add( capability ); } ...
6172dbcc-470c-447e-93e7-08bf370796fb
6
public static Collection<Coin> exchange( Coin orig) { // 1円は両替不可 if ( orig.equals( oneYenCoin())) { return Arrays.asList( orig); } final Coin upperBounds = orig; // origよりも安いけれど、金額の高い順にコインを1種類ずつ保持 ImmutableSortedSet<Coin> coinSet = ImmutableSortedSet.copyOf( /...
14444e6e-4513-4e20-8836-9f8d41eb2735
8
public void run(){ if(! hasStarted()){ videoRefIdName = getFirstPropertyValue("video-reference-id-prop"); batchUsername = getFirstPropertyValue("batch-username"); batchPassword = getFirstPropertyValue("batch-password"); publisherId = getFirstPropertyValue("publisher-id"); preparer = getF...
9c154c3f-bb96-4919-b383-49adc309c83d
3
private boolean isAlphaNum7BitString(String string) { for (int i = 0; i < string.length(); ++i) { final char c = string.charAt(i); if (c >= 127 || !Character.isLetterOrDigit(c)) { return false; } } return true; }
2b0a2a2b-9677-4141-8080-168550be94d5
9
private static void addResources(int i, int j, int chance, Texture tex){ if(Math.floor(Math.random()*chance)==1){ Main.tiles[i][j].resources.add(new Resource(tex, ResourceLocation.SW)); } if(Math.floor(Math.random()*chance)==1){ Main.tiles[i][j].resources.add(new Resource(tex, ResourceLocation.SE)); } i...
de85121f-16f6-45e0-b0d3-754da84d3c5e
7
private int index(Vector3d v) { Vector3d floor = v.floor(); double x = floor.x(); double y = floor.y(); double z = floor.z(); if (x == sx && y == sy && z == sz) { return -1; } if (size < epsilon) { return -1; } int index = 0; if (x > sx) { index |= X_FLAG; } if (y > sy) { ind...
f04104d1-2bf3-44b5-8dc6-89594f5fbeeb
5
@Override public void relocate(Car fCar) { PathIterator p = fCurve.getPathIterator(null); FlatteningPathIterator f = new FlatteningPathIterator(p, reduceCarSpeed(fCar.getSpeed())); Point2D nearestPoint = null; double distance = 1000; while (!f.isDone()) { float[] pts = new float[6]; switch (f.curren...
06330a14-29f2-4adb-97cc-cdbfc8ccf27b
9
@Override public ExecutionContext run(ExecutionContext context) throws InterpretationException { Value val = ((AbsValueNode) this.getChildAt(0)).evaluate(context); if (val.getType() == VariableType.STRING) { if(val.toString().toUpperCase().equals("BLACK")) UserInterface.dw.setCu...
0d518f64-386c-41c0-ac1d-52948e2b0c76
3
static int side(int r, int c) { int x = c, y = r, z = n - x - y; int s = (x == 0) ? L : 0; s |= (y == 0) ? R : 0; s |= (z == 0) ? D : 0; return s; }
d326fc7c-b61d-4346-aa21-aba43ab9bdf3
5
public CtClass getDeclaringClass() throws NotFoundException { ClassFile cf = getClassFile2(); InnerClassesAttribute ica = (InnerClassesAttribute)cf.getAttribute( InnerClassesAttribute.tag); if (ica == null) return null; String ...
9c489bbb-2945-44bd-8641-27005c5cf1fe
8
private void viewScreen(String action, boolean updated, HttpSession session, Connection database, HttpServletRequest request, HttpServletResponse response, Pr...
54e04679-c3f9-4bb6-a889-7477f046918c
2
public void draw (JEditorPane editor) { StringBuffer buf = new StringBuffer (); String name = toString (); editor.setContentType ("text/html"); buf.append ("<html>\n<head><title>"); buf.append (name); buf.append ( "</title></head>\n<body><font size=+1><b>"); buf.append (folder.i...
aaa2e142-d9f8-4ba9-b21b-871bd46751c3
4
public static void main(String args[]) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { //Altera o tipo de Designer do software para Ninbus for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { ...
d3a27c84-fe31-4053-972c-d8366082cfca
7
public static Message parse(String message) { switch(Message.parseType(message)) { case ID_REQUEST: return new IdRequestMessage().decode(message); case ID_RESPONSE: return new IdResponseMessage().decode(message); case SPAWN: return new SpawnMessage().decode(message); case DESPAWN: return n...
7402d254-f4a8-4cd8-8eb7-a77c0e8a8ad9
4
private int readCfaslOpcode() throws IOException { if (trace == API_TRACE_DETAILED) { debugNote("Reading CFASL opcode."); } int cfaslOpcode = read(); if (trace == API_TRACE_DETAILED) { debugNote("Read CFASL opcode: " + cfaslOpcode); } if (cfaslOpcode == CFASL_EXTERNALIZATION) { ...
bb2beb47-224f-46cf-95cf-f1068cfa7812
2
public void setReject(Configuration configuration) { ConfigurationButton button = (ConfigurationButton) configurationToButtonMap .get(configuration); if (button == null) return; if (button.state == ConfigurationButton.NORMAL) button.setState(ConfigurationButton.REJECT); button.doClick(); }
0b0fb15d-c136-4e2d-9508-e40fa1c83efb
8
@Override public boolean remove(String constraint) { // remove all locations and fingerprints for the map, then remove map String mapCnst = (constraint != null && constraint.length() > 0) ? constraint : "1=1"; String locationCnst = HomeFactory.getLocationHome().getTableIdCol() + " IN (SELECT " + HomeFactory.getL...
7058f536-11f0-4ea6-b4a4-11f4de1d0563
0
public Strategy getStrategy() { return strategy; }
e725326e-4ff8-418d-8a74-f1d03944b029
4
public void actionGuardarFoto(){ String path = FacesContext.getCurrentInstance().getExternalContext().getRealPath("/resources/images"); String archivo = path + "nombreImagenEstatica.jpg"; try { OutputStream outStream = new FileOutputStream(new File(...
881e91d9-1279-445b-90e1-52c3fc6b95ca
2
protected String concatEmail(Map.Entry<String, String> entry) { String email = entry.getKey(), name = entry.getValue(); if (name == null || name.isEmpty()) return email; return String.format("\"%s\" <%s>", name, email); }
8ef7dce8-b103-421f-a9e2-d75704a73eda
9
public int assessment(Board b) { int contZero = 0; int val = Integer.MIN_VALUE; int codI = 0; int codJ = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if(this.board.get(i, j)==0){contZero++;} if(val < this.board.get(i, j)){ val = this.board.get(i, j); codI = i; codJ = j; //...
8666caf8-0f6c-426c-9e32-42765806b601
4
public void render(GUIContext container, Graphics g) { if (NORMAL_FONT == null) { NORMAL_FONT = g.getFont(); } renderBackground(container, g); renderButtons(container, g); renderStats(container, g); for (Dialog dialog : dialogs) { dialog.render(container, g); } if (tooltip != null) { tooltip.re...
b57691ab-ce60-4542-9ba1-6c77c26aa30a
4
public void paint(Graphics g) { int size = this.getHeight(); int width = size / drawingSize; int height = size / drawingSize; for (int x = 0; x < drawingSize; x++) { for (int y = 0; y < drawingSize; y++) { // draw color if (drawing[x][y] == 0)...
4c643d8e-0d56-4842-a45e-cb87f333df63
8
public static BufferedImage mergeEdgeImages (BufferedImage img1, BufferedImage img2, BufferedImage img3, BufferedImage img4) { int width = img1.getWidth(); int height = img1.getHeight(); BufferedImage edgeImage = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY); for(int x = ...
cb00e8a1-68f5-4dde-977a-894de9ba850b
9
private void nymOfferClick() { try { String serverID = "ALL"; String nymID = "ALL"; if (serverMap != null && serverMap.size() > 0 && jComboBox5.getSelectedIndex() > -1) { serverID = ((String[]) serverMap.get((Integer) jComboBox5.getSelectedIndex()))[1]; ...
b3a78855-b6a4-4f0a-b66d-f4dbab0129c8
6
public ListNode detectCycle(ListNode head) { if (head == null) { return null; } ListNode fast = head; ListNode slow = head; boolean flag = false; while (fast.next != null && fast.next.next != null) { fast = fast.next.next; slow = slow.next; if (slow == fast) { flag = true; break; } ...
ec370bbc-ba15-4a58-a2d6-f7b42a8aa630
8
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
ab749468-08f8-4950-8c33-a14121febbcd
1
public static String getString(String key) { try { return RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException e) { return '!' + key + '!'; } }
6cf27a89-1a8f-40c8-8b7a-1231b17ca9d5
8
OpenProjFrame(final ConnectMethods list, final String login) { setTitle("Choose project..."); this.setList(list); this.setLogin(login); opf = this; Toolkit kit = Toolkit.getDefaultToolkit(); Dimension screen = kit.getScreenSize(); scr_w = screen.width; scr_h = screen.height; this.setLocation(scr_w...
dd980e18-7849-4059-8a01-b752ca17a7cc
2
@Override public void init() { setUsername(plugin.getConfig().getString("database.mysql.username")); setPassword(plugin.getConfig().getString("database.mysql.password")); setDatabase(plugin.getConfig().getString("database.mysql.database")); setIP(plugin.getConfig().getString("database.mysql.ip")); setPort(pl...
e660d982-8c7d-4bd9-a794-4d3995cb72c9
2
public void appliedVoltage(double voltage, double voltageError){ this.appliedVoltage = new Complex(voltage, 0.0D); this.appliedVoltageSet = true; this.appliedVoltage = new Complex(voltageError, 0.0D); this.voltageErrorSet = true; if(this.referenceSet && this.frequenciesSet)this.c...
6bb8493d-36a7-4c6f-8905-06d75e198688
7
public ArrayList<Meld> getBruteForceMove(Hand hand, int playerNum) throws Exception{ ArrayList<Meld> melds; ArrayList<Tile> originalTiles, usedTiles; Hand allTiles; // add all tiles on the board and in your hand to one set originalTiles = new ArrayList<Tile>(); originalTiles.addAll(hand.getTiles()); fo...
02581c02-7202-48c4-bfba-8814c099eecd
2
private void loadFromFile() { if (!configExists()) return; // Exit if file doesn't exist ConfigManager o = null; try { FileInputStream fileIn = new FileInputStream(CONFIG_FILE); ObjectInputStream in = new ObjectInputStream(fileIn); o = (ConfigManager) in.readObject(); in.close(); fileIn.close();...
d628497b-1e15-4147-8761-027d43a138ef
4
public Position findPlayer(Integer PlayerID) { for (int i = 0; i < 7; i++) { for (int j = 0; j < 7; j++) { Pin pinsOnCard = getCard(i, j).getPin(); for (Integer pin : pinsOnCard.getPlayerID()) { if (pin == PlayerID) { return new Position(i, j); } } } } // Pin nicht gefunden re...
37e2b383-cb01-4ae5-bc11-053dee2d2fe9
6
private int compareToLastTerm(int fieldNumber, byte[] termBytes, int termBytesLength) { if (lastFieldNumber != fieldNumber) { final int cmp = fieldInfos.fieldName(lastFieldNumber).compareTo(fieldInfos.fieldName(fieldNumber)); // If there is a field named "" (empty string) then we // will get 0 on...
0e752705-cd72-46f0-8d83-f7bda6b4db73
7
public void findShortestPath(){ for(int i = 0; i < locCount; i++){ for(int j = 0; j < locCount; j++){ shortestPath[i][j] = matrix[i][j]; } } for(int j = 0; j < locCount; j++){ shortestPath[j][j] = 0; } for(int k=0;k<locCount;k++){ for(int i=0;i<locCount;i++){ for(int j=0;j<locC...
f5ca9dcc-a607-4342-8226-0469cc1b63cf
7
private static void initDiagnostics() { String dest; try { dest = System.getProperty(DIAGNOSTICS_DEST_PROPERTY); if (dest == null) { return; } } catch(SecurityException ex) { // We must be running in some very secure environment. // We just hav...
74606763-d87f-43f5-bed2-33c0b94d81ac
4
public static void main(String[] args) { String path = DEFAULT_FILE; int positionDepart = 1; int positionArrivee = 0; if (args.length != 3) { System.err.println(USAGE + "\n\n" + "Vous n'avez pas spécifié de ficher ou vous n'avez pas spécifié la position" +...
ed74bddb-b387-4180-89eb-9a9c0dcd0a1e
1
private static boolean isLowerCaseLetter(char arg0) { return arg0 >= 'a' && arg0 <= 'z'; }
d8beab08-2a30-4ba4-be2f-72cecd8c557f
3
public static void main(String[] args) throws InterruptedException{ JFrame tabla_posicion = new JFrame("posiciones"); posiciones posiciones_tabla = new posiciones(); tabla_posicion.setContentPane(posiciones_tabla.posiciones); tabla_posicion.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);...
f4d0fa21-1e90-4c95-bbd9-c63c8dceae29
2
public static String pedirDni(){ boolean correcto=false; String dni=""; try{ do{ System.out.print("DNI => "); BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in)); dni=stdin.readLine(); correcto=Operaciones.isdni(dni); }while(correcto==false); }catch(Exception e){ Syste...
4cdac475-565b-403c-bb4b-9b9f5c8b8431
4
private boolean isValidRecord(String record) { final String noneStr = "(none0)"; if ((null != record) && !record.equals(noneStr) && record.startsWith(Field.LEFT_BRACKET) && record.endsWith(Field.RIGHT_BRACKET)) { return true; } else ...
a1f7b50b-22ee-4a7a-a5bb-1dfe1231081d
5
public CommandGui() { super("Commando"); outputPanels = new CardLayout(); errorPanels = new CardLayout(); directory = System.getProperty("user.dir"); File userDir = new File(directory); historyFile = new File(userDir, ".commandohistory"); FileInputStream input =...
4eac7fd5-539c-4ea2-a241-d2d5a03db6ba
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...
75e8c68f-7365-44fc-87d4-5b2776766e80
2
public Material value(String str) { for (Material m : Material.values()) { if (m.name().contains(str)) { return m; } } return Material.AIR; }
b5d97121-00fc-446f-aac1-ad74db4c7cb0
1
public int getNumberOfChildren() { if (children == null) { return 0; } return children.size(); }
680063a3-ecce-4676-b3cb-c9ff810179d4
5
@EventHandler (priority = EventPriority.NORMAL) public void onBlockBreak(BlockBreakEvent event){ Player p = event.getPlayer(); if(!RPSystem.permission.has(p, plugin.config.getString("block-restriction.override-permission")) && !p.isOp()){ if(plugin.itemConfig.getStringList("restricted-items").contains(event....
88ea7d3f-c8f7-4cd3-a820-23ed96a1ca2c
4
public void addVector(){ int i =0; int j; boolean found = false; while (i != v.size() && found == false){ j = v.elementAt(i).indexOf(' '); if (v.elementAt(i).substring(0,j).equals(fileName)){ found = true; } } if (found){ v.removeElementAt(i); } v.add(fileName + ' ' + fileType + ...
80296dec-e293-4e6f-bb25-ab06bdd8a02a
3
public boolean broadcastToMods(String msg) { MessageLib msgLib; PermissionManager perms; for (Player staff: Bukkit.getServer().getOnlinePlayers()) { perms = new PermissionManager(staff); if (perms.isGlobalMod()) { msgLib = new MessageLib(staff); msgLib.standardMessage(msg); } else...
04a7aded-0d06-469a-8d0a-1934e45c1af8
1
public void changeStatus(TicketStatus status) { if (status == null) { throw new IllegalArgumentException("Status shouldn't be NULL."); } this.status = status; }