method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
caa16db7-83b4-481e-975e-dcb8cebbff62
2
public static void main(String Args[]){ int l=1; int k =10000; while(k>0){ l = l*2; if(l>1000000007){ l = l%1000000007; } k--; } System.out.print(l); }
410fa6d7-bd06-45a3-a13a-891fd3508a51
5
public static void save() { File file = new File(Shortcuts.dataFolder, "bannedPlayers.dat"); FileOutputStream fos = null; ObjectOutputStream oos = null; try { fos = new FileOutputStream(file); oos = new ObjectOutputStream(fos); oos.writeObject(bannedP...
03aa2a81-e69a-4a1c-aacb-b69f78df2807
5
@Override public void update() { if (KeyHandler.isPressed(KeyHandler.ENTER)) { select(); } if (KeyHandler.isPressed(KeyHandler.LEFT)) { currentChoice--; if (currentChoice == -1) { currentChoice = options.length - 1; } } if (KeyHandler.isPressed(KeyHandler.RIGHT)) { currentChoice++; if ...
0ab0b816-10d8-49c4-8f76-8fc6e35b7939
4
public static void removeCopy(int copyId){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit(false); PreparedStatem...
454bf85b-cf2b-4093-b63f-4d11772a025d
3
public void setEQ(float[] eq0) { this.eq = eq0; if (eq==null) { eq = new float[32]; for (int i=0; i<32; i++) eq[i] = 1.0f; } if (eq.length<32) { throw new IllegalArgumentException("eq0"); } }
916a8ab7-ebb8-4e6a-b711-938495d2b2ec
2
@Override public Object clone() throws CloneNotSupportedException { EasyDate date = null; try { date = (EasyDate) super.clone(); if (calendar != null) { date.calendar = (Calendar) calendar.clone(); } } catch (CloneNotSupportedException e) { // ignore exception } return date; }
95dc3fd7-e96d-46ed-9041-e0991d535434
8
@Override public void actionPerformed(ActionEvent e) { if (selaaja.getI()==0 && selaaja.getJ()==0) { goodEnd = false; } if (e.getSource() == nappi1){ if (goodEnd == false) { selaaja.setJ(selaaja.getJ()+1); } ...
802fd0ce-74dc-48be-8e1e-14c844e7837f
5
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((carRenter == null) ? 0 : carRenter.hashCode()); result = prime * result + ((carType == null) ? 0 : carType.hashCode()); result = prime * result + ((endDate == null) ? 0 : endDate.hashCode()); result = prime ...
d014b724-cf04-4b63-b867-180b1c85a168
7
public String toString(){ String out = hours + ":" + minutes +" "+ AmPm + " "; if(ma) out += "mo,"; if(di) out += "tu,"; if(wo) out += "we,"; if(don) out += "th,"; if(vr) out += "fr,"; if(za) out += "sa,"; if(zo) out += "su,"; return out; }
c99f675c-425a-4b8c-a3b5-bd7123db4cac
1
public java.security.cert.X509Certificate[] getAcceptedIssuers() { java.security.cert.X509Certificate[] chain = null; try { TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); KeyStore tks = KeyStore.getInstance("JKS"); tks.load(this.getClas...
d57ec3d9-d4f7-4c11-a9c2-91494d0046cc
3
private void processAddMaster(Sim_event ev) { if (ev == null) { return; } int result = -1; Object[] data = (Object[]) ev.get_data(); if (data == null) { System.out.println(super.get_name() + ".processAddMaster(): master fil...
a3ee16fc-030f-45b0-bc70-197492abf349
5
public void ThreateningScore(Board b){ char c; if(color=='W')c='B'; else c='W'; int score=0; int best=-10; System.out.println(c); checkThreats(b,c); printThreats(); for(int i=0;i<numThreatened;i++){ score=toInt(threatened[i]); if(isThreatened(locThreatening[i])){ score+=toInt(threatening[...
51a81c20-4141-4269-9ac9-09ab92a72596
1
public boolean matchingArgPosition(ArgPosition candidate, boolean matchEmpty) { if (candidate == null) { return matchEmpty; } else { return isPrefixOf(candidate); } }
54c44e38-141b-437b-a004-b7dc9f97be97
0
public void setDestroyed(boolean destroyed) { this.destroyed = destroyed; }
2858ccc2-1ca1-4726-85e8-45c7e6a18a46
8
public String longestCommonPrefix(String[] strs) { int count = strs.length; if (strs.length == 0){ return ""; } String shortest = strs[0]; for (int i = 0; i < count; i++){ if (shortest.length() > strs[i].length()){ shortest = strs[i]; ...
e72a7dc0-5382-4c46-9c06-74a9aade4ef3
7
public Vector3D Trace(Ray ray, Scene scene, int cDepth, int maxDepth){ double dist = Double.MAX_VALUE; double tempDist; double intensity; double tempIntensity; int object = 0; double rCoeff =0; int currentDepth = cDepth+1; Vector3D colour = Vector3D.ZERO; Vector3D baseColour = Vector3D.ZERO; Vector3...
5d07f7a5-352c-4463-9dc0-db3476262055
9
@Override public boolean waitForDeviceReady(long timeout) throws ReaderException, UnsupportedDeviceException { try{ this.connect(); } catch(ReaderException e) { throw e; } if (this.terminal == null) throw new ReaderException("terminal is null"); try { // wait timeout milisecond for card ...
91bd9286-3898-4c87-adc0-139f9f9e0df6
8
@Override public void handleEvent(RowsSetEvent e) { System.out.println("Some row has been set.."); if(appContext.getControlTunables() != null) { List<CyRow> allRows; if(e.containsColumn(CyNetwork.SELECTED)) { System.out.println("Verified that selected was changed.."); if(e.getSource().equals(C...
8e2612b2-a5ad-4507-b0fb-7e66d3adb670
3
public void delete(Key key) { int i = hash((String)key); if (st[i].contains(key)) { N--; } st[i].delete(key); // halve table size if average length of list <= 2 if (M > INIT_CAPACITY && N <= 2 * M) { resize(M / 2); } }
b807a9fd-4c0f-4a23-8d1e-1e65488e8d19
4
private String downloadFileFromUrl(URL downloadUrl) throws IOException{ String filename = "gtfs.zip"; File downloadedFolder = new File("GTFS_Temp"); String downloadedLocation = downloadedFolder.getAbsolutePath() + System.getProperty("file.separator"); //"\\"; //temporary folder to store downloaded files String ...
5115e8ca-ec2f-4f21-8448-573a73971755
3
public void run() { try { this.MPrio.acquire(); if(this.counter == 0) this.MReading.acquire(); this.counter++; this.MPrio.release(); this.MWriting.acquire(); System.out.println("Ecriture"); Thread.sleep(1000); this.MWriting.release(); this.MPrio.acquire(); this.c...
245c6639-b6ac-4be9-a63e-56bc8f54b132
4
public void EvidenziaSAM(Model mod, AlberoMosse am){ if(am!=null) if(!am.isSAMNull()){ //System.out.println("Il sotto albero non è NULL! "); for(int i=0;i<am.getLengthSAM();i++) if(am.getSAM(i) != null) new EvidenziaAM(mod, am); }else{ //System.out.println("Il sotto albero è NULL! "); ...
561e6ee4-7e72-43b8-8b62-e54a0aa41447
1
@SuppressWarnings("restriction") public String send(String Token, String id, String deleted, String SME_ID, String date_entered, String date_modified, String modified_user_id, String created_by, String description, String assigned_user_id, String name, String type, String status, String date_closed, String expect...
f0fda038-449b-4dc4-b7de-e5d6bf129733
5
public void interrupt() { switch (dcpu.registers[0]) { case ACTION_GET_STATUS: performGetStatus(); break; case ACTION_SET_SKIP_UNIT: int b = dcpu.registers[1]; numberOfUnitsToSkip = ByteBuffer.allocate(8).order(ByteOrder.BIG_ENDIAN).putLong( (dcpu.ram[b]<<48)|(dcpu.ram[b+1]<<32)|(...
22ad00d6-3337-4c94-b838-9b1ec8f4f5ca
6
private long search(int[] nums) { if (nums.length == 1) return nums[0]; String key = buildKey(nums); if (cache.containsKey(key)) return cache.get(key); long max = 0, maxIndex = 0; for (int i = 0; i < nums.length; ++i) { int self = i == 0 ? nums[i] * nums[i + 1] : i ==...
84bd1cbd-8ce9-4a2c-bb5a-0302442b9849
4
public void run() { // signal that this thread has started threadStarted(); while (!isInterrupted()) { // get a task to run Runnable task = null; try { task = getTask(); } catch (Int...
5a35caab-bd0b-4ac4-bfc7-c254c73db64f
0
public void setCategoryName(String categoryName) { this.categoryName = categoryName; }
21d4204c-6349-4cc6-8443-e15b835ac3c0
4
@Override public boolean removeLockByResource(String resource) { ResourceLock thisLock = locksOfR.get(resource); // There is no lock on this resources if (thisLock == null) return false; locksOfR.remove(resource); if (!thisLock.isValid(resource)) re...
40a7ceff-253a-4391-8165-d69fe4b62645
5
public boolean calcularStringValidaAFD(String string) { Estado estadoAtual = this.estadoInicial; for (int i = 0; i < string.length(); i++) { String carac = String.valueOf(string.charAt(i)); for (Iterator<FuncaoTransicao> it = estadoAtual.getFuncoesTransicao().iterator(); it.hasNe...
ae50ec09-aa60-4bf8-bd72-7008c0ae359d
8
private boolean isValidHorMove(int r1, int c1, int r2, int c2) { if (r1 != r2) { return false; } int step = c1 - c2 < 0 ? 1 : -1; if (step > 0) { for (int c = c1 + step; c < c2; c += step) { if (board[r1][c] != EMPTY) { return ...
65e0080d-c4dd-44b3-9d76-2be3eb2dd27e
1
public static void printFloatBuffer(FloatBuffer fb) { fb.rewind(); while (fb.hasRemaining()) { System.out.print(fb.get() + ", "); } System.out.println(); }
3ba3e484-fd88-4d2a-9fd6-74f85cc2d944
3
public boolean needsProcessing(Object obj) { if (obj instanceof PhpObject) return true; if (obj instanceof LinkedHashMap) return true; if (obj instanceof ArrayList) return true; return false; }
e7e3d8d0-009a-4d4a-81f1-c924f3a15917
4
public String[][] listAlbums() { Logger.getLogger(BooksFolderAnalyser.class.getName()).entering(BooksFolderAnalyser.class.getName(), "listAlbums"); try { File[] allfiles = listAlbumsFiles(); if (allfiles == null) { Logger.getLogger(BooksFolderAnalyser.class.getNam...
7a02d210-d1cc-4374-ba8c-d7a208cd0bf7
6
public static IntegerWrapper lengthComputation(Stella_Object x) { { Surrogate testValue000 = Stella_Object.safePrimaryType(x); if (Surrogate.subtypeOfStringP(testValue000)) { { StringWrapper x000 = ((StringWrapper)(x)); return (IntegerWrapper.wrapInteger((x000.wrapperValue).length())); ...
058adb05-890f-4723-874d-d1eff2864dc6
3
public void reset()throws TableException{ String createString; java.sql.Statement stmt; try{ createString = "drop table " + ITEMS_TABLE_NAME + ";"; stmt = sqlConn.createStatement(); stmt.executeUpdate(createString); } catch (java.sq...
703006a1-7876-410f-bf04-2503253e676f
3
public AnisotropicDiffusionDialog(final Panel panel){ setTitle("Anisotropic diffusion"); setBounds(1, 1, 250, 200); Dimension size = getToolkit().getScreenSize(); setLocation(size.width/3 - getWidth()/3, size.height/3 - getHeight()/3); this.setResizable(false); setLayout(null); JPanel parametersPanel = n...
3bd00f60-4995-4245-aa5a-0755eb46994f
3
public static void main( String[] args ) { ArrayList<String> listaUczniow = new ArrayList<String>(); listaUczniow.add( "Dariusz Dybka" ); listaUczniow.add( "Jan Kowalski" ); listaUczniow.add( "Przemysław Rzedkowski" ); int i = 0; for ( String s : listaUczniow ) { ...
a5246b80-e729-4b7a-b9c8-a5f1784787d9
3
public void update(float delta) { for(GUI gui:guiLayer){ gui.update(); } if(!removeGuiLayer.isEmpty()){ guiLayer.removeAll(removeGuiLayer); removeGuiLayer.clear(); } if(!addGuiLayer.isEmpty()){ guiLayer.addAll(addGuiLayer); ...
831b6e94-21e6-4b29-bd88-a875e5585844
7
public ArithmeticalOperator createOperator(char operation, ArithmeticalOperator right, ArithmeticalOperator left){ ArithmeticalOperator operator = null; switch (operation) { case SyntaxArithmeticReader.PLUS: operator = new OperatorPlus(left,right); break; case SyntaxArithmeticReader.MINUS: ...
a125875c-bd7b-4c10-ad41-1293571a035a
1
public void closeReader() { try { this.reader.close(); } catch (IOException e) { e.printStackTrace(); } }
060114b0-fc9a-4468-8a76-348ec08147ef
3
@Override public void getDatas() { try { File xmlFile = new File("src/main/resources/candyBox.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBui...
e1dfbc3e-598f-42a4-9706-104bd3c1d680
3
public boolean tellUser(String sender, String target, String message){ UserAccount user = users.get(target.toLowerCase()); if (user==null) return false; ChatServerThread thread = user.getThread(); if (thread==null || !thread.isAlive()) return false; thread.tell(sender, message); ...
e7ec24e4-a8b8-4b7d-bd47-7170cf2bb30c
0
public String getId() { return id; }
e6d453ae-fc58-4f9b-a0eb-ebce993a3c27
9
public TextBox(){ label = new Label(); label.setX(this.getX()); label.setY(this.getY()); label.setText(hintText); label.getColor().setRGB(0.0f, 0.0f, 0.0f); bg = new Entity(); bg.setX(label.getX() - 5); bg.setY(label.getY() - 2); bg.setWidth(labe...
4daedc99-fdd9-4979-8452-6a717a5563ac
2
public static double max(double[] values) { double max = values[0]; for (double value : values) { if (value > max) max = value; } return max; }
fc8a3797-e2d5-477f-838d-4bad33d0de37
1
public static void main(String[] args) { for(int i = 1, j = i + 10; i < 5; i++, j = i * 2) { System.out.println("i = " + i + " j = " + j); } }
0c988515-c19f-44eb-bd85-ce2f7d5e014a
2
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { int n = 0; do { } while (!APIRequest.getInstance().updateScheduleRequest(Sport.NBA) && ++n < tries); }
66d4242f-71c7-4720-a3ef-4bea56231903
5
public static void deleteFile(String fileName){ // deletion flag boolean flag = true; // Create an instance of File representing the named file File file0 = new File(fileName); // Check that the file exists if(!file0.exists()){ System.out.println("Method de...
a695e7d0-1854-47e6-8268-507422d1b251
3
private boolean isEmpty(Body activeBody) { for (Unit u : activeBody.getUnits()) if (!(u instanceof IdentityStmt || u instanceof ReturnVoidStmt)) return false; return true; }
02fb658f-5587-4d25-ad15-433fbfc5f2ae
9
private static void irregularEnding(List<String[]> results, String stem, String ending) { if(ending.startsWith("ㅆ")) return; char feCh = ending.charAt(0); char ls = stem.charAt(stem.length()-1); if(feCh=='러'&&ls=='르') { // '러' 불규칙 results.add( new String[]{stem ,"어"+e...
e9e23992-4075-4e08-9b0d-991b1ac74274
4
public static void loadTree(BSTree tree, String file){ Scanner s = null; try { s = new Scanner(new BufferedReader(new FileReader(file))); while (s.hasNext()) { tree.insertNode(new Word(s.next())); } } catch(FileNotFoundException e) { System.out.println("File Not Found: ") ; } catch(IOExc...
a96d3872-033c-4cb2-b79f-2dfda5a79bf6
8
public void announceWeather(){ weather.updateWeather(); WeatherSnapshot morning = weather.getWeatherFor("06:00"); WeatherSnapshot midday = weather.getWeatherFor("11:00"); WeatherSnapshot afternoon = weather.getWeatherFor("17:00"); WeatherSnapshot night = weather.getWeatherFor("23:00"); WeatherSnapshot curre...
5a01e0b6-06f0-4c31-bf9e-033e5f16fd3a
6
public static void main(String[] args) { boolean[] isPrime = EulerMath.getSieve(N); int count = 0; for(int i = 2; i < isPrime.length; i++) if(isPrime[i]) { List<LinkedList<Integer>> perms = getCircularPerms( EulerMath.intToDigits(i) ); boolean add = true; for(int j = 0; j < perms.size() && ...
1a08433a-e701-4780-8b14-03acee278f33
1
public Stock query(String identifier) { Element e = getStockByIdentifier(identifier); if (e == null) { return null; } return new Stock(identifier, e.getAttribute("name"), Integer.parseInt(e.getAttribute("inventory")), Float.parseFloat(e.getAttr...
7f12f917-4c78-4c51-bba9-ecd70e7d3564
1
public void dumpSource(alterrs.jode.decompiler.TabbedPrintWriter writer) throws java.io.IOException { if (destination == null) writer.println("GOTO null-ptr!!!!!"); else writer.println("GOTO " + destination.getLabel()); }
d41eb252-c97c-4d1d-b680-3799cbdc951b
5
private List<U>mixTwoLists(List<U> l1, List<U> l2) { int newSize =(l1.size()+l2.size())/2; //System.out.println("newSize"+newSize); List<U> newList = new ArrayList<>(); for(int i=0; i<newSize; i++) { newList.add(rFunc.getRandom()); } boole...
f36e3bee-2ced-4c81-9810-aa74575d86b3
6
public void reload(){ if(loadedplugins.size()!= 0) for(Plugin pi:loadedplugins){ try{ pi.onDisable(); }catch(NullPointerException e){ } } File[] files = new File(readInstallLocation()+"\\plugins").listFiles(); for(File f:files){ if(f.getName().endsWith(".jar")){ load...
aae7f68e-15ee-4249-834a-b956c3b5476b
0
@Basic @Column(name = "FUN_SUELDO") public Integer getFunSueldo() { return funSueldo; }
518e92f4-30f8-42ce-8dcf-5d4247b7ee2d
4
public void reveal(Component cmpIn, int iX, int iY) { boolean bEnabled = this.jtcParent.isEnabled(); boolean bEditable = this.jtcParent.isEditable(); boolean bSelected = null != this.jtcParent.getSelectedText(); this.miCut.setEnabled(bEnabled && bEditable && bSelected); this.miCopy.setEnabled(bEnabled && bS...
8fece7e6-01a5-4f8e-8ca5-b12d477f6bc7
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Message other = (Message) obj; if (message == null) { if (other.message != null) return false; } else if (!message.equals(other.message)...
9966a272-8410-4952-8489-a568b27fe135
3
void exchange(int exchangeNumber) { for (Iterator<Player> i = players.iterator(); i.hasNext();) { Player currentPlayer = i.next(); if (currentPlayer == beginningPlayer) { // beginning player doesn't exchange the cards currentPlayer = i.next(); } ...
fe07e582-45a8-42d7-a2f0-4d4734dc23e0
0
EmptyStackEvaluationException(){ super("Inapropriate number of operands for evaluation"); }
d87b0517-f3af-4496-a540-6a1bee34f277
4
public int playRPS(int PlayerOneChoice, int PlayerTwoChoice, String playerNameOne, String playerNameTwo) { int res=winnerIs(PlayerOneChoice,PlayerTwoChoice); // also validates the inputs, invalid gives -1 if (res==0) System.out.println("It's a tie!"); else if(res==1) { System.out.println(weaponNameFromInde...
a2bdf9aa-0191-4ce4-8880-b947f1ca9f31
5
public void go() { new Thread(new Runnable() { public void run() { try { for (SimonButton button : buttons) { button.setEnabled(false); } for (int button_num : computerButtonPresses) { // iterate through each sequence element Thread.sleep(400); SimonButton butt...
ab64b58c-28e4-484a-9647-c6d6a3730c2a
0
public TextFile(String filename) { this.filename = filename; }
420f31d4-9d59-4422-a7e7-ee6b27b8d060
3
@Override public JSONObject main(Map<String, String> params, Session session) throws Exception { JSONObject rtn = new JSONObject(); User activeUser = User.findById(session.getActiveUserId()); if(!activeUser.isAdmin) { rtn.put("rtnCode", this.getRtnCode(405)); return rtn; } long venueId = Long.parseL...
aaccbe6d-61b2-45b7-b7d6-707c991da317
0
@Override public Integer getAdminPort() { return adminport; }
cb12a1d0-4592-485c-bafd-3322cdf3af69
6
@org.junit.Test public void testSemicolons() { javaCode = "{{{{{{{{{{{{{{}}{{{{{{}}}}}}{{}}}}}}}}}}}}}}"; FormatOptions formatOptions = new FormatOptions(); try { makeTest(formatOptions); } catch (Exception ex) { if (logger.isEnabledFor(Level.ERROR)) { ...
4ecf5022-84d4-450c-9f77-9e6c0351f7b0
8
String fileTypeString(int filetype) { if (filetype == SWT.IMAGE_BMP) return "BMP"; if (filetype == SWT.IMAGE_BMP_RLE) return "RLE" + imageData.depth + " BMP"; if (filetype == SWT.IMAGE_OS2_BMP) return "OS/2 BMP"; if (filetype == SWT.IMAGE_GIF) return "GIF"; if (filetype == SWT.IMAGE_ICO) return...
397cd70e-8de3-4f1b-ac41-868fbe315156
7
@Override public ListNode RemoveNode(int data) { ListNode previousNode = headNode; Boolean found = false; if ((headNode!=null) && (data == headNode.getData())) { headNode = headNode.getNext(); found = true; previousNode = null; } else { while ((previousNode !=null) && (previousNode.getNext()...
33d69d4a-1f1c-4b80-a7a5-afdee24e2a9b
7
public int getBlockTextureFromSideAndMetadata(int var1, int var2) { return var2 == 0?(var1 <= 1?6:5):(var2 == 1?(var1 == 0?208:(var1 == 1?176:192)):(var2 == 2?4:(var2 == 3?16:6))); }
cafe5574-89b5-4421-9c7d-e48874bba52f
0
public People(int id,String name) { this.Id = id; this.Name = name; // this.key_reports.add("123"); }
42638c32-35a6-4c87-a052-b054d5317d91
1
public void callOnError(ExecutionError error) { Handler h = handlers.get(new HandlerType(EventType.ERROR, null, null)); if (h != null) { ExecutionErrorHandler errorHandler = (ExecutionErrorHandler) h; errorHandler.call(error, error.getContext()); } }
80a2a4fa-6b82-48ed-adfc-3c40ffb46a01
0
void right(int velocity) { }
494053b4-2a8c-45b6-8faa-de5f7f3ee8cf
7
@Override public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source instanceof Vehicle) { Vehicle vehicle = (Vehicle) source; if (e.getActionCommand().equals(Constants.OPERATION_UPDATE)) { if (this.vehicle == vehicle) { updateVehicle(vehicle); } } } else if (sou...
28d84853-8d48-4dfa-8aad-dd807bb143ec
6
@Override protected void fillComponentsInEditorPanel(int rowSelected) { nameTextField.setText(getValueAt(rowSelected, 1).toString()); yearSpinner.setValue(Short.valueOf(getValueAt(rowSelected, 2).toString())); strengthSpinner.setValue(getValueAt(rowSelected, 3)); String spec...
abded2ec-8ace-4b68-8a8f-8309e7a72794
6
public void buildDetail(String id, JPanel panel) { if (getId().equals(id)) { return; } ResourceType type = getSpecification().getResourceType(id); panel.setLayout(new MigLayout("wrap 2", "[]20[]")); JLabel name = localizedLabel(type.getNameKey()); name.setFo...
132d6a23-bb0d-4fa0-a49e-44c9354be915
2
@Override public void mouseReleased(MouseEvent event) { if (isEnabled()) { mouseDragged(event); mShowBorder = mPressed; mInMouseDown = false; MouseCapture.stop(this); if (mPressed) { mPressed = false; click(); } repaint(); } }
7102e4c1-073c-4980-9cef-d2affe39b308
3
@Override public List<Venda> listAll() { Connection conn = null; PreparedStatement pstm = null; ResultSet rs = null; List<Venda> vendas = new ArrayList<>(); try{ conn = ConnectionFactory.getConnection(); pstm = conn.prepareStatement(LIST); ...
71eac575-4074-48b5-bf97-6fc76caa994a
0
public void setEmployeeId(int employeeId) { this.employeeId = employeeId; }
eafd7b79-5b10-4d82-82de-4ee6467caf5b
8
public String handelSuggestion(String room, String person, String weapon, Player accuser) { String info = null; ArrayList<String> dissapprovals = new ArrayList<String>(); Boolean cardShown = false; for (int i = 0; i < players.size(); i++ ) { if (cardShown) break; if (players.get(i).getName().equalsIgn...
2247a859-010e-4d54-9c04-efd89fd18233
6
public void connect() { if(connection == null) { try { Class.forName(driver); } catch(ClassNotFoundException classnotfoundexception) { throw new UserError("Could not find your database driver."); ...
da24a2df-57ea-48f9-ab81-ff0a3b34d248
3
public int calcPaletteDiffs(int pal) { int mostSimilar = -1; float bestDiff = Float.POSITIVE_INFINITY; for (int i = 0; i < palettes.length; i++) { if (paletteCounts[i] != 0) paletteDiffs[pal][i] = paletteDiffs[i][pal] = palDif(palettes[pal], palettes[i]); ...
6cb17b3b-c6ff-4482-9295-142580981695
4
private void initComponents() { Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); this.getContentPane(); outputTextField = new JTextArea(); titleLabel = new JLabel(); checkButton = new JButton(); jScrollPane1 = new JScrollPane(); jScrollPane2 = new JSc...
cbbc5471-89df-4743-af1d-438987083285
7
private void checkMove4 () { if (row != 7 && col != 7 && Othello.board[row+1][col+1] == null) { for (int i=row, j=col; i>=0 && j>=0; i--, j--) { if (Othello.board[i][j]==player) { list[4] = new Possible(row+1, col+1, i, j); break; } else if (Othello.board[i][j] == null) break; } } }
5779272d-3e1c-4668-9163-614c718367c1
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...
06d00539-173f-48d4-a312-1a126b57dc1e
9
private void SubmitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SubmitButtonActionPerformed boolean loginflag = false; successMessageLabel.setText(""); try { Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "ora...
811b1d7c-6a40-408e-9d59-1d37c124ffdb
5
public Object nextEntity(char ampersand) throws JSONException { StringBuffer sb = new StringBuffer(); for (;;) { char c = next(); if (Character.isLetterOrDigit(c) || c == '#') { sb.append(Character.toLowerCase(c)); } else if (c == ';') { ...
415d87aa-86e6-4300-b5dd-147705d70ddb
2
public List<E> toList() { ArrayList<E> elements = new ArrayList<E>(capacity); for (int i = 0; i < capacity; i++) { synchronized (table[i]) { Node<E> c = table[i].next; while (c != null) { elements.add(c.element); c = c.next; } } } return elements; }
0186e0b6-2577-4048-8721-13f7107404f7
3
public static void createMainScreen(){ /* 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://downlo...
d410d575-0ca2-407a-a92f-beb6f7131a6e
9
public void checkLevel(){ if (foodCount==levelLength){ //calculates the score of each snake score1=score1+player1.getSize()-1; score2=score2+player2.getSize()-1; snake1Alive=true; snake2Alive=true; //checks if the last level is reached if (level.levelNumber==5 && score1>score2){ JOptionPan...
5c8234a9-bf69-4483-945e-f627236e558c
2
public static boolean isValidString(String asString) { if (asString != null && asString.trim().length() > 0) { return true; } else { return false; } }
f121b6e6-b909-474e-8ab3-dee70b136e3c
8
private void converStart(String str) { String strR = ""; String strVal = ""; //去掉开头的0 for(int i = 0 ; i < str.length() ; i++ ) { if(!"0".equals(str.substring(i, i+1))) { System.out.println(str.substring(i, i+1)); strVal = str.substring(i); System.out.println(strVal); break; } } i...
690acbf6-d5fb-4b74-a6e7-c5bdc8d02bef
4
public void communicate() throws IOException { new Thread(new Runnable() { public void run() { try { String str = sbr.readLine(); while (str != null) { System.out.println(str); str = sbr.readLine(); } System.err.println("Disconnected by server"); } catch (IOException e) { ...
b46ded01-1d17-48db-b422-cf40e3d53f2f
5
public void removeOutside(){ if(outsideTimesCounter < xGen / grid / 2){ for(int i = 0; i < yGen / grid; i++){ if(rects[outsideCounter].type != INDESTRUCTUBLOCK)rects[outsideCounter].type = 0; outsideCounter += xGen / grid; } for(int i = 0; i < yGen / grid; i++){ if(rects[rightOutsideCounter].type...
469e5eea-7da8-4571-a5e9-f1a1061cea51
3
public void endTurn() throws InvalidActionException { if (getRemainingActions() <= 0) throw new InvalidActionException("The player has no turns left!"); if (!hasMovedDuringTurn()) throw new InvalidActionException("The player has not moved yet during his turn!"); while (getRemainingActions() > 0) decreme...
ac876794-2c69-4857-8db8-50638743452b
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...
fafe15e5-6b11-450e-b930-fbb85470936c
5
private Object[] winnerCouple( ArrayList<Card> cards, CardFamily triumph ) { Object[] res = new Object[2]; int maxValuePos = 0; Card winnerCard = null; if ( cards.size() < 1 ) return null; Card initialCard = cards.get( 0 ); int _t = 0; ...
93305c9b-4389-4b6a-a192-26a03c196832
8
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
a6a6de08-7c9d-46e1-b24a-9c7b2f02a2c5
8
public void insertSorted(double distance, Instance bag, int position) { if (isEmpty()) { mFirst = mLast = new NeighborNode(distance, bag, position); } else { NeighborNode current = mFirst; if (distance < mFirst.mDistance) {// Insert at head mFirst = new NeighborNode(distan...