method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d8b0d1fb-53fa-41c6-8c1a-db9275cc5004
8
@Override public int castingQuality(MOB mob, Physical target) { if((mob!=null)&&(target!=null)) { if(CMLib.flags().isSleeping(mob)) return Ability.QUALITY_INDIFFERENT; if(!CMLib.flags().isAliveAwakeMobileUnbound(mob,false)) return Ability.QUALITY_INDIFFERENT; final Item cloth=CMLib.materials().fi...
a3b9365e-4d21-41c6-940b-2bddd0b26d83
7
private Object readDelimitedField()throws IOException,EOR{ //read starting delimiter int i=reader.read(); if(i!=delimiter){//fail reader.unread(i); throw new EOR(); } //Inside the field ... boolean inside=true; StringBuilder builder=new StringBuilder(); while(inside){ i=reader.read(); if(i...
f178be1b-5b34-41b3-b033-8d0bc67249dd
8
public void run() { try { boolean eos = false; while (!eos) { OggPage op = OggPage.create(source); synchronized (drainLock) { int listSize = pageOffsets.size(); long pos = listSize > 0 ? ...
7a06c565-5c3c-42ee-82f9-1e618205ff75
3
public void run() { try { this.MPrio.acquire(); this.MReading.acquire(); this.MPrioR.acquire(); if(this.counter == 0) this.MWriting.acquire(); this.counter++; this.MPrioR.release(); this.MReading.release(); this.MPrio.release(); System.out.println("Lecture"); ...
0ec3f665-8be8-429b-af19-58f1a9209060
9
private static Map<String, RectBound> prepareGrid(Document iDoc) throws Exception { Map<String, RectBound> map = new HashMap<String, RectBound>(); Node iSvg = iDoc.getChildNodes().item(1); Node iG = iSvg.getChildNodes().item(3); NodeList childNodes = iG.getChildNodes(); for (int i = 0; i < childNo...
dfa6545c-6d70-4b74-8fc6-b404da8cfff5
9
private String BoardPiece(int i, int j) { assert(i>0 && i<rows && j>0 && j< cols); String str = new String(); if(this.cell[i][j] == CellEntry.inValid){ str = " "; } else if(this.cell[i][j] == CellEntry.empty){ str = " _ "; } ...
818fbc56-6d8b-42f1-bab2-b61072551fd1
5
private void list_movesMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_list_movesMousePressed current_move=null; current_frame=null; current_hitbox=null; hitbox_index_selected=-1; frame_index_selected=-1; //Add frames listOfMoves_main_file = main_doc.getElementsByTagName("Move...
75624e0a-a2a0-4d79-82ed-a04d817824aa
6
public void updatePathInfo() { this.romDisplay.setText(" No Rom Path Set"); this.boxDisplay.setText(" No Box Art Path Set"); this.cartDisplay.setText(" No Cart Art Path Set"); this.wheelDisplay.setText(" No Wheel Art Path Set"); this.videoDisplay.setText(" No Video Path Set"); if (this.activeSystem!=...
b553764f-0f13-4ba2-826c-e0c4273926b8
0
@Test public void twoTablespoonPlusOneOunceEqualTwelveTeaspoon(){ ArithmeticQuantity two_tbsp = new ArithmeticQuantity(2, Volume.TABLESPOON); ArithmeticQuantity one_oz = new ArithmeticQuantity(1, Volume.OUNCE); assertEquals(two_tbsp.add(one_oz), new ArithmeticQuantity(12, Volume.TEASPOON));...
ccc27eb4-a978-4b6e-955f-989cfae18656
3
public EnvironmentalWidget(String titleIn, boolean hasField, boolean canEdit) { setBackground(Color.WHITE); JPanel fieldPanel = new JPanel(); JPanel titlePanel = new JPanel(); fieldPanel.setBackground(Color.WHITE); fieldPanel.setLayout(new BorderLayout()); titleP...
e735a391-bdb4-4d92-a14a-2d4ec1836e26
6
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Airport other = (Airport) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return tru...
e6867dcb-21e9-48be-9522-ff73a4dd30dd
7
private static void printLayerDetails(Model model, String mode) { System.out.println("***************************************************************************"); System.out.println("****************************** Layer Details ******************************"); System.out.println("*****************************...
69a9c0d8-1dc1-4ce0-90c7-936bc51eb09f
3
public LinearInterpolation(double[] x, double[] y){ this.nPoints=x.length; this.nPointsOriginal = this.nPoints; if(this.nPoints!=y.length)throw new IllegalArgumentException("Arrays x and y are of different length "+ this.nPoints + " " + y.length); if(this.nPoints<3)throw new IllegalA...
a012dcbd-9fcb-46fd-b38f-95b7cdadfcd1
0
public Day getDayStored () { return dayStored; }
ca8bbdc7-1583-49f3-b148-355617bfd4e0
0
public void setA(int a) { this.a = a; }
3251184c-d23b-47ab-9d51-f2082abb89be
5
public static boolean isPrime(int number) { if (number < 0) { throw new IllegalArgumentException("Error: int cannot be < 0!"); } int sqrt = (int) (Math.sqrt(number) + 1); if (number == 2) { return true; } if (number == 1) { return false; } for (int j = 2; j <= sqrt; j += 1) { if (number % j...
4a25b801-1465-4ca3-88b0-9030261a4c72
3
public void checkPrinterStatus() { int HOW_MANY_INSTALLED_PRINTERS = 3; for (int i = 0; i < HOW_MANY_INSTALLED_PRINTERS; i++) { String usbId; byte[] array = new byte[32]; int returnedVal; if (i == 0) { returnedVal = eZioLib.FindFirstUSB(a...
325447ee-986f-4b63-8b0e-8ec618549e87
8
private Slot getSlot(String name, int index, int accessType) { Slot slot; // Query last access cache and check that it was not deleted. lastAccessCheck: { slot = lastAccess; if (name != null) { if (name != slot.name) break la...
5b88685f-70b1-4b3d-916e-d3d1ecda9eab
4
public boolean cadastrarBanca(int matriculaAluno, String data, String horario, String local, String usuarioOrientador, String professor1, String professor2, String professor3) { Aluno aluno = procurarAluno(matriculaAluno); Professor professor = procurarProfessor(usuarioOrientado...
bb34ac22-997e-4a4e-b60a-a57547ce5875
3
public void close() { EIError.debugMsg("Closing"); if (serverReceiveThread != null) { serverReceiveThread.setRunning(false); } if (socket != null) { try { sendData("goodbye"); socket.close(); } catch (IOException e) { ...
63820344-7f97-4cb9-bbe5-8f63f9393aba
8
private void paivitaPelaajaKomponentit(int pelaajanumero) { if (pelaajanumero == 0){ try{ ui.getPpanel().paivitaKomponentit(); }catch(Exception e){} } if (pelaajanumero == 1){ try{ ui.getN1panel().paivitaKomponentit(); ...
deb9697f-23ac-4a39-bf65-5fce6624e9c0
7
public void run(){ try { // Starting all threads at the same time (clock == 0 / "8:00AM"). startSignal.await(); } catch (InterruptedException e) { e.printStackTrace(); } //Initializing the current time and the Random object startTime = System.currentTimeMillis(); Random r = new Random(); //System....
d39b0716-dd85-4d38-ab86-320cb7c5154f
0
public void move(int dx, int dy) { AffineTransform at = new AffineTransform(); at.translate(dx, dy); ((GeneralPath) shape).transform(at); canvas.repaint(); }
d7582633-94a2-4432-9cc7-2a7de36a7313
2
@Override public boolean equals(Object o) { if (!(o instanceof TokenTuple)) return false; TokenTuple t = (TokenTuple)o; return tokenType.equals(t.tokenType) && token.equals(t.token); }
1a899ce3-eb35-47c0-9b2f-511a9243045a
5
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = ""; response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); PrintWriter writer = response.getWriter(); String dbDriver = "org.postgresql.Driver"; ...
298dfda0-2de9-4cdd-b20e-672ec9977df5
8
public void buildGraph(HashMap<String, LiveRange> liveRanges, HashMap<String, Integer> spillCosts) { for(String key: liveRanges.keySet()) { InterferenceNode node = new InterferenceNode(key); node.setSpillCost(spillCosts.get(key)); nodes.add(node); } for(InterferenceNode node: nodes) { String ...
e15cfa2f-020f-455f-b048-a6e878402dcc
4
private void resaveParamsCountrySelected(SessionRequestContent request) throws ServletLogicException { String page = (String) request.getSessionAttribute(JSP_PAGE); String editHotelPage = ConfigurationManager.getProperty("path.page.edithotel"); String editDirectionPage = ConfigurationManager.get...
0cfcd645-8424-44fd-8e6d-3fb3474ddd18
1
public void testSet_DateTimeFieldType_int3() { MutableDateTime test = new MutableDateTime(TEST_TIME1); try { test.set(DateTimeFieldType.monthOfYear(), 13); fail(); } catch (IllegalArgumentException ex) {} assertEquals(TEST_TIME1, test.getMillis()); }
39b6b93e-c64e-4190-8bc9-25db992c6728
8
public ArrayList<String> process(InputStream in) throws IOException { if(this._queue == null) { throw new ParserNotInitialized(); } byte[] byteArray = null; //to bypass problem with loading a pdf doc from stream which has been used before by Tika byteArray = IOUtils.toByteArray(in); InputStream in...
171be9b0-8863-4749-b4c1-8d2b5834ff8c
5
void renderWorldFX(Rendering rendering) { final Target HS = (hovered == null) ? null : hovered .subject(), SS = (selected == null) ? null : selected.subject() ; if (HS != null && HS != SS) { //renderSelectFX(hovered, HS, Colour.transparency(0.5f), rendering) ; hovered.renderSelection(re...
cfc6f29e-cf41-45d5-96b2-7a3e31dda23a
9
@Override public boolean equals(Object o) { if (o instanceof Pair<?, ?>) { Pair<?, ?> p1 = (Pair<?, ?>) o; if (p1.Key_.equals(this.Key_) && p1.Value_.equals(this.Value_)) { return (true); } } return (false); }
801ca096-7538-4664-8585-cbacf4cd3713
3
@Override public void updateSymptom(SymptomDTO symptom) throws SQLException { Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.update(symptom); session.getTransaction().commit(...
aca17a0e-de61-4e06-aa81-42b6c4c8f85e
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Colore other = (Colore) obj; if (blue != other.blue) return false; if (green != other.green) return false; if (red != other.red) ret...
ee5cddb3-647a-434b-acda-22d0843225a1
6
private void updateGui() { updateDisplay(); if (!itemSelected) { for (int i = 0; i<pockets.length; i++) { pockets[i].setVisible(true); pages[i].setVisible(true); } for (JButton aDisplay : display) { aDisplay.setVisible(true); } information.setVisible(tr...
929746cf-c75c-4775-9ebe-6e207bc46e90
4
public boolean isindb(final Location sign) throws SQLException { boolean a = false; long time = 0; plugin.getLoggerUtility().log("Checking if in table!", LoggerUtility.Level.DEBUG); time = System.nanoTime(); Statement st = null; String sql; ResultSet result; try { st = connector.getConnection().creat...
adb5fffe-17fa-4e47-9207-f0c19dc9a54e
7
void initTypes() { ArrayList<String> typeList = new ArrayList<String>(); boolean exonsAdded = false; for (String type : DEFAULT_TYPES) { // Add exons or introns? if (type.equals(Exon.class.getSimpleName()) || type.equals(Intron.class.getSimpleName())) { if (!exonsAdded) { // Add all exons and intr...
78959ea3-e92d-4bb1-999f-2607a5b304b0
2
private void copyGrid(int[][] int1, int[][] int2) { for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { int1[i][j] = int2[i][j]; } } }
e602253a-bc40-4d1e-b360-87519cdd1e20
8
private boolean checaSeExisteVariavelEmRegistro(String nomeVariavel) { System.out.println("ACOLAA:"+ nomeVariavel); if(!listaVariveisRegistro.isEmpty()){ if(!listaDeBlocos.isEmpty()){ for(int j=0;j< listaDeBlocos.size();j++){ String [] tabela1 = listaDeBlo...
2a0fbc9e-9365-4e7d-8a4e-5d407f6ec983
8
public void removeNeighboor(Ways w) { switch (w) { case NORTH: if (north != null) north.south = null; north = null; break; case SOUTH: if (south != null) south.north = null; south = null; break; case EAST: if (east != null) east.west = null; east = null; break; case WEST...
86934f8c-409f-4f3d-adfb-f89d2d49e8fc
5
private static String getUserCommand() { String command = null; while (command == null) { try { System.out.println("Чтобы открыть ячейку введите координаты: " + FieldBorder.VerticalAxisName + SaveLoad.WIGHT_HEIGHT_SPLITTER + FieldBorder.Hori...
99938d44-8b65-4b03-9cd3-075277fce655
0
public void setGestureOk(boolean gestureOk) { this.gestureOk = gestureOk; }
757c4360-e794-4190-a05a-2c631b9615a2
1
private static void testCase2(){ CellEntry[][] cell = new CellEntry[][]{ {CellEntry.empty, CellEntry.inValid, CellEntry.empty, CellEntry.inValid, CellEntry.empty, CellEntry.inValid, CellEntry.white, CellEntry.inValid}, {CellEntry.inValid, CellEntry.white, CellEntry.inValid, CellEntry.empty, CellEntry.inValid, Ce...
85159b36-b8d3-4535-bb0b-0f77f928615d
3
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { EmployeeForm employeeForm = new EmployeeForm(); employeeForm.setName(request.getParameter("name")); employeeForm.setSurname(request.getParameter("surname")); ...
c0f759af-76ce-44ff-a010-6da01fe73396
9
public void createFirst() { // Initialize first with empty set first = initFirst(); Map<Symbol, Set<Symbol>> prevFirst = initFirst(); Map<Symbol, Set<Symbol>> nextFirst = new HashMap<Symbol, Set<Symbol>>(); boolean hasChanged = false; do { nextFirst = initFirst(); for (NonterminalSymbol A : ...
9ef24d11-4725-4e1b-b326-f5a4d46bebe8
2
public static void main(String[] args) { int x = 1; if (x == 1) { // empty statement } else { while (true) { //empty statement } } }
7b4eb867-8782-4b51-a0aa-18726d42b691
2
public KeyUtils(AlgoCryptType algo, int keySize) { if ((algo != AlgoCryptType.RSA) && (algo != AlgoCryptType.DSA)) { throw new IllegalArgumentException("Invalid algo type (" + algo + ")."); } this.keySize = keySize; }
1c6d9277-203b-40a1-8f91-99a5604dcb88
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Categoria other = (Categoria) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return fals...
636aec21-cb7f-40c5-a511-31429639b5e5
5
@Override public String getColumnName(int column) { switch (column) { case 0:return "ID"; case 1:return "Nom"; case 2:return "Prénom"; case 3:return "E-mail"; case 4: return "Nb signalisation"; default:return "Autres"; } ...
d2d7438e-38a9-431d-9c5d-127958149834
6
public static Color makeHSBColor( double hue, double saturation, double brightness) { float h = (float)hue; float s = (float)saturation; float b = (float)brightness; h = (h < 0)? 0 : ( (h > 1)? 1 : h ); s = (s < 0)? 0 : ( (s > 1)? 1 : s ); b = (b < 0)? 0 : ( (b > 1)? 1 : b )...
f1a18a1a-31d6-490d-9bcb-f8263a5fda45
9
public static long playerNameToInt64(String s) { long l = 0L; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); l *= 37L; if (c >= 'A' && c <= 'Z') { l += (1 + c) - 65; } else if (c >= 'a' && c <= 'z') { l += (1 +...
68d8c216-ce93-4c3f-becd-9a699625cf93
3
@Test public void hello() throws Exception { Integer[] states; double[] distributionTheorique; AlgorithmMCMC<Integer> algo; MarkovChain mc ; double[] distributionExperimentale; // int i = 0; while (i < 100) { int N = rand.nextInt(10) + 1; ...
4778be03-290a-4018-8c38-aa52d6e61ce8
5
private void addValidators() { quantityoutlet.setInputVerifier(new AbstractValidator(this, quantityoutlet, "Ongeldige waarde! Verwacht formaat: x.y, groter dan 0.0") { @Override protected boolean validationCriteria(JComponent c) { if (autobox.getSelectedIndex() == 0) { ...
2be62b60-ec6c-4acd-8664-e060a801a2ab
4
private void ReadProperty(String cfile) throws IOException{ String line = ""; FileInputStream fileinputstream = new FileInputStream(cfile); BufferedReader bufferedreader = new BufferedReader( new InputStreamReader(fileinputstream)); do { if ((line = bufferedreader.readLine()) == null) break; ...
2f1c7135-a2fb-4029-b84a-29e9ab7e3d48
2
public void readFile() throws IOException { BufferedReader fileIn; try { fileIn = new BufferedReader(new FileReader(fileName)); } catch (FileNotFoundException e){ File points = new File(fileName); PrintWriter fileOut = new PrintWriter(points); file...
36281493-993d-44da-bad1-076870081dc1
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 ht...
a6a8552b-84ae-4ade-ae92-13bd766344ac
2
public URL getUkeplan(String ID, int week, int x, int y) { String adresse = "http://www.novasoftware.se/ImgGen/schedulegenerator.aspx?format=png&schoolid=72150/nb-no&type=3&id={" + ID + "}&period=&week=" + week + "&mode=3&printer=0&colors=32&head=0&clock=0&foot=0&day=0&width=" + x + "&height=" + y + "&maxwidth=" + x...
84c13e4f-ddf8-458e-be48-86d569034baf
9
private void paintPuzzle(Graphics g) { g.setColor(Color.DARK_GRAY); g.fillRect(0, 0, 1000, 1000); if (menu != null) { g.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 20)); g.setColor(Color.WHITE); int yPos = 150; int xPos = 80; for (String curString : getMenuTitle()) { g.dra...
b8bbd825-2184-4d8e-a952-562c823e5fc7
1
public static void main(String args[]){ PrestataireDeService p=new PrestataireDeService("lodsdggg", "pwwwd"); PrestataireDeService p1=new PrestataireDeService("lo", "pwwwd"); p.setAdresse("sqddqs"); p.setTelephone(123); PrestataireDeServiceDAO prestataireDeServicedao =new Prestat...
04f3af32-3ad3-4889-8a2c-c0a95b8e855d
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://download.oracle.com/javase/t...
e59c22e6-93a6-474f-b857-b47caada2c16
0
public void setMainWindowModel(MainWindowModel mainWindowModel) { this.mainWindowModel = mainWindowModel; }
8e15eaee-269c-4683-a535-af315b9cf752
6
public static void main(String... args) { Map<String, List<PathPattern<ServletAction>>> map = new HashMap<String, List<PathPattern<ServletAction>>>(); //init one servlet action ServletAction servletAction = new ServletAction("profile.jsp", ServletAction.Type.REDIRECT); PathPattern<Servl...
cb9dc894-9bb6-44b5-94d5-a01c4860300b
5
public boolean hasChanged(){ if(parent!=null && parent.hasChanged()) return true; if(!position.equals(oldPosition) || !rotation.equals(oldRotation) || !scale.equals(oldScale)) return true; return false; }
d78504cf-c1e0-4ceb-829f-bef48407e828
7
public static String runAllTests() throws ConnectionException, RemoteException { StringBuffer sbuff = new StringBuffer(""); ConnectorConfig config = new ConnectorConfig(); config.setUsername("asawant02@dev.com"); config.setPassword("test@234"); config.setAuthEndpoint("https://login.salesforce.com/services/...
8873b4cc-32c0-4f09-aa30-bc5ca140245e
6
private static Image getImage(String filename) { // to read from file ImageIcon icon = new ImageIcon(filename); // try to read from URL if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) { try { URL url = new URL(filename); ...
ce7c2d75-74c6-4e7a-a061-3572fdc19233
6
public void setW(Integer value, boolean status_effect) { if((value == 0) && status_effect) { status.setBit(bits.Z); PIC_Logger.logger.info("Flag: Zero"); } else if(value > 255) { value -= 256; if(status_effect){ status.setBit(bits.C); PIC_Logger.logger.info("Flag: C"); } } else if(valu...
7bdd1aa2-2901-452f-a4cf-fa8604e996e2
4
public static void console() { Fachada fachada = Fachada.getInstance(); Scanner console = new Scanner(System.in); boolean stop = false; while(!stop) { System.out.println("Escolha a opcao:\n" + "1. Indexar\n" + "2. Buscar\n" + "3. Encerrar"); int opcao = console.nextInt(); // ACTION 1 => INDE...
eb2757f2-480c-4f65-b7ac-69c84db837c0
2
public void update(BufferedImage bimg) { int[] pixels = new int[bimg.getWidth() * bimg.getHeight()]; bimg.getRGB(0, 0, bimg.getWidth(), bimg.getHeight(), pixels, 0, bimg.getWidth()); ByteBuffer buffer = BufferUtils.createByteBuffer(bimg.getWidth() * bimg.getHeight() * 4); for (int y = 0; y < bimg.getH...
573cbc82-4163-4cdb-9023-9db0ec27a944
2
public void append(char c) { if (c != '0' && c != '1') { throw new IllegalArgumentException("Argument must be '0' or '1'"); } path_ = path_ + c; }
d08aebb1-cd12-41f3-ae2e-4f02231c9f22
4
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); String line; while ((line = in.readLine()) != null) { int n = Integer.parseInt(line.trim()); if (n == 0) break; p = new Poin...
8f555771-8b9d-4a80-b77d-54c551139464
6
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Person)) return false; Person person = (Person) o; if (!firstName.equals(person.firstName)) return false; if (!mail.equals(person.mail)) return false; if (!phone.equals(person...
ca1cb791-8580-4eef-a79e-d3e5d4b9ad35
0
public String getCountry() { return super.getCountry(); }
35a09e8a-f605-4f34-ab0c-de05bf614428
6
public void run() { while (!isInterrupted()) { // hier wird die Zieladresse (target) aus der Nachricht extrahiert try { String message = receive(); // System.out.println("ServerThread "+myNumber+":"+" "+message); if (message != null) { StringTokenizer ST = new StringTo...
48479c09-f7c4-4cbc-bcad-91f9cb0e20e6
4
private int winnerIs(int WeaponOne, int WeaponTwo) { if(WeaponOne<0 || WeaponOne>2 || WeaponTwo<0 || WeaponTwo>2) return-1; int resultNum=(3+WeaponOne-WeaponTwo)%3; int winningPlayerIsNum=resultNum; return winningPlayerIsNum; }
68659f78-17bd-4772-a8da-d84af2c01663
6
public static void main(String[] args) { com.proxious.jdblib.mysql.MySQL mySQL = new com.proxious.jdblib.mysql.MySQL("localhost", "3306", "root", "root", "test"); mySQL.openConnection(); if (mySQL.isOpen()) { System.out.println("Connection open."); } else { ...
ee7b1b2d-9988-4263-a918-3a290ed5e661
2
public List listar() { String sql = "SELECT * FROM PEDIDO as r inner join cliente as c on r.idCliente = c.idCliente"; try { conn = GerenciaConexaoBD.getInstance().getConnection(); PreparedStatement stmt = conn.prepareStatement(sql); ResultSet rs = stmt.executeQuery(); List<Reserva> listarReserva = new...
b2daec51-caaa-47a3-830d-bb2bda0fb489
5
public ListNode reverseBetween(ListNode head, int m, int n) { if (head == null) return head; int length = n - m +1; if (length == 1) return head; ListNode tail = head; for (int i = 0;i<n ;i++) tail = tail.next; if (m == 1) { return reverse(head,tail, length); } ListNode p ...
853b28e8-97b7-4726-a729-546078a3281f
3
public void dropClient(int clientId, String reason) { logger.finer("Dropping client " + clientId + ": " + reason); boolean clientDropped = false; synchronized(CONNECTION_LOCK) { if(clients.containsKey(clientId)) { ClientInfo client = clients.get(clientId); try { sendPacket(Packet.createForceDiscon...
15276c91-d13f-4fc9-b2e6-3bfff130bfb0
7
public BigInteger[][] getEncryptionKeys(BigInteger[] keyArray) { // String keyString BigInteger[] outputArray = new BigInteger[52]; // BigInteger[] keyArray = Helper.stringToBigIntegerArray(keyString); BigInteger key = Helper.bigIntegerArraySum(keyArray, 8); BigInteger[] shortKeyArray = Helper.ext...
4c61577b-7ab8-4dbc-b6da-c44e3b5c59d3
8
public static void main(String[] args) { ArrayList<Integer> primes = new ArrayList<Integer>(); for (int i = 0; i < isPrime.length; i++) if (isPrime[i]) primes.add(i); int first = 0, second = 0, third = 0; for (int i = 0; i < primes.size(); i++) for (int j = i + 1; j < primes.size(); j++){ int k =...
32d8fad8-5484-49e3-b152-b754718d4606
8
private void begin() { int[] i = new int[101]; int[] v = new int[101]; int[] x = new int[101]; int[] l = new int[101]; int[] c = new int[101]; for ( int n = 1; n <= 100; n++ ) { i[n] = i[n-1]; v[n] = v[n-1]; x[n] = x[n-1]; l[n] = l[n-1]; c[n] = c[n-1]; String roman = romanize(n); for ( ...
1dcc4deb-f039-4c8f-bf48-ceaf929c0be0
6
private void hSplit() { boolean keepReading = true; int index; while (keepReading) { try { String line = null; Tuple t = null; while ((line = input.getNextString()) != null) { if (line.indexOf("END") == 0) { keepReading = false; } else { t = Tuple.makeTupleFromPipeDa...
72d9b1b5-0ec7-421f-96b3-cd111cc3e40a
3
private void updateStateExit(List<Keyword> keywords, List<String> terms) { for (Keyword kw: keywords) { for (DialogState d : kw.getReference()) { if (d.getCurrentState() == Start.S_EXIT) { Main.giveMain().setUserLoggedIn(false); return; } } } }
9faa9927-ea38-4144-ad6a-ab0170ed80e2
3
private float limit(float eq) { if (eq==BAND_NOT_PRESENT) return eq; if (eq > 1.0f) return 1.0f; if (eq < -1.0f) return -1.0f; return eq; }
a9d7e040-ac96-445d-97d6-2af2556e4e4a
0
public static int luma(int color) { int red = (color & RED_MASK) >> 16; int green = (color & GREEN_MASK) >> 8; int blue = (color & BLUE_MASK); double y = 0.3*red + 0.59*green + 0.11*blue; return (int)y; }
5fef1cc5-48cc-4f86-af3f-55a2505d411c
4
public static void main(String[] args) { final A a = new A(); for (int i = 0; i < 3; i++) { new Thread() { @Override public void run() { while (true) { ...
b8afcdf3-701a-4156-a3af-0bfee4cd062d
2
public boolean equals(Object o) { if (o == this) return true; if (o instanceof ArrayType) { ArrayType type = (ArrayType) o; return type.elementType.equals(elementType); } return false; }
fc47ae3d-58fc-4098-beaf-5451e66557a2
4
public void keyReleased(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_A || e.getKeyCode() == KeyEvent.VK_D) p1.stop(); if(e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_RIGHT) p2.stop(); }
4e6dc8ef-6925-49b2-974b-fe95f85c680d
0
@Test public void nullAndEmptyStringsAreIgnored_whenAdded() { trie.add(null); trie.add(""); //assertFalse(trie.contains(null)); assertFalse(trie.contains("")); }
6cb10625-ff47-41c5-8808-01421187fdf4
0
public int getX() { return x; }
54cdbb74-9a94-4a25-9256-6a6a69be9e05
1
public BufferedImage load(String path) { try { return ImageIO.read(getClass().getResource(path)); } catch (IOException ex) { System.out.println(ex.getMessage()); } return null; }
0ba37cf4-0ee0-447e-8ee0-c6a9659dbb65
8
private boolean startSprinkler(StartReason reason) { if (DeviceStatus.humidityStatus >= 80 && reason != StartReason.MOTION) { Log.log(reason.toString() + ": humidity too high, sprinkler not started", deviceName); return false; } else if (DeviceStatus.weatherStatus == DeviceStatus.WeatherStatus.HEAVY_RAIN || D...
93ca4a64-6288-4735-b13f-363b5732bd99
2
private boolean isWord( String s ) { return ( !"/".equals( s ) && !SPECIAL.contains( s ) && !SPACE .contains( s ) ); }
922299b9-1ccc-479a-a9d3-470450bd7d8c
2
protected void processTextAreaBlocks(List<String> taBlocks) { if(generateStatistics) { for(String block : taBlocks) { statistics.setPreservedSize(statistics.getPreservedSize() + block.length()); } } }
50b029cc-891c-47ac-ab85-5cedabb5567e
1
public static URL loadResourceAsURL(String resourcePath) { if(resourcePath.startsWith("/")){ return ResourceLoader.class.getResource(resourcePath); }else{ System.err.println("A resource path must(!) begin with a \"/\""); return null; } }
37e74ab2-6e4b-4a7a-8c9b-120c5a8798bc
4
public static String loadFromFile() throws IOException { Map<String, UserEntity> map = new HashMap<String, UserEntity>(); String webRoot = Utils.getWebRoot();//this.getServletConfig().getServletContext().getRealPath("/"); File file = new File(webRoot + "account.txt"); BufferedReader read...
10491a23-b112-4f4a-9e52-6ac262987f71
8
public Set<Map.Entry<Float,Byte>> entrySet() { return new AbstractSet<Map.Entry<Float,Byte>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TFloatByteMapDecorator.this.isEmpty(); } publ...
2ed688f7-3f20-4bec-97e3-27f231a2c7ac
8
public void resetAP(MapleClient c, byte stat) { MapleCharacter player = c.getPlayer(); short amount = 0; switch (stat) { case 1: // STR amount = (short) (player.getStat().getStr() - 4); if ((player.getRemainingAp() + amount) > 32767) { ...
b469afc0-b51c-47eb-a4df-d16f7a50223c
7
@Override public void onEnable() { if (!beenEnabled) { PluginManager pm = getServer().getPluginManager(); log.debug("Registering events:"); // The "UI", checks for hits against controller blocks log.debug(" - BLOCK_DAMAGE"); pm.registerEvent(Event.Type.BLOCK_DAMAGE, blockListener, Event.Priority.H...
3c45846c-50e5-4281-9255-0416e3b1dc01
9
private int buildJump(int xo, int maxLength) { gaps++; //jl: jump length //js: the number of blocks that are available at either side for free int js = random.nextInt(4) + 2; int jl = random.nextInt(2) + 2; int length = js * 2 + jl; boolean hasStairs = random.nex...
7358736a-24a9-45f4-8069-b55e2f2bc9d9
4
protected void computeInitialFeasibleSolution() { for (int j = 0; j < dim; j++) { labelByJob[j] = Double.POSITIVE_INFINITY; } for (int w = 0; w < dim; w++) { for (int j = 0; j < dim; j++) { if (costMatrix[w][j] < labelByJob[j]) { labelByJob[j] = costMatrix[w][j]; } ...