method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9dbb43c4-3dfc-4dcc-bbd6-8764f8ce681a
2
public JokerScherm(final SpeelScherm speelscherm, final Spel spel) { setBackground(new Color(0, 0, 0, 150)); setBounds(0, 0, 800, 600); setLayout(new MigLayout("", "[grow][530,center][grow]", "[grow][200px,center][grow]")); JPanel panel = JPanelFactory.createBackgroundJPanel(); add(panel, "cell 1 1,grow"); ...
65ebae4e-19fc-4949-8d0d-31b1d9e8825d
5
public Main() { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { try { UIManager.setLookAndFeel(info.getClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e...
bf50bdd0-476e-4bdd-8adc-69b7e6a0f6df
6
public static String downloadStringResource(HttpURLConnection connection) { StringBuffer content; InputStream inputstream = getSafeInputStream(connection); if (inputstream == null) { return null; } // load the Stream in a StringBuffer // Check encoding ...
9fa1c110-5010-42b5-b602-64e0d98131a1
9
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String args[]) { if(cmd.getName().equalsIgnoreCase("freeze")) { if(args.length < 1) { sender.sendMessage(new StringBuilder(pre).append("Please specify a player you would like to freeze!").toString()); return true; } ...
c176c6d3-3527-4a67-a787-448651cb10b0
0
public void setFname(String fname) { this.fname = fname; }
0f282fed-b61d-4a1a-9731-ec1ca5e90301
4
@Override public void onCollide(CollisionBox tempBox) { if(tempBox.getCollisionType() == CollisionType.PLAYER) { if(biteWait == 0) { int tempH = GameCore.spawnEngine.getPlayer().currentHealth - 1; GameCore.spawnEngine.getPlayer().setCurrentHealth(tempH); biteWait++; } if(biteWait == 15) ...
ddec295c-548e-4d67-a41e-7e668978e3b5
4
public void setHSBColor(int row, int col, double hue, double saturation, double brightness) { if (row >=0 && row < rows && col >= 0 && col < columns) { grid[row][col] = makeHSBColor(hue,saturation,brightness); drawSquare(row,col); } }
13f367de-2abc-4be1-af71-0fb4d9059429
9
protected void cleanFiles() throws Exception { final Logger log = log(); if (null == epoch) { log.fine("Epoch is not set, cleanup skipped"); return; } Manager db = getDb(); PathFilter filter; try { filter = getEffectiveFilter(); } catch (IOException invalid) { throw new RuntimeExcepti...
85be2ccb-c436-44f1-be9d-5ff6415ace98
3
public int minMaxIndexLookback( int optInTimePeriod ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 30; else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) ) return -1; return (optInTimePeriod-1); }
a7863b1e-5757-43af-b559-5c30c313b648
9
private ExtendedPolygon[] convertWorldToScreen2(GameObject that, int width, int height) { ExtendedPolygon[] poly = new ExtendedPolygon[3]; double[][][] faces = that.getBounds().getFaces(); double[][] faceX; double[][] faceY; double[][] faceZ; Color xFaceColor; Color yFaceColor; Color zFaceColor; /...
dea919b5-1491-4929-af0f-a471bac5de93
1
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; }
fc3c4a4f-0b80-4996-9278-cee72808b8fa
1
public ResultSet getAllProcessorsOfType(int processorType) { ResultSet res = null; try{ String query = "SELECT * FROM processor_types WHERE processorBrandID=?"; stmnt = CONN.prepareStatement(query); // Bind Parameters stmnt.setInt(1, processorType); res = stmnt.executeQuery(); } catch ...
b02207cf-3eb8-4379-8e8c-bbf477fc6cd3
3
@Override public void deserialize(Buffer buf) { mapId = buf.readInt(); int limit = buf.readUShort(); npcsIdsWithQuest = new int[limit]; for (int i = 0; i < limit; i++) { npcsIdsWithQuest[i] = buf.readInt(); } limit = buf.readUShort(); questFlags = ...
af366265-9c1f-48f2-ae02-66d57bbc7991
3
@Override public void onCombatTick(int x, int y, Game game) { List<Entity> neighbors = ((SinglePlayerGame) game) .getSquareNeighbors(x, y, 1); for (Entity neighbor : neighbors) { if (neighbor.id == EntityType.archer.id) { ((MortalEntity) neighbor).damage(1...
ff162aa0-305a-4a33-9304-0534300b53d0
3
public ReturnObject remove(int index) { ReturnObjectImpl returnValue = new ReturnObjectImpl(); if (index < 0 || index >= size()) { returnValue.value = ErrorMessage.INDEX_OUT_OF_BOUNDS; return returnValue; } for (int i = index; i < size(); i++) { array[i] = array[i + 1]; } return null; }
d008c043-7e10-4740-8e2d-881226778c91
2
public static void toggleWordWrap(IEditorPart editor) { if (editor == null) { return; } // editor (IEditorPart) adapter returns StyledText Object text = editor.getAdapter(Control.class); if (text instanceof StyledText) { StyledText styledText = (StyledTex...
dd07e12e-83e6-4ea6-88e5-bd2ab64588b2
6
private void initializeQueryPropertiesNew() { synchronized (defaultQueryProperties) { defaultQueryProperties.clear(); try { final InferenceParameterDescriptions desc = DefaultInferenceParameterDescriptions.loadInferenceParameterDescriptions(this, 10000); final InferenceParameters default...
2bffb86e-40da-4eaf-98f4-c3e5ba28cae5
3
public RetCode RestoreCandleDefaultSettings( CandleSettingType settingType) { int i; if (settingType.ordinal() > CandleSettingType.AllCandleSettings .ordinal()) return RetCode.BadParam; if (settingType == CandleSettingType.AllCandleSettings) { for (i = 0; i < CandleSet...
a05faf08-24ab-4daf-b053-f6ac67c75cb4
2
public boolean IDscanner(int trackingNumber){ int loop; for (loop = 0; loop < enemiesPresent.size(); loop++){ if (enemiesPresent.get(loop).getID() == trackingNumber){ return true; } } return false; }
dcfcebbd-de42-46b6-80c9-b7c0a64b6b5f
1
private static void checkFA(Object fa, Object o, String field) { if (fa == null) { throw new ComponentException("No such field '" + o.getClass().getCanonicalName() + "." + field + "'"); } }
e7a32701-8617-49df-9a9c-84576ab8cbbe
9
public void actionPerformed(ActionEvent ae) { if(ae.getSource() == jRegisterPanel.getCancelButton()) { setVisible(false); jLoginFrame.setVisible(true); dispose(); } else if (ae.getSource() == jRegisterPanel.getRegisterButton()) { String szEmail = jRegist...
9a97ab7e-4fc5-4682-b8b8-20de44139711
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SondageReponse other = (SondageReponse) obj; if (this.id != other.id) { return false; ...
a6f86063-4f4e-4c63-9874-f14f0de6120e
1
private static void run(String sourceName, InputStream in, ImageInfo imageInfo, boolean verbose) { imageInfo.setInput(in); imageInfo.setDetermineImageNumber(true); imageInfo.setCollectComments(verbose); if (imageInfo.check()) { print(sourceName, imageInfo, verbose); } }
1684d2d6-7096-4630-9e76-3f420e7755c0
4
int guessPoleIndex(int poleCellId) { if (alreadyIncludes(poleCellId)) { return cellIds.indexOf(poleCellId); } int cenRow = getCenterRow(); int cenCellId = cellIds.get(getCenterIndex()); int cellsToPole = mesh.getDistanceInCells(poleCellId, cenCellId); int pole...
45bbca1d-e633-4149-82b7-5fe815d0ccbd
0
public double getEccentricity() { return Math.sqrt(1 - b * b / a * a); }
e2418b5a-1901-4898-b0f6-dab41fb74ff2
4
public Mask multiplyBy(Mask mask) { if (this.getWidth() != mask.getHeight()) { throw new IllegalArgumentException("Incompatible matrix"); } Mask result = new Mask(this.getHeight(), mask.getWidth()); for (int i = -1 * this.getHeight() / 2; i <= this.getHeight() / 2; i++) { for (int j = -1 * mask.getWidth(...
4ad0db64-3110-4b38-865d-5b6531c6da1e
1
private void write(BufferedWriter out) { StringBuffer sb = new StringBuffer(); sb.append("db." + JSONWriter.COLLECTION_NAME + ".insert({"); sb.append("stationId: \"" + _stationId + "\""); sb.append(", stationName: \"" + Stations.getName(_stationId) + "\""); sb.append(", latitude: \"" + Stations.ge...
878a57e4-8e16-48fc-b51b-351a83c77bef
7
protected void readCommentHeader() throws Exception { readOggHeader(); byte[] headerTest = new byte[7]; // unfortunately we need to look for the vorbis header do { raf.read(headerTest); raf.seek(raf.getFilePointer() - 6); } while (headerTest[0] != 0x03 && // comment header id...
f26a29a6-20f9-486c-8ad6-359a9fdb23f8
4
private void appendFrameTypes( final boolean local, final int n, final Object[] types) { for (int i = 0; i < n; ++i) { Object type = types[i]; AttributesImpl attrs = new AttributesImpl(); if (type instanceof String) { attrs.addAttri...
2e50b7f1-c327-4e89-84ec-df4f5b741e62
4
public static void countChar(String string) { if (string == null || string.isEmpty()) { System.out.println("Null or empty"); return; } for (int i = 0; i < string.length(); i++) { char asd = string.charAt(i); if (treeMap.get(asd) == null){ ...
efa6dc01-5051-4769-8c80-b75256abb854
4
public static int getDashboardTensionUnit() throws ClassNotFoundException { int weightUnit = 0; try{ //Class derbyClass = RMIClassLoader.loadClass("lib/", "derby.jar"); Class.forName(driverName); Class.forName(clientDriverName); }catch(java.lang.ClassNotFoundE...
16203dc8-9628-4565-a4eb-e2ad4c2fcafc
2
public static void main(String[] args) { try { Logger.getAnonymousLogger().info("Starting."); final CycAccess cycAccess = new CycAccess("public1.cyc.com", 3600); Logger.getAnonymousLogger().info("Connected to: " + cycAccess.getHostName() + ":" + cycAccess.getBasePort()); // cycAccess.tr...
1b2b8ed0-a796-4a03-8b75-9a1d92201ef5
2
private static DecimalImpl mulInt(final long d1Base, final long d2Base, final int d2Factor) { final long d1_1 = d1Base / MUL_COMPONENT; final long d1_2 = d1Base % MUL_COMPONENT; final long d2_1 = d2Base / MUL_COMPONENT; final long d2_2 = d2Base % MUL_COMPONENT; final long r11 = d1_1 * d2_1; final long r12 = d1_...
4cc8ecd2-65f4-4181-9bed-d294640f048b
2
@Override public List<Object> getAll(int gameID){ XStream xStream = new XStream(new DomDriver()); List<Object> model=new ArrayList<Object>(); Object temp=null; Statement stmt=null; try { stmt = db.getConnection().createStatement(); ResultSet rs = stmt.executeQuery("SELECT command FROM MoveCommand where...
96d89d3b-0e0f-40df-998d-f6a2e788c688
5
public boolean bateCom(Aula aula2) { if(this.diaDaSemana != aula2.getDiaDaSemana()){ return false; } Periodo p1 = this.getPeriodo(); Periodo p2 = aula2.getPeriodo(); if((p1.getLimiteSuperior().after(p2.getLimiteInferior()) && p1.getLimiteSup...
524a5d28-5c62-4c5a-a76f-dfd9f71815e5
7
public byte[] handleRequest(byte[] request) { try { String req = Utils.byteToString(request); if (req.startsWith(HEARTBEAT_COMMAND)) { req = req .substring((HEARTBEAT_COMMAND + COMMAND_PARAM_SEPARATOR) .length()); logger.info(myInfo + " recieved heartbeat ping with server list " + re...
d331985e-107d-444b-ade3-297d36e3cfb0
2
Map<String, ArrayList<ArrayList<String>>> datasOfClass(ArrayList<ArrayList<String>> datas){ Map<String, ArrayList<ArrayList<String>>> map = new HashMap<String, ArrayList<ArrayList<String>>>(); ArrayList<String> t; String c; for (ArrayList<String> data : datas) { t = data; ...
9ae26036-e6a1-4d1a-b45d-741c03c5f896
8
private void setConfigFile(String conf) throws FileNotFoundException, IOException { this.configFile = conf; File f = new File(configFile); if (!f.exists()) { return; } try { BufferedReader reader = new BufferedReader(new FileReader(f)); StringBuilder stringBuilder = new StringBuilder(); String ...
cb2dbade-19ae-4558-b71f-4aa94b231b28
2
public double[] rawItemMeans(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.rawItemMeans; }
b17b016a-ddb2-456f-b2cb-38c102f8a915
6
public static Boolean CheckMapsize(int players, int mapsize) { if ((mapsize > 50) || (mapsize <= 0)) { System.out.println("Invalid Map Size"); return false; } else { if (players >= 2 && players <= 4) { if (mapsize < 5) { System.out .println("Minimum size of map for the number of players is...
88b2e29f-4c88-410c-a5c3-e30c4f8a5d76
1
public void keyPressed(KeyEvent e) { if (stage != null) { stage.keyPressed(e); } }
9f92901f-6ef7-4949-ad55-925b60e7cdb7
1
public boolean rateReview(String isbn, String reviewer, int score) throws SQLException { if (reviewer.equals(username)) { return false; } LinkedList<String> columns = new LinkedList<String>(); LinkedList<String> values = new LinkedList<String>(); columns.add("ISBN"); ...
2af5c05a-809f-4a24-aeef-55f1acaee4a3
2
private static void postQueryCleanup(Connection c, Statement st, ResultSet rs) { try { if(rs != null) { rs.close(); st.close(); c.close(); } } catch(Exception e) { Actions.addAction(new Action(ActionType.WARNING, "Unable to close Database connections " + "post query.")); } }
2b88b219-46f3-44e3-a89f-76d81cc2f97d
6
private String getServerSetting(String tagName) { String val = ""; // try { NodeList nodeList = m_root.getElementsByTagName( "MyServer" ); if ( nodeList == null ) { return val; } Element child = (Element)nodeList.item(0); NodeList childNodeList = child.getElementsByTagName( tagName ); Element c...
f6b1f79b-93a0-4030-8327-1e6e438fcddf
0
@Override public Object clone() { return this; }
f81bd3b1-28a9-4b10-a047-67ebb45e9028
7
public boolean canImportTransferable(DataFlavor[] transferFlavors) { boolean result = false; for (DataFlavor df:transferFlavors) { if (DataFlavor.javaFileListFlavor.equals(df) || DataFlavor.imageFlavor.equals(df) || (urlListDataFlavor != null && urlListDataFlavor.equals(df)) ) { result = true; ...
bbbd681e-e09d-4cab-ae8e-9526166c8825
1
private void renderThings(Graphics2D g){ g.clearRect(0,0,screenWidth,screenHeight); //render field g.setColor(Color.WHITE); //The base measurement g.fillRect(worldXToScreen(1000), worldYToScreen(4000), (int)(4000*screenXFactor), (int)(2000*screenYFactor)); //entity draw loop for(int i=0; i<pla...
eadec721-0fe4-48ae-a6ca-0b8110fc9016
4
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dateOfBirth == null) ? 0 : dateOfBirth.hashCode()); result = prime * result + ((firstName == null) ? 0 : firstName.hashCode()); result = prime * result + ((lastName == null) ? 0 : lastName.hashCode...
34f47177-d7c1-4043-b312-83797ca5a3a8
0
private void setData() { ArrayList<String> list = campaignRef.getSettings(); background1Field.setText(list.get(0)); background2Field.setText(list.get(1)); background3Field.setText(list.get(2)); logoField.setText(list.get(3)); buttonField.setText(list.get(4)); }
ab666ec8-abe4-44f5-a72a-7ae37dfbd239
8
public boolean searchForPyro() { // look for a Pyro in the same Room Pyro target_pyro = null; double smallest_angle_to_pyro = Math.PI; for (Pyro pyro : current_room.getPyros()) { if (pyro.isVisible()) { double abs_angle_to_pyro = Math.abs(MapUtils.angleTo(bound_object, pyro)); if (...
51c4d8fd-0073-4c29-afbd-92f853d182d0
1
public int onEnd() { if(log.isLoggable(Logger.WARNING)) log.log(Logger.WARNING, "onEnd"); return transition; }
5abfb047-a03b-4e7f-8cf4-7073fe7a1e1c
8
private void balanceOut(){ int balance = hoehe(rechts) - hoehe(links); assert (balance <= 2); assert (balance >= -2); if (balance == -2) { int ll = (links.links == null) ? 0 : links.links.hoehe; int lr = (links.rechts == null) ? 0 : links.rechts.hoehe; if (ll >= lr) // >= ?? rechtsRotation()...
f93f6b57-ac1b-4ee5-8051-3bb8099ce95e
4
public void body() { initializeResultsFile(); createGridlet(super.get_id(), NUM_GRIDLETS); // schedule the initial sending of gridlets. // The sending will start in a ramdom time within 5 min Random random = new Random(); int init_time = random.nextInt(5*60); ...
7017406b-fc4a-47b6-84d8-74f751cc7ba6
0
public void setAgencia(String ag) { this.agencia = ag ; }
6732bbcc-d58d-4123-88c4-f0c41ac7dab5
2
private JPanel createMatrixPanel() { JPanel panel = new JPanel(); for (int i = 0; i < bMatrix.length; i++) { for (int j = 0; j < bMatrix[0].length; j++) { panel.add(bMatrix[i][j]); } } return panel; }
39db61af-07b5-4306-a75f-d4fd21a319da
0
public void insert(TestBean bean) { jdbcTemplate.update("insert into TEST VALUES ( ?, ? )", bean.getId(), bean.getName()); }
b5ebbb58-9786-4d2f-827e-8a2f8431dafa
8
public static void main(String [] args) { ExperimentDao experimentDao = new JpaExperimentDao(); // ExperimentDataStore cache = new RedisABSeeCache(); ExperimentDataStore cache = new MemcachedExperimentDataStore(); // ExperimentDataStore cache = new HashMapABSeeCache(); cache.flush(); // Clear down from previous...
1312ee48-0510-4571-b691-0ae556a8939f
5
public void copyFile(String copyFrom,String copyTo){ File file1 = new File(copyFrom); File file2 = new File(copyTo); try { if(!file1.exists()){ throw new SecurityException(); } if(file2.exists()){ System.out.println("The file yo...
f24d45f2-b71b-473d-adcb-672f4cbb8a65
1
public boolean add(Libros l){ PreparedStatement ps; try { ps = mycon.prepareStatement("INSERT INTO Libros VALUES(?,?,?,?,?,?)"); ps.setString(1, l.getCodigolibro()); ps.setString(2, l.getNombrelibro()); ps.setString(3, l.getTitulolibro()); ps.s...
7cea10af-a275-42b6-a60a-26f31f45fbbf
8
public static void main(String[] args) { String[] texts = new String[] { "kiedy xP x-D :-D :( :(((( ;)kierowca samochodu stracił panowanie? :) I Ci ludzie ciągle piją do wszystkich, że nie chcą ich przepuszczać na skrzyżowaniach, że kierowcy samochodów nie chcą wjeżdżać na chodniki, aby przepuścić przepychającego...
0b475cf8-d571-4471-a1c1-130dceb92a3e
9
public void updateLabels(Label l, ArrayList<String> labels) throws RollbackException { for(String s : labels) { if(s.equals("funny")) l.setFunny(l.getFunny() + 1); else if(s.equals("cute")) l.setCute(l.getCute() + 1); else if(s.equals("animal")) l.setAnimal(l.getAnimal() + 1); else if(s.equals...
b8d9e18b-02ac-444e-ba91-16b519dff321
1
private void doIndex() throws IOException { for (int i = 0; i < files.size(); i++) { InputStream is = files.get(i); String s = new BufferedReader(new InputStreamReader(is)).readLine(); tokenize(s, i); } }
e823757d-cad7-4dca-8094-9032899e4970
5
protected ModReader(){ try { unimodController = new UnimodDataAccessController(unimodUrl); psiModController = new PSIModDataAccessController(psiModUrl); prideModController = new PRIDEModDataAccessController(prideModdUrl); } catch (Exception e) { String msg...
2d63fff3-6ada-4e94-aabe-0b131c9680ff
2
private void loadChidren() { Iterable<T> iterable = _selector.select(_ancestor); if(iterable != null) { _children = iterable.iterator(); if(_children.hasNext()) { _childIterator = new FlatternerIterator<T>(_children.next(), this._selector); _state = 1; } else { _state ...
63855df4-630c-4c76-b960-f14e4ca2c3d7
7
public Warrior(Grid g, Patch p) { super(g, p); setFriendly(true); setMove(3); setRange(0); setHealth(100); setShield(5); setDamage(20); setMaxHealth(110); try { getStates().add(ImageIO.read(new File("res/Warrior/Warrior.gif"))); } catch (IOException e) { } try { getStates().add(ImageIO.re...
c9b19a55-7dfc-4ab1-a3b7-8c995662f7b5
4
public void sql_add_account() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver").newInstance(); Statement s = GUI.con.createStatement(); //CHANGE FUNCTIONS DEPENDING ON HIERARCHY if(GUI.Level == 1) { s.executeUpdate ("INSERT...
1d1bb1f3-7465-44a9-8f47-88839fa9c590
1
public void startWorkers (int workersNum) { for (int i = 0; i < workersNum; ++i) { Worker worker = new Worker(this, i); workers.add(worker); (new Thread(worker)).start(); } }
80d33bac-e71c-4d7b-b1e1-239df5a6c082
4
public static List<Interval> merge(List<Interval> intervals) { Collections.sort(intervals, new Comparator<Interval>() { @Override public int compare(Interval o1, Interval o2) { // TODO Auto-generated method stub return o1.start-o2.start; } }); for (int i = 0; i < intervals.size() - 1; i++) { ...
1090e4db-ea57-4c17-b798-bfd99ca5995a
6
public static void zeigeBmiAn (double bmi) { // Ausgabe System.out.print("Der BMI ist: " + bmi + ", dass ist "); // mit Zusatzinfo if(bmi < 20){ System.out.println("Untergewicht"); } else if(bmi >= 20 && bmi <= 24){ System.out.println("Idealgewicht"); } else if(bmi >= 25 && bmi <= 30){ Sy...
38f87c3d-c4ab-4fcf-86d5-e532e7f26a5f
4
public void deleteDupNodeInPlace(ListNode head){ if(head == null) return; ListNode current = head; while(current != null){ ListNode runner = current; while(runner.next!=null){ if(current.val == runner.next.val) runner.next = runner.ne...
571791f6-92d9-4cb9-9411-93affd26d422
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (hashCode() == o.hashCode()) return true; NaturalSatellite that = (NaturalSatellite) o; if (population != that.population) return false; ...
4d49b550-588f-40cd-a9dd-2eb86b0c39d5
1
public boolean isLeaf() { return (this.fDroit == null && this.fGauche == null); }
851970fb-e4af-42a3-bce3-0b2cfadcd994
4
public MethodVisitor visitMethod( final int access, final String name, final String desc, final String signature, final String[] exceptions) { buf.setLength(0); buf.append("{\n"); buf.append("mv = cw.visitMethod("); appendAccess(access); ...
9da7bb4c-e065-40f4-a1e1-548f249b3974
2
public static ArrayList<Question> getQuestionsByQuizID(int quizID) { ArrayList<Question> questionList = new ArrayList<Question>(); try { String statement = new String("SELECT * FROM " + DBTable + " WHERE quizid = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, qui...
485fc822-6ef6-41e9-a5b7-b59154cf9222
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ElementScore elementScore = (ElementScore) o; if (element != null ? !element.equals(elementScore.element) : elementScore.element != null) return false;...
b9127648-8e36-42fe-9c67-9817a496614d
0
@Id @Column(name = "PCA_GENERICO") public Integer getPcaGenerico() { return pcaGenerico; }
b015bb40-7eaf-4e1c-8120-2b4b2cfb4261
7
public void paint1(Graphics g) { //g.drawImage(introImagen, 0, 0, this); g.drawImage(background, 8, 30, this); g.setFont(new Font("Serif", Font.BOLD, 34)); g.drawString("Score: " + score, 44, 195); g.setColor(Color.red); g.drawString("Vidas: " + vidas, 44, 250); ...
a679eb81-9345-48ca-a2ed-4e743829f845
4
@Test public void test_insertions() { int m = 3; int n = 5; Matrix m1 = new MatrixList(m, n); for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) m1.insert(i, j, (double) (i * j)); } for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) assertEquals(m1.get(i, j), (double) (i *...
6454681a-6dc4-4f77-b8b5-64cc23ea4fe2
5
private void subledger2(ArrayList<ArrayList> arrayL) throws SQLException { String query3; this.getORDTLID(); System.out.println("sub2 size "+arrayL.size()); Statement stmt = null; this.connect(); conn = this.getConnection(); stmt = conn.createStatement(); ...
82e62d86-7afe-4a4b-ba9d-1ae24c7a7084
7
public void actionPerformed(ActionEvent e) { System.out.println(e.getActionCommand() + " pressed."); if (e.getActionCommand() == "BOXSELECT") { boxSelect(); } else if (e.getActionCommand() == "BRUSH") { brush(); } else if (e.getActionCommand() == "ERASER") { eraser(); } else if (e.getActionComm...
e607c466-3700-4e37-8167-7be4c6bb2c58
0
public void addChangeListener(ChangeListener listener) { changeListeners.add(listener); }
0c9bf9a8-7fac-483a-beef-3106c034695f
9
public int ladderLength(String beginWord, String endWord, Set<String> wordList) { Set<String> beginSet = new HashSet<String>(); Set<String> endSet = new HashSet<String>(); int len = 1; HashSet<String> visited = new HashSet<String>(); beginSet.add(beginWord); endSet.add(endWord); while (!beginSet....
0802b16b-c23c-4e7b-b456-f19a5f357043
6
private final int getHpFilter() { int[] hps = { 0, 1000, 5000, 10000, 20000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000, 600000, 700000, 800000, 900000, 1000000, 1200000, 1400000, 1600000, 1800000, 2000000, 2250000, 2500000, 2750000, 3000000, 3500000, 4000000, 450000...
7cae7b68-f185-4c84-88ac-401caf7a0c79
8
protected void paintButtonPressed(Graphics g, AbstractButton b) { boolean divider = b.getName() == null ? false : b.getName().equals("dividerButton"); if(divider) { return; } int lenText = b.getFontMetrics(b.getFont()).stringWidth(b.getText() == null ? "" : b.getText()); int star...
e6dbda70-67e9-426c-a2f4-7055bac7e162
5
public boolean move(){ int x =getPlayerposX(); int y=getPlayerposY(); boolean hite = false; System.out.println(x); if (x<=x+1&&x>=x-1&&x==x){ System.out.println("estoy aqui dentro de los margenes"); if(y>=y+1&&y>=y-1){ System.out.println("estoy aqui dentro de los margenes"); hite=true; } }...
1baae296-aa26-4303-af8a-54827abb2ccc
8
static boolean isCongruent(Class<?>[] params, Object[] args){ boolean ret = false; if(args == null) return params.length == 0; if(params.length == args.length){ ret = true; for(int i = 0; ret && i < params.length; i++){ Object arg = args[i]; Class<?> argType = (arg == null)...
3f2ca5ff-634d-4051-947b-fe32cfa4090b
5
private void mc(int itr) { List<P> wybrane = new ArrayList<P>(); Random r = new Random(); P wybrane_n = new P(); for (int i = 0; i < this.tabSizeX; i++) { for (int j = 0; j < this.tabSizeY; j++) { //if ( this.naGranicy(i, j) ) continue; // nie biez pod uwage gotowych ziaren wybrane.clear(); i...
4ead9cea-cfb1-4140-9565-d390fa02dce6
7
public static void recv(String provider, String server, String user, String password) { Store store = null; Folder folder = null; try { // -- Get hold of the default session -- Properties props = System.getProperties(); Session session = Session.getDefaultInstance(props, null); // -- Get hold of...
4e6ef4d3-d49c-4abe-869d-ac91477585db
7
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...
07429e7a-2583-46e3-863c-3090787f63a7
5
public double[][] cholesky(double[][] matriz) { double temp[][] = new double[linhas][colunas]; for (int i = 0; i < linhas; i++) { for (int j = 0; j <= i; j++) { double soma = 0.0; for (int k = 0; k < j; k++) { soma += temp[i][k] * temp[j][...
cafd508c-fe48-4e93-badf-fc34858fead9
0
public static void send(String message){ }
365dd69d-c138-4ee3-9604-eac312d26988
6
public static void main(String[] args) { IMamifer mamifer1 = new AnimalSalbatic("leu", false, 5); IMamifer mamifer2 = new AnimalDomestic("vaca", true, "Andrei"); Animale animal1 = new AnimalSalbatic("zebra", false, 0); AnimalSalbatic salbatic = new AnimalSalbatic("hiena", false, 2); ...
92aa8db8-5332-4c45-9060-57b68c2ddd0b
2
public void add_bits (int bitstring, int length) { int bitmask = 1 << (length - 1); do if (((crc & 0x8000) == 0) ^ ((bitstring & bitmask) == 0 )) { crc <<= 1; crc ^= polynomial; } else crc <<= 1; while ((bitmask >>>= 1) != 0); }
1517c34c-ddd3-458f-af63-22ebed956fe3
1
private int lengthOfCurrentString() { int i = 0; while (bytes[streamPosition + i] != 0) { i++; } return i; }
646a4753-0927-4ea9-9b7b-f7d2a678ff8d
5
public void updateGroup(Group f) { if (groups == null) { updateGroups(); } //save changes to db MongoHelper.save(f, MongoHelper.GROUP_COLLECTION); if (!user.getGroups().contains(f.getId())) { //user doesn't have the group yet user.addGroup(f.g...
6d7f2bc7-bf79-44c3-9340-2e3d5ac6c9ec
7
public boolean mouseDrag (Event event, int x, int y) { boolean firstDrag = false; if (!dragged) { if (x > dragStart.x+dragThreshhold || x < dragStart.x-dragThreshhold || y > dragStart.y+dragThreshhold || y < dragStart.y-dragThreshhold) { dragged = true; firstDrag = true; }...
8d3427a1-357f-42e1-9d31-169b6f0ad8b1
7
public N getCeilingNode(T payload) { N p = m_root; while (p != null) { int cmp = compare(payload, p.getPayload()); if (cmp < 0) { if (p.getLeft() != null) p = p.getLeft(); else return p; } else if (cmp > 0) { if (p.getRight() ...
30448abd-0147-4248-80f2-ef3579e56beb
5
private JMenu getBoardsMenu() { //add List of Boards final JMenu boards = new JMenu("Board(s)"); //clicking the new board button brings up the new board dialog JMenuItem newBoardButton = new JMenuItem("New Board"); boards.add(newBoardButton); newBoardButton.addActi...
72765058-89b1-431e-9346-35e1e1e365aa
6
private void recursiveDelete(File file) { if (file == null || !file.exists()) { return; } if (file.isDirectory()) { File[] files = file.listFiles(); if (files == null || files.length == 0) { return; } for (File f : files...
0263c411-c128-4cd9-bcd9-586cff087fce
8
public void checks() { if (Mouse.isButtonDown(0)) { Vector3D vector = new Vector3D(0, 0, 0); vector.y = ((float) -Math.sin(Math.toRadians(camera.pitch))); float v = (float) Math.cos(Math.toRadians(camera.pitch)); vector.x = ((float) (Math.sin(Math.toRadians(camera...