method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c5bac041-58cf-448e-af64-d2470a059376
3
@WebMethod(operationName = "FindProdInBra") public ArrayList<ProdBra> FindProdInBra(@WebParam(name = "pb_prod_id") String pb_prod_id) { ProdBra pb_in = new ProdBra(); ArrayList<ProdBra> pb_ins = new ArrayList<ProdBra>(); ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>...
a66a2e39-ada1-4125-ba01-e0f90bff3fe6
2
public List<Deal> rechercherParCategorie(String categorie) { PrestataireDeServiceDAO psdao = new PrestataireDeServiceDAO(); try { String sql = "SELECT * FROM Deal Where categorie='"+categorie+"' "; ResultSet rs = crud.exeRead(sql); List<Deal> liste = new ArrayList<De...
ace4497f-c852-4cf7-ad51-2a572759879f
0
@Override public void changeSum(int delta) { money += delta; }
25d93214-2a1b-40e5-9913-7074fe6f5dd7
4
public String getMessage() { StringBuffer sb = new StringBuffer(40); sb.append(super.getMessage()); if (m_key != null | m_group != null) { sb.append(": "); if (m_group != null) { sb.append("group = ").append(m_group); if (m_key != null) { sb.append(", "); } ...
3dd9597c-d51c-4b7a-bedd-f8a5396c8d0c
8
public void putAll( Map<? extends Character, ? extends Character> map ) { Iterator<? extends Entry<? extends Character,? extends Character>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Character,? extends Character> e = it.next(); ...
acf0fec9-67e0-4e2b-a50a-ec14e37f7cf8
4
public T[] bestPath(Class pathClass) { if (bestEntry == null) return null ; final Batch <T> pathTiles = new Batch <T> () ; for (Entry next = bestEntry ; next != null ; next = next.prior) { pathTiles.add(next.refers) ; } if (verbose) I.say("Path size: "+pathTiles.size()) ; int len = pathTil...
ebfcad91-a9cc-4ed6-ad4a-9eb4a1388749
7
private void generateDayPriorityList() { time = Calendar.getInstance().getTime().toString().split(" "); switch (time[0]) { case "Mon": dayPriorityList = new String[] { ShutdownTask.MONDAY, ShutdownTask.TUESDAY, ShutdownTask.WEDNESDAY, ShutdownTask.THURDAY, ShutdownTask.FRIDAY, ShutdownTask.SAT...
fd81b5b3-c833-42c4-864b-730df27ce54a
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
1b59b415-efd6-4fb0-94ae-87f8810c3f64
2
private City parseCity(String str) { City city = new City(); Pattern numPattern = Pattern.compile("[0-9]+"); Matcher match = numPattern.matcher(str); boolean index = true; String s = null; while(match.find()){ s = match.group(); if(index){ double nodeIndex = Double.parseDouble(s); city.setInde...
6494df55-b5e3-4dac-83ee-7f8833d4f9bf
9
public static Cons walkValuesTree(Cons tree, Object [] MV_returnarray) { { Stella_Object otree = null; StandardObject otype = null; Cons bindtree = Stella.NIL; Symbol valuevar = null; boolean hasproceduralvalueP = false; { ConsIterator it = tree.rest.allocateIterator(); loop0...
e0438992-4312-4e4f-a9ef-05395ee11464
8
private DigraphProvider<? super DigraphLayoutNode<V>, Digraph<? extends DigraphLayoutNode<V>, ? extends DigraphLayoutArc<V, E>>> getSubgraphProvider() { return new DigraphProvider<DigraphLayoutNode<V>, Digraph<? extends DigraphLayoutNode<V>,? extends DigraphLayoutArc<V,E>>>() { @Override public Digraph<? extend...
6cd509f1-0fcf-430f-9305-af39c14135a7
9
synchronized void updateMap(int intLocX, int intLocY) { DuskObject objStore; Entity thnStore; int i=0, i2=0, i3; if (intLocX-VIEW_RANGE<0) i = -1*(intLocX-VIEW_RANGE); if (intLocY-VIEW_RANGE<0) i2 = -1*(intLocY-VIEW_RANGE); for (;i<MAP_SIZE;i++) { if (intLocX+i-VIEW_RANGE<MapColumns) { for (i3...
5d67f29d-2542-44d0-971d-e8e95a6ca729
5
protected static void updateExtras( Holding holding, List <HoldingExtra> extras, int numUpdates ) { if (numUpdates % 10 != 0 || ! holding.structure.intact()) return ; if (verbose) I.sayAbout(holding, "Updating extras for: "+holding) ; final int level = 1 + (int) Math.floor(holding.upgradeLevel() ...
1bf8cb6f-5a6b-47f4-bcc5-c1f91c022290
4
public static BufferedImage sobel(BufferedImage input) { int Gx[][] = new int[][]{ {-1, 0, 1}, {-2, 0, 2}, {-1, 0, 1} }; int Gy[][] = new int[][]{ {-1, -2, -1}, {0, 0, 0}, {1, 2, 1} }; ...
0775ab14-c26b-4149-b380-f57e59f7dbd1
8
private static boolean getDependent(Term term, ArrayList list, ArrayList result) { if (term.var == null) { boolean found = false; for (int i=0; i<term.subterms.length; i++) { if (!getDependent(term.subterms[i], list, result)) { return false; } if (term.subterms[i].getSort().isHidden())...
715e4dcb-6efb-4910-895b-62bae56b5852
0
public void setMiddleName(String middleName) { this.middleName.set(middleName); }
eb1b9b36-632e-4c06-92c0-446cf6f6caaf
2
public static void initialize(GL2 gl, int numLights){ int[] maxLights = new int[1]; // Make Sure lighting is turned on gl.glEnable(GL2.GL_LIGHTING); // Check to make sure we aren't enable more lights than the graphics card can support gl.glGetIntegerv(GL2.GL_MAX_LIGHTS, maxLigh...
9db32717-afd3-4ff5-8fbd-2ec02385c5be
7
@Override public String toString() { String params = ""; List<String> parameters = new ArrayList<String>(); if(cc != null && cc.length() > 0) { parameters.add("cc=" + getCc()); } if(lang != null && lang.length() > 0) { parameters.add("lang=" +...
14954c64-1294-4f05-9be2-2228147b1745
8
protected TreeBuilder createTreeBuilder(Properties properties, Feature... features) { Class<?> clazz = load(TreeBuilder.class, properties); if (clazz == null) { return new Builder(features); } try { if (Builder.class.isAssignableFrom(clazz)) { Constructor<?> constructor = clazz.getConstructor(Feature[...
051a1623-a4f3-4588-b778-724a20073edf
6
@Test public void testRegistration() { System.out.println("testRegistration"); try { assertTrue(c.registerToServer(GlobalConstants.IP_LOOPBACK)); } catch (Exception ex) { fail("Registration from client to server failed - " + ex); } try { ...
2ff4b326-acba-4f63-9809-fbb61184282b
1
public void updateItem(Item item){ try{ session.beginTransaction(); session.update(item); session.getTransaction().commit(); } catch(HibernateException e){ Main.getFrame().showError("A hozzáadás sikertelen volt: "+e.getMessage()); }}
9b2a9584-0494-4b7f-b073-a7fd39089a5e
5
private static int bcd(char digit) { if (digit >= '0' && digit <= '9') { return digit - '0'; } switch (digit) { case '.': return 10; case '-': return 11; case '+': return 12; default: ...
184e635e-ea89-4159-ae15-20def0a81601
6
public boolean[][] whereCanIWalk(Point in){ boolean[][] output = new boolean[widht][height]; clearVars(); lastChecked.add(in); int lock = 0; boolean running = true; while(running){ toCheck.clear(); for(Point p : lastChecked){ for(Point q : getPointsAround(p)){ doStuff(q); } } ...
735bac61-3fbc-4533-abe9-52325de2909c
5
public Stack<Labyrinth> launchGUI(File file) throws Exception { Stack<Labyrinth> labyStack = new Stack<Labyrinth>(); try ( FileInputStream fInputStream = new FileInputStream(file); ZipInputStream zInputStream = new ZipInputStream(fInputStream); ) { whi...
388e9da7-204c-4339-a1a0-26b5df6d5519
1
public void getOffenceList() { offencelist = new List("Offence List", Choice.IMPLICIT); Enumeration keys = ofl.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); offencelist.append(key + "|" + (String) ofl.get(key), null); } ...
3a8ea46b-ff52-404a-a4e2-040aa1bcb00b
4
@Override public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException { // Back Half of Tower bg1.draw(); // Draw Clouds in behind tower // TODO // Front Half of Tower bg2.draw(); // Draw Clouds In front of tower // TODO switch (screen){ case...
caf2a1cd-1a78-42a7-885d-a8c67da58b7e
2
public static InetSocketAddress getMostRecent() { if(clientRecent != null) { if(clientRecent.size() > 0) { return clientRecent.get(clientRecent.size() - 1); } } return null; }
120bcc8a-54fd-497e-b600-6759bfe15bb9
0
protected Map<String, Object> getSaveData() { Map<String, Object> mappings = new HashMap<String, Object>(); mappings.put("permissions", permissions); mappings.put("options", options); mappings.put("name", name); return mappings; }
35737254-e4e9-4e08-a9af-5e697eb8503e
9
@Test public void testDebuts() { try { compareGame = RulesParser.parse("./rules/Chess.xml"); Scanner sc = new Scanner(new File("./test/Debuts.txt")); int debutsNumber = sc.nextInt(); int xSize = 8; int ySize = 8; for (int i = 0; i < debutsNumber; ++i) { game = RulesParser.parse("./rules/...
7ae46bd9-8f8d-4689-b8db-70f979239b38
2
@Override public void remover(Cliente cliente, Funcionario funcionario) { try { conn = ConnectionFactory.getConnection(); String sql = "DELETE FROM compra where id IN (SELECT compra.id FROM compra " + " JOIN funcionario ON compra.idfuncionario = funcionario.id...
9a536f88-145f-4bc9-a7af-9c2730e9cc20
6
public void iterate(){ calculate(); if(ages){ if(active){ if(age == 0){age = 1;} else{age += 1;}}else{ age = 0;} if(fades){ if( age >= fade){ purgeState(); age = 0;}} if( age > 1023){ age = 1023; }state = agify(age);} }
33034904-6964-4250-9612-e42c69a130b0
1
@Test public void throwExceptionIfSocialBudgetItemsDoesNotContainAValidMonetaryAmountTestOne() throws Exception { List<SocialBudgetItem> socialBudgetItemsList = new ArrayList<SocialBudgetItem>(); socialBudgetItemsList.add(new SocialBudgetItem(new Date(), "Test Description #1", null)); when...
e9cb189f-f792-4615-afcd-c87e8e64d9b5
8
public static byte[] decode( final String base32 ) { int i, index, lookup, offset, digit; byte[] bytes = new byte[base32.length()*5/8]; for(i = 0, index = 0, offset = 0; i < base32.length(); i++) { lookup = base32.charAt(i) - '0'; /* Skip chars outside the looku...
1c51e027-1370-4094-8375-66f4bee217e4
9
private int[] startWith(String gram) { int[] range = {-1, -1}; int[] temp = null; int str = 0; int end = this.trigram.length - 1; while (str <= end) { int mid = (str + end) / 2; String[] grams = getGrams(this.trigram[mid]); if (grams[0].com...
6f5e49a6-e097-416c-8b12-7ca49cb3a017
1
private static boolean canConnect(Access me, Access other) { // first check for plain type compatibility if (other.getField().getType() .isAssignableFrom(me.getField().getType())) { return true; } // if this fails, let Conversions kick in. return Conversions.canConvert(me.getField().getType(), other.ge...
47ff3b74-ea5e-4b79-a863-f09ec2642e73
4
public void initialize(URL url, ResourceBundle rb) { //Create the observable data structures DVDList = FXCollections.observableArrayList(); genreList = FXCollections.observableArrayList("Action", "Drama", "Comedy", "Family", "Fantasy", "Sci-Fi"); //Load default dvd data loadGen...
a912cece-0b12-43da-baf7-2e5eb571970e
0
public CheckResultMessage checkL2(int day) { return checkReport.checkL2(day); }
2abce6ba-67b6-4ccf-91f7-cf738003a778
8
@Override public Class<?> getColumnClass(int column) { switch (column) { case ProjectTableModel.COLUMN_COLOR: return Color.class; case ProjectTableModel.COLUMN_CREATED: return Date.class; case ProjectTableModel.COLUMN_TIMEOVERALL: case ProjectTableModel.COLUMN_TIMETODAY: return Integer.class; case...
e63cad36-f3f7-44de-8cc2-d41ebcd9a9ee
9
private void consultarMultilang(String body){ String[] lenguajes = {"en", "es", "ca", "cs", "da", "de", "nl", "el", "eu", "fi", "fr", "he", "hr", "hu", "it", "ja", "ko", "no", "pl", "pt", "ru", "sv", "tr", "uk", "zh"}; boolean encontrado = false; // Me fijo en URL ...
62732667-a530-460a-a688-f218837ca907
0
public String getCognome() { return cognome; }
0300c065-45ee-4d39-93b0-c39e06db1324
0
public void setSupplierCode(int supplierCode) { this.supplierCode = supplierCode; }
dd1f32be-2d16-4199-9a96-9789f333b494
7
public CMD_Private (int length, CommandSender sender, String name, String [] args) { if (sender.hasPermission(new Permissions().publicprivate)) { if (name.equalsIgnoreCase("Console")) sender.sendMessage(ChatColor.GRAY+"You cannot set your chatroom to private because you are the console!"); else { if ...
dba7a847-fba3-455e-ac38-be9e5fc2328f
5
public void convert(String type, String code, String[] options, File file, boolean kirjKoodTied) throws IOException { if (kirjKoodTied) { PrintWriter IDOut = new PrintWriter(new FileWriter(IDfile, true)); IDOut.println(code); IDOut.close(); } for (int...
7c4b24fb-9811-498c-b37c-8c3d7e9ee09e
0
public static void main(String[] args) { System.out.println("Hello, World"); System.out.println("Programming is fun"); }
950df945-f4b1-4e18-b01b-243ff986d4d2
9
@Override protected T computeNext() { if (delegate instanceof SkippingIterator<?>) { SkippingIterator<? extends T> skippingDelegate = (SkippingIterator<? extends T>) delegate; int toSkip = 0; while (random.nextDouble() >= samplingRate) { toSkip++; } // Really, would be nicer ...
d256dddc-919c-490e-96ba-2d55a76b23fe
9
@SuppressWarnings("deprecation") public List<VineUser> searchUser(String term) throws Exception { if (this.authenticated && !TextUtil.isempty(key)) { if (!TextUtil.isempty(term)) { term = URLEncoder.encode(term); HttpResponse response = HttpUtil.get( Constants.VINE_API_SEARCH_USER.replaceAll("\\{ter...
ba4f1ce9-2564-453d-964b-d63622b47cd0
2
private String readChars ( int ln ) { byte[] b = new byte[ln]; try { fcdx.read(b,0,ln); } catch (IOException e) { e.printStackTrace(); } String s = ""; for(int i=0;i<ln;i++) s+=(char)b[i]; return s; }
809ac0ac-779c-4292-b18a-299eda58d87f
1
public void mostrarCoeficientes(){ int i = 0; for (Double coeficiente : coeficientes) { System.out.println("c" + i + " = " + coeficiente); i++; } }
715a7e92-527c-4e91-9d3a-b941ba84c52c
0
@Test public void testFacade() { Car facade1 = new Car(); Car facade2 = new Car(); assertEquals(facade1.getPosition(), facade2.getPosition()); assertEquals(facade1.isDestroyed(), false); facade1.run(); facade2.run(); facade1.collide(facade2); assertEqu...
de9f84d6-a806-488a-ad10-04d9a9ef9b66
9
@Override @SuppressWarnings("SleepWhileInLoop") public void run() { while (ModelSMSListener.isConnected()) { try { if (ModelSMSListener.isInbound()) { report = new Date() + "# Waiting for incoming sms...\n" ...
62ba9c83-41db-4b08-8e94-bb28aa94ad76
4
@SuppressWarnings("deprecation") /** * Read image */ public void readImage(String filePath) throws IOException { FileInputStream fileInputStream = new FileInputStream(filePath); DataInputStream dis = new DataInputStream(fileInputStream); // look for 4 lines (i.e.: the header) and discard them ...
5f201e8e-3676-4533-8e62-c9139e2fb91f
2
public void reset (boolean force) { if (force || !isLocked) { champion = null; championName.setText (""); setSelected (false); } }
29ad9a37-b824-4162-9ed3-d8e5898c227d
7
@Override void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) { // Replace child if(this._avalie_ == oldChild) { setAvalie((PExp) newChild); return; } for(ListIterator<PEstrCaso> i = this._estrCa...
f2b3ef27-2bd4-4cb0-b122-4c22bac1663a
4
public boolean SetRun(boolean run){ boolean test = false; if (test || m_test) { System.out.println("ConnectFourAI :: SetRun() BEGIN"); } m_running = run; if (test || m_test) { System.out.println("ConnectFourAI :: SetRun() END"); } return true; }
b4656225-9352-4142-90f9-376a3e4eaa8d
2
public void buildPrefab(int x, int y, String name) throws IOException{ String path = name; FileInputStream in = new FileInputStream(path); width = in.read(); height = in.read(); for (int i = 0; i < width; i++){ for (int j = 0; j < height; j++){ Boot.getWorldObj().getTileAtCoords(x + i, y + j).se...
dbaebaba-ec35-41cc-9574-d816cd6195e3
5
public List<Hoja> getListaHoja(){ LinkedList<Hoja> ListaHoja = new LinkedList(); Conexionbd.conexion bd = new Conexionbd.conexion(); try{ bd.conectarBase(); ResultSet rs; try { rs = bd.sentencia.executeQuery("SELECT * FROM CATEGORIA WH...
8fc87f89-33a1-4dbb-b030-d083fc682ab0
5
public void elFixer(int indice1, int indice2, int arr) { String url = "jdbc:derby://localhost:1527/PDPIVP"; String selectdatos="SELECT * FROM Rutas"; int rutatabu=0; try{ Class.forName("org.apache.derby.jdbc.ClientDriver"); //catch SQLException Connection con = DriverManager.getConnectio...
ddeb495d-9c23-4e4a-96f2-4306eaee4414
7
public void trainBernoulli() { Map<String, Cluster> trainingDataSet = readFile(trainLabelPath, trainDataPath, "training"); Map<String, Cluster> testingDataSet = readFile(testLabelPath, testDataPath, "testing"); // do testing, if the predicted class and the gold class is not equal, increment one double error ...
1e245081-9cfe-44c9-af98-2b6c42fb10ec
5
protected String makeIndentStr(int indent) { String tabSpaceString = /* (tab x 20) . (space x 20) */ "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t "; if (indent < 0) return "NEGATIVEINDENT" + indent; int tabs = indent / tabWidth; indent -= tabs * tabWidth; if (tabs <= 20 && indent <= 20) ...
0986ef1d-6ca7-4916-a66a-822749350350
8
public static void texinfoDescribeClass(Stella_Class renamed_Class, OutputStream stream) { stream.nativeStream.print("@deftp Class " + Utilities.yieldTexinfoTypeSpec(Stella_Class.classSymbol(renamed_Class))); { Surrogate renamed_Super = null; Cons iter000 = renamed_Class.classDirectSupers.theConsList; ...
bcebfbec-b9ee-491e-aeea-bf5321cf15ee
9
public static void closeConnection(Connection conn, Statement stat, ResultSet rs) { try { // 关闭结果集对象. if (rs != null && !rs.isClosed()) { rs.close(); rs = null; } } catch (SQLException e) { // 当关闭失败时,记录错误信息,并报告上层代码. throw new RuntimeException(e); } finally { try { // 关闭Statement对象. ...
1fc44e18-6574-44c3-92ce-3bc18d48b4e4
5
public void run() { // Initialisiere InfileHandler mit Dateipfad des Testdatensatz aaa InfileHandler ifh = new InfileHandler("Testdatensatz/Data.txt"); //Initialisiere OutfileHandler mit Dateipfad des Ausgabeordners OutfileHandler ofh = new OutfileHandler("result/"); ...
93cc9da8-6892-4316-b412-88aaca2ea560
4
public void loadDetailsFromClipboard() { java.awt.datatransfer.Transferable transferred = this.clipboard.getContents(null); java.awt.datatransfer.DataFlavor flavors[] = transferred.getTransferDataFlavors(); java.awt.datatransfer.DataFlavor flavor = flavors[0]; try { String content = transferred.getTransferD...
743d2db5-89c8-4cb1-9a63-096f93d5d52b
8
public int getItem(final String message) { int id; try { try { try { id = Integer.parseInt(customMessages.getString(message)); } catch (Exception e) { Material m = Material.getMaterial(customMessages.getString(message).toUpperCase()); id = m != null ? m.getId() : -1; ...
92f323e1-1b45-43b7-a3f6-720d05aeb1ea
1
public HungarianDiceSet() { for ( int dice = 0 ; dice < 16; dice ++){ addDice(6); } }
bfa54846-720e-40be-8d05-233cde473c1c
7
@Override public void onJoin(String connectionName, String host, Message m) { if(m.getNickname().equalsIgnoreCase(connection.getNick())) { if(!(m.getContent().equals(""))) { System.out.println("i am joining a channel myself."); System.out.println("Joined:"+ m.getContent()); } } else if(m.getUser...
a120cc8b-d03b-4c79-b055-1fd92b53e6d5
5
private String createNewRequest(Iterable<Map<String, String>> results) { String[] tabTest; String newRequest = new String(); ArrayList<String> listSynonyms = new ArrayList<>(); for(Map<String, String> map: results) { for(String key: map.keySet()) { ...
dce88b72-a919-4ef5-a5a4-7dc3d1f15df7
6
public Position call(){ // Word that was encountered Position encounteredWord = null; // We'll trust that the words are valid - another class should ensure to not pass null pointers int lengthToRead = position.getLength(); // Clean up the word to search word = word.trim()...
69657a49-9e46-43a9-b70b-aebaf33a2664
5
public void setDescr( String descr ) { if( cxnSp != null ) { cxnSp.setDescr( descr ); } else if( sp != null ) { sp.setDescr( descr ); } else if( pic != null ) { pic.setDescr( descr ); } else if( graphicFrame != null ) { graphicFrame.setDescr( descr ); } else if( grpSp != null ) ...
771e7248-f2e0-4721-beec-8e6e75a64d2e
8
public static CfRule parseOOXML( XmlPullParser xpp ) { HashMap<String, String> attrs = new HashMap<>(); ArrayList<String> formulas = new ArrayList<>(); try { int eventType = xpp.getEventType(); while( eventType != XmlPullParser.END_DOCUMENT ) { if( eventType == XmlPullParser.START_TAG ) { ...
7ba3bafa-0a5c-433f-b273-dc5c588a3457
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...
fec989d8-1f36-43f8-9051-29ce9202182b
2
public ArrayList<Usuarios> isValid(Usuarios user){ ArrayList<Usuarios> usuarios = new ArrayList<>(); try { PreparedStatement ps = this.mycon.prepareStatement("SELECT * FROM Usuarios WHERE codigo=?"); ps.setString(1, user.getCodigo()); ResultSet rs ...
3f535cf8-527c-4791-bc15-fcd18522ed4f
5
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
638acb09-9264-4853-9de9-7300c6e85e83
9
private void createContentPane() { if (contentPane != null) return; contentPane = new JPanel(new BorderLayout()); ActionListener okListener = new ActionListener() { public void actionPerformed(ActionEvent e) { confirm(); dialog.setVisible(false); cancel = false; } }; JPanel p = new JP...
29cf6a72-db74-40f2-9388-7e87e8d28035
6
private void scrollAction() { if (m_scrollEnabled) { Direction direction = getScrollDirection(50); if ((m_scrollTimer != null) && (m_scrollDirection != direction)) { clearScrollTimer(); } if ((direction != null) && (m_scrollTimer == null)) { ...
812a8f25-f16f-4538-8497-35dd3dc8a6a5
5
private void txtMemberIDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMemberIDActionPerformed if (txtMemberID.getText() != "") { btnEdit.setEnabled(true); try { ResultSet rs = DB.myConnection().createStatement().executeQuery("select * from members where MemberID...
c0eb765e-9b45-4dff-a449-4d5e5912cf1f
3
private void check(char[] one, char[] two) { if (one.length != two.length) { Assert.fail("length (" + one.length + " vs " + two.length + ")"); } for (int i = 0; i < one.length; i++) { if (!(one[i] == two[i])) { Assert.fail(one[i] + " vs " + two[i] + " @ "...
45859a7e-8e02-430b-b6cf-bb7ca5b8a505
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...
f61b9ada-c7ce-42db-a2f8-eca4a108af3a
1
public List<Integer> sort(List<Integer> list) { int len = list.size(); if (len < 2) return list; List<Integer> left = sort(list.subList(0, len/2)); List<Integer> right = sort(list.subList(len/2, len)); return merge(left, right); }
6f1d82a0-ec12-467b-ada6-6de2b282d888
1
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Ok")) { SimpleDateFormat format = new SimpleDateFormat("h:mm a"); Date time = (Date)spinner.getValue(); Date time2 = (Date)spinner2.getValue(); String startTime = format.format(time); String endTime = forma...
d985747e-96fb-4ab6-adee-8327fc9e3e2a
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...
1533f870-df19-42c8-a908-941b8129a31b
7
private void FileChooserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FileChooserActionPerformed myFile = FileChooser.getSelectedFile(); this.setVisible(false); try { String tmp = ""; String line= ""; BufferedReader reader; ...
e54cde38-b0ed-48d3-be17-d0bb91150c11
7
public static NXNode parse(SeekableLittleEndianAccessor slea, NXNode parent, NXFile file) { int stringId = slea.getInt(); String name = file.getString(stringId); int childCount = slea.getUShort(); int type = slea.getUShort(); //TODO: byte! //TODO: childcount should come after type, not after data! //We'll u...
2f710e1c-ef31-4ff6-ab9d-a7f5f3e22358
6
final boolean method3619(int i, boolean bool) throws IOException { anInt4551++; if ((i ^ 0xffffffff) >= -1 || i >= bufferSize) throw new IOException(); synchronized (this) { int i_6_; if ((anInt4558 ^ 0xffffffff) > (anInt4556 ^ 0xffffffff)) i_6_ = -anInt4556 + bufferSize + anInt4558; else i_6...
7f78d425-f446-45f5-9d05-68c77637a793
6
private Item getCheapestItem() { Map<Class<? extends Item>, BigDecimal> prices = new HashMap<Class<? extends Item>, BigDecimal>(); for (Class<? extends Item> genericResource : this.getActualItems()) { prices.put(genericResource, PriceCalculator.calculateItemPrice(genericResource)); ...
87fb51e0-b81a-4030-8b63-2d9c30e5b086
5
public int candy(int[] ratings) { int[] candy = new int[ratings.length]; //allocate candies, considering the minimal rating on the left candy[0] = 1; for(int i = 1; i < ratings.length; i++){ candy[i] = ratings[i] > ratings[i-1] ? candy[i-1]+1 : 1; } //modify t...
a62fc80b-c1a9-4ff0-8eed-810bc2246069
0
@Deprecated public static void main(String[] args) { DeprecatedTest test = new DeprecatedTest(); test.doSomething(); Date date = new Date(); System.out.println(date.toLocaleString()); }
95611f84-ad77-4627-b448-99d8bcde6e1a
9
public void testManyFormats() throws IOException { // Get the directory holding our test files File testFilesDir = new File(getClass().getResource(testVorbisFile).getFile()).getParentFile(); // Check each one int validFiles = 0; for (File file : testFilesDir.listFiles()) { ...
d8f2aae1-5e76-4eb4-becc-8cdd808a6a6e
6
public String getString() { char c[] = { 0, 0, 0, 0, 0, 0 }; c[0] = (nextp0 == tError) ? 0 : (char) nextp0; c[1] = (nextp1 == tError) ? 0 : (char) nextp1; c[2] = (nextp2 == tError) ? 0 : (char) nextp2; c[3] = (nextp3 == tError) ? 0 : (char) nextp3; c[4] = (nextp4 == tError) ? 0 : (char) nextp4; c[5] = (ne...
aa1b0aad-a151-4bb0-9d51-8a0403ad1a1a
6
public void checkCondition(ArrayList<OperateShape> shapes) { event = new CollisionEvent(); for (OperateShape ball : shapes) { if (ball instanceof Circle) { for (OperateShape bar : shapes) { event = new CollisionEvent(); if (bar instanceof Bar) { checkCollisionBar(ball, bar); if (isColli...
1b355e67-4a1d-4bfb-a8fb-066891e962cc
8
public static double[][] readMatrix(Path path, HamaConfiguration conf, int rows, int columns, int blockSize) { int finalRows = getBlockMultiple(rows, blockSize); int finalCols = getBlockMultiple(columns, blockSize); double[][] matrix = new double[finalRows][finalCols]; SequenceFile.Reader reader = null; ...
c6697f40-138c-4e8f-a0ba-9d380fbc0120
4
public XYLocation getKingLocation(String color) { for (int i = 0; i < rowBoard; i++) for (int j = 0; j < colBoard; j++) if (getValue(i,j) instanceof King && getValue(i,j).getColor().equals(color)) return new XYLocation(i,j); return null; }
3eeee7c7-9c5c-4c7a-a35c-51120728e673
7
@Override public boolean equals(Object o) { if (o == this) return true; if (o instanceof Pair) { @SuppressWarnings("rawtypes") final Pair p = (Pair) o; return ((p.first == first) || ((p.first != null) && (p.first.equals(first)))) && ((p.second == second) || ((p.second != null) && (p.second.equals(se...
00c40170-6a73-4b14-b71d-3503e8f7abb9
7
public void startJobProcessing() { try { // config cmdArgs LOGGER.info("configure CmdArgs"); this.availiableCmdLineOptions = this.genAvailiableCmdLineOptions(); // parse cmdArgs LOGGER.info("parse CmdArgs"); this.cmdLine = this.genCommandL...
32051d37-2a8e-43ac-8ee9-0161077f5fce
1
public void deleteProject(String projectID) { Project prj = manager.find(Project.class, projectID); if (prj != null) { manager.remove(prj); } }
bd77ed9f-5468-4f14-b2ff-e28dbba4b141
7
@Override public void loop() { switch (step) { case 0: if(Motors.movement.isMoving()){ if(Motors.tsf.isPressed()){ Motors.movement.backward(); reset(); step++; } } else{ Motors.movement.forward(); } break; case 1: if (delta()>400){ Motors.movement.stop(); Mo...
5da40b15-7dab-4686-8efd-758e47e15c49
9
@Override public Parameter getParameter(final int parameterIndex) { Parameter parameter; switch (parameterIndex) { case 0: case 1: parameter = super.getParameter(parameterIndex); break; case 2: parameter = time; ...
242a5b64-9bbd-4775-92de-2a708458ef8b
2
private ArrayList<Attribut> getAllAttribut(String Declaration) { ArrayList<Attribut> ArrayAttribute = new ArrayList(); String AttToken =""; Declaration = Declaration.trim(); StringTokenizer st = new StringTokenizer(Declaration, ","); while(st.hasMoreTokens()){ AttToken = st.nextToken(); int i = 0; St...
444432e8-7316-42b0-b8b2-55cbddb33b0d
4
public void act() { // spawn ships random if(Greenfoot.getRandomNumber(10000) < 10) { addObject(new ship1(), Greenfoot.getRandomNumber(900),0); } if(Greenfoot.getRandomNumber(10000) < 10) { addObject(new ship2(), Greenfoot.getRando...
07a7b439-1a79-46cf-a266-b7bb905fff5c
4
void doHigher() { if (gameInProgress == false) { // If the game has ended, it was an error to click "Higher", // So set up an error message and abort processing. message = "Apasa \"Joc nou\" pentru a incepe!"; repaint(); return; } ha...