method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8133843a-2c30-49bd-bee2-88c60d0924f4
1
private static int promptUser(String msg) { Object[] options = {GUITreeLoader.reg.getText("yes"), GUITreeLoader.reg.getText("no")}; int result = JOptionPane.showOptionDialog( Outliner.outliner, msg, GUITreeLoader.reg.getText("confirm_save"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, ...
76fca4ad-fa72-4eca-a060-0e8a9ed466a5
1
public double getAverageLoss(ArrayList<DataPoint> dataPoints) { double result = 0; for(DataPoint dp:dataPoints) { result += dp.sqError; } return result/dataPoints.size(); }
ced1cc6c-ef21-44b2-b702-9b53e61cd117
7
public static LanguageIdentifier generateFromCounts(File countModelsDir, String[] languages) throws IOException { Map<String, File> modelFileMap = Maps.newHashMap(); Map<String, CharNgramLanguageModel> modelMap = Maps.newHashMap(); File[] allFiles = countModelsDir.listFiles(); int order ...
f5ed1250-eed3-4859-a977-4fdf8e0ccc47
7
private ReadPreference createReadPreference(final Map<String, List<String>> optionsMap) { Boolean slaveOk = null; String readPreferenceType = null; DBObject firstTagSet = null; List<DBObject> remainingTagSets = new ArrayList<DBObject>(); for (String key : readPreferenceKeys) { ...
26c99e4d-ec01-4185-a4c4-d3b5fbf17292
6
@Override public void drawSolutionk(Graphics drawingArea, int... arg) { int diameter = arg[2]; int x = arg[0]; int y = arg[1]; int depth = arg[3]; int toDraw = DRAW_ALL; if(arg.length == 5){ toDraw = arg[4]; } if(depth == 0){return;} drawingArea.drawRect(x, y, diameter, diameter); if((...
a756694e-1737-47f2-b8b9-7224caafba66
6
public static String escape(String string) { char c; String s = string.trim(); StringBuffer sb = new StringBuffer(); int len = s.length(); for (int i = 0; i < len; i += 1) { c = s.charAt(i); if (c < ' ' || c == '+' || c == '%' || c =...
2357d44e-cce5-47de-8233-59cee4bb658d
3
public int getHighestY() { int y = a[1]; if(b[1] > y) { y = b[1]; } if(c[1] > y) { y = c[1]; } if(d[1] > y) { y = d[1]; } return(y); }
f76379b5-283c-4e06-9d67-9ebead85a978
1
public String[] getSignal() { String[] array = new String[signal.size()]; int n = 0; for(Long key : signal.keySet()) { array[n] = key.longValue() + "=" + signal.get(key); n++; } return array; }
b576a126-ea15-44f6-9bb2-62c7d00b2583
3
private void updateMealFound(List<Keyword> keywords, List<String> terms, List<String> approval) { //Since the user is asked for an approval, if he says yes, his history will be saved. if (!approval.isEmpty()) { if (approval.get(0).equals("yes")) { //Save user history //DateFormat dateFormat = new Simp...
3d4cc715-2ae0-413c-9294-0172b2933262
1
public Siirto suurin(){ if (koko == 0){ return null; } return keko[0]; }
841c72b0-03e9-4709-b04d-717ff5576629
1
public static int[] leftHalf(int[] array) { int size1 = array.length / 2; int[] left = new int[size1]; for (int i = 0; i < size1; i++) { left[i] = array[i]; } return left; }
ba713e06-157e-49b7-a08d-d870afd16b7d
4
private File determineOutfile() { File file; final String fn = System.getProperty(PROPERTY_FILE_LOCATION); if (fn != null) { file = new File(fn); if (file.exists()) { file.delete(); } try { file.createNewFile(); ...
718734a6-9176-4f36-af9c-b2ee4697909c
6
public boolean getBoolean(String key) throws JSONException { Object object = get(key); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String)object).equalsIgnoreCase("false"))) { return false; } else if (object.equals(Boolean.TRUE) ...
a2ad937d-8708-4de0-8a72-6c917b6411c3
8
public boolean comment(String comment, int imgId, String username) { PreparedStatement stmt = null; Connection conn = null; ResultSet rs = null; int user_id = 0; Calendar currenttime = Calendar.getInstance(); Date date = new Date((currenttime.getTime()).getTime()); try { conn = DbConnection.getConne...
2f172fbe-fad0-4c34-919c-f0cfe410dde3
1
@Override public void render() { super.render(); Player player = Application.get().getLogic().getGame().getPlayer(); InventoryComponent ic = player.getInventory(); Renderer.get().drawText("Money:" + ic.getMoney(), x + 5, y + 5); /* Renderer.get().drawText("C...
b6c89784-4b2c-4932-bf8b-8227ad88fbb6
9
public static boolean deleteDirectory(String dir) { // 如果dir不以文件分隔符结尾,自动添加文件分隔符 if (!dir.endsWith(File.separator)) { dir = dir + File.separator; } File dirFile = new File(dir); // 如果dir对应的文件不存在,或者不是一个目录,则退出 if (!dirFile.exists() || !dirFile.isDirectory()) { System.out.println("删除目录失败" + dir + "目录不存在!"...
643df288-69eb-47d5-917a-fa961394ad39
9
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed try { if (validarDatos()){ //cargo Parametros del Reporte Map parametros = new HashMap(); parametros.put("name_empresa", r_con.getRazon_soci...
964f4609-fd60-4e9b-a9b5-24dab9fa5db5
6
@SuppressWarnings("unchecked") private void addEntityRestrictions(Restriction query, ExtendedField field, Object patternObject) { Restriction subPart = null; if (field.isMappedAsList()) { List<Object> liste = (List<Object>) field.getValue(patternObject); if (liste ...
0b775a56-54f4-4389-91eb-9ae1ad2987fd
6
@Override public void crearFichero(String ruta) { FileInputStream from = null; FileOutputStream to = null; File toFile = new File(ruta + this.getMetadato("nombre") + this.getMetadato("extension")); try { from = new FileInputStream(this.video); ...
961e3b39-fd8b-4f33-9045-7815571be24a
6
public static <VT> int[] generateRandomHopsOut(Random r, ChiVertex<VT, Float> vertex, int n) { int l = vertex.numOutEdges(); float[] cumDist = new float[l]; float prefix = 0.0f; for(int i=0; i < l; i++) { float x = vertex.getOutEdgeValue(i); cumDist[i] = prefix +...
8d0ec87b-7ec4-40fa-8158-03d9e5b3d968
1
public String showList(){ size = 5; if(page == 0) page = 1; List<Record> list = recordDAO.findPage(page, size); recordList = new RecordList(); recordList.setList(list); return SUCCESS; }
2a2bbd3a-98dd-4466-a62a-5cd5454953fe
8
private void mouseDraw(MouseEvent e) { int states = Goldfish.getMaxStates(rule); if (e.getX() < 0 || e.getY() < 0 || e.getX() / scale >= width || e.getY() / scale >= height) return; Patch p = _grid.getPatch(e.getX() / scale, e.getY() / scale); if (_drawState == -1) { ...
2a6a6081-4489-433e-98f2-98ed7a95e3a3
9
public SortedMap<Long, Boolean> berecheneZustandsWechselVonBis(Long von, Long bis) { // TODO Auto-generated method stub Calendar cal1 = new GregorianCalendar(); cal1.setTimeInMillis(von); Calendar cal2 = new GregorianCalendar(); cal2.setTimeInMillis(bis); SimpleDateFormat df = new SimpleDateF...
d44f9ff0-34f4-4e4e-a2c2-e5ec1652b7a2
9
private static boolean updateHashEquiJoinCardinality(HashEquiJoin j, Map<String, Integer> tableAliasToId, Map<String, TableStats> tableStats) { DbIterator[] children = j.getChildren(); DbIterator child1 = children[0]; DbIterator child2 = children[1]; int child1Ca...
83c30ea0-eb20-4c0d-9f97-be06f34a2c7e
0
public ClusteredMarker(Location location, float size) { this.location = location; this.size = size; }
e41415b7-7f1d-40b1-902b-f6a1a62e8528
9
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { if (_Entity == null) { throw new IllegalArgumentException("You must set an entity before drawing anything with this composite."); } try { // Get the max bounds of the writable raster. int maxX = dstOut.getMinX() + dstOut.getWidth(); ...
260be1f2-9094-4f3e-b867-ffd5d2b8127a
6
public boolean checkIfBinarySearchTree(Node root) { if(root!=null) { if(root.left != null && maxValue(root.left) > root.data) return false; else if(root.right != null && minValue(root.right) < root.data) return false; else return (checkIfBinarySearchTree(root.left) && checkIfBinarySearchTree(root...
99dd3010-f64f-4a10-9cca-f68ade8d3649
1
public static boolean password(String pass){ if(pass.matches("(\\w){8,30}")) return true; return false; }
6b7c8002-41ad-4320-b21b-4f1f98802301
5
public void doGame() { humanPlayer player1 = new humanPlayer(); System.out.println("\nWe need to know who Player 1 is!"); player1.getName(); player1.marker = "X"; System.out.println("\nNow for Player 2"); humanPlayer player2 = new humanPlayer(); player2.getName(); ...
066ad77a-2715-4740-adfa-4b9557c7b3aa
2
public boolean hasNext() throws IOException { while (!tokenizer.hasMoreTokens()) { String line = reader.readLine(); if (line == null) { return false; } tokenizer = new StringTokenizer(line); } return ...
00f47d05-6ea3-4321-8d4d-3d6c4015c49c
2
public void saveSettings() { try { properties.store(new FileOutputStream(new File(Constants.PROPERTIES_FILE)), ""); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } ...
95c6163c-cbbb-42c8-b78b-43051799765e
0
public RequestFileTransferHandler(int port, File file, String ip){ fileData = file; ipOfPeer = ip; portFile = port; }
d8b6a087-7c6b-4144-b3fb-47b2f825dead
9
public static void openJMX(File file) { FileInputStream reader = null; try { BmLog.debug("Loading file: " + file); reader = new FileInputStream(file); HashTree tree = SaveService.loadTree(reader); GuiPackage guiPackage = GuiPackage.getInstance(); ...
7fafcb72-a1f3-4b25-8add-7c68a5456e84
5
public Model getModelAt(int i, int j, int k, int l, int i1, int j1, int k1) { Model model = getAnimatedModel(i, k1, j); if (model == null) return null; if (adjustToTerrain || delayShading) model = new Model(adjustToTerrain, delayShading, model); if (adjustToTerrain) { int l1 = (k + l + i1 + j1) / 4; ...
f841934e-cf91-4350-8a03-fcd2805568c7
5
public boolean intersectsInner(AABB var1) { return var1.x1 >= this.x0 && var1.x0 <= this.x1?(var1.y1 >= this.y0 && var1.y0 <= this.y1?var1.z1 >= this.z0 && var1.z0 <= this.z1:false):false; }
68fc1b72-9aba-42d8-a5dd-508b680f82dc
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
8cfff5ce-84bd-47ee-a6a5-dd3445385fff
3
private static void buildBasicMultiColor(Release set, List<SeperatorDefinition> seps) throws MalformedURLException { SeperatorDefinition def = new SeperatorDefinition(); for(MagicColor c: MagicColor.values()) if (c.isBaseColor()) def.addLeftSymbol(new ImageIconDrawer(SymbolFa...
badcd908-d2bc-4c1d-9fa6-e3dae164c03b
1
@Test public void arithmeticInstrOpcodeTest() { try { instr = new ArithmeticInstr(Opcode.BR, 10, 20); } catch (IllegalStateException e) { System.out.println(e.getMessage()); } assertNull(instr); //Checks instruction isn't created with invalid opcode for its format. }
6e1fb5b2-c3d3-4c4b-80b5-73a214022669
6
@Override public boolean equals(Object o) { if (!(o instanceof ParserSettings)) return false; ParserSettings other = (ParserSettings) o; return (allowLists == other.allowLists) && (allowSingleTokens == other.allowSingleTokens) && ...
661b4eb4-2077-453b-847e-8449d2692987
0
public String toString() { return a + "\n" + b; }
34948718-baff-4885-85fd-f0782aeffcd0
1
public WatchKey addWatcher(String folderPath, int mask, boolean watchSubtree) throws IOException { Watcher watcher = notifier.addWatcher(folderPath, mask, watchSubtree); Watcher previousWatcher = registeredWatchers.put(watcher.getWatchKey(), watcher); if (previousWatcher != null) { LOG.warn(StringUtil.concaten...
0014f339-c6cc-41ca-b4bc-1f6f9ed12710
7
public static void main(String[] args){ int nodecounter=0; Scanner sc=new Scanner(System.in); Scanner str=new Scanner(System.in); System.out.println("how many lines?"); int n=sc.nextInt(); Bst t=new Bst(); for(int i=0; i<n; i++) { String op=str.nextLine(); String temp=op.substrin...
27a8b676-a25c-40ad-90c1-b369ffa1612f
2
public String getSimpleCode(){ String str = ""; String itemCode = item.getCode(); if(itemCode != ""){ String nextTemp = Tree.getNextTemp(); str = item.getCode() + this.printLineNumber(true) + nextTemp + " := " + item.place + "\n"; ArgumentListExpression.argList += nextTemp + ", "; } else...
4868829d-d080-4fd8-a1d3-b002ecd660a4
2
void showPageContent(PageInfo page) { try { Desktop.getDesktop().browse(page.getURL().toURI()); } catch (IOException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); } }
cc0c4023-2b4f-4d92-a1d0-9913d18e977b
6
private GameState mutineerNightAction(GameState state, Card card, boolean output) { GameState end = new GameState(state); Color faction = card.getFaction(); Player player = end.getPlayer(faction); //If only the mutineer remains, the pirate can't be offered up for //2 gold and nothing happens if(playe...
cef2921a-db7c-432d-b934-6f1419aade26
1
public void award_bonus(BigInteger threshold, BigInteger bonus) { if (getBalance().compareTo(threshold) >= 0) deposit(bonus); }
b1ab381c-3d2d-4bd4-954a-d196c6183d05
4
private void findRuleAndAddWords( String word, String wikiText ) { int idxStart = wikiText.indexOf( "{{" ); int idxEnd = wikiText.indexOf( "}}", idxStart ); while( idxStart >= 0 && idxEnd >= 0 ) { Properties props = parseRule( wikiText, idxStart + 2, idxEnd ); String rule...
24b3dba4-a3b9-48af-8b20-24704c9c140b
3
@Override public void actionPerformed(ActionEvent e) { OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(); OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode()); if (textArea == null) { return; } Node node = textArea.n...
77005776-1f64-42fd-b7c3-88feed0196e1
2
private ArrayList<Journal> getSelectedJournals(){ int[] rows = tabel.getSelectedRows(); if (rows.length == 0) { ActionUtils.showErrorMessage(ActionUtils.SELECT_JOURNAL_FIRST); } ArrayList<Journal> journalList = new ArrayList<Journal>(); for(int row : rows) { ...
31e497d6-d2fd-4922-9e6e-99a1b1e2d63b
3
public void update(GameContainer gc, StateBasedGame sb, float delta) { if (cooldown <= 0) { cooldown = 0; onCooldown = false; } else if (onCooldown) { if(beamTimer >=5000){ beamOn=false; } beamTimer+=delta; cooldown -= delta; } }
fe209f89-a119-4710-8653-909ca0ac9d6e
1
private static void supplyBeverage() { beverage = BeverageFactory.getInstance().makeBeverage(beverageChoice); if (beverage == null) { System.out.println("Invalid beverage name suppplied."); } else { System.out.println(beverage.getName() + " will cost you Rs. " + beverage.getPrice()); } }
0fcdb2d2-abe8-4394-90e1-e386581810fc
2
private void method95() { for (int i = 0; i < localNpcCount; i++) { int k = localNpcIndices[i]; Npc npc = localNpcs[k]; if (npc != null) { method96(npc); } } }
5b296f2f-52d2-4506-b4d3-26dc7542d18e
4
private byte[] getDiagramBuffs(){ byte []diagramBuff = new byte[Optiums.DIAGRAM_BUFF]; if(lengthBuff != 0 && buff != null){ int needCoffe = Optiums.DIAGRAM_BUFF / lengthBuff; needCoffe = Optiums.BUFF_SIZE / needCoffe; for(int i = 0 , l = 0; i < lengthBuff; ++i) for(int j = 0; j < Optiums.BUFF_SIZE - ne...
f8c002f0-57d9-4677-8906-fb2b6f81aaea
3
@Override public Key next() { if (!hasNext()) throw new NoSuchElementException(); Node node = stack.pop(); if (node.right != null) stack.push(node.right); if (node.left != null) stack.push(node.left); return node.key; }
3fbd6776-af44-4bd5-87df-a1626502dbe9
1
private void renumberList(List<BaseElement> list){ int index = 1; for (BaseElement element : list) { element.setId(index); index++; } }
1d1f3b05-d078-4436-9fa3-c02d046971fc
3
private void initUI() { setTitle("JProgressBar"); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(40, 40, 40, 40)); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); progressBar = new JProgressBar(); progressBar.setMaximumSize(new Dimension(150, 20)); progressBar.se...
9977c455-ddc9-4aba-b201-ed52a69e5af8
1
public int getPointsPerSubcomplex() { return pointsPerSubcomplex > -1 ? pointsPerComplex : (NumOfParams + 1); }
e51da564-2c66-4439-ba22-da23cecf0614
9
public byte[] next() throws IOException { byte[] key1 = result1.next(); byte[] key2 = result2.next(); if (key1 == null || key2 == null) return null; int cmp = Bytes.compareTo(key1, key2); while (cmp != 0) { if (cmp < 0) { while (cmp < 0)...
d1823e88-985f-466f-9fe4-2f15c70ee71e
4
@Override public void actionPerformed(ActionEvent e) { if (e.getSource().equals(ok)){ valitseOikeaTapahtumaKunOkNappiaPainetaan(); }else if (e.getSource().equals(osasin)){ kertauspaneeli.paivitaOsaaminen(OsaamisenTila.OSATTU); } else if (e.getSource().equals(melkein))...
90606ec6-f1d1-4441-9f97-18756aa5a5bb
1
public void mousePressed(MouseEvent event) { Transition t = getDrawer().transitionAtPoint(event.getPoint()); if (t != null) controller.transitionCheck((FSATransition) t); }
e05d2ece-16a7-4d62-9329-39916a31d856
3
public Shape get_shape() { Shape rval = null; if (type == TYPE_RECT) { rval = new Shape( (int)(rect.x), (int)(rect.y), (int)(rect.x+rect.width), (int)(rect.y+rect.height)); } else if (type == TYPE_CIRCLE) { rval = new Shape( new Point(circle_center.x, ...
c519b807-3213-4595-a91e-8001a053dfc4
2
@Test public void testGetTile() { System.out.println("getTile"); int x = 1; int y = 1; Tile newtile=new Tile(); Tile[][] store=new Tile[3][3]; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ store[i][j]=newtile; } } ...
42b62aa5-89a1-4c69-9012-4b3f7c65bf86
4
private static void waitForConnection() { // waiting will be set true through notifyfreeconnection waiting = true; double delay = 0; while (waiting) { try { Thread.sleep(100); } catch (InterruptedException e) { // Nothing } delay += 0.1; if (delay == WARN_TIME) { System.err ...
e75939de-eb00-4b79-b25e-3946f10ee7b5
0
public void paintConfiguration(Component c, Graphics2D g, int width, int height) { super.paintConfiguration(c, g, width, height); MealyConfiguration config = (MealyConfiguration) getConfiguration(); // Draw the torn tape with the rest of the input. Torn.paintString((Graphics2D)g, con...
7a33242e-ed46-43f6-bc35-0906711625a8
9
public TaskRow(final ControllerInterface controller, final EDITED_TaskScrollPanel taskScrollPanel, Task ta) { super(); t = ta; // this.controller = controller; this.taskScrollPanel = taskScrollPanel; // TODO setlenient su sdf, rimosso // TODO layout has to be fixed a lot! I didnt mind about it now //...
4bcc39e5-22e7-48d4-b8f3-3aa0a918b7e8
4
private void btnRemoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoverActionPerformed UsuarioSistema tmp = null; try{ tmp = dao.Abrir(this.idUsuarioRemover); }catch(Exception ex){ JOptionPane.showMessageDialog(rootPane, ex.getMess...
a1366208-0677-417f-8372-8fdf90db211e
5
private boolean zzRefill() throws java.io.IOException { /* first: make room (if you can) */ if (zzStartRead > 0) { System.arraycopy(zzBuffer, zzStartRead, zzBuffer, 0, zzEndRead-zzStartRead); /* translate stored positions */ zzEndRead-= zzStartRe...
9e91d653-bd6e-4569-9abc-fd5da861ed0f
4
@Override public Mortgage createNewChild(TreeMap<String, String> properties) { Mortgage mortgage = new Mortgage(); mortgage.setName(properties.get(NAME)); String startCapitalString = properties.get(Mortgages.TOTAL); String nrPayedString = properties.get(Mortgages.NRPAYED); if...
dc8311a9-219d-445c-b867-57fc19521d95
5
@EventHandler(priority = EventPriority.HIGH) public void InteractDamageMob(EntityDamageEvent event){ if(event.getCause() == DamageCause.ENTITY_ATTACK){ final EntityDamageByEntityEvent realEvent = (EntityDamageByEntityEvent) event; if(realEvent.getDamager() instanceof Player){ String damagerName = ((Player)...
66d7d791-ea31-4735-b71c-0e643287ec3c
1
public void method473() { for (int j = 0; j < vertexCount; j++) { int k = xVertex[j]; xVertex[j] = zVertex[j]; zVertex[j] = -k; } }
793004bc-0cd1-4b7c-b068-718042261e06
3
public void throwInItem(Item item){ int pos = -1; for(int i = 0; i < neededItems.length; i++){ if(item.getName().equals(neededItems[i])){ neededItems[i] = null; } } if(isFinished()){ context.dropItemOnFloor(product); } }
cba331c9-fb7b-4359-85ed-f534cbcbf736
2
public static void endKW(String name,DateTime startTime, DateTime EndTime, Boolean x,String errorCause){ kwstart+="<tr class="+(x?"Pass":"Fail")+"><th>"+name+"</th><td>"+Seconds.secondsBetween(startTime,EndTime).getSeconds()+"</td><td>"+(x?"Pass":"Fail")+"</td><td>"+errorCause+"</td></tr>"; }
6242fd3a-9958-4003-b976-d440b562bfef
7
private static void calculatePolynomialApproximation(ApparentPlace ap, double t0, double ghapoly[], double decpoly[], double hppoly[]) { double gha[] = new double[3]; double dec[] = new double[3]; double hp[] = new double[3]; double earthRadius = 6378137.0/ap.getObserver().getEphemeris().getAU(); boolean i...
90f26418-a118-4d97-a4de-807c8f0834f6
8
public static void dBoard() { p(); System.out.println(" 0 1 2 3 4\t 0 1 2 3 4"); for (int row = 0; row < 5; row++) { String rowStr = row + " "; for (int col = 0; col < 5; col++) { rowStr += board[row][col] + " "; } rowStr += "\t" + row + " "; for (int col = 0; col < 5; col++) { switch (st...
611fe575-acf6-4bd5-8685-0568f8501bc0
0
public void start(){ running = true; core = new Thread(this, "Core"); input = new Thread(new InputManager(), "Input"); core.run(); input.run(); }
aa0bdb34-d81b-4e1f-b7a5-d19d50511bbb
0
@Before public void setUp() { }
a679f66d-377b-4404-a0a1-c4184d8edf68
0
public void setAantalpaginas(int aantalpaginas) { this.aantalpaginas = aantalpaginas; }
2ffafbcf-2852-4562-8285-c4e0a2933569
5
public boolean registeredStundent(StudentVO studentVO) throws LibraryManagementException { PreparedStatement preparedStatement = null; ConnectionFactory connectionFactory = new ConnectionFactory(); Connection connection = connectionFactory.getConnection(); String sqlquery = "insert into STUDENT (FIRST_NAME...
340513e7-5fef-45c4-8a9b-75b90d294497
9
public GuiApplication() { // give every JList a ListModel list1Model = new DefaultListModel<>(); list1.setModel(list1Model); list2Model = new DefaultListModel<>(); list2.setModel(list2Model); list3Model = new DefaultListModel<>(); list3.setModel(list3Model); ...
142a1538-bb8a-4733-9590-a04708187885
7
public void moveCard(GameSpot fromSpot, GameSpot toSpot, int numberOfCardsToMove) { Deck fromDeck = getDeck(fromSpot); Deck toDeck = getDeck(toSpot); if(ruleService.isGoingToResolutionPile(toSpot)){ movingToResPile(fromSpot, toSpot, numberOfCardsToMove); }else{ Deck fromCards = getFromCards(fromDeck,numbe...
80a89dbe-bd25-4fca-994a-ebf0bcff7be3
4
static final public CreateActorStatement create_actor_stmt() throws ParseException { CreateActorStatement result; Token typeTok; Token nameTok; jj_consume_token(INSTANTIATE); typeTok = jj_consume_token(TYPEIDENT); result = new ...
cc18aad0-ea06-4c91-93b6-f07a61e8c619
0
public EntityManager getEntityManager() { return entityManager; }
09ce372b-500f-42a1-9854-3c027995f59e
0
@Test public void testValidGroupCanBeCreated() throws Exception { GroupObject validGroup = new GroupObject("habrahabr", "labrabar", "xerahabr"); createGroup(validGroup); }
68fb7716-268e-4365-a78e-8903e317dd3e
9
static void sortWith0(double[] a, int fromIndex, int toIndex, DoubleComparator cmp) { final int length = toIndex - fromIndex + 1; if (length < 2) return; if (length == 2) { if (cmp.gt(a[fromIndex], a[toIndex])) { double x = a[fromIndex]; a[...
4098c7db-f7a5-4825-bcb1-e995c70ea68c
7
private String getFeatureAsString(Feature feature) { String label = Messages.message(getFeatureName(feature)) + ":"; if (feature.hasScope()) { for (Scope scope : feature.getScopes()) { String key = null; if (scope.getType() != null) { key =...
48595a73-b819-4eef-9c75-cbb47ff300d7
7
public boolean nextToEnemy(int x, int y, int[][] activeMap) { return ((y != activeMap.length - 1 && activeMap[y + 1][x] == -2) || (y != 0 && activeMap[y - 1][x] == -2) || (x != activeMap[0].length - 1 && activeMap[y][x + 1] == -2) || (x != 0 && activeMap[y][x - 1]...
704b5c25-4484-4399-ad81-f94c2033ec3b
8
@Override public void actionPerformed(ActionEvent e) { String aux = ""; if (e.getSource() == this.viewTI.getAbre()) { if (this.viewTI.getGol().isSelected()) { aux = "VW Gol"; } else if (this.viewTI.getFox().isSelected()) { aux = "VW ...
69c72b68-70c9-49e2-a19a-d42ba38cefbc
2
public void setLength(final double newLen) { int xFac = (x >= 0 ? 1 : -1); int yFac = (y >= 0 ? 1 : -1); double len = Math.sqrt(x * x + y * y); double alpha = Math.asin(Math.abs(x) / len); x = Math.sin(alpha) * newLen * xFac; y = Math.cos(alpha) * newLen * yFac; }
02b1a833-876d-4c5a-b233-522624040ffd
4
@Override public void analyse(LexicalAnalyser analyser) throws AnalyseException { String content = analyser.getSentence(); if (content == null) { throw new AnalyseException("Error: the sentence is null"); } for (int index = 0; index < content.length(); index++) { char current = content.charAt(index); ...
fc2566bc-3a39-4515-a471-9b87e23dc520
7
@Override protected void setReaction(Message message) { try { String[] messageParts = message.text.split(" "); String profileId = messageParts[1]; String result; switch (messageParts[2]) { case "random": result = SelectRandomGame(profileI...
0ec0fb7a-215c-4141-9deb-05899ccaeb64
4
protected void handleControlPropertyChanged(final String PROPERTY) { if ("RESIZE".equals(PROPERTY)) { resize(); drawBackground(); drawForeground(); } else if ("REDRAW".equals(PROPERTY)) { drawBackground(); drawForeground(); } else if ("...
8e7b9be2-0598-4f69-9330-ee60bbf9b793
4
public static String getStreamExtractor(Queue<String> parts) { String type = next(parts); if (type == null) return null; type = type.toUpperCase(); if (type.equals("SET")) { String value = next(parts); return String.format("new StaticExtractor(%s)", value); } try { ParseType.valueOf(type); re...
1f44cd43-8ef4-43f9-b312-199fa4ddff11
6
public static boolean setValidity(Tickets.Ticket ticket, int validity) { if (validity == 1 || validity == 2 || validity == 4 || validity == 6 || validity == 8 || validity == 10) { ticket.setValidity(validity); return true; } else { return false; } }
b7052bd8-742b-40d1-97e0-a97fcc0681d8
6
@EventHandler public void EndermanHunger(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getEndermanConfig().getDouble("Enderman.Hu...
40facf87-5f18-4929-9de8-e8753c46e646
8
private Map<Integer, Double> getLastUsages(List<UserData> bookmarks, double timestamp, boolean categories) { Map<Integer, Double> usageMap = new LinkedHashMap<Integer, Double>(); for (UserData data : bookmarks) { List<Integer> keys = (categories ? data.getCategories() : data.getTags()); double targetTimestamp...
8c5d44f2-38e9-4b0f-883c-63ff897b236f
3
public static void main (String [] args) { try { //int reps = Integer.parseInt(args[0]); int reps=1; while (reps < 10) { for(int i=0;i<reps;i++) System.out.println("*"+"%2s"); System.out.println("\n"); reps...
8bf0b57c-3209-4f4a-ac04-2d4cf0ad7c89
0
protected int getMaxAge() { return MAX_AGE; }
06668b3c-c514-4a74-ada2-089e202d16f5
3
@Override public void draw(List<Row> rows, ViewEventArgs args, int from){ this.setRows(rows); // System.out.println("at main draw: " + rows.size() + " " + this.getRows().size()); if (this.getRows() != null && this.getRows().size() > 0){ int currentTop = args.getTop(); // System.out.println("at main draw:...
b1175ac9-0a80-469b-97cf-b29fe2f0f340
8
public boolean monitor (final String addr_, int events_) { boolean rc; if (ctx_terminated) { ZError.errno(ZError.ETERM); return false; } // Support deregistering monitoring endpoints as well if (addr_ == null) { stop_monitor (); re...
0cde88b2-d78e-4581-8ace-b7d7a6290863
4
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockDestroy(BlockBreakEvent event) { for (Entry<Integer, Game> en : GameAPIMain.getRunners().entrySet()) { if (en.getValue() instanceof CTTGame) { if (en.getValue().getPlayers().contains(event....