method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5d79af6d-4ac4-4df6-bee1-bbb78b933126
5
public void run() { try { captrueOutputStream=new BufferedOutputStream(s.getOutputStream()); } catch (IOException ex) { return; } AudioFormat format =new AudioFormat(8000,16,2,true,true);//AudioFormat(float sampleRate, int sampleSizeIn...
0c98a6c6-cf6e-4613-9398-c49592609f4d
5
public void PlayGame() { if (lifepoints <= 0){ gameover = true; //out of life } if (gameover == true){ draw.gameEnded(); } if (isItMovingTime){ moveOwl(); } if (hitMine()){ boom...
0197bb72-77ae-48ee-be76-2120f097e208
2
public boolean isCommand(String id) { for (String each : commands) { if (id.equals(each)) { return true; } } return false; }
bd953eb8-081e-4833-b247-a85d7632face
3
private void destroy(float x, float y) { beeHitBox.setLocation(x + 8,y); for(int i = 0; i < map.length; i++){ if(beeHitBox.intersects(map[i])){ if(map[i].type != 0){ map[i].type = 0; } } } }
be2b9bfd-13f4-4c0a-b96f-5ed058a31f0c
4
protected void assignTeamRep() { teamRepDLM.removeAllElements(); Object teamRepO = teamMemberSTRJlst.getSelectedValue(); String teamRepName = null; if (teamRepO != null) { teamRepName = teamRepO.toString(); teamRepDLM.addElement(teamRepName); } String[] teamRepValue = debateSelected.getTeamRep(); if...
f24e5854-7466-46e3-9ed1-39e0dcb144e7
1
public void onEvent(Event event) { if (event instanceof ScannedRobotEvent) { OnScanRobot((ScannedRobotEvent) event); } }
eba8faa9-a8b2-4703-a76d-ffdcf1dbcfc4
6
public void addTower(String type, int x, int y) { Tower t = new Tower(x, y, CalculateTowerRange(x, y, 10), 10); if (credits >= t.getPrice()) { credits -= t.getPrice(); for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { map.getTile(x + ...
fe74335a-5843-419e-b8e9-f2397cefb6b3
6
private Integer getNbSugarsFromInstruction(String instruction) { Integer nbSugars = null; if (instruction == null || instruction.isEmpty()) { nbSugars = 0; } else if (instruction.matches("[0-9]+")) { try { nbSugars = Integer.parseInt(instruction); ...
7264e1f0-4266-4716-9f98-44984ea36658
2
private void heap_up(Binarynode node) { if (node == root) { return; } int valuehelper; if (node.parent.value > node.value) { valuehelper = node.value; node.value = node.parent.value; node.parent.value = valuehelper; } else { ...
980c8169-e058-4f46-a25f-21b61109f43e
9
public static char toJamo(char jamo, int flag) { char result = 0; switch (flag) { case JAMO_CHOSEONG: if (jamo >= 0 && jamo <= 0x12) { result = (char)(jamo + 0x1100); } break; case JAMO_JUNGSEONG: if (jamo >= 0 && jamo <= 0x14) { result = (char)(jamo + 0x1161); } break; case JAMO_JON...
e8286f45-6030-4335-9aa8-e84b28b6b598
0
public Driver(boolean show){ this.show=show; }
e214dba7-807e-4317-a845-81f42df3e385
9
public static ArrayList<EARSRequirement> ReadXML(String _fileName) { ArrayList<EARSRequirement> reqsList = new ArrayList(); String opCond, opTrig, sName, sResp, specState, featIncl; String reqType, reqCCode, reqIndex; try { // if(XmlValidate.validate(_fileName)) ...
46b3da45-a48a-4328-ac22-4a5ef43876e2
6
@Override public boolean activate() { furnace = SceneEntities.getNearest(Constants.FURNACE_IDS); if (Players.getLocal().isMoving()) { if (furnace != null && furnace.isOnScreen() && Inventory.getCount(Constants.IRON_ORE_ID) > 1 && Inventory.getCount(Constants.COAL_ID) > 2 && !Constants.SM...
5ab23942-04a6-4bef-8ea6-d00d719b303e
8
private Vector see(Vector dis, SimulationEntity otherObject){ double len = dis.getLength(); //We only act on what's in range of vision if(len > 0 && len <= Constants.maxVision){ //First we normalize the vector to get the direction dis.normalize(); if (othe...
764bb7fe-2e1d-4e37-81ea-9ba51834ce10
3
void q19() { String s = "pizza"; if ("pepperoni".compareTo(s) < 0) { if ("pineapple".compareTo(s) < 0) { if ("vegetarian".compareTo(s) < 0) { String x = "veggie" + s; } } } }
83d02b61-f9a6-4b44-9fc8-1f41055d8c00
5
protected void updateDefaultLocation() { //Récupération des centres int centrex1 = (elem1.getX() + elem1.getWidth() / 2); int centrey1 = (elem1.getY() + elem1.getHeight() / 2); int centrex2 = (elem2.getX() + elem2.getWidth() / 2); int centrey2 = (elem2.getY() + elem2.getHeigh...
ae7e0b5e-babf-4bae-8c66-4ed1ca024137
2
public static void launch() { Window.createWindow(coreEngine.getWidth(), coreEngine.getHeight(), coreEngine.getTitle()); Camera camera = new Camera(coreEngine.width, coreEngine.height); instance.init(); while (!Display.isCloseRequested() && !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)...
4116c71a-180f-4afc-ba47-08d3f4136bc7
0
Knight(int t, boolean w, int x, int y){ super(t,w,x,y); dist = 1; int[][] ex = {{1, 2}, {-1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, 1}, {-2, -1}}; moves = ex; }
9fedfa59-b958-46bb-b6b9-43f05edaa7a8
0
public int getId() { return id; }
d6da26a6-e11c-46d3-aae2-306a9ddd5ba7
8
private void processLine(String line) { if (line.matches("\\[[^]]+]")) { changeSection(line.substring(1, line.length() - 1)); } else { switch (section) { case MODULES: line = line.trim(); if (line.matches("[\\$A-Za-z_][0-9A-Za-z_]*")) { enabledModules.add(line); } break; case...
94065d49-1079-4ff4-8e26-4c1d87366aa8
0
@Override public void rotateX(int angle) { base = DimensionalTrasform.rotateX(angle, base); setColoredExes(); }
c52c72f8-a728-47df-b553-c960eceeb552
9
public int minDepth(TreeNode root) { // Start typing your Java solution below // DO NOT write main() function if(root == null)return 0; LinkedList<TreeNode> queue = new LinkedList<TreeNode>(); queue.addLast(root); TreeNode first = root; int level = 0; while(!que...
5ea90541-c8d3-401d-bbb6-35a1b214c40f
1
public void remove(AlumnoBean oAlumnoBean) throws Exception { try { oMysql.conexion(enumTipoConexion); oMysql.removeOne(oAlumnoBean.getId(), "alumno"); oMysql.desconexion(); } catch (Exception e) { throw new Exception("AlumnoDao.removeAlumno: Error: " + e....
7a34b225-ad62-47ed-8fb0-58423b232bb9
2
public String getName() { if(this.firstName.isEmpty() && this.lastName.isEmpty()) return "Nouvel enseignant"; else return this.firstName + " " + this.lastName; }
51e59604-05d0-499c-9ac5-a46b1219af9c
1
@Override public void execute(VirtualMachine vm) { super.execute(vm); if (identifier != null) { ((DebuggerVirtualMachine) vm).enterEnvironmentRecord(identifier, vm. topFrameSizeRunTimeStack() - 1); ...
243a99ea-4994-44f2-b17f-3ff42deb29aa
8
@Test public void probarFormatos() { //http://docs.oracle.com/javase/1.5.0/docs/api/java/text/DecimalFormat.html //http://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html Locale[] locales = NumberFormat.getAvailableLocales(); double myNumber = -1234.56; NumberFo...
ed6c7844-41ff-4edf-a8ab-35c2be9fac87
4
public Room[] buildRoomList(Cell[][] cells) { int cellCount = cellsWidth * cellsHeight; int ROOM_MIN = (int) (.3 * cellCount); int ROOM_THRESHHOLD = (int) (.5 * cellCount); int numberOfRooms = 0; while (numberOfRooms <= ROOM_MIN || numberOfRooms >= ROOM_THRESHHOLD) { ...
d66bb68d-1e05-4a72-8450-ed77869b0c00
9
private TokenType.Element charToTokenType( char ch ){ TokenType.Element type; switch( ch ){ case '=': type = TokenType.Element.EQUALS; break; case '<': type = TokenType.Element.LESS_THAN; break; case '+': type = TokenType.Element.PLUS; break; case '-': ...
54aa80da-0d6f-4b28-a6ab-8eb055711c27
9
public void characters(CharSequence chars, int locationId, int properties) throws XPathException { if (inFormattedTag || (properties & ReceiverOptions.USE_NULL_MARKERS) != 0) { // don't split the text if in a tag such as <pre>, or if the text contains the result of // expanding a charact...
d5666092-9e37-47c4-893c-c1b9f718b230
1
public boolean mousewheel(Coord c, int amount) { if (!Config.zoom) return false; si = Math.min(8, Math.max(0, si - amount)); setScale(scales[si]); return (true); }
cf3d233e-db32-473c-bb77-fb5a202fe448
9
private Rectangle subDivide(BST node, int depth){ if (depth == 0){ //leaf nodes, randomly generate rectangles in this area areas.add(node.area); //randomly determine if the room is hidden or not. if(MapRand.randBool(HIDDEN_ROOM_PROB) == false){ //create room within this area by the given padding ...
15e99117-2c57-4527-84f9-e7a34b525cbf
2
private void handleFileOpen() { //saveProgress(); setFileName(null); String chosenFileName; if(JFileChooser.APPROVE_OPTION == fileChooser.showOpenDialog(frame)) { File file = fileChooser.getSelectedFile(); chosenFileName = file.getAbsolutePath(); } else return; clearCards(); cardStackFrom = Card...
624359f6-c0d6-4361-bb99-24d9ed7fd83d
0
public int[] getPixels() { return pixels; }
7b6ded98-cce1-407a-9114-5709ea189c6c
3
public void setZip(String zip) { if(zip == null || zip.isEmpty() || zip.length() != 5){ throw new IllegalArgumentException(); } this.zip = zip; }
64747627-b0b1-4899-a459-a4b9c8148a7a
5
private void resize() { width = getSkinnable().getWidth(); height = getSkinnable().getHeight(); if (getSkinnable().isKeepAspect()) { if (aspectRatio * width > height) { width = 1 / (aspectRatio / height); } else if (1 / (aspectRatio / height) > width) { ...
7817fbca-fd26-4491-a9d2-ed0df4200b42
9
public static int[] getJenksBreaks(ArrayList<Double> list, int numclass) { //int numclass; int numdata = list.size(); if( numclass > list.size() ) { numclass = list.size(); } double[][] mat1 = new double[numdata + 1][numclass ...
3b171dc4-96ec-4049-9cea-b3f79135ef4a
7
private void procurarProximaRota(List<Rota> rotaDeEntrada, String origem, String destino, List<Rota> rotas) { // Valida se a origem jah passou por alguma rota, entao deve ser // disconsiderado, para nao gear looping infinito de rotas if (jaPassouPeloPontoComoOrigem(origem, rotaDeEntrada)) { return; } // C...
192a4d7e-f17f-4a7b-8158-23670d29d79a
7
@Override public ForeignKey parse() { if(!this.prepared) { this.prepared = true; StringBuilder sB = new StringBuilder(); sB.append("FOREIGN KEY ("); int i = 0; for(String lF : lFL) { if(i > 0) { sB.append(", "); }else{ ++i; } sB.append(lF); } sB.append(") \...
ee84278c-ec24-457b-82e6-81d56f9f927b
6
public static void openFolder(File path) { String absolutePath = path.getAbsolutePath(); OperatingSystem os = getCurrentPlatform(); if (os == OSX) { try { Runtime.getRuntime().exec(new String[] { "/usr/bin/open", absolutePath }); return; } catch (IOExc...
1879a6c1-e073-49d8-aa6b-cfb3aff74b02
7
public int getTruthState() { int[] truthStates = new int[nines.size()]; for(int i=0; i<nines.size(); i++) { truthStates[i] = nines.get(i).getTruthState(); } int wrong = 0; int incomplete = 0; int solved = 0; for(int i=0; i<nines.size(); i++...
f9840a12-efac-48ae-834c-c8b5366abdc8
0
public int getHeight() { return this.h; }
9812196e-0cb7-4282-9e48-6415ceda43ed
3
public void saveData(File file) { try { BufferedWriter out = new BufferedWriter(new FileWriter(file)); String data = Statistics.exportData(); if (data != null) out.write(data); else JOptionPane.showMessageDialog( dialog, "Error: no data to write!", "Error saving", JOptionPa...
d28e0a21-0c05-4659-a24e-98f54eb2a0e9
9
public JTable getSelectedTable() { switch (tabbedPane.getSelectedIndex()) { case ACCT_TAB_INDEX: if (accountInfoTabPane != null) switch (accountInfoTabPane.getSelectedIndex()) { case CONTACT_TAB_INDEX: return contactInfoTable; case TANK_TAB_INDEX : return tankInfoTable; case SERVICE_TAB_...
74509854-919f-47ec-bd45-5c0cb6b78aec
2
public String readFile() { StringBuffer sb = new StringBuffer(); try { String str; while((str = x.readLine())!= null) { sb.append(str); sb.append("\n"); } } catch(Exception e) { System.out.println("Error reading the file"); } return sb.toString(); }
82933e3c-3ec0-436e-aa2d-30b66afa5729
5
public void remove(int i) { if (i == 1) { firstElement = firstElement.getNextElement(); } else if (i > 1) { Element tmpf = firstElement; Element tmps = firstElement.getNextElement(); Element tmpt = firstElement.getNextElement().getNextElement(); ...
b56bbd9a-eb79-423c-8e4b-e12e7aa512fb
7
public void zoom() { MapObject[][] objRef = new MapObject[TILE_COUNT_WIDTH][TILE_COUNT_HEIGHT]; boolean[][] availability = new boolean[TILE_COUNT_WIDTH][TILE_COUNT_HEIGHT]; for (int i = 0; i < objRef.length; i++) { for (int j = 0; j < objRef[i].length; j++) { objRef[i][j] = this.grid[i][j].getObjec...
ceeb03ca-005b-4b8a-a4bb-522d777cd3e3
8
final void method3984(int i, int i_0_, int i_1_, boolean[][] bools, boolean bool, int i_2_, int i_3_) { anInt5151 = i_2_; int i_4_ = 0; float[] fs = new float[aClass262_5149.getSize(0)]; for (Class348_Sub1 class348_sub1 = (Class348_Sub1) aClass262_5149.getFirst(4); class348_sub1 != null; class34...
10471e7f-93fb-4196-ba03-e36db7b85810
0
public Owner getOwner(){ return owner; }
dd8a9f34-c30b-442c-a3bc-77c60d549e2f
3
public BoxGUI(BoxPos _boxPos) { boxPos = _boxPos; box = boxPos.getBox(); setFont(font); setFocusable(true); addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent mouseEvent) { grabFocus(); } @Override public void mousePressed(MouseEvent mouseEvent) {} @Ov...
fb0ac520-35f4-45dd-a79f-c82215cb5998
4
@Override public void mouseClicked(MouseEvent arg0) { if(list != null & list.getSelectedIndex() > -1) { switch (list.getSelectedIndex()) { case 0: //common preferences are selected mainPanel.add(lookAndFeelPanel); break; case 1: mainPanel.add(pathAudioPanel); break; ...
f950afb3-7435-4bc5-b7aa-6778584ed8c2
8
private int getVertexCount() { int vertexCount = coordinates.length; if (colors3 != null) { if (colors3.length > vertexCount) vertexCount = colors3.length; } else if (colors4 != null) { if (colors4.length > vertexCount) vertexCount = colors4.length; } if (normals != null) { if...
77b00948-286a-460d-aba9-5aeb5646a01d
9
int insertKeyRehash(float val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look ...
83105ee4-20d7-43b5-9abf-e028409fcc3f
0
public WeatherTypes getWeatherType() { return weatherType; }
ca6e8790-fe2e-48ba-abdc-20da2cca0528
4
public Celda buscarCelda(int x, int y) { if((x < 0 || x >= this.dimension) || (y < 0 || y >= this.dimension)) { return null; } else { return this.tablero.get(this.convertirCoordenada(x, y)); } }
941e5a87-88a4-48ec-abce-ef22daf73f74
9
public static UserBean login(UserBean bean) { // Preparing some objects for connection Statement stmt = null; // Get the username and password from the bean // (Initially entered by the user and saved to the bean by the Servlet) String username = bean.getUsername(); String password = bean.getPassword(); ...
2cd94a0d-200c-4a17-8302-efc324cbef47
5
public void update(GameContainer container, StateBasedGame sbg, int delta) throws SlickException { int xpos = UIGlobals.convertMouseLocation(Mouse.getX(), container.getWidth()); int ypos = UIGlobals.convertMouseLocation(Mouse.getY(), container.getHeight()); if (Mouse.isButtonDown(0)){ if (play_button.isO...
778b1595-0044-4b48-a326-26ebbceafc3c
4
@Override public void valueRecived(SlotInterface s, Value v) { if (s.getLabel().equals(Trigger)) { if (__lock) { return; } // do something if (code_.equals(textArea_.getText()) && body_ != null) { __lock = true; run(); } else { __lock = true; code_ = textArea_.getText(); parse...
5cce1825-457d-4b46-886c-46dc04324052
4
public void run() { if(Bank.open()) { if(Bank.deposit(Util.tokenId, 0)) { int time = 0; while(validate() && time <= 4000) { time += 50; Time.sleep(50); } } } }
0ce6b070-f92f-4200-a7d1-b0b6fe900f12
4
public List<Example> getDistinctTransazioni(String table) throws SQLException, EmptySetException{ Example tr; List<Example> comp = new ArrayList<Example>(); String query = "SELECT DISTINCT * FROM " + table + " ;"; Statement s = DBAccess.getConnection().createStatement(); ResultSet r = s.executeQuery(que...
0231ad4b-cc83-4ca7-8190-be335151994a
9
@Override public String getReply(String message, String pnumber) { if(state==-1){ message=convertMessageFromShortcut(message); state=0; } if(state==0){ state=state+1; return "Choose Your preferLangauge\n"+ getListOfLanguage()+"\n"+getLastLine(); } if(state==1){ int option=MessageHandler.getMes...
523411a1-b429-4754-8e7a-9f15b35f2830
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Brigade other = (Brigade) obj; if (this.id != other.id) { return false; } if ...
bc670362-28f4-4b9c-899c-0225901b02fe
6
public boolean submitEvidence(Evidence evidence, String actionType) { boolean flag = false; Element evidenceE = (Element) document .selectSingleNode("//" + actionType + "[@id='" + evidence.getId() + "']"); if (evidenceE != null) { evidenceE.element("dialogState").setText(evidence.getDialogState()); // W...
5d0fcc5f-c002-4fbf-afdd-bf7127d00e8c
8
@Override public int compareTo(ThreeDimCoordinate coord) { final int BEFORE = -1; final int EQUAL = 0; final int AFTER = 1; if (coord == null) return AFTER; if (this.getX() == coord.getX() && this.getY() == coord.getY() && this.getZ() == coord.getZ()) return EQUAL; if (this.getZ() == c...
607764ae-ff7a-496b-9d32-ed5c746dfef3
1
public ReceiveQueryEvent(Object source, ConnectionInfo info, String execCommand, Object params) { super(source); if (info == null) throw new IllegalArgumentException("info is null."); this.connectionInfo = info; this.execCommand = execCommand; this.params = params; }
bcbcfb51-7c8a-4f73-b466-df9fc7c62c52
8
protected CohoNumber nextNorm(CohoMatrix A_trans_base, Matrix x, Matrix y, CohoNumber currNorm){ try{ Matrix pi = A_trans_base.getSolution(x); Matrix eta = A_trans_base.getSolution(y); CohoNumber newNorm = null; for(int i=0;i<pi.length();i++){ CohoNumber pi_i = pi.V(i); CohoNumber eta_i = eta.V(i...
d1ae57c7-1bd1-4646-b9e1-4d89bc102617
4
public void paintAllBlocks(Graphics g) { for (int x = 0; x < blockmap.width; x++) { for (int y = 0; y < blockmap.height; y++) { for (int z = 0; z < blockmap.depth; z++) { if (blockmap.map[x][y][z] != null) { g.drawImage(blockTextures[bl...
ea428ccf-aceb-42a0-bb8f-774f95f3e73a
3
private void fillTours(List<Tour> tours, AbstractDao dao) throws DaoException { if (tours != null) { for (Tour tour : tours) { Criteria directCrit = new Criteria(); directCrit.addParam(DAO_ID_DIRECTION, tour.getDirection().getIdDirection()); List<Direc...
42b8f790-8284-4e66-bd05-822ef6ff72cf
0
public List<Record> getList() { return list; }
ef0e1ec0-81de-4d8d-921b-5b60befe04f0
7
public String makeThrow(int humanResponse) { // Rock = 0, Paper = 1, Scissors = 2 //Stores in Group of 3, the RPS and adds it a to hash table which records the counts of that RPS value. computerResponse = calc.calculateThrow(humanResponse); if (humanResponse == computerResponse) { ...
419aed03-c665-4fdf-a0f8-e7e422d84aec
8
private void incrementSendMessages(ProcessId dst) { if(sentCount.get(dst.toString()) == null) sentCount.put(dst.toString(),1); else sentCount.put(dst.toString(), sentCount.get(dst.toString())+1); if(messagesToCount > 0 && scheduledToCountSend == true){ if((cou...
7b975d1c-d372-451d-83be-b0679f07515b
6
public static TimeDuration makeTimeDuration(int days, int millis) { while (millis < (0 - Stella.MILLIS_PER_DAY)) { millis = millis + Stella.MILLIS_PER_DAY; days = days - 1; } while (millis > Stella.MILLIS_PER_DAY) { millis = millis - Stella.MILLIS_PER_DAY; days = days + 1; } ...
d75920bd-56a2-411d-a276-f0376b62ff5c
2
public void close(){ try{ this.fileChannel.close(); this.fileOutputStream.close(); }catch(Exception e){ e.printStackTrace(); try{ this.fileChannel.close(); this.fileOutputStream.close(); }catch(Exception e1){ e1.printStackTrace(); } } }
c13b34e9-ee34-4bde-93b5-15a9cb72e760
5
private static boolean isHex(final byte c) { return ('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F'); }
db33b00f-371e-49f1-9b39-50790fc61bb8
3
HashMap<String, String> parseAttributes(String attrStr) { HashMap<String, String> keyValues = new HashMap<String, String>(); if (attrStr.length() > 0) { Matcher matcher = ATTRIBUTE_PATTERN.matcher(attrStr); while (matcher.find()) { if (matcher.groupCount() >= 2) { String key = matcher.group(1).toLow...
00a4724d-4e31-47a2-bbef-2291671037a3
0
public FlatternerIterable(final T ancestor, final Selector<T, Iterable<T>> selector) { this._ancestor = ancestor; this._selector = selector; }
5110e971-5ea2-4523-8d5c-797039c636d2
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); }
0ce136aa-92c9-4514-9b5b-1c9f9fb8c86d
9
boolean objectValid(Object objectInfo, long queryIntervalStart, long queryIntervalEnd, ConfigurationAreaTime kindOfTime, TimeSpecificationType timeSpecificationType) { // Die Klasse ist im Package sichtbar, damit ein JUnit-Test die Methode prüfen kann long[] activationTimes; if(kindOfTime == ConfigurationAreaTim...
4f8c9aac-18c1-4a4e-8f8c-b3bdb72e4375
4
@WebMethod(operationName = "setMonitorData") public void setMonitorData(@WebParam(name = "device") String device, @WebParam(name = "md") MonitorData md) { dbHandler.updateDevices(device, md); if(md.getIsDeleted()) { dbHandler.deleteInterface(device, md); } else {...
eddc7e8b-b531-4a73-948b-866f4fff5468
2
private boolean checkIfZeros(int x, int y) { return (x == 0 && y == 0) ? true : false; }
e9c727ba-a00f-402b-94f6-b2e79ed06767
9
void hitmiss(int xe, int ye, int [][] pixel2, int [][]pixel, int [] lut){ int x, y; // considers the pixels outside image to be 0 (not set) for (x=1; x<xe-1; x++) { for (y=1; y<ye-1; y++) { pixel[x][y]+= lut[( pixel2[x-1][y-1] + pixel2[x ][y-1] * 2 + pixel2[x+1][y-1] * 4 + pixel2[x-1][y ]...
bbd1c5b3-c53c-4c4c-aef7-608e39b1044e
0
private void setTypeOfTreatment(){ int a=0; String b="123"; //Clinic.setTypeOfTreatment(a,b); }
c0c37f19-fb99-4ecc-be38-f8c290368ef5
1
public IsAssignableTo( Class<?> superclassOrInterface ) { this.superclassOrInterface = superclassOrInterface; }
158ac1de-b38c-4185-9b23-025a007d9e2b
7
public <T> int updateDB(String query, ArrayList<T> sqlParam){ PreparedStatement ps = null; int rs = 0; try{ ps = conn.prepareStatement(query); int i = 1; for (T a : sqlParam){ //System.out.println(a.getClass()); if (a.getClass() == String.class){ ps.setString(i, (String)a); //System.ou...
e4bbfa20-e0eb-469f-ba91-5bd29f9c8d91
5
private int sendPacket(Packet packet, ClientInfo client) throws ServerNotStartedException, NullPacketException, CouldNotEncodePacketException, PacketIOException { int sequenceNumber = -1; synchronized(CONNECTION_LOCK) { //regardless of whether the packet is valid, if the client is not connected then throw a NotC...
b6c6e8d2-1850-4d95-9c25-21a9c346b6f5
5
public void actionPerformed(ActionEvent ae) { JFileChooser fileChooser = new JFileChooser(); int showOpenDialog = fileChooser.showOpenDialog(frame); if (showOpenDialog != JFileChooser.APPROVE_OPTION) return; createAmazonS3Bucket(); ProgressListener progressL...
0ce45a9d-9150-4924-beb4-08acc16334d6
6
@Override public void execute(CommandSender sender, String[] arg1) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (arg1.length < 1) { sender.sendMessage(ChatColor.RED + "/" + plugin.reply + " (message)"); return; } ChatPlay...
1c7a937b-89d9-4254-b950-b2d9dc67af74
8
@Override public void run() { RUBTConstants.main_log.info("Tracker is up"); while (this.keepRunning) { RUBTConstants.main_log.info("Tracker sending event " + this.getEvent()); //send http request byte[] httpResponseArray = null; try { httpResponseArray = httpConnectionToTracker(); } catch (...
34374adf-8f8e-4529-b795-d4c48a2aabf6
9
public boolean tooHeavy(Drone d, Cell c){ if(c.weight > 10){ c.weight -= 10; Drone next; for(int i = 0; i<droneList.size();i++){ if(droneList.get(i) != d){ next = droneList.get(i); currentCell.add(next); while( c.loc.y != next.loc.y || c.loc.x != next.loc.x){ if(c.loc....
772d01cc-c4e6-4200-bc56-a1bbcc61f4f6
0
@Override public void documentAdded(DocumentRepositoryEvent e) {}
b8d1bb02-8b6f-4d57-abf1-40122a8752cc
4
public void setBarPlayer1(JPanel panel) { boolean test = false; if (test || m_test) { System.out.println("Drawing :: setBarPlayer1() BEGIN"); } if (test || m_test) System.out.println("Drawing:: setBarPlayer1() - END"); m_barPlayer1 = panel; }
9f9657c4-77e4-4653-8d85-bf7b0270bc30
6
public void parse() { boolean success = false; // Keep trying if file not found while (!success) { System.out.print("Enter filename (or 000 to exit): "); this.file = in.nextLine(); if (file.trim().equals("000")) { System.out.println("Program Terminated"); System.exit(0); } try { // In...
c016f0ba-2bab-43b5-ba86-460ec58f6bd6
0
private int parent(int i) { i += 1; return i / 2 - 1; }
48631e0b-3cab-4ecf-a7ff-3003fb4f9074
5
private void bouge(Direction direction, Labyrinthe laby) { int x = position.x; int y = position.y; switch (direction) { case HAUT: deplaceSiPasDeMur(x, y - 1, laby); break; case BAS: deplaceSiPasDeMur(x, y + 1, laby); break; case GAUCHE: deplaceSiPasDeMur(x - 1, y, laby); break; case DR...
71690a34-7301-4c84-ab8b-5ab59b46ec4b
8
static public <T> void read(byte[] buf, Header hdr, Decoder<T> decoder, Consumer<T> consumer) { if (hdr == null) { hdr = header(buf); } final int str0 = hdr.row0 + hdr.rowSize * hdr.rowCount; StringReader r = (i) -> { int pos = str0 + i; if (pos < str0...
e4f9ae11-4c23-4e39-8073-133a20cac3a1
8
@Override public int neighbourhoodBest(int particle) { if(particle == wheel){ int best = 0; for(int i = 1; i < fitness.size(); i++){ if(maximum){ if(fitness.get(i) > fitness.get(best)){ best = i; } }else{ if(fitness.get(i) < fitness.get(best)){ best = i; } } } ...
a50399b7-ae07-4f52-a62e-98ed9e73b4cc
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Way way = (Way) o; if (id != way.id) return false; if (Double.compare(way.price, price) != 0) return false; if (time != null ? !time.eq...
5030f8e1-eb82-46e5-aaf3-044c0d172ae1
0
@Override public AbstractPlay mkRandom() { return plays.get(rnd.nextInt(plays.size())); }
4019dade-0c08-4b98-9d32-39a3c9596eb9
8
static String escape(String pattern) { boolean skip = false; int count = 0; StringBuilder sb = null; int last = 0; for (int i = 0; i < pattern.length(); i++) { char c = pattern.charAt(i); if (c == '\'') { skip = !skip; } else if (c == 'Z' && !skip) { count++; if (count == 2) { if (sb...
8acedbca-b441-4896-9bb0-293cddf4afcd
6
@Override public void mousePressed(int button, int x, int y) { switch(button){ case Input.MOUSE_LEFT_BUTTON: if(gui.isOnMap(x, y)){ setInteractionState(InteractionState.mapScrolling); } break; case Input.MOUSE_RIGHT_BUTTON: switch(interactionState){ case normal: case selected: ...
b925b3ad-31c2-44b0-9bfc-84bc046fa36b
3
private static boolean hasSameClassifications( ArrayList<HashMap<String, String>> examples, String goalAttribute) { String g = ""; HashMap<String, String> example = examples.get(0); g = example.get(goalAttribute); for (int i = 1; i < examples.size(); i++) { example = examples.get(i); if (!g.equals("") ...