method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4978c9cd-3863-48c5-854b-868dfe765010
8
public boolean checkNick(String nick) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { conn = getConnection(); pstmt = conn .prepareStatement("select nickname from member where nickname=?"); pstmt.setString(1, nick); rs = pstmt.executeQuery(); if (rs.ne...
f5a6a0d9-fd08-4228-a453-3cbf318453fb
8
@Override public Vector solve(Basis b) { BigInteger[][] big = convertToBigInteger(b); LLL.integral_LLL(big, big.length, big[0].length); // TODO: Not actually necessary to do this conversion, // because we have to convert to double for solving linear equations int[][] reduc...
cb8520bc-f412-47d2-a3ff-b64f5dfb67c5
6
private void openSerialPort(CommPortIdentifier commPortIdentifier) { if (openedPort != null) { serialPort.close(); } if (commPortIdentifier != null) { try { serialPort = (SerialPort) commPortIdentifier.open("MonitorConsole", 2000); } ...
7fc505b2-4856-41b0-9533-20494117f744
6
public boolean render(Level var1, int var2, int var3, int var4, ShapeRenderer var5) { boolean var6 = false; float var7 = 0.5F; float var8 = 0.8F; float var9 = 0.6F; float var10; if(this.canRenderSide(var1, var2, var3 - 1, var4, 0)) { var10 = this.getBrightness(var1, var2, var3 - 1, var4); var5.color(v...
44905e62-6607-427b-a370-1bd628e71747
1
public Tester(String name) { this.name = name; }
8d415657-a01c-4f37-92b4-4b337ad65cd6
7
public void updateDrawableRect(int compWidth, int compHeight) { int x = currentRect.x; int y = currentRect.y; int width = currentRect.width; int height = currentRect.height; //Make the width and height positive, if necessary. if (width < 0) { width = 0 - widt...
12a1b474-66d4-482e-9ef6-b0097c34b4b6
5
public synchronized void update() { //Check the collision of the between the robot and the walls. checkTileMapCollision(); updatePosition(); //Animation if (currentAnimation == SCRATCH) { if (animation.hasPlayedOnce()) { isScratching = false;...
114f18dd-a55e-4e86-8408-dfd17d1aef52
8
public static int floodFill(State s) { // Initialization Queue<Position> fringe = new LinkedList<>(); Set<Position> visitedStates = new HashSet<>(); fringe.add(s.player); visitedStates.add(s.player); while (fringe.size() > 0) { //Pop new state Po...
3e3663cb-3e00-4334-b34a-8580160af826
7
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { log.debug("{} public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException:", getClass()); log.debug("params: uri={}, localName={}, qName={}, attrs=...
50e5b9b4-d846-431e-a4fb-d234df8cd2f5
9
private void GenerateAttackPayloadsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_GenerateAttackPayloadsButtonActionPerformed PreparedStatement ps = null, ps_attack = null; ResultSet rs = null; Connection conn = null; String HTTPRequest = "", ParameterName = "", ParameterValue ...
e9f393a9-a792-4c16-be26-82374a2a3b30
9
public Emage buildEmage(Timestamp lastEmageCreationTime, long windowSizeMS) { filterPointQueueByWindow(windowSizeMS); this.pointQueue.addAll(this.pointStream.getAndClearNewPointsQueue()); Iterator<STTPoint> pointIterator = this.pointQueue.iterator(); GeoParams geoParams = this.pointStream.getGeoPar...
d5417ed1-49bb-40b8-b8f8-64b8ac1a9847
6
@EventHandler public void MagmaCubeWither(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.getMagmaCubeConfig().getDouble("MagmaCube...
250151ed-ecb7-4175-ae3a-39525bf2c32c
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...
22a9504d-20a1-4acc-91b4-15dec7fe0962
9
public static String clasificar(String path){ DiccionarioXml dic = new DiccionarioXml("/home/borja/proyectos/ecloud/logica/palabras.xml"); String palabras[]=dic.getPalabras(); /*for(String palabra:palabras) System.out.println(palabra); */ ArrayList<Integer> contadoresTema= new ArrayList<Int...
7b277ebc-0275-46c3-8d0f-17caed02b1b2
0
public String getQuantity() { return quantity; }
124b8b62-39a7-4688-8dd8-0ec65b4a4820
9
public static final void safeShutdown(final boolean restart, int delay) { if (exiting_start != 0) return; exiting_start = Utils.currentTimeMillis(); exiting_delay = (int) delay; for (Player player : World.getPlayers()) { if (player == null || !player.hasStarted() || player.hasFinished()) continue; ...
f603fc68-514f-4768-b5fa-5c17aeb61e23
1
public boolean add(Administrador admin){ PreparedStatement ps; try { ps = mycon.prepareStatement("INSERT INTO Administradores VALUES(?,?,?)"); ps.setString(1, admin.getNombre()); ps.setString(2, admin.getPassword()); ps.setString(3, admin.getDNI()); ...
8d1b830f-014c-4496-9b53-1ff355bda23a
6
protected void updateEntityActionState() { ++this.entityAge; if (this.entityAge > 100) { this.randomMotionVecX = this.randomMotionVecY = this.randomMotionVecZ = 0.0F; } else if (this.rand.nextInt(50) == 0 || !this.inWater || this.randomMotionVecX == 0.0F && this....
fac1f08e-ca3b-4898-ab14-7bdccf6d99fb
3
public boolean canCreateUnit(int id) { if (id >= 11 && id <= 16 && candy >= candyTable.get(id)) return true; else return false; }
de70ba8b-d752-47ac-926b-c431527ece6c
4
public boolean carOnLane(Car fCar, Lane lane) { double x = fCar.getPosition().getX(); double y = fCar.getPosition().getY(); if (x >= lane.getMinX() && x <= lane.getMaxX() && y >= lane.getMinY() && y <= lane.getMaxY()) { return true; } return false; }
fe951eb0-4ec4-4df3-bfc9-96f23a897e16
7
@Override public void actionPerformed(ActionEvent e) { //System.out.println("EndAction"); OutlinerCellRendererImpl textArea = null; boolean isIconFocused = true; Component c = (Component) e.getSource(); if (c instanceof OutlineButton) { textArea = ((OutlineButton) c).renderer; } else if (c instanceo...
5206aaa9-4835-490b-a109-3adb8303cd33
5
public void menuTextAsym() { int choice; do { System.out.println("\n"); System.out.println("Text Cryption Menu"); System.out.println("Select Asymmetric Cryption Methode"); System.out.println("----------------------------------\n"); System.out....
f89e2cf8-a7dd-4b2c-9dc0-23dddfb821c9
8
public static void readRelevanceJudgments( String p,HashMap < String , HashMap < Integer , Double > > relevance_judgments){ try { BufferedReader reader = new BufferedReader(new FileReader(p)); try { String line = null; while ((line = reader.readLine()) != null){ // parse th...
a9fa9a51-c29b-4bcc-97d1-6ce8045ca229
9
public static void UpdateStateTestImageTransform() { int selection = m_MenuTestImageTransform.UpdateMenuKeys(); switch (selection) { case MENU.TEST_IMAGE_TRANSFORM.OPT_IMAGE_TRANS_NONE: case MENU.TEST_IMAGE_TRANSFORM.OPT_IMAGE_TRANS_ROT90: case MENU.TEST_IMAGE_TRANSFORM.OPT_IMAGE_TRANS_ROT180: case MEN...
8c15c97f-deef-4df2-9cde-613c10cb7ebd
6
public static GameMode getGameMode(String gamemode) { if (gamemode.equalsIgnoreCase("survival") || gamemode.equalsIgnoreCase("0")) { return GameMode.SURVIVAL; } else if (gamemode.equalsIgnoreCase("creative") || gamemode.equalsIgnoreCase("1")) { return GameMode.CREATIVE; } else if (gamemode.equalsIgn...
f8f9df99-32a5-46eb-9825-5a67f262bf29
7
@Override public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) { final java.util.Map<String,String> parms=parseParms(parm); if(parms.containsKey("CURRENT")) return Integer.toString(httpReq.getClientPort()); if(Thread.currentThread() instanceof CWThread) { final CWConfig config...
b24be0b4-480e-486e-aecc-d34ccd466689
0
public boolean isSeed() { return this.torrent.isComplete(); }
ff80922b-5c0d-4fd6-8201-7d57333952e2
4
public int get(int key) { if(map.containsKey(key)){ Node n=map.get(key); if(n.prev!=null){ if(dll.last==n) dll.last=n.prev; n.prev.next=n.next; if(n.next!=null) n.next.prev=n.prev; n.p...
57d8d059-1b9c-43a2-8d83-e5b58b3e4309
6
public ArrayList<Object> selectPath() { if(paths.size() == 0) { System.out.println("Path not found."); } else { if(paths.size() == 1) { System.out.println("One path founded."); printPaths(); return paths.get(0); } else { Scanner scanner = new Scanner(System.in); boolean ...
e64c27f7-ee1e-44b7-a3eb-c25a20cf2fba
7
public void connect() throws ConnectionException, IOException { if(clientConnection == null || clientConnection.isClosed()) { try { clientConnection = new ServerSocket(port); Fluid.log("Target: Accepting connections on port " + port); } catch(BindException e) { throw new ConnectionException(e); ...
f3c5b0a9-6c56-4f7a-b859-97b2584d4f06
9
@Override public void render(PApplet g) { g.pushMatrix(); g.translate(x, y); g.rotate(theta); g.scale(PIXEL_WIDTH, -PIXEL_WIDTH); g.noSmooth(); g.imageMode(PConstants.CENTER); switch (animationState) { case UP: if (!hitOnce) g.image(sprite1, 0, 0); else g.image(hitSprite1, 0, 0); brea...
bd9ea4ea-f2bd-4501-ab34-75c10db78acc
4
public int jump(int[] A) { int steps = 0, max = 0, next = 0; for (int i = 0; i < A.length - 1 && next < A.length - 1; i++) { max = Math.max(max, i + A[i]); if (i == next) { // ready to jump if (max == next) return -1; // unreachable next = max; steps++; } } return steps; }
935446cb-1b87-4ca6-9945-e6c761887eaf
6
public int run (String[] args) throws Exception { long startTime = System.currentTimeMillis() / 1000L; for(int i = 0; i < args.length; i++){ System.out.println(i + " : " + args[i]); } if (args.length < 2) { System.err.printf("Usage: %s [Hadoop Options] <d> <maxDimensions> <dataSets> <key> <input>...
f2dfd907-c8c5-4e97-8f1c-6a7d499919c0
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...
bece2b4e-29a6-4223-ae53-3fadfc5066fc
1
private boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; } }
1658ee14-a18c-4d52-b730-e499dfce6cb0
0
@Test public void testMetadataRetrieval() throws SQLException { Populator p = new Populator(); System.err.println(p.metaDataDao.tableNames("linse")); System.err.println(p.metaDataDao.foreignKeys()); }
e37f916c-d268-4db8-b3db-37cb8e846abc
4
public Boolean leftFantasma(int n){ Query q2; switch(n){ case 0: q2 = new Query("leftBlinky"); return q2.hasSolution(); case 1: q2 = new Query("leftClyde"); return q2.hasSolution(); case 2: ...
4fad0ed5-3760-4a47-a136-ba0fed2bf2bc
6
@EventHandler public void CreeperInvisibility(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.getCreeperConfig().getDouble("Creeper...
c2f13637-b5f8-48b8-a882-a4063187f3ee
8
private Point[] getItemCoordinates() { switch (GameLevel.currentLevel) { case 3: Point[] level_3 = {new Point(195, 75), new Point(195, 135), new Point(255, 135)}; return level_3; case 4: Point[] level_4 = {new Point(225, 45), new Point(225...
fd400faf-bd34-4f4b-9ae9-d27c61f948bd
8
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (args.length == 0) { TimeBanHelpCommand command = new TimeBanHelpCommand(plugin); command.setManPage("help"); if(sender != null && sender instanceof...
c661e0be-3802-48fa-928b-72b719d5ef82
0
public String getShopAddress() { return shopAddress; }
62cb445d-b976-4016-8bfa-d2984a32551c
6
public void setDate(int year, int month, int day) { //verify the year is in bounds if (year < 1867 || year > Calendar.getInstance().get(Calendar.YEAR)){ return; } //verify month if (month < 0 || month > 12) { return; } //v...
e667af16-0d52-4ba2-b4e1-3bc4145bfcbd
9
public String execute(HttpServletRequest request, HttpServletResponse arg1) throws Exception { ResourceBundle bundle = Resource.getInstance().getRequestToObjectMap(); this.txtId = generalTools.NullToEmpty((String)request.getParameter("txtId")); this.txtDescription = generalTools.NullToEmpty((String)request....
4c42d05b-c4c7-41d0-b027-18f95ca3fd9e
3
public static Date getDateParam(SessionRequestContent request, String name){ String param = (String) request.getParameter(name); if (param != null && !param.isEmpty()) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); try { Date currDate = formatte...
3aa098ec-6907-4dcf-88ab-c64facf3466d
8
public boolean isInChannel(String channel, String bot) { for (User user : getUsers(channel)) { if (bot.equalsIgnoreCase("%note") && user.getNick().equalsIgnoreCase("Kitteh")) { return true; } if (bot.equalsIgnoreCase("!note") && user.getNick().equalsIgnoreCase...
6135ae9d-2e53-4294-91df-09a1d0251d43
5
public static final boolean isNumeric(String str) { int length; if (str == null || (length = str.length()) == 0) { return false; } char[] chars = str.toCharArray(); do { // 48-57 if (chars[--length] < '0' || chars[length] > '9') { return false; } } while (length > 0); return true; }
8d3d691c-50d4-4798-8095-0887eae49d71
3
public File unzipFile(ZipFile in, File fileLocationOnDiskToDownloadTo) throws IOException { FileOutputStream dest; Enumeration<? extends ZipEntry> zipFileEnum = in.entries(); while (zipFileEnum.hasMoreElements()) { ZipEntry entry = zipFileEnum.nextElement(); File destFile...
6b0e8e0e-5e95-4926-ac59-22ccaeedb4bc
2
public void initWindow(boolean full) { // Create game window... setIgnoreRepaint( true ); setResizable(false); this.addWindowListener(this); // Add the WindowListening events to the GameWindow if(full) { // Disable fullScreen this.setSize(WIDTH, HEIGHT); this.setUndecorated(true); gd.setFullScreenW...
b12848ba-b938-43d5-b99a-5a4c9078f480
1
public static int arrayDimension(String desc) { int dim = 0; while (desc.charAt(dim) == '[') ++dim; return dim; }
711ffde6-6932-463b-adc4-2aa25feadc1a
8
private static Date parseDateWithLeniency(String str, String[] parsePatterns, boolean lenient) throws ParseException { if (str == null || parsePatterns == null) { throw new IllegalArgumentException("Date and Patterns must not be null"); } SimpleDateFormat parser ...
8ca8f8ef-2d3e-4939-bea1-d854caf26082
8
protected Result parseInsruction(String nextInstruction) { String[] parsed = nextInstruction.split("\\s+"); if (parsed.length > 4){ return Result.createError(Errors.TOO_MANY_PARAMS, nextInstruction); } if(allowableCommands.contains(parsed[CMDINDX])){ //further processing if ( "GET".equals(pars...
5ac4a568-6ec7-439e-ab02-c1638b9c339a
2
public Bipartite(Graph G) { marked = new boolean[G.V()]; color = new boolean[G.V()]; isBipartite = true; for (int v = 0; v < G.V(); v++) if (!marked[v]) { dfs(G, v); } }
5e36f37f-0d64-4040-8d82-c5b0e836360b
8
private boolean evaluateBuildRBondClause(String str) { String[] s = str.split(REGEX_SEPARATOR); if (s.length != 3) return false; int n = model.getAtomCount(); double x = parseMathExpression(s[0]); // index of atom 1 if (Double.isNaN(x)) return false; int i = (int) x; if (i >= n) { out(ScriptEvent...
5a8c96f1-4f1c-4d3b-8799-bf628adcec7f
5
@Test public void test2(){ String outputString = ""; String buffer = ""; File data = new File("german"); try { BufferedReader reader = new BufferedReader(new FileReader(data)); while((buffer = reader.readLine()) != null) { outputString += buffer; buffer = null; } } catch (FileNo...
79c47868-9ed0-46fc-a648-45b890094aa0
1
public void clear() { final Iterator iter = iterator(); while (iter.hasNext()) { ((Stmt) iter.next()).cleanup(); } super.clear(); }
e06ff12b-aea6-408b-93d9-ee88d11aa41a
0
@Override public void startSetup(Attributes atts) { outliner = this; setTitle(atts.getValue(A_TITLE)); // Load Preferences loadPrefsFile(PARSER, ENCODINGS_FILE); // Setup the FileFormatManager and FileProtocolManager fileFormatManager = new FileFormatManager(); fileProtocolManager = new FileProtocolMa...
6db3731f-e625-4c5c-b66d-b238be12a2ce
4
Grid (){ //gen 4x4 grid = new ArrayList<>(4); //gen y then x for (int i = 0; i < 4; i++) { grid.add(new ArrayList<Tile>()); for (int j =0 ; j < 4; j++){ grid.get(i).add(null); } } for (int i = 0; i < 2; i++) { if(!genTile()){ System.err.println("Grid: ctor> Grid full or could not gen ...
a55fe5fa-f9bf-4d5a-b3ec-2267ac7ae246
3
public void eliminaUltimo(){ if(this.inicio == null){ System.out.println("La lista esta vacia"); }else{ if(this.inicio.getLiga() == null){ this.inicio = null; }else{ Nodo<T> nodoQ = this.inicio; Nodo<T> nodoT = null; while(nodoQ.getLiga() != null){ nodoT = nodoQ; nodoQ = nodoQ.get...
1b80d54f-0966-4ee6-815a-6ae093b772b8
9
@Override public boolean sendDeath() { WorldTasksManager.schedule(new WorldTask() { int loop; @Override public void run() { if (loop == 0) { player.setNextAnimation(new Animation(836)); } else if (loop == 1) { player.getPackets().sendGameMessage( "Oh dear, you have died."); } e...
332297ed-b425-4592-8678-7837ead4dcec
4
public void setForecastDayAndNight(int aftertoday,Iterator<Element>tempit,WeatherInfo tempweather,int isNight){ Element tempElement; int i=0; while(tempit.hasNext()){ tempElement=tempit.next(); switch (i) { case 0:tempweather.setForecasttype(aftertoday, tempElement.getText(), isNight);break; case 1:te...
c4d48873-3cd1-4328-89af-9ba580bc51bd
4
public static void main(String... args) { int biggestNum = 0; for (int i = 1000 - 1; i >= 100; i--) { for (int j = 1000 - 1; j >= 100; j--) { int target = (i * j); if (isPalindrome(target) && target > biggestNum) { biggestNum = target; ...
535b6752-aad8-4386-a977-8a35a343d03f
3
public void set(int symbol, int freq) { if (symbol < 0 || symbol >= frequencies.length) throw new IllegalArgumentException("Symbol out of range"); if (freq < 0) throw new IllegalArgumentException("Negative frequency"); total = checkedAdd(total - frequencies[symbol], freq); frequencies[symbol] = freq; ...
d3a4e5e5-decb-4465-bb94-5a04a1296488
3
public void activate(Robot paramRobot, int paramInt) { super.activate(paramRobot, paramInt); if (this.state != null) { Vector localVector = this.state.getSpecialProgramParts(); Enumeration localEnumeration = localVector.elements(); while (localEnumeration.hasMoreElements()) if ((lo...
f4ac2155-f9dd-4cf9-b2e1-42e9c8510aa0
5
private static void readSettings(){ //Checkbox was changed: Save changes to wini Wini ini; //Ini handler boolean firstSetup = false; try{ File settings = new File(NineManMill.settingsfile); if (!settings.exists()) { //If settings file does not exist, leave the default values settings.createNewFile...
78c1bd43-61a0-4682-abae-13549ab209d5
1
protected String removeCDATA(String title) { return ( title.indexOf("<![CDATA[") != NOT_FOUND ) ? title.substring(9, title.length() - 3) : title; }
3bdbb683-075c-4655-99a3-267e85216e29
0
private void btnCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrarActionPerformed //Cierra la interfaz de registro setVisible(false); }//GEN-LAST:event_btnCerrarActionPerformed
3b539f45-ad13-4137-a60e-e5e2d717e28c
2
@Override public void startUp(GameTime gameTime) { // Call the startUp methods of all the register GameLayers super.startUp(gameTime); // Change the mouse GameEngine.setCustomCursor(GameAssetManager.getInstance().getObject(BufferedImage.class, Configuration.GUI.Misc.GAME_MOUSE)); // Realign all of the m...
1bae0f2e-ded5-450f-9edd-9f02e187b4c5
2
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: String file_name = "storage.txt"; try { ReadFile file = new ReadFile(file_name); String[] aryLines = file.OpenFile...
e2ee0227-3266-4a39-acaf-32fa8b004f59
0
public void setInitialHeight(int initialHeight) { this.initialHeight = initialHeight; }
072d9ff8-c68e-4d90-b8b7-c65689daf6f2
0
public void setFirstName(String firstName) { this.firstName.set(firstName); }
9a173aa1-42d4-4f22-ae8c-3127446b2e85
9
@Override public void dragOver(DropTargetDragEvent event) { TreePanel panel = getPanel(); int x = panel.toHeaderView(new Point(event.getLocation())).x; TreeColumn overColumn = panel.overColumn(x); if (overColumn != null && overColumn != mColumn) { ArrayList<TreeColumn> columns = new ArrayList<>(panel.getCol...
21c582f0-fcff-4ba6-8506-157a55061acb
2
private void closeOpenInterfaces() { // clearTopInterfaces outputStream.writeOpcode(130); if (invOverlayInterfaceID != -1) { invOverlayInterfaceID = -1; needDrawTabArea = true; aBoolean1149 = false; tabAreaAltered = true; } if (backDialogID...
dd0ab2b7-9e60-4a52-97f7-cc93f1b1dfa5
7
@Override public void update(double time) { if (Input.getKeyDown(Keyboard.KEY_W) || Input.getKeyDown(Keyboard.KEY_UP)) { if (selectedOption > 0) { selectedOption--; } } if (Input.getKeyDown(Keyboard.KEY_S) || Input.getKeyDown(Keyboard.KEY_DOWN)) { if (selectedOption < 1) { selectedOption++; }...
b1afe46f-8121-47b7-9b49-721f78f854db
8
public void run(){ RConsole.openUSB(10000); long updateStart, update; boolean objectDetected = false; boolean obstacle = false; boolean foam = false; int buffer = 0; while (true) { updateStart = System.currentTimeMillis(); ColorSensor.Color vals = censor.getColor(); ColorSensor.Col...
e2703d9f-3c01-4bc1-bc0b-22355e580ab1
4
private void optimizeMathe(){ //Mathe: 4 hjs mandatory if(myData.subjects[MATHE].writtenExamSubject==false){ int hjsToAdd; if(myData.subjects[MATHE].oralExamSubject==true){ hjsToAdd = 3; //since 13.2 is already in C } else {hjsToAdd = 4;} ...
2e07c9c8-6c31-44a4-b024-49dc79053b45
0
public static void main(String[] args) { System.out.println(ncr(40, 20)); }
34e01f2f-d2cb-47ad-9e4c-9aea55d85133
3
public static void closeDatabaseEngine() throws SQLException { try { dbProperties.put("shutdown", "true"); DriverManager.getConnection(dbProperties.getProperty("derby.url"), dbProperties); } catch (SQLException ex) { dbProperties.remove("shutdown"); // ...
6d570f04-fdbf-4bf2-b695-5f9d1fbde126
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Stage other = (Stage) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return fals...
3cf311d7-f6fd-4b4b-b3fa-085174701f33
0
public void put(Object o) { addFirst(o); }
9db29fd4-1b33-434b-a5dc-3b909faf5adb
2
public static void main(String[] args) { // Listは宣言時に値を設定できる。 List<String> list1 = Lists.newArrayList("hoge", "huga", "piyo", "tao", "tarou"); SimpleLogger.debug(list1.toString()); // newHashMapは宣言時に値を設定できない、ImmutableMapはできるけど。 Map<String, Person> map1 = Maps.newHashMap(ImmutableMap.of( // "hoge", n...
b188a625-a5b3-481d-85af-b4bef9d1cbec
2
private int popupSauvegarde () { if ( this.fileName == null ) return JOptionPane.CLOSED_OPTION ; int choix = GUIUtilities.question_YES_NO_CANCEL (Utilities.getLangueMessage( Constantes.MESSAGE_SAUVEGARDER_FICHIER_ENCOURS )) ; if (choix == JOptionPane.YES_OPTION) save(); ...
2c44f548-f952-4f5e-b850-25789669db6f
3
public static Subject[] findFLangSubjects(Data myData) { List<Subject> results = new ArrayList<>(); results.add(myData.subjects[ITA]); for(Subject thisWahlfach:myData.getWahlfaecher()) { if(thisWahlfach.getSubjectType()==FOREIGN_LANG) results.add(thisWahlfach); } i...
79494392-b3a5-4b58-ade2-624a2efb40e7
8
public void actionPerformed(ActionEvent e) { if (btnReadRow == e.getSource()) { try { readRow(); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } else if (btnWriteRow == e.getSource()) { writeRow(); } else if (btnReadCol == e.getSource()) { ...
621780e0-c179-4393-8c8d-28304839edce
5
private final void method1595(byte i, int i_17_, ByteBuffer class348_sub49) { anInt2852++; if (i >= 5) { if ((i_17_ ^ 0xffffffff) == -2) ((Class218) this).anInt2853 = class348_sub49.getShort(); else if ((i_17_ ^ 0xffffffff) != -3) { if (i_17_ == 3) ((Class218) this).aBoolean2854 = true...
50daa7d2-a793-4bdc-8010-55262cb1a409
8
public TriangleContainer clone(){ TriangleContainer ret = new TriangleContainer(); if (leftAnglePoint!=null) ret.leftAnglePoint = new Point3D(leftAnglePoint); if (topAnglePoint!=null) ret.topAnglePoint = new Point3D(topAnglePoint); if (rightAnglePoint!=null) ret.rightAnglePoint = new Poi...
a108480e-40a0-4cfc-8fbe-7bb811dd3ec1
3
public static boolean containsElement(Object[] array, Object element) { if (array == null) { return false; } for (Object arrayEle : array) { if (nullSafeEquals(arrayEle, element)) { return true; } } return false; }
5289a8f9-f437-46c4-99a3-edb5e0696d4d
0
public DynamicArray() { this.array = new Object[10]; this.size = 0; }
7b783166-f715-41dd-83de-1bf8193aef40
9
public SkillsPanel(EVECharacter character){ this.character = character; setLayout(new BorderLayout()); DBHandler db = new DBHandler(); for(int i=0;i<character.getSkills().size();i++){ Skill currentSkill = character.getSkills().get(i); if( isGroupExists(currentSkil...
a93c0ffb-e307-421c-b3db-27b5cb3b34de
6
public static <GInput, GOutput> Converter<GInput, GOutput> conditionalConverter(final Filter<? super GInput> condition, final Converter<? super GInput, ? extends GOutput> acceptConverter, final Converter<? super GInput, ? extends GOutput> rejectConverter) throws NullPointerException { return new Converter<GInput,...
7f1eec1d-bacd-477c-9d41-ec571707ada6
1
private void setCursor(Point point) { Point worldCoords = getWorldCoordinates(point); if (worldCoords != null) { ClientPlayer me = client.getSession().getSelf(); double angle = Math.atan2(worldCoords.y - me.getShooterMount().y, worldCoords.x - me.getShooterMount().x); me.setShooterAngle(angle); AdjustSh...
442eff97-7250-41aa-9289-654f267f6df1
6
@Override public void run() { if (Updater.this.url != null) { // Obtain the results of the project's file feed if (Updater.this.read()) { if (Updater.this.versionCheck(Updater.this.versionName)) { if ((Updater.this.versionLi...
fc645a08-6597-499f-a9dd-16aa837851a8
1
public void test_toFormatter() { DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder(); try { bld.toFormatter(); fail(); } catch (UnsupportedOperationException ex) {} bld.appendLiteral('X'); assertNotNull(bld.toFormatter()); }
86ad8e50-eebf-4fc7-8f76-b1b163b25f66
3
public void setToolBar(JToolBar newToolBar) { JToolBar oldToolBar = getToolBar(); if (oldToolBar == newToolBar) { return; } if (oldToolBar != null) { headerPanel.remove(oldToolBar); } if (newToolBar != null) { newToolBar.setBorder(B...
67ef088e-32d4-4deb-a597-4484bb906c19
4
public static void main(String[] args){ PrintTimes printer = new PrintTimes(); PrintClusters cprinter = new PrintClusters(); TunableParameters params = TunableParameters.getInstance(); int runs = 1; int[][] allClusters = new int[runs][params.getDataSetSize()]; int[][] ...
4b40c445-0656-4b4d-afb0-0ba739c4a919
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...
3e8f6ef0-bd9b-4b1c-a386-a8bd7be8c643
6
public ListNode getIntersectionNode(ListNode headA, ListNode headB) { int firstCount = 0; int secondCount = 0; //First number of nodes in first list ListNode A = headA; while (A != null) { firstCount = firstCount + 1; A = A.next; } //Find ...
a59b6af1-3af7-469e-a912-625a578f7e71
0
public MergeSort(int[] array){ this.array = array; }
5668efca-d821-4a3c-b40d-585b1b6d3e8d
9
@Override public void insert(K k) { // induction basis: BinarySearchTreeItem<K> p; if (root == null) { p = new BinarySearchTreeItem<K>(k); p.left = null; p.right = null; } else { p = root; } // induction step: while (true) { if (p.key == k) { if (p.left == null) { p.left = new B...
f182a7a2-7fde-43e1-a6b4-22c8bccf0528
9
private static String calculate(String input) throws Exception { if (input.equals("")) { return(input); } double val1, val2, result; String output = null; String symbol; Stack<Double> stack; String[] symbols; stack = new Stack<Double>(); symbols = input.split(" "); for (int i = 0; i < sy...
244400ca-1264-448b-a5fa-64ce84ffa4f0
9
public static int sizeOf(Class<?> cls) { if(cls == boolean.class) return 1; if(cls == byte.class) return 1; if(cls == char.class) return 2; if(cls == short.class) return 2; if(cls == int.class) return 4; if(cls == long.class) return 8; if(cls == flo...