method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
307a7d5e-fd1a-4230-9198-ad10ca5f9248
8
public static void main(String[] args) throws IOException, ParseException { EvidenceRecordFileIterator iterator = new EvidenceRecordFileIterator(new File(args[0])); Read context = new Read(); SAMFileHeader header = new SAMFileHeader(); header.setSortOrder(SAMFileHeader.SortOrder.unsorted); SAMSequenceRecord s...
9c5dc566-56e7-4084-99d8-583cfb1eda2f
7
float getInterpolatedVoxelValue(Point3f pt) { int iMax; int xDown = indexDown(pt.x, iMax = voxelCounts[0] - 1); int xUp = xDown + (pt.x < 0 || xDown == iMax ? 0 : 1); int yDown = indexDown(pt.y, iMax = voxelCounts[1] - 1); int yUp = yDown + (pt.y < 0 || yDown == iMax ? 0 : 1); int zDown = indexDown(pt.z, iM...
67b9f16e-66df-41e0-a6c4-95c07ba638f3
5
public static String readDomainName(DataInputStream dis, byte firstCount) throws Exception { StringBuffer strBuf = new StringBuffer(); while (true) { // read character count byte count = 0; if (firstCount != 0) { count = firstCount; firstCount = 0; } else count = dis.readByte(); if (...
36a0c79d-d3a8-4d11-8dcb-f95d869e3a0f
2
@Override public T validate(String fieldName, T value) throws ValidationException { if (value == null) { return null; } if (min.compareTo(value) > 0) { return min; } return value; }
f7a34ecf-5556-4af2-9c1c-0155d5530785
4
@Override public boolean execute(WorldChannels plugin, CommandSender sender, Command command, String label, String[] args) { final Map<Flag, String> info = new EnumMap<Flag, String>(Flag.class); info.put(Flag.TAG, WorldChannels.TAG); if(!(sender instanceof Player)) { ...
e912496f-7bc7-4722-a2ac-756d790b21f1
0
@Override public String getVersion() { return "*"; }
3e0e4d9b-53d2-4d37-bd63-7730c71c9077
3
@Override public void run() { for(int i=0 ; i<pCapacity;i++) { if(i<list.getSize()){ list.addItems(rand.nextInt(45)); try { Thread.sleep(rand.nextInt(30)); } catch (InterruptedException ex)...
7f22b1d2-9c4f-4742-a1d9-7ad32aac6bf8
0
public boolean endTurn() { timer--; return timer == 0; }
e8fe0e05-0242-472b-ae74-396c31ffcf5f
0
public void render() { Image buffer = createImage(500, 600); Graphics b = buffer.getGraphics(); super.paint(b); b.drawImage(null, 0, 0, 500, 550, this); // any other drawing goes here getGraphics().drawImage(buffer, 0, 0, 500, 600, this); }
30f5c417-3375-4e77-a20d-60afdeeee32c
5
private boolean isHexDigit(int value){ return (value>='0' && value<='9' || value>='a' && value<='f' || value>='A' && value<='F'); }
e37f7d23-7a60-4cec-828d-74c6dfb43630
0
public Queue<String> getUnsearchList(){ return this.staticList; }
7beeb4b8-a05f-49d3-aeac-18bdf1d1f04a
0
public CheckResultMessage check26(int day) { return checkReport.check26(day); }
5fb69a65-18cf-4b51-870b-4d860e7beff8
9
public void actionPerformed(ActionEvent e) { if(e.getSource().equals(btnNewButton)){ MetodiDiSupporto.nuovoThread(new Runnable() { public void run() { disposeFrame(); GiocoOffline gO = new GiocoOffline(LauncherFrame.this); gO.inizia(); } }); } if(e.getSource().equals(btnNewButto...
43b0078f-29e0-40e6-a6db-d62f3473b7d9
9
private void updateTable(){ // FileTable tablemodel = new FileTable(); // myfiletable = new JTable(tablemodel); files = new ArrayList<File>(); dirs = new ArrayList<File>(); int rowCount=tablemodel.getRowCount(); for (int i = rowCount - 1;i >= 0;i--) { t...
1498a5be-c0a6-43b8-97db-51b9c250bcce
4
public Properties getAttributesInNamespace(String namespace) { Properties result = new Properties(); Iterator enm = this.attributes.iterator(); while (enm.hasNext()) { XMLAttribute attr = (XMLAttribute) enm.next(); if (namespace == null) { if (attr.getName...
8d3393ac-f890-4639-b66e-1ff9485c9aae
7
private Map<Date, Double> addCreditCardCommission(Map<Date, Double> fees, String options) { if (options == null || options.length() == 0) { return fees; } boolean found = false; String[] optionArray = options.split(";"); for (int i = 0; i < optionArray.length; i++) { if ("CCARD".equalsIgnoreCase(optionA...
73866e02-6ec9-41a2-b1a9-133b0c645f6b
7
public ElementInfo getElementInfo(Element element){ ElementInfo elementInfo=(ElementInfo)Factory.getFactory().getDataObject(Factory.ObjectTypes.ElementInfo); elementInfo.setElement(element); String type=XmlUtil.stripNameSpaceIf(element.getTagName()); SchemaTypes types=null; if("element"...
25de08be-afa6-4cad-b056-dd80ea96de2c
0
protected Object[] initializeRow(int row) { Object[] newRow = new Object[getColumnCount()]; Arrays.fill(newRow, null); return newRow; }
9bbdc2d3-c4b6-40a8-81d2-d963f35e96de
2
public House(){ for (int y=0;y<100;y++) { for (int x=0;x<100;x++) tileLayout[x][y] = new Tile('.',1,1,x,y); // create each actual tile } }
9df42378-282f-4a8f-ae33-71af5fa3d3b4
9
public JCalkPanel() { setLayout(null); final JTextField txt = new JTextField("0"); add(txt); txt.setBounds(20, 20, 400, 22); String [] str = {"7", "8", "9", "4", "5", "6", "1", "2", "3", "0"}; JPanel butPan1 = new JPanel(); butPan1.setLayout(new GridLayout(4, 3)); for (int i = 1; i <= 10; i++) { JB...
61011154-f1df-4978-9d12-fb81d093305f
7
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
80eef9b7-8619-43c3-9152-e3644191c374
1
public int getEntityType(String ename) { Object entity[] = (Object[]) entityInfo.get(ename); if (entity == null) { return ENTITY_UNDECLARED; } else { return ((Integer) entity[0]).intValue(); } }
8b87e1de-cf3b-4418-b1dd-789e49fd66be
2
private static int getNthValue(Integer[] a, int startIndex, int endIndex, int n) { int pivotValueIndex = startIndex + (endIndex - startIndex) / 2; int resultPivotValueIndex = setInOrderPosition(a, pivotValueIndex, startIndex, endIndex); if (resultPivotValueIndex + 1 == n) { return a...
e2c685f2-9071-4acc-8854-1be6572200c8
5
public String toSentence() { List<Long> aStartTime = new ArrayList<Long>(); List<Long> aEndTime = new ArrayList<Long>(); boolean currAvailability = false; for (int i = 0; i < nSlot; i++) { if (this.aIsAvailable[i] == currAvailability) continue; currAvailability = this.aIsAvailable[i]; if (currAv...
08ddd03f-23a2-43ff-bb05-890a78000f9f
9
public void applyMutation(Individual offspring) { int rand = 8; if(offspring.problemInstance.periodCount==1)rand--; int selectedMutationOperator = Utility.randomIntInclusive(rand); if(selectedMutationOperator==0) { //greedy //intra IntraRouteGreedyInsertion.mutate(offspring); } else if (selec...
ea95bc2c-19e5-4db2-9627-3ebd58697f19
1
@Override public void actionPerformed(ActionEvent event) { Openable openable = getTarget(Openable.class); if (openable != null) { openable.openSelection(); } }
4d6246bd-9e39-448a-81b8-cd7171806ed8
1
private String prependTimestamp(String str) { if ( str.isEmpty() ) { return str; } else { Calendar c = Calendar.getInstance(); String timestamp = timestampFormat; timestamp = timestamp.replaceFirst("h", getTwoDigits( c.get(Calendar.HOUR_OF_DAY) ) ); ...
980e8c48-4166-456d-a2b5-32305a1adabf
2
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { RequestDispatcher rd = null; try { producten.haalBestellingOp(Integer.parseInt(req.getParameter("pId")), Integer.parseInt(req.getParameter("inBestelling")), Integer.parseInt(req.getParameter("voor...
c72f4a34-6a96-43a1-aca8-038f2ccb9fe2
0
public JSONObject main(Map<String,String> params, Session session) throws Exception { return CommonResponses.showNotImplemented(); };
9ddb262e-ecb4-40d3-825a-301b97db6995
1
public String basename() { int p = name.lastIndexOf('/'); if (p < 0) return (name); return (name.substring(p + 1)); }
e2261ed5-d03f-4d1a-88fa-c757a64c1710
4
public void searchLinkAndAddToSet(String str) { String tmp; str = str.replace(" ", ""); int start = str.indexOf("<a"); if(start >= 0){ start = str.indexOf("href=\""); if(start >= 0){ str = str.substring(start+6, str.length()); start = str.indexOf("\""); tmp = str; if(start >= 0){ s...
8601043d-d1d6-4413-a9b1-91ec19d1adc1
8
public DroneController(final VisualRenderer visual) { try { drone = new ARDrone(); drone.connect(); drone.addImageListener(new BufferedImageVideoListener() { @Override public void imageReceived(BufferedImage image) { RescaleOp rescaleOp = new RescaleOp(1.4f, 50, null); rescaleOp.filter(i...
3c485458-6e12-4037-adea-5acb7db3022d
8
public void init() { this.setTitle("Config Model"); this.setResizable(true); this.setVisible(true); this.setSize(ecran.getWidth() / 2, ecran.getHeight() / 2); this.setLayout(new GridLayout()); this.setLocation(ecran.getFrame().getX() + ecran.getWidth() / 2 - this.getWidth() / 2, ecran.getFrame().getY() + ...
f10263a4-bc5f-4ed6-8f82-12832ff99614
3
public String toSql() { return sql + (whereClause != null ? " WHERE " + whereClause.toSql() : "") + (orderClause != null ? " ORDER BY " + orderClause.toSql() : "") + (limit != null ? limit.toSql() : ""); }
c35a2f3f-e6d4-4d2d-b668-981016ddd090
9
private void newQuestion() { if(ques == Const.QUES_PER_ROUND || lvs == 0) { if(rnd == Const.NUM_ROUNDS || lvs == 0) { final_points.setText(Integer.toString(points)); if(total_ques == Const.NUM_ROUNDS * Const.QUES_PER_ROUND && lvs > 0) complete.setVisible(true); CardLayout cl = (CardLayout)windows....
da737be0-425a-42a9-bb42-a6757076d972
6
public void activate(Robot paramRobot, int paramInt) { Vector[][] arrayOfVector = getEnvironment().getObjectMap(); boolean bool = true; int i = this.location.x; for (int j = 0; j < this.shape.length; j++) { int k = this.location.y; for (int m = 0; m < this.shape[0].length; m++) { if ...
f521933c-1a7f-4e84-9a7a-b1920f228120
0
public String getUrl() { return this.getReferRequestWrapper().getUrl(); }
f4150674-4061-4a2b-b9aa-ca8d655a23d2
7
private boolean verifierDeplacementSinge(final int tmpX, final int tmpY) { boolean dplInterdit = false; if (this.monkeyIsland.valeurCarte(tmpX, tmpY) == Integer.valueOf(0)) { dplInterdit = true; } else { // Verifier pas de singe int n = 0; final List<SingeErratique> erratiques = this.monkeyIsland.get...
9eba9112-5e41-492f-a1ee-0ac79f8e14cd
2
public Iterator<Ticket> getAvaliableTickets() { List<Ticket> avaliableTickets = new ArrayList<Ticket>(); for (Ticket ticket : tickets) { if (ticket.getStatus() == TicketStatus.ENABLE) { avaliableTickets.add(ticket); } } return avaliableTickets.iterator(); }
ebdde80a-03ed-44b5-8e69-74cbcf383021
4
public static void main(String[] args) { URLMonitor mon = new URLMonitor(); mon.addRemaining("http://cs.lth.se/eda095"); ArrayList<Processor> processors = new ArrayList<Processor>(); for (int i = 0; i < 10; i++) { Processor p = new Processor(mon, "http://cs.lth.se/eda095"); processors.add(p); p.start(...
8099574a-e48f-4091-8b3f-8a67618199e8
9
public List<FoodDataBean> getBoardCommentaryList(int idx) throws Exception{ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; List<FoodDataBean> commList = null; String sql = ""; FoodDataBean comm = null; try{ conn = getConnection(); sql = "select * from foodcommentary wh...
f1c52803-088a-4c0d-9601-a90c78663e62
3
private void addAnswersTable() { tablePanel = new JPanel(); tableModel = new DefaultTableModel(new String[] { "Treść odpowiedzi", "Poprawna" }, 0){ Class[] types = { String.class, Boolean.class }; // making sure that it returns boolean.class. @Over...
8c58eea9-1465-4aeb-a435-514354691fcc
5
public static void main(String[] args) { StopWatch stopWatch1 = new StopWatch(); final int LENGTH_OF_LIST = 100000; int[] list = new int[LENGTH_OF_LIST]; stopWatch1.start(); for (int i = 0; i < LENGTH_OF_LIST; i++) { list[i] = (int) (Math.random() * list.length); } for (int i = 0; i < LENGTH_OF_LIST; i...
ece20257-321c-426d-a777-1e0a9985131c
4
public String getCurrentPuzzle() { String currentPuzzle = ""; for(int i = 0; i < 16; i++) { for(int j = 0; j < 16; j++) { if(entries[i][j].isEditable()) { currentPuzzle = currentPuzzle + "E "; } else { currentPuzzle = currentPuzzle + "N "; } if(entries[i][j].getText().equals("")) { ...
812b55ad-c322-4385-ac95-e24923c61f09
8
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || this.getClass() != obj.getClass()) { return false; } Result otherResult = (Result) obj; boolean statsEqual; if (status == null) { if (ot...
4f533b22-015d-476e-bf08-c90cc2fdb1f6
8
public boolean move() { game_area.updateDirection(); Point next_field = getHead().add(direction); /* Wenn sich neuer Punkt im Spielfeld befindet, * fuege den Punkt der Schlange hinzu und ueberpruefe * anschliessend, ob Schlange zu lang ist. Wenn ja, loesche * letzten P...
34f4cad7-7e24-4b7a-8575-32648fb4dfb1
3
public static void loadVideoInfo() { checkUSB(); System.out.println("start to load videos' info from usb"); String rootPath = USBConfig.drivePath; String videonewFolder = rootPath + USBConfig.VIDEO_NEW_FOLDER + "\\"; System.out.println(videonewFolder); File videoFilesPath = new File(videonewFolder); if ...
b0d98125-77a2-44ca-bf72-8117c3d51012
1
private void drawCenter(int[] circle, int r){ //TODO: change int d = getD(); for (int i = -3; i < 4; i++ ){ circle[((r+i)*d) + r] = GUIStandarts.drawColor; circle[(r*d) + r + i] = GUIStandarts.drawColor; } }
1e19c067-ca10-4821-9b2f-a56129dfbd8b
5
void setActive(String name){ Sheet a=null; for(Sheet s:sheets){ if(s.getName().equals(name)){ a=s; break; } } if(a==null) return ; switch(viewType){ case VIEWTYPE_TABS:{ JTabbedPane tabs=(JTabbedP...
cf3ceb1e-6a10-43c2-894d-740e330da198
1
private void dropTable(String tableName) throws SQLException { if (conn != null) { PreparedStatement stmt = conn.prepareStatement(String.format("DROP TABLE IF EXISTS %s", tableName)); stmt.execute(); } }
57fc2a2a-8528-4627-bf0a-663d72c9eeb0
0
@Override public File getFile() { return super.getFile(); }
2658595c-ddf6-4fe2-84df-4c5e95cd967d
9
public SmallCardsViewer(DeckCreator parent) { super(JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); this.parent = parent; swingWorker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { ...
236658d5-cfbd-4446-b57e-6f283932a923
6
public static StandardObject extractParameterType(StandardObject self, Symbol parameter, Object [] MV_returnarray) { { Surrogate testValue000 = Stella_Object.safePrimaryType(self); if (Surrogate.subtypeOfSurrogateP(testValue000)) { { Surrogate self000 = ((Surrogate)(self)); { Slot slot = S...
443a1366-6ab1-4053-adb6-e978255a6525
1
public CtField lookupField(String className, Symbol fieldName) throws CompileError { CtClass cc = lookupClass(className, false); try { return cc.getField(fieldName.get()); } catch (NotFoundException e) {} throw new CompileError("no such field: " + fieldNam...
ca8d0673-61a9-4f45-8278-bc695c2ed76a
5
@Override public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) { if(!(sender instanceof Player)) { return true; } Player player = (Player) sender; if(!(args.length == 1)) { return true; } if(!(Util.hasLocations(player))) { return true; } fo...
88f7a2ef-9e1b-4261-a34e-8ea5b1f0075d
6
private void mergeTwoRegions(DenseRegion r1, DenseRegion r2){ Cluster c = null; int clusterID =0; if(!r1.getIsInCluster() && !r2.getIsInCluster()){ c = new Cluster(this.clustersCount); c.addDenseRegion(r1); c.addDenseRegion(r2); r1.setClusterID(c.getID()); r2.setClusterID(c.getID()); this.cluste...
7fe124da-977b-4a8c-af86-8ed333b61b14
2
@Override public void show() { System.out.println(name + ", here are your search results:"); Auction[] auctionResults = as.search(input); for(Auction auc : auctionResults){ try{ System.out.println(auc.toString()); } catch(Exception e){ System.out.println("No results match"); } } System...
83a9c3d8-1784-4509-98d2-70361ef518ff
6
public int uniquePaths(int m, int n) { if (m==0||n==0){ return 0; } int posible[][] = new int[m][n]; posible[0][0] = 1; for (int i = 1;i<m;i++){ posible[i][0] = 1; } for (int i = 1;i<n;i++){ posible[0][i] = 1; } ...
bf6f95b4-1667-4e9f-83d8-2ac0c5110116
9
private static void sortBlock(File[] files, int start, int end, File[] mergeTemp) { final int length = end - start + 1; if (length < 8) { for (int i = end; i > start; --i) { for (int j = end; j > start; --j) { if (compareFiles(files[j - 1], files[j]) > 0) { final File temp = files[j]; ...
5945a177-d2e8-42bc-aed9-e8cba7466516
1
public JPanel getUserlistLayoutMenu() { if (!this.init_1) { IllegalStateException e = new IllegalStateException("Call init first!"); throw e; } return this.userlistLayoutMenu; }
f4c1c21f-bb76-4013-a92a-68d4978284a3
7
public MatchTuple match(Tree<String> a, Tree<String> b) { if (!a.getRoot().getLabel().equalsIgnoreCase(b.getRoot().getLabel())) { return new MatchTuple(0, a.size(), b.size()); } else { int m = a.getRoot().getChildrenSize(); int n = b.getRoot().getChildrenSize(); ...
47956795-9e4f-43d0-b195-0e55a53af791
7
public int countRightDiagonal(Example e, int currentToken, int numTokensCountingFor){ int height = e.getBoard().height; // 6 int width = e.getBoard().width; // 7 int countOfTokensEncounteredDiagonallyRight = 0; // counter int countOfCurrentPlayersNInARow = 0; // bottom index is (5, 0) for (int i = heigh...
ae1d56d9-f11c-419d-85aa-1c6bce67faaf
7
private Set<String> keywordsFromUrlString(String urlChunk) { Set<String> keywords = new HashSet<>(); if (urlChunk.length() < MIN_KEYWORD_LENGTH) { return keywords; // enforce a minimum keyword length. } if (dictionary.isStringInDictionary(urlChunk)) { keywords.add...
c4a93503-6c88-4a9e-b388-cb0febb3fa71
0
public Company getCompany() { return Cmp; }
6725a109-673a-49a3-a8ee-ad3043e384d1
3
@SuppressWarnings("unchecked") private List<IResource> fetchResources(HtmlPage page) throws MalformedURLException { List<IResource> resources = new ArrayList<>(); for (HtmlScript script : (List<HtmlScript>) page.getByXPath("/html/head/script")) { String src = script.getSrcAttribute(); ...
1ab6e007-9767-469e-9ab3-a7e951ec8578
8
@Override public boolean partieTerminee() { //On teste chaque ligne possible pour les deux joueurs for(int i = 1; i <= getPlateau().getLongueur() - getValeurVictoire() + 1; i++) { for(int j = 1; j <= getPlateau().getLongueur(); j++) { if(getPlateau...
26366c55-61f0-4d3b-acc5-0622b00bcb74
8
public static Map<String,String> getDataGroupSubjectMap(String url,String minDateStr,String maxDateStr) throws ParseException{ Map<String,String> map = new IdentityHashMap<String,String>(); List<String> DataGroupList = new ArrayList<String>(); List<String> SubjectList = new ArrayList<String>(); List<String> rem...
361d0874-c733-472f-98fc-fd1617810ddb
5
private void scrollSelectionIntoViewInternal() { Selection selection = mModel.getSelection(); int first = selection.nextSelectedIndex(getFirstRowToDisplay()); int max = getLastRowToDisplay(); if (first != -1 && first <= max) { Rectangle bounds = getRowIndexBounds(first); int tmp = first; int last; ...
2d77c980-6ba2-423c-99db-b0b607118f2d
5
public String consultarTurnos(boolean sentenciaCompleta) { conexion.conectar(); String respuesta = "exito"; String modificadorConsulta = ""; String modificadorConsulta2 = ""; if (sentenciaCompleta) { modificadorConsulta = "and descripcion='' and t.estado = false "; ...
5eed9154-3c5c-48e0-8312-68946604947c
5
public boolean checkChunksExist(int var1, int var2, int var3, int var4, int var5, int var6) { if (var5 >= 0 && var2 < 128) { var1 >>= 4; var2 >>= 4; var3 >>= 4; var4 >>= 4; var5 >>= 4; var6 >>= 4; for (int var7 = var1; var7 <= ...
4822a7ae-aeba-4375-a4a4-8c1a7455e7f3
8
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) { String cmd = command.getName().toLowerCase(); if (cmd.equalsIgnoreCase("roomy")) return RoomyCommands.roomyCmd(sender, args); else if (cmd.equalsIgnoreCase("setroom")) return Room...
ac5fd28a-c500-499f-9a9e-99667842481a
0
public static void main(String a) { SpringApplication.run(BookAFlightApplication.class, a); }
9c81559b-c5d4-4c08-aa72-d998b319ee88
2
public static EnterMineAndDigForNugget getSingleton(){ // needed because once there is singleton available no need to acquire // monitor again & again as it is costly if(singleton==null) { synchronized(EnterMineAndDigForNugget.class){ // this is needed if two threads are waiting at ...
264eff6f-28bf-4138-923d-e65d194c977f
7
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof MSN)) return false; MSN msn = (MSN) o; if (!MTSO.equals(msn.MTSO)) return false; if (!location.equals(msn.location)) return false; if (!mateMSN.equals(msn.mateMSN)) return fal...
b08dfdd9-cfd6-4631-b65e-c52fa72c5555
0
@Override public boolean supportsMoveability() {return true;}
00223358-e709-4165-86a3-a467d3e85990
1
@Override public void run() { for(long i = 0; i < 2000000000; i++); System.out.println("Slowly thread completed"); }
968ad751-aa58-47af-9bcc-4796a63f59b3
1
public static String toString(Line line) { if (line == null) return null; Line.Info info = line.getLineInfo(); return info.toString();// + " (" + line.getClass().getSimpleName() + ")"; }
a734ca4c-3538-4a13-a59c-7a6469596e32
8
public boolean pensar(ArrayList<Carta> cartasAbiertas) { int cuenta = contar(cartasAbiertas); int acum = sumarCartas(); if (acum == 21) { return false; } else if ((cuenta > 0 && cuenta <= 5 && acum <= 17)||(cuenta<= -5 && acum>=17 )||(cuenta==0 && acum<17)) { re...
09151fa8-24dc-45ae-8a8f-bd54463547a1
8
private boolean isPunctuation(char next) { return next == '{' || next == '}' || next == '|' || next == ':' || next == '.' || next == '!' || next == '=' || next == '&' || next == ';'; }
e57e9fa4-d546-40f9-95bd-5c5136feed70
4
public Vector3D[][] exportVectors() { for(int i = 0; i < numPlane; i++) { Equation e = equations[i]; String s = ""; if (Equation.needUpdate[i]) { // s = s + ":" + i; needDraw[i] = updateVecs(e, i); e.update(false); alpha[i] = e.alpha; } if (i == 4 && s != "") { // System.out.println...
7ce32e48-db19-46d7-81a8-5bc4594a36ef
1
public static void print(int intArr[], int len){ System.out.println("After sorting array using RADIX SORT...\nThe following is the sorted array:"); for (int i=0; i<len; i++){ System.out.println(intArr[i]); } }
c34c5ede-aac3-4ec2-8feb-8a025fa564e3
2
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int iDelay = 0; resp.setContentType("text/html"); PrintWriter writer = resp.getWriter(); if(req.getParameter("delay") != null) { try { ...
ec02850d-a67c-4c4e-acef-a9b40e2b3004
8
public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) {// parcour par colonne case 0://colonne id_Stock return Pharmacies.get(rowIndex).getId_ph(); case 1://colonne id_Stock return Pharmacies.get(rowIndex).getNom_ph(); ...
1da2cfda-68b0-4e52-a558-1cc2ba5a8723
0
public void addFileDownloadItem(FileDownloadItem item){ items.add(item); }
0a06aa9b-5867-4fcd-a517-510844009463
4
public static List<String> depthFirstSearch(Graph graph, String startName, String goalName) { HashMap<String,Vertex> vertices = graph.getVertices(); // get all the vertices if(!vertices.containsKey(startName) || !vertices.containsKey(goalName)) throw new UnsupportedOperationException("The graph does not co...
a5474e79-4490-4351-bb84-744edbb2562d
4
private void setSkin(String lookAndFeel) throws FileNotFoundException, IOException{ try { UIManager.setLookAndFeel(lookAndFeel); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTr...
19ce3358-5968-4b00-90d2-e11d5f03cc3c
1
public void visitEnum(final String name, final String desc, final String value) { if (name != null) { cp.newUTF8(name); } cp.newUTF8(desc); cp.newUTF8(value); av.visitEnum(name, desc, value); }
f546dae7-bc56-47ad-ba18-d1ec9d6ceef6
1
public int binaryToDecimal(String binary) { int decimal = 0; for (int i = binary.length() - 1; i >= 0; i--) { decimal += (binary.charAt(i) - '0') * Math.pow(2, binary.length() - i - 1); } return decimal; }
e44a6230-f2f5-4001-8dbc-aa0ba5f6f3ca
4
public Game(List<Player> players) throws FileNotFoundException, IOException{ if(players == null){ throw new NullPointerException("Players can't be null"); } if(players.size()<2){ throw new IllegalArgumentException("The game needs at least 2 players."); } allLetterTiles = new ArrayList<Tile>(); allPlay...
211a21d0-898b-4aea-bf1c-71ad61c71063
9
public Instances getDataSet() throws IOException { Instances result; double[] sparse; double[] data; int i; if (m_sourceReader == null) throw new IOException("No source has been specified"); if (getRetrieval() == INCREMENTAL) throw new IOException("Cannot mix getting Instance...
9752a44b-1ce1-46a9-8def-de442bd2f369
8
private Dimension layoutSize(Container target, boolean preferred) { synchronized (target.getTreeLock()) { // Each row must fit with the width allocated to the containter. // When the container width = 0, the preferred width of the container // has not yet been ...
86eb9fd2-d648-4650-932d-c2b60baf018f
2
public int getAverage(final String callName) { float avg = -1; final List<CallData> callDataList = getCallData(callName); for (final CallData callDataEntry : callDataList) { if (avg == -1) { avg = callDataEntry.getDuration(); } else { avg = (avg + (float)callDataEntry.getDuration()) / (float)2; }...
35ff3a14-a807-4f62-b0ca-72be042507cb
5
private void processMessage() throws InterruptedException { try { MessageUnit mu = messageQueue.take(); Message m = mu.msg; Object result = null; if (m instanceof SubmitWorkerMessage) { SubmitWorkerMessage swm = ((SubmitWorkerMessage) m); ...
086aa665-f03d-4fec-86fa-3aacb4699038
7
public static SwtorParserEvent newEvent(SwtorParser.StateChange sc){ SwtorParserEvent ev = null; switch(sc.getType()){ case HEALS: ev = new HealEvent(sc); break; case DAMAGE: ev = new DamageEvent(sc); break; case THREAT: ev = new ThreatEvent(sc); break; case COMBAT: ev = new C...
73769443-53ee-41c4-b3f1-dea6527c9e8e
9
public static void main(String[] args) { int valor1=0; int valor2=0; double resultado=0; char continuar; boolean validar=true; int opcion=0; Scanner teclado=new Scanner(System.in); operacion ooperacion=new operacion(); do ...
28ea3614-a656-49ed-807e-245a4d583c4b
4
public void loadPlayerConfigFile(String file) throws FileNotFoundException, BadConfigFormatException { FileReader playerReader = new FileReader(file); Scanner playerScanner = new Scanner(playerReader); HumanPlayer human; ComputerPlayer currentComputer; final int numColumns = 4; int row = 0, column = 0; in...
8cd99d83-8255-41ab-bed4-3946994e0607
0
public TankDrive() { requires(Robot.driveTrain); }
0ee25d3b-4852-43d9-b501-678a96fdd441
1
public SaveFileFormat getSaveFormat(String formatName) { int index = indexOfName(formatName, saverNames); if (index >= 0) { return (SaveFileFormat) savers.get(index); } return null; }
7d84dd9c-ccc5-42b0-846d-59074475c240
1
public void abort() throws java.io.IOException { //String command = createInferenceAbortionCommand(); //DefaultSubLWorkerSynch newWorker = new DefaultSubLWorkerSynch(command, getCycServer(), false, getTimeoutMsecs()); //newWorker.getWork(); if (this.suspendReason == InferenceWorkerSuspendReason.INTERRUP...
bf2f22c2-f16f-4cd6-9226-bc3306c9964d
1
public boolean checkHasLost() { if(this.life < 1){ return true; } return this.hasLost; }