method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0e451137-e6f8-463b-8417-fe1ca7eead49
4
public synchronized void paintComponent(Graphics g) // Called on the event dispatch thread { if (values == null) return; Graphics2D g2 = (Graphics2D) g; int width = getWidth() / values.length; for (int i = 0; i < values.length; i++) { double height = values[i] * getHeight(); ...
d7185dc3-dc2e-4d49-910c-0093bc0e3df5
2
public void setSecond(int s){ //does the same thing as the set minute method. second = ((s >= 0 && s<60) ? s : 0); }
3951288e-43ca-4b21-aa44-31da08476785
6
@Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL && e.getWheelRotation() > 0) { // If scrolling down if (game.getInv().itemSelected > 0) { // If the tileSelection is greater than 0 game.getInv().itemSelected--; // Lower tileSelection } el...
809729ea-d7a6-47b1-966a-55421ac7f0fc
4
@SuppressWarnings("deprecation") public void rewardKillStreak(Player p) { PlayerStorage pStorage = SE.getStorage(p.getName()); System.out.println(pStorage); int killStreak = pStorage.getKillStreak(); double streakVal = killStreak / 3.0; if (streakVal >= 1) { if (streakVal % 1 > 0) { if (!pStorage.isR...
d186140f-917c-4aa9-9130-2fb8a06bce05
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 ...
2b4b3cf1-76bb-4448-8def-89266cd5a936
3
public void update() { time++; if (time >= 7400) time = 0; if (time > life) remove(); za -= 0.1; if (zz < 0) { zz = 0; za *= -0.55; xa *= 0.4; ya *= 0.4; } move(xx + xa, (yy + ya) + (zz + za)); }
6640b75e-de9a-4df8-9296-9715e7f8ff23
5
public boolean isValidFleet(ArrayList<Ship> proposedFleet) { for(int i = 0; i < proposedFleet.size(); i++) { Ship testingShip = proposedFleet.get(i); boolean works = true; for(int j = 0; j < proposedFleet.size(); j++) { if(i != j) { if(testingShip.contains(proposedFleet.get(j))) work...
9a12b513-1323-4f20-82f5-2174d5a0f76d
1
public boolean checkAnswer(int answer) { if (answer == s.getResult()) return true; return false; }
69f33aaa-17ce-47ac-beea-d4304b1e3ab2
6
public void draw(Graphics2D g2) { g2.drawImage(background, 0, 0, GamePanel.WIDTH, GamePanel.HEIGHT, null); g2.drawImage(coin, GamePanel.WIDTH - coin.getWidth() - 90, 18, coin.getWidth(), coin.getHeight(), null); g2.setFont(new Font("LCD", 2, 50)); g2.drawString(PlayerData.playerData.getName(), 80, 49); g2.dra...
38b66475-5982-4430-a18b-dd74a188e9da
3
public Grammar(String fileName) throws FileNotFoundException { m = new HashMap<String, Rule>(); File file = new File(fileName); Scanner s = new Scanner(file); keyCounter = 0; while (s.hasNextLine()) { // loop in a loop, outside to go through and make rules String str = s.nextLine(); //check to get ...
2ae32fb0-24a6-46ae-bc56-ad2437cec607
7
private void character(char ch) throws IOException { if (ch <= 0xff) { // In single byte characters, replace only the five // characters for which well-known entities exist in XML if (ch == 0x22) { writer.write("&quot;"); } else if (ch == 0x26) { ...
14e8cda5-4979-4f9a-ba24-8727b36fd65f
9
public void render(int mx, int my, boolean[] buttons) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(1, 1, 1); Textures.fillRectangle(24, 16+40, w-24-5-24+1, 20*17+1); GL11.glColor3f(0, 0, 0); Textures.fillRectangle(25, 17+40, w-24-5-24-1, 20*17-1); GL11.glColor3f(1, 1, 1); GL11.glEnable(GL11.GL_TE...
e7bcd7c8-6f54-4ed1-ab52-6f6672d9e40c
7
@Override public boolean open(List<Matchable> patterns) { Iterator<Matchable> it = patterns.iterator(); this.columns.clear(); while (it.hasNext()) { Matchable pattern = it.next(); this.columns.put(pattern.getTitle(), pattern.getDescription()); this.fields.add(pattern.getTitle()); } if (this.con...
e4e0a016-107d-4069-a0c3-6800c2b0b79c
8
public int hashCode() { if (cachedHashCode == Integer.MIN_VALUE) { int hashCode = 0; // Load the annotation class getAnnotationType(); Method[] methods = annotationType.getDeclaredMethods(); for (int i = 0; i < methods.length; ++ i) { ...
c707949c-f66d-4c65-a7de-8b33914ff8d8
2
@Override @SuppressWarnings("InfiniteLoopStatement") public void run() { while (true) { messageSystem.execForAbonent(this); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } }
ab3715b0-19e1-4da8-845a-7b8496c1219a
8
public static void main(String args[]) { try { int screenWidth = (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(); int screenHeight = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight(); windowWidth = (screenWidth < NBBLOCKX*32 ? screenWidth-10 : NBBLOCKX*...
ad30d236-decd-45ea-87a3-077bc7fbdbcf
3
public int DecodeBit(short[] probs, int index) throws IOException { int prob = probs[index]; int newBound = (Range >>> 11) * prob; if ((Code ^ 0x80000000) < (newBound ^ 0x80000000)) { Range = newBound; probs[index] = (short)(prob + (2048 - prob >>> 5)); if ((Range & 0xFF000000) == 0)...
5395fbd8-c0f7-4ccb-94b2-b481bb558eb9
0
public void display() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); dialog.setVisible(true); } }); }
7f4613f4-23a4-4a68-9483-e97c7733cb02
7
public void mouseDragged(MouseEvent e) { currentX = e.getX(); currentY = e.getY(); if (SHAPE_TOOLS.contains(currentshape) ) // flag == false) // only to show shape while drawing rect /line { repaintRect(startX, startY, prevX, prevY); ...
c239d695-ab4a-4058-a487-468a5505c942
1
public void test_strictChrononolgy_Chicago() { DateTimeZone zone = DateTimeZone.forID("America/Chicago"); Chronology lenient = StrictChronology.getInstance(ISOChronology.getInstance(zone)); try { new DateTime(2007, 3, 11, 2, 30, 0, 0, lenient); fail(); } catch (Il...
acc80253-31b8-488c-ab49-718758f9952f
3
public void update() { if (delay == NONE) return; final long elapsed = (System.nanoTime() - startTime) / 1000000; if (elapsed > delay) { currentFrame++; startTime = System.nanoTime(); } if (currentFrame == frames.length){ currentFrame = 0; playedOnce = true; } }
547db5fa-a804-454e-8daa-5b0423fade7c
9
private void checkWallCollisions() { // X coords if (getPosX() - getRadius() < 0 && getVelocityX() < 0) { getVelocity().setX(getVelocity().getX() * -1); setVelocity(getVelocity().times(GameSettings.WALL_BOUNCINESS)); } else if (getPosX() + getRadius() > Game...
fc0b1ca5-a188-46c4-b81d-3ca09c129144
1
public static void main(String[] args) throws NumberFormatException, IOException { int numPackets = Integer.parseInt(in.readLine()); int numKids = Integer.parseInt(in.readLine()); int[] packets = new int[numPackets]; for(int i = 0; i < numPackets; i ++) { packets[i] = Integer.parseInt(in.readLine()); } ...
55a6ec78-54e3-4e36-a506-e1070e8ef5d4
1
private void addPeopleToTheNetwork(Person[] people){ for (Person person : people) this.network.addPerson(person); }
ce4366fd-0253-491a-a9c7-15fd60b4cb52
9
public int GetMax(Color channel) { int treshhold = 5; // if value is above treshhold we do not account for it to minimize noise influence int[][] hist_value = Parent.Camera.GetHistogram(0); int ret = 255; if (channel == Color.red) { for (int i = hist_value[0].length - 1; i >...
c267f3a9-38b1-46f1-a5e8-3a292414d377
7
public PDDocument crearDiario(Calendar fechaInicial, Calendar fechaFinal, DefaultTableModel modeloTabla, JFrame dialogo) { PDDocument document = new PDDocument(); try { PDPage pagina1 = new PDPage(); document.addPage(pagina1); PDFont font = PDType1Font.HELVETICA_BO...
cf3a2fae-0260-4eb3-90eb-1d323ff66d59
2
public static void startInTheCloud(JSlider numberOfUsersSlider, JSpinner durationSpinner, JSpinner iterationsSpinner, JSpinner rampupSpinner) { saveCloudTest(numberOfUsersSlider, ...
25dd2f27-d6b0-4be6-ac6a-526fe2ef0673
3
public int numOfEmptySquares() { int count = 0; for (Square[] a : squares) { for (Square s : a) { if (s.piece == null) { count++; } } } return count; }
3ce77e82-794e-4fa1-8991-aef0ca6fb329
2
public static HandShakeStart decodeHandShakeStartFromBuffer (ByteBuffer buffer) { // Protocol name int pNameLen = (buffer.get()) & 0xFF; byte[] pNameBytes = new byte[pNameLen]; buffer.get(pNameBytes); String pName = new String(pNameBytes, ISO_8859_1); // Reserved bits ...
df877fc8-c5b0-475b-bbf2-1876719533da
5
void set(syVDist para) { float x; mode = (int) para.mode; gain1 = (float) Math.pow(2.0f, (para.ingain - 32.0f) / 16.0f); //System.out.printf("%d mode %d gain1 %f\n", d_cntr++, mode, gain1); switch (mode) { case OFF: break; case OVERDRIVE: gain2 = (para.param1 / 128.0f) / ((float) Math.atan(g...
31b26816-3035-46ce-94e8-4c8b58751fba
0
public ArrayList<Card> getDeck() { return deck; }
f9f3190d-b07c-4e32-9f46-856fd322780c
2
public static boolean check_variable_name_repeat(Variable_table variable_table, String name) { for (int i = 0; i < variable_table.variable_name.size(); i++) { if (variable_table.variable_name.get(i).toString().equals(name)) { return false; } } return true;...
6bcaa10d-c543-41db-aaaa-748441429428
4
public void removeFullRows() { for (int row = getHeight() - 1; row >= 0; row--) { for (int col = 0; col < getWidth(); col++) { if (board[row][col] == null) { break; } if (col == getWidth() - 1) { moveRowsDown(row...
6e09e87f-e6b6-4812-ab6e-18ae697ea841
8
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; double max = 0; for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix[0].length; j++) { max = matrix[i][j] > max ? matrix[i][j] : ...
bc75ef4b-eec6-40a2-a3dc-7e67f94ef505
6
public boolean eliminar(E x){ if(cabeza == null) return false; if (talla == 1){ //no se puede eliminar una lista con un nodo cabeza = null; cola= null; talla = 0; } Nodo<E> tmp = cabeza, anterior = null; boolean res = false; ...
eb9aef61-a900-491c-9c33-900587ecf084
7
public static void main(String[] args) { controller = BoardController .getBoardController(BoardConfiguration.EMULATOR_12x12); spots = new Spot[3]; // Das Array colors verwaltet unsere Farben und wird vom Controller // angefordert. colors = controller.getColors(); // Die Spots sind die Scheinwerferlicht...
0c2381fa-afd8-4c54-b275-5e5e7ea0b93b
2
private void generateHardwareSystemsEP(int alternatives, int[] possibilities, int[] repetitions) { for (int i = 0; i < alternatives; i++) { HardwareSystem hardwareSystem = new HardwareSystem(); for (int j = 0; j < project.getHardwareSets().size(); j++) { int index = (i / repetitions[j]) % project.getHardwar...
abe939f6-fdd4-48fa-9653-f3b06eb834cc
2
public FastqBuilder appendSequence(final String sequence) { if( sequence == null ) { throw new IllegalArgumentException("sequence must not be null"); } if( this.sequence == null ) { this.sequence = new StringBuilder(sequence.length()); } this.sequence.append(sequence); return this; }
de64df24-ac1f-40aa-9f78-268b5a6f65bb
4
@Override public void execute() { seq(new WalkToSegment(0, 8)); seq(new WalkToSegment(-1, 8)); seq(new WalkToSegment(36, 16)); seqMove(new OverworldInteract(5)); seq(new SkipTextsSegment(4)); // pewter skip text for (int i=0;i<38;i++) { seqMove(new PressButton(Move.RIGHT | Move.LEFT), 0); } for (int...
7b6e8f1c-4864-4cbb-bd7d-a6d42f33bb50
5
public void instantiateTileBarView(ArrayList<Term> query1, ArrayList<Term> query2, ArrayList<Term> query3, ArrayList<String> query1Strings, ArrayList<String> query2Strings, ArrayList<String> query3Strings){ if(selected != null){ int numChapters = selected.getNumChapters(); Tile chapter; Chapter chap; //Bu...
e8666c9e-10ee-4b5f-bd04-90e34d2569ac
1
public void setDelay(long dly) { if (sim != null) sim.setDelay(dly); }
ce85da37-fe5f-4550-aaec-407c5fd9975b
9
void handleExtendedModify(ExtendedModifyEvent event) { if (event.length == 0) return; StyleRange style; if (event.length == 1 || text.getTextRange(event.start, event.length).equals(text.getLineDelimiter())) { // Have the new text take on the style of the text to its right (during // typing) if no style informati...
78175736-971c-4a03-aa06-e3f0a1531000
7
public static void main(String[] args) { int x,y,S=0; x=Integer.parseInt(JOptionPane.showInputDialog(null,"Ingrese un número inicial")); y=Integer.parseInt(JOptionPane.showInputDialog(null,"ingrese un número final")); for (int i = x; i <= y; i++) { ...
d5ba1f6b-3928-4b80-89de-44822b42093c
3
public Labyrinth(LinkedList<Edge> edges){ this._edges = edges; Iterator<Edge> _iter = edges.iterator(); while(_iter.hasNext()){ Edge _edge = _iter.next(); if(!this._nodes.containsValue(_edge.getNodeA())){ this._nodes.put(_edge.getNodeA().getId(), _edge.getNodeA()); } if(!this._nodes.containsValue(...
5d4b2719-b3a0-45bb-b544-41a1efde8a1f
3
public void onTopic(String channel, String topic, String setBy, long date, boolean changed) { if (channel.equalsIgnoreCase(DarkIRC.currentChan.name)) { String topic_message = DarkIRC.AppLang.getString("topic_msg").replace("{~channel~}", cha...
36c9a310-557f-413c-8c87-7a2aabe77a98
5
@Test public void execute() { LOGGER.info("Starting test execute method..."); Position position = new Position(1, 1, Orientation.NORTH); Mower mower = new Mower(position); Long[] borders = { 3L, 3L }; List<Action> instrcutions = new ArrayList<Action>(); List<Position> positions = new ArrayList<Position>()...
7b17eb2c-79c0-47dc-9ba2-03ce72786dc8
1
public static File chooseFile(JFrame frame, String Button, int mode) { JFileChooser jfc = new JFileChooser(); jfc.setFileSelectionMode(mode); jfc.setMultiSelectionEnabled(false); jfc.setAcceptAllFileFilterUsed(true); int success = jfc.showDialog(frame, Button); if(success == JFileChooser.APPROVE_OPTION) {...
c02e8f25-da79-4c79-bdb3-c64b98d60d63
8
protected boolean handleKeyDown(KeyEvent e) { if (acceptArrowKey(e)) { accStepIncrement(); if (stateTransition(STATE_INITIAL, STATE_ACCESSIBLE_DRAG_IN_PROGRESS)) setStartLocation(getLocation()); switch (e.keyCode) { case SWT.ARROW_DOWN: placeMouseInViewer(getLocation().getTranslated(0, accGet...
02d2828e-2c98-4148-9acb-689db548ef93
8
@Override public void setFrameRatePerSecond(double value) { if (value == 15) FPSComboBox.setSelectedIndex(0); if (value == 20) FPSComboBox.setSelectedIndex(1); if (value == 23.976) FPSComboBox.setSelectedIndex(2); if (value == 23.978) FPSComboBox.setSelectedIndex(3); if (value == 24) FP...
b8ed19a7-fcdd-44ca-b8c0-b9c84506b8f8
2
public List<Planet> NotMyPlanets() { List<Planet> r = new ArrayList<Planet>(); for (Planet p : planets) { if (p.Owner() != 1) { r.add(p); } } return r; }
f8d2b2fa-68ab-46f3-af75-438aa1d1a0ee
5
public AboutDialog(JFrame parent) { super(parent, "About Sinalgo", true); GuiHelper.setWindowIcon(this); this.setLayout(new BorderLayout()); //this.setResizable(false); this.setPreferredSize(new Dimension(600, 300)); JEditorPane html = new JEditorPane(); html.setContentType("text/html"); html.setT...
0afd79d3-d1e6-45f4-9a70-4b38296b7b1b
3
public void serviceChanged(ServiceEvent event) { String[] objectClass = (String[]) event.getServiceReference() .getProperty("objectClass"); if (event.getType() == ServiceEvent.REGISTERED) { System.out.println("Ex1: Service of type " + objectClass[0] + " registered."); } else if (event.getType() == Se...
0c3820dc-5d45-427e-a809-3697a73d939d
7
static public Spell getFireSpell(int i) { switch (i) { default: case 0: return new Firebending(); case 1: return new Firebending_Lava(); case 2: return new FirebendingJump(); case 4: ...
51938190-3e9b-48c2-818a-f1ebe217da41
7
private File scanDirectoryForExecutable(File directory, String fileName) { boolean caseSensitive = Enigma.isFileSystemCaseSensitive(directory); String fileNameDot = fileName + "."; File[] files = directory.listFiles(); if (files != null) { for (int i = 0; i < files.length; i+...
4f002f68-cd4b-4838-928c-87ba692a869c
8
@ScriptyCommand(name="bean-call") public Object beanCall(Object[] aArgs, IContext aCtx) throws CommandException { try { final String lPath = guardStringOther(aArgs); final Resolution lRes = resolve(lPath, aCtx); if(! filter(lRes)) throw new CommandExceptio...
df0c9e6c-0d68-4f3e-80ad-0d0444da7266
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final VtOpenRequest other = (VtOpenRequest) obj; if (localVTSessionIdentifier == null...
c331ed2d-fdaa-4860-962c-ace938eb663f
1
static public boolean convertResponseToBoolean(Object response) { if (response.toString().toUpperCase(Locale.ENGLISH).equals("T")) { return true; } else { return false; } }
2a0fb7de-2146-4e42-aaa6-f334a93b6d5a
4
public static Application parseReferrerString(String referrerString) { // skip the empty and "-" referrer if (referrerString != null && referrerString.length() > 1) { for (Application applicationInList : Application.values()) { if (applicationInList.isInReferrerString(referrerString)) return application...
691e01bc-c3dd-42c5-b8e8-7cad8ad121a9
9
public void func_71515_b(ICommandSender par1ICommandSender, String par2ArrayOfStr[]) { if (par2ArrayOfStr.length >= 1) { if (par2ArrayOfStr[0].equals("on")) { MinecraftServer.func_71276_C().func_71203_ab().func_72371_a(true); func_71522_a(par1I...
0e90f7d0-724f-464c-9d0f-7587bba66b58
4
private void fillTargetTable() throws SQLException { log.debug("Filling target table..."); int batchSize = config.getBatchSize(model.getTargetTable()); JdbcValueReader jdbcValueReader = jdbcValueReaderProvider .getValueReaderFor(model.getTargetTable()); Iterable<String> sourceColumns = model.getSourceCol...
a198816b-f008-4b86-944a-6223b490f9e8
5
static final void method1215(byte i) { if (i != 3) method1217(-39, null); anInt2078++; if (Class240.anInt4674 != 9) { if ((Class240.anInt4674 ^ 0xffffffff) == -6 || Class240.anInt4674 == 6) ByteBuffer.setClientState(2, 3); else if (Class240.anInt4674 == 12) ByteBuffer.setClientState(2, 3); } el...
f958191b-2981-4533-9277-5d93aef0c0ef
4
@Override public Set<String> checkConflict(Request request){ if (!this.isRunning){ throw new RuntimeException("access a down site"); } switch (request.requestType){ case READ: return lockManager.checkConflict(request.resource, requ...
d6419e59-6bba-4ab4-8973-e51970ddb2b8
6
public PacketType getPacketType() { if(packetType == null) { switch(getType()) { case "PAR 2.0\0RecvSlic": packetType = PacketType.REOCV_SLICE; break; case "PAR 2.0\0Creator\0": packetType = PacketType.CREATOR; break; case "PAR 2.0\0IFSC\0\0\0\0": packetType = PacketType.INPUT_FILE_SLI...
331c303e-50a1-405b-af2a-d0c703429c6d
3
public static Employee [] findAllEmployeeData() { Employee [] employeedata; String read; ArrayList<String> employeeData = new ArrayList<String>(); try { BufferedReader reader = new BufferedReader(new FileReader("employee.txt")); while((read = reader.readLine()) != null) { employeeData.add(read); } ...
fac0eab9-8e46-4412-83be-ce65b6cef6f5
9
@Override public Class<?> getColumnClass(int indiceColuna) { switch (indiceColuna) { case 0: return Boolean.class; //status case 1: return String.class; //fornecedor case 2: return String.class; //job case 3: ...
252ce191-31f3-41cd-8f6f-1d7144060227
5
private void checkHelp(int command) { switch (command) { case 2: System.out.println("EchoClient> Syntax: <connect> <address> <port>\n" + " <address>: Hostname or IP Address of the Server.\n" + " <port>: The port of the echo service on the respective server.\n" + " Connects to the gi...
6da7be32-cae9-46f4-97f7-e524aa949c19
3
public static void main(String[] args) { File archivoEntrada = new File("F:\\Proyectos\\Acoplado PEMSA\\Modulo_Calculo_Acoplado\\Archivo de estampado.nas"); File archivoSalida = new File("F:\\Proyectos\\Acoplado PEMSA\\Modulo_Calculo_Acoplado\\Archivo de calculo.bdf"); ModeloMalla fuente =...
799079f9-670c-4152-88b3-eba3775d944e
7
private boolean _jspx_meth_html_submit_0(javax.servlet.jsp.tagext.JspTag _jspx_th_html_form_0, PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // html:submit org.apache.struts.taglib.html.SubmitTag _...
cbcc015a-59c0-4d04-b64a-240e43a3f23e
9
public boolean fGetDataForTest(String testName) { //DataSheet final String dataSheet = dataSheetsPath + "\\" + Environment.get("CLASSNAME") + ".xls"; final String mainSheet = "MAIN"; final String testNameColumn = "TEST_NAME"; //Clear Dictionary Dictionary.clear(); orgDictionary.clear(); //Get co...
9f2fdd5b-7435-4fdf-8c33-36b5c0bd91a8
9
public char comprobarVector(Prototipo[] vector) { HashMap<Character, Integer> recuento = new HashMap<>(); HashMap<Character, Integer> repetidos = new HashMap<>(); for (Prototipo pro : vector) { if (recuento.containsKey(pro.getEtiqueta())) { int i = recuento.get(pro.ge...
747d0d13-a891-411c-8642-94a610231081
8
public boolean isResultRequired(ResultProducer rp, Object[] key) throws Exception { if (m_ResultProducer != rp) { throw new Error("Unrecognized ResultProducer calling isResultRequired!"); } if (m_Debug) { System.err.print("Is result required..."); for (int i = 0; i < key.length; i...
0a80d7fb-6985-485a-a171-c5329961cd2f
0
@Override public int compareTo(Node that) { return this.freq - that.freq; }
bdce0012-81f4-4ccc-b3e1-eecc452d2c21
3
public void close() { if (!_serverStop.getValue()){ _serverStop.setTrue(); for (ConnectionHandler<T> currentConnection : _allConnections) { currentConnection.stopServer(); } try { _serverSocket.close(); } catch (IOException e) {} } }
296afe0b-9350-418a-8cd1-5755d0ade841
4
public Token makeToken(String s,int startPosition,int endPosition) { if (s.equals("//")) { // filter comment try { int oldLine = source.getLineno(); do { ch = source.read(); } while (oldLine == source.getLineno()); } catch ...
94eed499-c19e-47bd-8874-39934d99bf28
9
public void admitPatient() { String reason = admitPatient_admissionReason.getText(); String description = admitPatient_comments.getText(); for(Person person: hospital.allUsers.values()){ Patient patient = (Patient)person; if(patient.getFirstName().equals(admitPatient_pa...
4c36c227-b573-4253-b92b-6f10fe03ed36
4
public void register(Object value) { if (JSONzip.probe) { int integer = find(value); if (integer >= 0) { JSONzip.log("\nDuplicate key " + value); } } if (this.length >= this.capacity) { compact(); } this.list[this.le...
37da74a5-a885-498f-bce2-8f4f81f78538
7
public boolean compute(float time) { //Wenn kein Tor da ist bleibt der Ball stehen if(Goals.isEmpty()) { return(true); } //Tor wurde erreicht? if(goalReached()) { return(false); } if(worldChanged()) { //Berechnungsmodi unterscheiden if(pathmode == MODE_POINT) { calcul...
a7529839-f379-4c39-923d-aef1c3ef0caf
8
public RarcFilesystem(FileBase _file) throws IOException { file = new Yaz0File(_file); file.setBigEndian(true); file.position(0); int tag = file.readInt(); if (tag != 0x52415243) throw new IOException(String.format("!File isn't a RARC (tag 0x%1$08X, expected 0x5...
b881ca6e-d73e-43c3-9469-918113cd642b
9
private void randomMove(int number){ Random random = new Random(); double dx = random.nextDouble()*pow(-1, random.nextInt())/20; double dy = random.nextDouble()*pow(-1, random.nextInt())/20; if (canNotPassWall(beings.get(number).getX(), dx, beings.get(number).getY(), dy)){ dx...
60809536-5757-4f2d-8498-b59110087e11
0
public int getCapacity() { return capacity; }
bb915f13-903a-42ab-a8c8-5881a6c10112
0
public String compileDetail(){ System.out.println(pass_code); return SUCCESS; }
3a534d75-5a4d-4875-b53b-9340af9794c0
5
public void Crop() { BufferedImage temp = new BufferedImage(stopCropPoint.x - startCropPoint.x, stopCropPoint.y - startCropPoint.y, parent.ic.getCurrentlyDisplayImage().getType()); BufferedImage currentDisplay = parent.ic.getCurrentlyDisplayImage(); int w = stopCropPoint.x - startCropPoint.x; int...
a6161f17-68db-44d7-8aff-84ba3f99c92b
0
public static void main(String[] args) { BlockingQueue<Integer> q = new BlockingQueue<>(); QueuePublisherThread t1 = new QueuePublisherThread(q); QueueSubscriberThread t2 = new QueueSubscriberThread(q); new Thread(t1, "Caller").start(); new Thread(t2, "Service").start(); }
a07e4097-b335-43d0-9d85-a21b7455e654
9
@Override public void setTimelineEvent(){ KeyFrame kf = new KeyFrame(Duration.millis(17), new EventHandler<ActionEvent>(){ public void handle(ActionEvent e){ if(soundWaves[INDEX_ZERO].getRadius() >= observer.getCenterX()-source.getCenterX()){ if(observer.getCe...
406bff9f-0f3f-432d-835a-cc37f4047185
4
public static void saveRentalBook(int rentId, int prodId){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { conn.setAutoCommit(false); Prepa...
03580dac-ae96-428e-8061-251108e4739e
8
protected Instances process(Instances instances) throws Exception { Instances result; int i; int n; double[] values; String value; Instance inst; Instance newInst; // we need the complete input data! if (!isFirstBatchDone()) setOutputFormat(determineOutputFormat(getInput...
8541ebc4-0c13-4b41-8b1a-55fc651b2be4
0
public void ReleaseStream() throws IOException { Flush(); _stream = null; }
32b3ef5c-3544-4e6d-8185-2162b0e84267
9
public void takeOrder() { ConsoleOutputUtility.printWelcomeMessage(); List<IBeverage> orderList = new ArrayList<IBeverage>(); List<KeyValuePair> beverageList = CommonUtility.getKeysAndValues(KahveciEfendi.BEVERAGE_PROPERTY); boolean isBeveragePartFinished = false; IBeverage beverage = null; while (!isBevera...
e5860be9-a15a-4628-a253-4afc4b3af709
3
public int getAsset(String as){ if ("Pork Bellies".equals(as)){ return pb; } else if ("Frozen Orange Juice Concentrate".equals(as)){ return oj; } else if ("Soybeans".equals(as)){ return sb; }else throw new Error("No such asset"); ...
68360efd-5e84-413f-b8b9-7619a4b05731
6
public void resample_nearest( int sample_idx, int sample_frac, int step, int left_gain, int right_gain, int[] mix_buffer, int frame_offset, int frames ) { int loop_end, offset, end, max_sample_idx; sample_idx += OVERLAP; loop_end = loop_start + loop_length - 1; offset = frame_offset << 1; end = ( frame_...
e3c48980-ee7b-42ca-a613-1b84931131f0
2
@Override public void deleteMin() throws EmptyCollectionException, KeyNotFoundException { if (treeIsEmpty()) throw new EmptyCollectionException(); Node x = root; while (x.left != null) x = x.left; delete(x.key); }
547f69bb-561f-4e9e-9117-0192bb0c1a69
6
public static String[] getDelta(String ip, String comunidade, String objeto, String valorAnterior) throws IOException { System.out.println("\nSNMP Get Delta"); System.out.println("Objeto: " + objeto); System.out.println("Comunidade: " + comunidade); // Inicia sessaso SNMP Transp...
45451948-abf2-47a4-b3e8-cada9a1a4fbf
9
public static void main(String[] args) throws IOException { Selector selector = Selector.open(); DatagramChannel channel = DatagramChannel.open(); channel.connect(new InetSocketAddress("localhost", 8888)); channel.configureBlocking(false); channel.register(selector, SelectionKey...
d58620d3-8681-4aa4-a6c2-b20ec87be988
1
public static void main(String[] args) { try { throw new NullPointerException(); } catch (NullPointerException e) { logException(e); } }
a677e114-2ae8-4cc3-b217-aa2f652d5c5e
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if((!mob.isInCombat())||(mob.rangeToTarget()<1)) { mob.tell(L("You really should be in ranged combat to cast this.")); return false; } for(int i=0;i<mob.location().numItems();i++) { fi...
d62e9f13-6e57-4382-916f-23245c9b7e9b
6
public static void main(String[] args) { if (args.length > 0) { String param = args[0]; if (param.equalsIgnoreCase("-gui")) { JFrame f = new JFrame("2d-Tree Demo"); f.addWindowListener(new WindowAdapter() { public void windowClosing(...
87e8a3f5-274b-463a-9b4f-9a74956c49c9
7
public void remove(int position) { SListNode<T> currentNode, previousNode; if ((position < 0) || (head == null) || position > size - 1) { return; } else { if (position == 0) { head = head.next; size--; if (size == 0) tail = null; return; } currentNode = previousNode = head; while (position ...
fdcc5a08-ea33-493f-a0a6-226b920bbc99
7
@Override public boolean equals(Object other) { if(other == null) { //check first if the other object is null return false; } if(other.getClass().equals(this.getClass())) { Item toCompare = (Item) other; boolean equal = (other == this) || //if they are the same object ((th...
06beebe8-542c-4377-a63c-17f24c098e2d
5
public void testAllPairs(File file) { try { Scanner scan = new Scanner(file); while (scan.hasNextLine()) { String[] line = scan.nextLine().split("\t"); if (line.length != 2) continue; String host = line[0].trim(); int ip = stringToIP(line[1].trim()); if (!testPair(ip, host)) { Syst...
65fde9b5-edd5-407e-976e-ba2410434ef5
6
private static String unescape(String in, String escChars) { if (in == null) return null; if (in.length() == 0) return ""; //can't be any escapes in 1-char String, and we need to guarentee one pass through the loop escChars = escChars.concat("\\"); StringBuffer out = new StringBuffer(in.length()); char c=' ',...