method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d735083d-e79a-4713-a7fc-4c4d1c68706d
6
public void run() { if (logic.getEnemyState(0) == false && currente == 1) { currente = 2; } if (logic.getEnemyState(1) == false && currente == 2) { currente = 3; } if (logic.getEnemyState(2) == false && currente == 3) { currente = 1; } repaint(); }
4bdf1abc-33c8-41cc-8598-2bf0e3f58229
2
public Roster getRosterByID (int id) { for (Roster r: rosters) if (r.getRosterID() == id) return r; return null; }
ca20e8e4-c3b5-4ce5-a8a4-5293d8a29383
6
private void parse( String directory ) { // Go through each directory and get the java source // files for this dir. log.debug( "Scanning " + directory ); DirectoryScanner directoryScanner = new DirectoryScanner(); File baseDir = new File( directory ); directoryScann...
6e6a6114-5ce8-4961-a7b3-306747a9772c
7
public void recordContinueFrom(FlowContext innerFlowContext, FlowInfo flowInfo) { if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { if ((initsOnContinue.tagBits & FlowInfo.UNREACHABLE) == 0) { initsOnContinue = initsOnContinue. mergedWith(flowInfo.unconditionalInitsWithoutSideEffect()); } else { initsOnC...
1c4b1527-7b60-4818-be59-29caeeb1c254
6
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == btnNewButton) { String usernameText = usernameField.getText(); Staff user = null; for (Person person : staffList) { if (person.getName().equals(usernameText)) { user = (Staff) person; break; } } if (user != n...
ffb16d7c-45ff-46ca-9f2d-e803dfd81282
7
public static boolean LoadTest(Path p) { try { BufferedReader reader = Files.newBufferedReader(p, cSet); String readL = ""; GlobalFuncs.loadMapCharacteristics(reader); GlobalFuncs.scenMap.loadMap(reader); GlobalFuncs.allCOAs = new Vector<COA>(); // Load units while(readL != null) { ...
b5734ff5-755a-42ba-81c1-78d1b8b283b3
3
private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed if (jTable5.getSelectedRow() < 0) { JOptionPane.showMessageDialog(this, "Please select contact to delete", "Error", JOptionPane.ERROR_MESSAGE); return; } int...
1bdcbe9b-906c-46b9-a57d-6ca5a40004cf
9
private static int getOpcode(int sort, int opcode) { if (sort == TYPE.BOOLEAN.sort || sort == TYPE.CHAR.sort || sort == TYPE.BYTE.sort || sort == TYPE.SHORT.sort || sort == TYPE.INT.sort) { opcode -= 4; } else if (sort == TYPE.LONG.sort) { ...
2826da9d-72b8-4ec0-8e4c-82c82d1ecd57
4
public static void main(String[] args) throws InterruptedException, RemoteException, UnknownHostException, NotBoundException { try { Parser.dataNodeConf(); if (Hdfs.Core.DEBUG) { Parser.printConf(new ConfOpt[] {ConfOpt.HDFSCORE, ConfOpt.DATANODE}); } } catch (Exception e) { e.printStackTrace()...
482aeba2-88ee-4389-b1dd-b8d2aaef415c
0
protected Icon getIcon() { java.net.URL url = getClass().getResource("/ICON/de-expressionify.gif"); return new ImageIcon(url); }
052dae66-c008-414d-823c-e323649475dd
2
public List<Utr3prime> get3primeUtrs() { ArrayList<Utr3prime> list = new ArrayList<Utr3prime>(); for (Utr utr : utrs) if (utr instanceof Utr3prime) list.add((Utr3prime) utr); return list; }
64b379b5-5cdc-493c-ada2-1e19f1404c12
7
public void accept() { PluginVars.removeRequest(this); if(!this.requester.isOnline() || !this.requested.isOnline()) return; if(PluginVars.isDueling(this.requester) || PluginVars.isDueling(this.requested)) { this.requested.sendMessage(this.requester.getName() + " is in a duel."); return; } try { if...
9fa60a45-5d5f-4255-84e4-db3380a438c3
8
private Set<Class<?>> add(final Class<?> cls, final Set<Class<?>> s) { if (cls.isInterface()) { s.add(cls); } for (final Class<?> iface : cls.getInterfaces()) { add(iface, s); } final Class<?> superclass = cls.getSuperclass(); if (superclass != nul...
24d1c38f-5bc1-4a4e-b635-148ec72d3f33
5
@Override public void happens() { Character character = Game.getInstance().getCurrentCharacter(); Character exp1 = null; int index = 0; ArrayList<Character> players = Game.getInstance().getCharacters(); search: for (int i = 0; i < players.size(); i++){ if(players.get(i).getItemHand().size() > 0){ Arra...
47351873-8a8e-45e0-ab2b-9d28d5b4c881
7
public int reductionColonne() { int sommeRegret = 0; int min; for(int j = 0; j < this.getTaille(); j++) { min = this.getValue(0, j); if(j == 0) { min = this.getValue(1, j); } for(int i = 0; i < this.getTaille(); i++) { if(this.getValue(i, j) != -1) { min = (this.getValue(i, j) < min...
ad349c5b-ef2a-4ed1-9f07-b30a4e30a2d4
0
public static void dehoist_all(Node currentNode) { currentNode.getTree().getDocument().hoistStack.dehoistAll(); return; }
15dd8816-0a5f-4936-af46-1b2833039b1c
2
public synchronized void stop() { if (!running) return; running = false; try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } }
91dadf1b-0d93-411c-91e6-30b2676d9a24
2
private static String compareFields(String texto, String[] fields) { String fieldFound = "null"; for (String field : fields) { if (texto.contains(field)) { String linea = texto; fieldFound = linea; } } return fieldFound; }
ff3459ee-1759-4e75-8f44-6ffe09536b42
3
private static void addEntry(Hashtable entries, String name) { String dir = ""; int pathsep = name.lastIndexOf("/"); if (pathsep != -1) { dir = name.substring(0, pathsep); name = name.substring(pathsep + 1); } Vector dirContent = (Vector) entries.get(dir); if (dirContent == null) { dirContent = ne...
fb0cf544-9a73-4d99-99b8-99997e04738b
2
void takeTour() throws TooHotException, TooColdException { int temperature = (int) (Math.random() * 100); System.out.println("temperature = " + temperature); if (temperature > 60) { throw new TooHotException("Too hot here"); } else if (temperature < 10) { throw new TooColdException("Too cold here"); } ...
f57ed256-721e-49a9-a131-ab5e77b24422
0
public String getContent() { return content; }
a04d53c6-3938-466c-be13-4eb1e0bf4b77
4
public final Map<Integer, String> titles() { synchronized (this) { while ((this.lock > 0) || (this.lockRead > 0)) { try { wait(); } catch (final InterruptedException e) { Thread.currentThread().interrupt(); return null; } } ++this.lockRead; } try { parseIfNeeded(); return...
45337751-0144-45e9-975f-6ef495fe9317
9
public static void main(String[] args) { try { if (args == null || args.length < 1 || args[0] == null) { // If no arguments passed we exit. We need 1 parameter // containing the path of the configuration file System.out.println(ERROR_NO_CONF); ...
8bec49f3-2e6f-4ab9-9487-64a1f3895714
4
private void stats(Graphics g) { Player player = game.getPlayer(); int rows = 5; int width = per * 128; int height = per * 16 * rows; int x = (getWidth() - width) / 2; int y = getHeight() - height; g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, per * 12)); ...
601332ac-7c05-455a-afaf-e24f7728ee89
5
private void showSaveDialog() { //TODO: Prevent saving (grey out this option) when the game is over. if (matchFileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { try { String filePath = matchFileChooser.getSelectedFile().getPath(); if (!filePath.endsWith("." + MatchSaveData.SAVE_FILE_EXTEN...
43feedf8-0526-4bdc-b360-adfeee30c72a
7
@Override public void generate(Tile[][] tiles, Random random) throws ArrayIndexOutOfBoundsException { Vec2D lt = Vec2D.get(8, 8); for (int x = 0; x < tiles.length; x++) { for (int y = 0; y < tiles.length; y++) { tiles[x][y] = Tile.grass; } } try { for (int i = 0; i < 96; i++) { tiles[lt.getX...
42a8ffc4-023c-4d9a-9efc-5f39e2effc59
6
public void spread(){ if(direction != null && tailleRestante > 0){ switch(direction){ case N : plateau.createFlamme(this.getHauteur(), this.getLargeur()-1, this.tailleRestante-1, this.direction, this.dateFin); break; case S : plateau.createFlamme(this.getHauteur(), this.getLargeur()+1, this.taill...
0f6a3f28-cc57-42a3-a88c-142562e8d5af
8
private int computeSkyLightValue(int par1, int par2, int par3, int par4, int par5, int par6) { int var7 = 0; if (this.canBlockSeeTheSky(par2, par3, par4)) { var7 = 15; } else { if (par6 == 0) { par6 = 1; ...
5e53b25e-7f4b-4a3c-b4ba-4af805586093
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 fe...
d9b9d5de-3c9d-4e86-ab1f-d00739da0d28
2
double[][] lhsu(double[] xmin, double[] xmax, int nsample) { int nvar = xmin.length; double s[][] = new double[nsample][nvar]; for (int j = 0; j < nvar; j++) { int[] idx = randperm(nsample); for (int i = 0; i < nsample; i++) { double P = (idx[i] - random()...
d9099cad-1fee-4b57-b4b0-7c09f5c628c6
4
@EventHandler(ignoreCancelled = true) public void onInventoryClick(InventoryClickEvent event) { if (!event.getInventory().getType().equals(InventoryType.CRAFTING)) // Survival inventory return; Arena arena = OITG.instance.getArenaManager().getArena((Player) event.getWhoClicked()); ...
d09459e0-82a0-4661-9d06-ed22bbaa28fb
4
public void moveWest() throws InterruptedException{ if (isDoor[3] && !isLocked[3]){ currentX--; currentRoom = rooms[currentY][currentX]; currentRoom.playerVisits(); setAdjacentRooms(); Game.printMessage("You walk through the western door\n"); } else if (!isDoor[3]) Game.printMessage("There is no d...
e858c2c0-b690-443d-989e-1c4e76a3dca1
8
public static Coordinates readMoveFromKeyboard() { Coordinates result = null; while (result == null) { System.out.print(">"); String str = null; int row = 0, column = 0; BufferedReader d = new BufferedReader(new InputStreamReader( Syst...
ad5b131a-ee4f-4156-8234-043ca0910ac3
7
public boolean[] getSubDivideMask(CSVColumn sdi, Date start, Date end, File folder) { if (sdi != null) { try { File fname = ObjFunc.resolve(sdi.getFile(), folder); CSTable sdt = DataIO.table(fname, sdi.getTable()); String column = sdi.getColumn(); ...
a78235a0-abf4-4462-8607-f3038113c6c8
8
public void moveNoAnimate(int xa, int ya) { if(xa != 0 && ya != 0) { move(xa,0); move(0,ya); return; } xas = xa; yas = ya; LastDir = dir; if (xa < 0) dir = 1; // 0 - north| 1- east | 2 - south | 3 - west | if (xa > 0) dir = 3; if (ya < 0) dir = 2; if (ya > 0) dir = 0; if(!collision(0,y...
5bdbfac7-9130-4e0a-a106-2aec3cf40159
1
public boolean isEmpty() { return (!this.player.isEmpty() && !this.reason.isEmpty()); }
e07ec45e-d464-421b-91b0-9ae52f3a95df
9
private void addDirectoryToParentEntriesFile(final File CVSdir) throws IOException { synchronized (ksEntries) { final File parentCVSEntries = seekEntries(CVSdir.getParentFile().getParentFile()); // only update if the file exists. The file will not exist in the // case where ...
5203b9aa-0267-4cdc-b039-78c0a04a4756
7
private void destroy(Map<K, List<ObjectTimestampPair<V>>> m, KeyedPoolableObjectFactory<K, V> factory) { for (Iterator<Entry<K, List<ObjectTimestampPair<V>>>> entries = m.entrySet().iterator(); entries.hasNext();) { Entry<K, List<ObjectTimestampPair<V>>> entry = entries.next(); K key ...
e5ed5bf0-cafd-4511-872a-03969c4c2e5e
5
public boolean isResizable(Component c) { boolean resizable = true; if (c instanceof JDialog) { JDialog dialog = (JDialog) c; resizable = dialog.isResizable(); } else if (c instanceof JInternalFrame) { JInternalFrame frame = (JInternalF...
fd2e2e13-b768-4329-a844-679709def648
4
private void sink(int i) { while (2 * i + 1 <= N) { int index = 2 * i + 1; if (index + 1 <= N && pq[index].compareTo(pq[index + 1]) > 0) { index = index + 1; } if (pq[i].compareTo(pq[index]) > 0) { T temp = pq[index]; ...
bd477bd0-d505-4fb6-9b00-124c4f83253c
4
public static void cleanUpTable() { //Loop through every row in the table for(int k = 0;k<=5;k++) { if(clientsTable.getModel().getValueAt(k, 0) == null) { System.out.println("Found Null Value at: " + k); if(k != 5) { if(clientsTable.getModel().getValueAt(k+1, 0) != null) { Syst...
11144e42-1076-4f88-aa7b-785cea095399
2
private void addLines(Document doc, Element linesElement, FileData fileData) { int maxLines = fileData.getLines().size(); if (fileData.getBranchData().size() > 0) maxLines = Math.max(fileData.getLines().size(), Collections.max(fileData.getBranchData().keySet())+1); for (int i = 0; i ...
4264a565-8237-41a6-9d4f-6394c939f21c
1
public void destroyScreen() { isRunning = false; try { gameThread.join(); } catch (InterruptedException e) { e.printStackTrace(); } // game.setScreen(null); }
c90bf58e-437f-46f1-9aee-214f3bd87a2b
5
public Net clone () { Net newNet = new Net(); //clone all the nodes... for (Node node : this._nodes) { Node newNode = node.clone(); newNet.addNode(newNode); // if it's an input or an output, put it in the right place if (newNode instanceof InputNo...
13b97516-6e0f-4aeb-8460-1137e9f8a48f
4
public static Promotion addPromotion(Promotion p) { if (p == null) return null; // We check if the promotion doesn't still exist in the Professor List. boolean exist = false; int pos = 0; for (int i = 0; i < FileReadService.pList.size(); i++) { if (FileReadService.pList.get(i).equals(p)) { exist = ...
6cb34b26-1983-4ad6-94c0-31b2e4a51db8
3
protected void finishModification() { try { courseModel.saveModelFile(); } catch (IOException e) { JOptionPane.showMessageDialog(this, "Cannot save static data file:\n" + e); } try { courseModel.saveStatusFile(); } catch (IOException e) { JOptionPane.showMessageDialog(this, "Cannot save statu...
190d3623-d3a6-4b0d-8989-076cfd806b60
8
private boolean r_shortv() { int v_1; // (, line 49 // or, line 51 lab0: do { v_1 = limit - cursor; lab1: do { // (, line 50 if (!(out_grouping_b(g_v_WXY, 89, 121))) { break lab1; } if (!(in_grouping_b(g_v, 97, 121))) { break lab1; } if (!(out_grouping_b(g_v, 97, 121))) {...
adbba36e-9ea1-47c4-86d9-64bc76bd1ead
2
public void removeSelfFromGrid() { if (grid == null) throw new IllegalStateException( "This actor is not contained in a grid."); if (grid.get(location) != this) throw new IllegalStateException( "The grid contains a different actor at lo...
06e9cfab-eff3-48c1-a7c9-be557e411fa5
5
public boolean buildProduct(String productName){ for(ManufacturedProduct mfp : this.inventory.getManufacturedProductList()){ if(mfp.getProductName().equals(productName)){ for(String rm : mfp.getRawMaterialList()){ for(RawMaterial rm1 : this.inventory.getRawMateria...
74dee449-dd81-4870-b17e-6e7c848a7f43
4
public void addDownloadFromFileName(String fileName) { try { byte[] content = FileReader.readByteArray(fileName); // TODO: Maybe, need real (but simple) check of file format if (content.length < 3) { throw new RuntimeException("Wrong file format"); ...
9878359c-f654-494e-b583-99153acefdff
4
private double addColumnsFromGeometry(RoadGeometry roadGeometry, int beginning, int end, double columns) { if (geometryFitsInside(roadGeometry, beginning, end)) { columns += roadGeometry.length() / (double) roadGeometry.getSmax(); } else if (geometryEndIsOutside(roadGeometry, beginning, end)) { columns += (en...
0923e5a2-43c4-40cc-a8f0-81547897f5f8
5
public static void computePaths(Station source) { source.setMinDistance(0.0); System.out.println("source = " + source); // Using PriorityQueue class with minDistance as a priority (see the comparator of Station) PriorityQueue<Station> vertexQueue = new PriorityQueue<Station>(); vertexQueue.add(sour...
e341ae44-3b08-442c-a785-da214f705bec
4
public int numDistinct(String S, String T) { // Note: The Solution object is instantiated only once and is reused by // each test case. int ls = S.length(); int lt = T.length(); int[][] DP = new int[lt + 1][ls + 1]; for (int i = 0; i <= ls; ++i) { DP[0][i] = 1; } DP[1][0] = 0; for (int i = 1; i <= ...
19e65e94-9e17-4344-b5db-9d029a4f79f8
7
private void updateBoards(List<Clients> clientsList, Character[][] board, int playerNum){ Iterator itr = clientsList.iterator(); int i=0, j=0; while(itr.hasNext()){ Clients client = (Clients) itr.next(); if(playerNum == PLAYER1){ //copy board of player1 for(i=0; i<4; i++){ for(j=0; j<5; j++){ ...
02382f41-0651-4384-8299-9b7f738e1845
8
public static void main (String argv[]) { // create scanner that reads from standard input Scanner scanner = new Scanner(System.in); if (argv.length > 2) { System.err.println("Usage: java Main " + "[-d]"); System.exit(1); } // if commandline option -d is provided, debug the scanner if (argv.le...
0e85da9f-5163-488f-8c96-72271c894c42
2
private void printResults(ChessGameConfiguration[] results){ String errorMsg; if (results.length == 0){ errorMsg = messages.getString("noSolutionsFound"); System.out.println(errorMsg); }else{ String msg = results.length + " "+ messages.getString("solu...
11590829-7aba-4559-a800-26bc8db1674e
7
private HttpHeader getHttpHeader(int length){ len = len + length; splitbyte = findHeaderEnd(bytes, len); if(splitbyte > 0){//find http header end findHttpHeader = true; httpHeader = new HttpHeader(); // Create a BufferedReader for parsing the header. ByteArrayInputStream hbis = new ByteArrayInputStrea...
aa101283-adb6-4330-b380-f0c2736d8d03
2
private static Map<Character, Integer> addToMap(String text) { Map<Character, Integer> map = new HashMap<>(); for (int i = 0; i < text.length(); i++) { char character = text.charAt(i); if (map.get(character) == null) { map.put(character, 0); } ...
eea811c6-1b8e-4beb-ab6a-c4a56fdac4db
4
@Override public void run() { System.out.println("Input run"); this.window.setEditable(true); try { OutputStreamWriter os; os = new OutputStreamWriter(out); while (this.open) { System.out.println("input loop"); ...
badd6dab-b9a6-477b-a1a7-7ea67451eb58
5
public boolean checkDot(char c, boolean allowDot) { return (c == '.' && allowDot) && (c == '.' && Utils.getCountOf(getText(), ".") < 1) && (c == '.' && !getText().isEmpty()); }
93c1616f-5d4d-4dec-a8e4-970e7f41403c
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Campus)) { return false; } Campus other = (Campus) object; if ((this.id == null && other.id != null) || (this.i...
06f71235-7dd1-484c-b563-b11111c5662d
9
final static Options createInstance( final Configuration configuration ) { final Options instance = createDefaultInstance(); if ( configuration != null ) { instance.setAntialiasScreen( configuration.isAntialiasScreen() ); instance.setShowScale( configuration.isShowScale() ); ...
c322a345-8060-492c-90c9-5657c7a2d6cc
4
private void mainLoop() { screen = new ScreenSprites(); screen.init(); timer = new Timer(Constants.FPS_UPDATE); fpsMeter = new FpsMeter(); while (!Display.isCloseRequested()) { glLoadIdentity(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); int j = timer.ticksMissed; if (j > 1) fpsMeter...
e1ec2a03-2e13-45fc-abb1-4b19473acdc9
7
public void dostuff(HashMap<Integer,GameData> g,Vector<Integer> index,CalculatingConsole c,HashMap<String,PlayerData> p) { game=g; con=c; players=p; LinkedList<Moneys> tem=new LinkedList<Moneys>(); tem.add(new Moneys("Correct",TOURNY)); correction=new Player("Correct",25000,tem,this); con.everyone.put...
d2502d99-0390-4c67-8a64-dd4910b31087
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
e799fc1b-ce54-4b74-9655-fa7d1d0037b9
8
public void compExecTime() { double newExeTime; double newCost; dEval = 0; dTime = 0; dCost = 0; for (int i = 0; i < iClass; i++) { newExeTime = 0; // System.out.print("Cost[" + i + "]"); for (int j = 0; j < iSite; j++) { if (dmAlloc[i][j] != -1) { if (dmAlloc[i][j] < 1) { newExeTime...
3434c637-c7cc-4501-b4ed-33106e218aeb
0
public String getId() { return id; }
2cfdbabb-4a27-47c5-a741-d4cd5b55df57
3
public void saveImage(ActionEvent e){ int returnVal = fc.showSaveDialog(Paintimator.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File savedPane = fc.getSelectedFile(); String ext = Utils.getExtension(savedPane); ImageFilter imgfltr = new ImageFilter(); if (imgfltr.accept(savedPane)) { tr...
304954ba-4ee1-4a19-9378-049eb49b56b6
7
public static void main(String args[]) throws IOException { Scanner in = new Scanner(System.in); String password = "star"; System.out.println(">Enter the database password:"); String passIn = in.nextLine(); if(passIn.equals(password)) { System.out.println(">Enter menu selection:\n1 Create File\n2 Open F...
fc046e1a-a3d4-4960-8335-c74106e7f5dd
1
public void writeData(final DataOutputStream out) throws IOException { out.writeShort(locals.length); for (int i = 0; i < locals.length; i++) { out.writeShort(locals[i].startPC()); out.writeShort(locals[i].length()); out.writeShort(locals[i].nameIndex()); out.writeShort(locals[i].typeIndex()); out.w...
baef7ded-4659-4796-a244-81690db7ac23
6
public double evaluateState(StateObservationMulti stateObs, int playerID) { boolean gameOver = stateObs.isGameOver(); Types.WINNER win = stateObs.getMultiGameWinner()[playerID]; Types.WINNER oppWin = stateObs.getMultiGameWinner()[(playerID + 1) % stateObs.getNoPlayers()]; double rawScore...
2b8e2951-dba4-4221-88bf-f2ce7b923e8e
7
public double obtenerMinimo(int columna, String csvFile){ String line = ""; String cvsSplitBy = ","; BufferedReader br = null; double minimo = 0; boolean primera = true; try { br = new BufferedReader(new FileReader(csvFile)); while ((line = br.readLine()) != null) { St...
2f1bd22d-aed3-4945-b0d8-caeefe4c6707
6
public BlockMap(int var1, int var2, int var3) { this.width = var1 / 16; this.depth = var2 / 16; this.height = var3 / 16; if(this.width == 0) { this.width = 1; } if(this.depth == 0) { this.depth = 1; } if(this.height == 0) { this.height = 1; ...
83126d01-5522-4465-a2b4-684d8bb61286
3
public boolean cadastrar() { EntityManager em = conexao(); try { if (em != null) { Paciente paciente = new Paciente(); paciente.setIdPaciente(null); paciente.setNome(nome); paciente.setDataNasc(dataNasc); pacient...
c44a87d0-cf5a-410c-b5b6-442de52dc3b4
1
@Test public void testGetAllCouriers()throws Exception{ List<Courier> couriers = connection.getAllCouriers(); //check first courier Assert.assertEquals("First courier slug", firstCourier.get("slug"), couriers.get(0).getSlug()); Assert.assertEquals("First courier name", firstCourier...
f08bf9e3-b974-4ef1-84ae-ff4d6878b625
3
public static void main(String[] args) throws ClassNotFoundException { int[] sched = {1,2}; DbHelper db = new DbHelper(); for(int schedule : sched) { List<Group> groups = fillRooms(db, schedule); System.out.println("Schedule: " + schedule + "-------------"); for(Group g : groups) { ...
e3c27946-6824-40d2-aed4-f33950e90810
9
@Override public Command createCommand(Context context, String... args) { HttpCommand.Operation operation; String path = null; MediaType mediaType = null; Map<String, String> parameters = new HashMap<String, String>(); Map<String, String> headers = new HashMap<String, String>...
b76b0d1b-a5ad-4715-a88f-4a83c537056c
0
public static void question9b() { /* QUESTION PANEL SETUP */ questionLabel.setText("Which of these below do you like the most?"); questionNumberLabel.setText("9b"); /* ANSWERS PANEL SETUP */ //resetting radioButton1.setSelected(false); ...
c8558004-4a00-4895-b7e2-db6e38c0781f
8
static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[18]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 4; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { ...
ad58ae56-1e02-4bea-b63d-6ef54cdb48a4
2
public static List<Laureate> filterByDeathYear( List<Laureate> inputList, List<String> ListOfTerms) { List<Laureate> outputList = new ArrayList<Laureate>(); // parse input, keep what matchs the terms. for (Laureate Awinner : inputList) { if (ListOfTerms.contains(Awinner....
00e0345b-9c6d-4ef2-9d45-26a1fe8a0c6c
6
public void run() { boolean var27 = false; label183: { label184: { label185: { label186: { label187: { try ...
e381ba2b-6055-4f3d-8570-5fb457beb4bd
0
public String toString() { return "x = " + this.x + ",y = " + this.y + ";"; }
07ebb472-ea64-434f-aa51-a6bbdaabcdc3
9
public FloorItem getGroundItem(int id, WorldTile tile, Player player) { if (floorItems == null) return null; for (FloorItem item : floorItems) { if ((item.isInvisible() || item.isGrave()) && player != item.getOwner()) continue; if (item.getId() == id && tile.getX() == item.getTile().getX() &&...
0d5234f9-3b4f-4cdd-8da0-d3cc8f4c7c43
7
public byte[] populate(byte[] frameData) { logger.debug("populate.."); boolean readingState=false; int bytesRead=0; //boolean frameCompleted=false; ByteBuffer payloadBuffer = ByteBuffer.allocate(frameData.length); for (byte newestByte:frameData){ bytesRead++; if (newestByte == START_OF_FRAME && !readi...
5b44db66-e993-4937-a17c-79379e76c901
2
TreeNode rightNext(){ TreeNode head = queue.poll(); if (head.right != null) queue.offer(head.right); if (head.left != null) queue.offer(head.left); return head; }
db44aae7-27b2-4be9-b2e1-747c1c7dbd92
6
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == btnSave) { saveUpdateSubProcess(); closedByOk = false; } if (e.getSource() == btnClose) { if (saveUpdateSubProcess()) { closedByOk = true; SubProcessCUDialog.this.setVisible(false); } } if (e.getSource...
a0d791d8-abfa-4cb5-b2b5-e6f0c5ea749a
5
private void insertAVL(TreeNode currentNode, TreeNode newNode) { if (currentNode == null) { this.root = newNode; } else { if (newNode.value.compareTo(currentNode.value) < 0) { if (currentNode.left == null) { currentNode.left = newNode; ...
77f6872b-8b86-424e-9015-bf0376f789e9
6
public double evaluate(Tree<Board> tree, boolean maxPlayer) { Board b = tree.getRoot(); if (tree.getLeaves().isEmpty()) { this.isFinished = true; return getBoardValue(b); } else { double bestValue; if (maxPlayer) { bestValue = Integer.MIN_VALUE; List<Tree<Board>> t = tree.getLeaves(); for(...
b9ed511e-6d4e-423f-921c-1b22d88980f3
3
private static void executeCmd(String... cmd) { System.out.println("spawning" + Arrays.toString(cmd)); try { ProcessBuilder pb = new ProcessBuilder(cmd); Process p = pb.start(); if (true) { InputStream in = p.getInputStream(); BufferedI...
3695aa84-aaca-4b3a-b01f-f91dc5165ed7
6
@Override public void tick(MainGame game, Person person) { if(person.storedWood.getAmount() >person. maxResource || person.storedFood.getAmount() > person.maxResource || person.storedMetal.getAmount() > person.maxResource || person.storedStone.getAmount() > person.maxResource) { //Make the player go to t...
31990279-6f6d-4399-9e5a-2fef2db67b15
4
public static Image loadImage(String name, int type) { switch(type) { case BMP: return loadBMP(name); case PNG: return loadPNG(name); case JPG: return loadJPG(name); case GIF: return loadGIF(name); default: throw new UnsupportedOperationException("Not a supported image type. [" ...
33965956-a23c-42f4-87f6-e73117e84648
9
public int largestRectangleArea(int[] height) { Stack<Integer> s = new Stack<Integer>(); int len = height.length; int [] left = new int[len]; int [] right = new int[len]; int index =0; for (int i=0;i<len;i++) { while (!s.isEmpty() && height[s.peek()]>=height[i]) s.pop(); left[i]= i- ...
73722b4c-a5a8-49a0-95fc-f9a8a03c5b4d
3
public static void caida() { if (terminocaida){ terminocaida = false; file = new File("."); ruta = file.getAbsolutePath(); Thread hilo = new Thread() { @Override public void run() { try { ...
ef87ab07-de93-4f8d-9472-4700a05e9668
3
public static List<TrialGroup> createTrialGroups(List<Trial> trials) throws IncorrectNumberOfTrialsException { List<TrialGroup> trialGroups = new ArrayList<TrialGroup>(); while (!trials.isEmpty()) { List<Trial> trialsInThisGroup = new ArrayList<Trial>(); for (int iTrial = 0; iTrial < Opt...
a4b1c696-62f5-4c5c-9e81-02dfc431ad8c
9
private static void merge(ConllSentence sen, ConllSentence mwe, String[] originalpositions) { ArrayList<Integer> op = new ArrayList<Integer>(); for(String s: originalpositions){ op.add(Integer.parseInt(s)); } int orignalMWEHeadPostion = op.get(0); int headOfMWE = Integer.parseInt(((sen.lines.get(orignal...
e08c52d5-0e4b-4fd6-a41c-8255fe15303e
9
public void actionPerformed(ActionEvent evt) { /** if save configuration button is clicked */ if (evt.getActionCommand().equals("Save Configurations")) { /** copy new keys back to glocal variables */ for (int i = 0; i < 4; i++) for (int j = 0; j < 5; j++) BomberKe...
6b2f1450-eda5-4b61-8527-05b61fa966be
6
public static boolean helpMostSpecificMethodP(Stella_Class renamed_Class, MethodSlot method) { if (renamed_Class == null) { return (true); } { boolean testValue000 = false; { boolean foundP000 = false; { Slot slot = null; Cons iter000 = renamed_Class.classLocalSlots.theConsLi...
661fa881-14d1-4578-8e92-2f5eff87b837
9
@Override public List<ECollisionType> getCollisions(Long id, Long lecturerId, List<Long> roomIds, List<Long> studentGroupIds, int numberOfAppointments, Date startDate, Date endDate) { if (id != null) { return new ArrayList<ECollisionType>(); } // The set with all found collionsTypes Set<ECollisionType...
f45839ff-87a5-4cf5-9d7c-f1c21d2bfba2
8
public void move(boolean max, int m) { int start = m; int finish = m + this.board[m]; int loops = (finish - start) / 13; if (max) { if (finish == 13) { finish++; } if (finish <= 12) { fillBeans(start + 1, finish); } else { ...
e992ec56-673e-49f7-8663-df7870b554f5
4
public static void print(Collection<? extends Object> collection) { Iterator<? extends Object> it = collection.iterator(); collection.getClass(); System.out.print(collection.getClass().getSimpleName() + ": " + (it.hasNext() ? it.next() : null)); while(it.hasN...