method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
034f6f48-7079-4c5a-bf70-0b17744575ad
3
@Override public void paintComponent (Graphics g) { if (isActive) if (isHovered) AHOVER.paintIcon (this, g, 0, 0); else ACTIVE.paintIcon (this, g, 0, 0); else if (isHovered) IHOVER.paintIcon (this, g, 0, 0); else INACTIVE.paintIcon (this, g, 0, 0); }
fd052d42-09f8-4622-a7a4-352938821ca4
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...
d18590fd-173a-41f7-919c-68c668fbd081
6
private List<Long> pickNextEdgeFrom_Using_(Long currHeadVertice, Set<Long> usableEdges) { Set<Long> incident = graph.getIncident(currHeadVertice); countAccess(1); // build the set of usable edges connected witht the head Set<Long> intersect = new HashSet<>(usableEdges); intersect.retainAll(incident); ...
11b370b7-f2b0-4779-8174-89010ff8bece
7
@Override protected void createRadioGroups() { Map<String, ButtonGroup> tempRadioGroupMap = new HashMap<String, ButtonGroup>(); for ( SwingWidget<?> widget : swingWidgetMap.values() ) { if ( widget.getControl() instanceof RadioButtonT && ( (RadioButtonT) widget.getControl() ).getRadioGroup() != null &...
9fce1501-5a25-4c25-8a77-8c5dae3fc0a3
0
protected boolean step() { controller.step(); return true; }
428fe0a6-5c12-41a1-899c-97c1be76e14b
2
public static int BitsInByte(byte b) { int ret = 8; for (int i = 7; i >= 0; i++) if (b << i == 0) ret--; else break; return ret; }
94334b3f-0b9b-47fb-b1a4-159cde79983d
1
private void createSashFormContent() { sash = new Sash (mainComposite, SWT.VERTICAL); final FormLayout formLayout = new FormLayout(); mainComposite.setLayout(formLayout); FormData treeLayoutFormData = new FormData (); treeLayoutFormData.left = new FormAttachment (0, 0); treeLayoutFormData.right = new ...
7b40a7a8-e9fc-4c4a-8170-c45b36e0e762
5
public static void pause(){ //Allow players to pause their game, thanks for the help - got it working if(EZInteraction.wasKeyPressed('y') || pause){ if(EZInteraction.wasKeyPressed('y')) pause = !pause; if(EZInteraction.wasKeyPressed('b')) pongRun = !pongRun; if(EZInteraction.wasKeyPressed('v')){ /...
d0e76a27-376b-4be6-8964-77ded7abb875
4
private boolean anyMovement() { if (backward || forward || right || left) { return true; } return false; }
3b55957a-e348-48d6-9f5e-5b0e021cc80e
8
protected void updateButtonState() { Component newTabComponent = displayPanes.getSelectedComponent(); run.setEnabled(false); if (newTabComponent instanceof JScrollPane) { newTabComponent = ((JScrollPane) newTabComponent).getViewport().getView(); } if (newTabComponent instanceof CodeTextPane) { CodeTextP...
0c94fcf7-c6e2-40e5-ad8a-8bcf6b9fdcf3
5
private static int[] merge(int[] left, int[] right){ int l=0, r=0; int[] ret = new int[left.length+right.length]; int index = 0; while(l<left.length && r<right.length){ if(left[l]<right[r]){ ret[index++]=left[l++]; } else { ret[index++]=right[r++]; } } while(l<left.length){ ret[index++]=...
f7a131c5-42eb-42ac-9b21-ebf21b242ea4
0
RLOGDatatypeProperties() { this.uri = "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog#" + name(); }
94fd6f8c-f42e-4e6a-b4e5-1a47253409ac
6
public Boolean checkBuiltIn(Location loc, Player play, Boolean isBreak){ if(!this.getBuiltIn().containsKey(play.getWorld())) this.getBuiltIn().put(play.getWorld(), true); if(isBreak){ if(this.hPlayerBreakBlock.containsKey(loc)) if(this.hPlayerBreakBlock.get(loc).contains(play)){ return true; } ...
86adc5f0-0ed9-4c49-9650-d377e977973a
7
@EventHandler public void GhastHarm(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.getZombieConfig().getDouble("Ghast.Harm.DodgeCh...
70ece218-c3ce-403f-8594-dffed99accd2
4
public void setFace() { if (_value < 11) { _face = ((Integer)_value).toString(); } else if (_value == 11) { _face = "jack"; } else if (_value == 12) { _face = "queen"; } else if (_value == 13) { _face = "king"; } ...
b841e4ed-0844-421d-ac12-fac106b59752
8
public double getCategoryJava2DCoordinate(CategoryAnchor anchor, int category, int categoryCount, Rectangle2D area, RectangleEdge edg...
19ed1813-8e29-4615-a013-da2f2575e05a
9
@Test public void testGetPixel() { try { // Boundary test // Top left corner assertEquals(i.getPixel(0, 0, Colour.RED), 136); assertEquals(i.getPixel(0, 0, Colour.GREEN), 146); assertEquals(i.getPixel(0, 0, Colour.BLUE), 149); // Top right corner assertEquals(i.getPixel(0, 3871, Colour.RED), 116...
5f792bd7-3001-483a-ae27-153ce3dff12b
4
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dataOrcamento == null) ? 0 : dataOrcamento.hashCode()); result = prime * result + id; result = prime * result + pagamento; result = prime * result + ((pessoa == null) ? 0 : pessoa.hashCode()); result =...
0cc9eb51-e969-4269-a1a0-a7897187bd18
7
public static void xmlToBTX(File fin, File fout) throws XMLStreamException, IOException { XMLInputFactory fact = XMLInputFactory.newFactory(); try (FileReader fr = new FileReader(fin); BTXPusher out = new BTXPusher(fout)) { XMLEventReader in = fact.createXMLEventReader(fr); XMLEvent s; while (!(s = in....
5850f68e-7a0b-4761-8227-b41a9ecade24
1
public void playCity() throws InterruptedException{ try { in = new FileInputStream(city); as = new AudioStream(in); ap.player.start(as); } catch(Exception e) { System.out.println("Got an IOException: " + e.getMessage()); e.printStackTrace(); ...
dcd936bb-81d1-4483-adb0-edeb57e9a3a7
6
public static void textPack(byte packedData[], String text) { if (text.length() > 80) { text = text.substring(0, 80); } int length = text.length(); int key = 0; int bitPosition = 1 << 3; int srcOffset = 0; packedData[0] = (byte) length; for (; length > srcOffset; srcOffset++) { int textByte = 0xff...
b37a5dcd-7b47-4c21-b5dc-035bbbf5037f
6
static void init(){ appPath = (System.getProperty("user.home")); if(isWindows()){ //appPath = appPath + "\\Application Data\\StudyBuddy\\";//Windows uses backslash. Two needed as escape sequence appPath = System.getenv("APPDATA") + "\\StudyBuddy\\"; //Above invalid on non default...
ce847d54-c2f6-4827-8e62-ba1d87c224f8
5
@Override public void mouseExited(MouseEvent e) { if (isDragging) { // Update the UI if (targetNode.isSelected() && !targetNode.isFirstChild() && (componentType == TEXT)) { OutlineLayoutManager layout = targetNode.getTree().getDocument().panel.layout; OutlinerCellRendererImpl renderer = layout.getUICom...
5b72f290-eb26-4a1a-99cd-55ea1555f088
8
public boolean displayModesMatch(DisplayMode m1, DisplayMode m2){ if(m1.getWidth() != m2.getWidth() || m1.getHeight() != m2.getHeight()){ return false; } if(m1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && m2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && m1.getBitDepth() != m2.getBitDepth()){ retu...
39e12a38-11c2-4796-83d7-7565ed2c549d
4
public void run () { // se realiza el ciclo del juego en este caso nunca termina while (true) { /* mientras dure el juego, se actualizan posiciones de jugadores se checa si hubo colisiones para desaparecer jugadores o corregir movimientos y se vuelve a pintar to...
c32cec77-63d8-4cec-80f5-9f7438fb2be5
9
public static String convertFloat(float amount, boolean speech) { int num = (int) amount; String start = Integer.toString(num); int remainder = (int) ((amount - num) * 1000); if (start.equals("0")) { start = ""; } else if (remainder > 0) { if (speech) { start += " and "; } else { start += " "...
545bf4de-ee48-45b0-8738-63221bceaa98
6
public static void writeForALevel(int level) throws Exception { System.out.println(level); BufferedReader reader = new BufferedReader(new FileReader(new File( ConfigReader.getGoranOct2015Dir() + File.separator + "PC_0016 Metagenomics Study Report" + File.separator + "PC_0016 Data" + File.separat...
6ddfdc54-aabc-490f-9664-762f05efc33f
0
public CommandEditConfig(CreeperWarningMain plugin) { this.plugin = plugin; }
f06ef9bd-b842-498d-96ad-cc24170474fc
0
public Chance not() { return new Chance(1 - probability); }
a3202162-82dc-4662-83b3-ccb52d9a6e55
8
public boolean loadParameterFromFile(String path) { BufferedReader br; boolean done = false; int counter = 0; String currLine = null; try{ br = new BufferedReader(new FileReader(path)); while((currLine = br.readLine()) != null) { if(cou...
3a2a01ed-713a-475f-8b73-ceaa5c61225a
4
public void renderSides(){ for(int i = 0; i < worldHeight - 2; i++){ renderTileSize(sideTextures[0], 0, i + 1); } for(int i = 0; i < worldWidth - 2; i++){ renderTileSize(sideTextures[1], i + 1, 0); } for(int i = 0; i < worldHeight - 2; i++){ renderTileSize(sideTextures[2], worldWidth -1, i + 1)...
e72547fe-bc7d-487c-858c-afc9f6d2b914
8
private void processLoadState() { // loadingStages if (Client.lowMem && loadingStage == 2 && Region.anInt131 != plane) { gameScreenCanvas.initDrawingArea(); aFont_1271.drawANCText(0, "Loading - please wait.", 151, 257); aFont_1271.drawANCText(0xffffff, "Loading - please wait....
d6da7116-bbb5-4c3d-8b1d-3e7e465777c3
7
@Override public void run() { try { while(connection.isConnected()) { String requestS = ""; BufferedReader reader = new BufferedReader( new InputStreamReader(connection.getInputStream())); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(connection.getOutputStre...
384dc97c-0e68-4195-9656-d00fe2e63167
2
@Override public void setDetailedHops(List<Integer> hopPath, AggregatePositioner source) { DefaultListModel model = ((DefaultListModel) getReportHopList().getModel()); model.clear(); if (hopPath == null) ((DefaultListModel) reportHopList.getModel()).addElement("No selection"); else { ...
5cf678f3-2330-4755-ace1-18d3c2b20beb
8
public static int[] getMatchesBetween(Integer team1, Integer team2, String temporada, Connection conexion) throws SQLException{ StringBuilder query = new StringBuilder(); query.append("SELECT Empate, VictoriaLocal, VictoriaVisitante FROM Partidos "); query.append("WHERE Local...
e1899b84-3ff0-4c2f-8a97-d92b86889199
7
public static String[] splitMoveText(StringBuffer movetext) { while (Character.isWhitespace(movetext.charAt(0))) { movetext.deleteCharAt(0); } List tokens = new LinkedList(); String lastToken = ""; while (movetext.length() > 0) { while (Character.isDigit(movetext.charAt(0))) { mo...
0886bc54-68b6-4aae-8bc2-e52282c38126
2
public void cpuTurn() { AbstractPlay play=black.nextPlay(); play.execute(); log.setMessage(play.toString()); if(play instanceof Capture){ turnChanger.eatIncrement(); FactoryOfPlays factory = new FactoryOfCapturingsForPiece(play.getDestination(), board); while (!factory.isEmpty()){ play = b...
6fc16565-dc61-4a9b-83a0-7f62be38ad66
5
@Override public List<Course> getCourses(int userId) throws SQLException { List<Course> courseList = new ArrayList<>(); Connection connect = null; PreparedStatement statement = null; try { Class.forName(Params.bundle.getString("urlDriver")); connect = DriverM...
9a7216c1-1105-4d34-9863-63de176a8901
5
private SplayTreeNode zagZag(SplayTreeNode node) { SplayTreeNode k1 = new SplayTreeNode(node.parent.parent); SplayTreeNode k1Parent = k1.parent; SplayTreeNode a = new SplayTreeNode(node.parent.parent.left); if (a.isNull()) a.parent = k1; SplayTreeNode k2 = new SplayT...
c5a520f2-1507-4e53-958c-2206c4cb21c3
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Austritt)) { return false; } Austritt other = (Austritt) object; if ((this.id == null && other.id != null) || (...
b285262b-de55-4672-821b-c232027888db
5
public final Collection getCollection(Identifier ident) { if (ident instanceof PackageIdentifier) return packs; else if (ident instanceof ClassIdentifier) return clazzes; else if (ident instanceof MethodIdentifier) return methods; else if (ident instanceof FieldIdentifier) return fields; else if (...
cedb60a4-cc7c-4900-af7c-cf91cd6102a8
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...
c91a3f2a-3c72-4065-86b5-1f9657f8e148
2
@Override public Ship clone() { // Create new hashmap for the new nodes Map<Coordinates, Node> nodes = new HashMap<Coordinates, Node>(); // Put transfer each node to the new hashmap for (Node n : nodeMap.values()) { Coordi...
fd6fec34-a9fe-4f54-b74c-abb64f7bc277
5
public static void modifierReponse(Reponse reponse, String nouveauMessage, Utilisateur utilisateur) throws ChampInvalideException, ChampVideException { if (utilisateur == null || (!utilisateur.equals(reponse.getAuteur()) && utilisateur.getRole().getValeur() < reponse.getSujet().getReponseRoleMinimum...
4d7a4f07-6d06-4cc4-88f0-8dcaa2fba885
7
public int search(int[] A, int target) { int left = 0; int right = A.length - 1; while (left <= right) { int mid = (left + right) / 2; if (A[mid] == target) { return mid; } if (A[mid] >= A[left]) { if (A[left] <= t...
0293793f-137e-43f1-be08-8ed919702801
8
static int process(String line) { if(line == null || line.trim().length() == 0) return 0; int n = Integer.parseInt(line.trim()); String[] p = readLine().trim().split(" "); Map<String, Long> mp = new HashMap<>(); for(String str : p) { mp.put(str, (long) 0); } for(int i = 0; i < n; i++) { Str...
609b38ee-c66a-494d-a2cf-01f11ea986d1
4
private void loadAnalyzers() { // Lista cu analizatoarele disponibile aList = new ArrayList<Analyzer>(); // Deschide directorul xml_schema. File directory = new File(Config.exec_schemas); // Ia fisierele din directorul xml_schema. File[] files = directory.listFiles(); // Parseaza fiecare fisier. for ...
88a6d21d-fd9b-41db-885e-bb2bca093280
0
public void setName(String name) { this.name = name; setDirty(); }
454ccedd-074d-45c3-ad44-9e324204cc4d
4
public static boolean CheckGetCommandList(String path){ boolean result = false; ArrayList<Commands> inputCommands; inputCommands = FileReader.getCommandList(path); for (Commands print : inputCommands) { if(print == null){ result = true; break; ...
4b3da367-9cac-463e-a0db-630fce4672fe
5
public void onKeyEvent() { if (Keyboard.getEventKeyState()) { if (Keyboard.getEventKey() == Keyboard.KEY_LEFT) { this.position.setPositionX(this.position.getPositionX() - 1); } if (Keyboard.getEventKey() == Keyboard.KEY_RIGHT) { this.position.s...
9533db15-fb04-4b76-8c7d-3fe43ef43902
2
public Conexion(){ try{ System.out.println("Cargando conexion..."); Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); System.out.println("Cargando driver..."); cnx = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=dbRestaurante2012442", "BP", "123"); // cnx = Dr...
8c513f94-0d32-4665-afcc-f518ac105cb2
6
public String[] obtenerRespuestasCorrectas(int tamaño){ String csvFile = "dataset/diabetes_prueba_resultados.csv"; BufferedReader br = null; String line = ""; String cvsSplitBy = ","; String respuestas [] = new String [tamaño]; int contador = 0; try { br = new BufferedReader(new FileReader(csvFile))...
ea12b138-22b9-4830-aa6e-f48d6d7dbab4
0
public static ServiceManager getServices() { return _services; }
1e19c848-bb3d-4100-862b-0e2dc2c0ec3a
6
public <X> void processAnnotatedType(@Observes ProcessAnnotatedType<X> event, final BeanManager beanManager) { final AnnotatedType<X> type = event.getAnnotatedType(); for (AnnotatedMethod<?> method : type.getMethods()) { for (final AnnotatedParameter<?> param : method.getParameters()) { ...
a77b2e1b-e4df-416d-8606-6976a50b57b1
4
public static void main(String[] args) { // метод мэйн должен описывать общий сценарий и быть максимально коротким Game game; try { if (args.length == 0) { game = new Game(); } else { game = new Game(args); } // game = a...
088e2232-da00-48b3-93c9-9eb19c17845c
8
@Override public String getDescription(Hero hero) { int bDmg = SkillConfigManager.getUseSetting( hero, this,"BaseTickDamage", 0, false); float bMulti = SkillConfigManager.getUseSetting( hero, this,"LevelMultiplier", 0, false); long duration = SkillConfigManager.getUseSett...
43f7da6c-ffbc-4136-b779-b662ec62c5a5
2
@Override public void doAction(Player player, Grid grid) throws InvalidActionException { if (player.getRemainingTurns() <= 0) throw new InvalidActionException("The player has no turns left!"); Position currentPos = player.getPosition(); Position newPos = new Position(currentPos.getxCoordinate() + 1, curren...
e7e39c5e-be3f-4e63-8085-6cd6c8bcca98
8
@Override public void actionPerformed(ActionEvent arg0) { if((JButton)arg0.getSource() == btnEditThisPage) { if(editMode) editOff(); else editOn(); } else if((JButton)arg0.getSource() == btnBack) { overlord.cl.show(overlord.getContentPane(), "resultsPage"); } else if((JButton)ar...
83b1b814-ac13-4de4-ad54-39b7a869f4e9
5
private void incDec16bit(int rTo, boolean inc) { rLoadedFromAddress[rTo] = rLoadedFromAddress[rTo+1] = -1; if(rMask[rTo] == 0xFF && rMask[rTo+1] == 0xFF) { if(inc) r[rTo+1]++; else r[rTo+1]--; if(r[rTo+1] >= 0x100) { r[rTo+1] -= 0x100; r[rTo] = (r[rTo]+1) & 0xFF; } if(r[rTo+1] < 0x0) ...
fc98760c-019a-450d-b203-69475dc65752
3
public void deletContact(String first, String last){ for(Contacts aContact:contacts){ if (first.equals(aContact.firstName) && last.equals(aContact.lastName)){ System.out.print(last+","+first+" has been removed!\n"); } else{ System.out.println("No record found."); } } }
c1ffdf0d-b777-420d-baea-3c721d6e9cae
0
@Override public String getName() { return "user"; }
9a815fb0-ddb2-464e-9ba8-d8175d104ad4
9
@Override public void handle(Message<?> event) { Object body = event.body(); javax.jms.Message jmsMessage = null; String contentType = null; if (body instanceof JsonObject ) { try { jmsMessage = session.createTextMessage(body.toString()); c...
a177c9e8-0f01-411a-b34b-2a150b357b67
7
static final int method3405(int i, boolean bool) { anInt9765++; if (Class348_Sub1.anIntArray6547 == null) return 0; if (!bool && Class199.aClass352Array2636 != null) return Class348_Sub1.anIntArray6547.length * 2; int i_1_ = 0; if (i != 2012104999) method3405(118, false); for (int i_2_ = 0; Class34...
05df119d-ea78-4064-b6f8-f4c86e4dd6f9
5
public CreatureTemplateDialog() { setTitle("Creature Template Editor - MSB"); setBounds(100, 100, 294, 110); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); GridBagLayout gbl_contentPanel = new Grid...
46ffa68a-2e4d-4f10-a799-8b749375cac8
1
public void start() { cbTimer.start(new Callback() { double startTime; int tick=0; @Override public void cb() { if (tick==0) startTime=System.nanoTime(); tick++; animationFrame.setAnimationTime((System.nanoTime()-sta...
4963eca2-8880-4c75-bee9-861d75cfe2ef
8
private Message queryFromString(String query_line) throws TextParseException, NameTooLongException { String[] tokens = query_line.split("[ \t]+"); Name qname = null; int qtype = -1; int qclass = -1; if (tokens.length < 1) return null; qname = Na...
b415d171-519b-4f6b-b9d2-da8c5bbbd274
7
public static void findPotentials(String data_file, int iterations) { LoopMRFPotentials p = new LoopMRFPotentials(data_file); LoopyBP lbp = new LoopyBP(p, iterations); for(int i=1; i<=p.loopLength(); i++) { double[] marginal = lbp.marginalProbability(i); if(marginal.length-1 != p.numXValues()) // take off ...
9dd37b5b-b847-4fb3-b6a6-e41bc6dce245
9
private static boolean hasExactly9Digits(int i, int j){ List<Character> results = new ArrayList<Character>(); for(char c : Integer.toString(i).toCharArray()){ if (results.contains(c) || c == '0') return false; results.add(c); } for(char c : Integer.toString(j).toCharArray()){ if (results.contain...
6ce35b6f-06a1-4af0-aeea-0d2d4d51d46b
9
@Override public int attack(NPC npc, Entity target) { final NPCCombatDefinitions defs = npc.getCombatDefinitions(); int distanceX = target.getX() - npc.getX(); int distanceY = target.getY() - npc.getY(); boolean distant = false; int size = npc.getSize(); Familiar familiar = (Familiar) npc; boolean usingS...
d5bd7287-94d7-4b12-aee9-c20ee2a7963a
0
public WorldTest() { }
c058f54d-3c33-4172-b297-93f1e67b40f7
4
public void next(int width, int height) { x += incX; y += incY; float random = (float)Math.random(); // collision with right side of screen if (x + textWidth > width) { x = width - textWidth; incX = random * -width / 16 - 1; fontFace = 0; fontSize = 125; fillColor =...
fdeb1989-2b78-407c-90d5-3fdd562889f7
6
public boolean intersectsAbove(RPChromosomeRegion testRegion) { // Only need to test if some part of this region is above and some within test region. if (endChromID > testRegion.endChromID || (endChromID == testRegion.endChromID && endBase > testRegion.endBase)) { if (start...
b3098d50-a644-4e34-b45c-a4d858ca5d47
0
public Location getLocation() { return location; }
cf1695a7-cd94-4ed0-b027-e5e47be338d7
9
public Coordinate fromCartesian(Vector2D point) { int n = refPolygon.count(); Coordinate coordinate = new Coordinate(n); Vector2D[] si = new Vector2D[n]; double[] Ai = new double[n]; double[] Di = new double[n]; double[] ri = new double[n]; for (int i = 0; i <...
ff1b7b61-3fe4-47dd-846e-33c6222a8067
6
public static void main(String[] args) { BasicConfigurator.configure(); Logger.getRootLogger().setLevel(Level.INFO); try { listAllClasses(); start(); } catch (BindException e) { try { CloseableHttpClient httpclient = HttpClients.createDefault(); URI uri = new URIBuilder().setScheme("http").setH...
e463ff79-da39-4c9e-9169-f72cbff0c178
3
public static void main(String[] args) { // Nested "if" Statements String gender = "female"; int age = 43; if (gender.equalsIgnoreCase("male")) { if (age > 30) { System.out.println("You are a male over the age of 30"); } else { System.out.println("You are a male under the age of 30"); } ...
3a946b5b-a5c7-41e8-bfb6-bfbb71309ddb
9
public static void main(String[] args){ Scanner in = new Scanner(System.in); int sit=0, stand=0; int n = in.nextInt(); char[] text = in.next().toCharArray(); for(int i=0;i<text.length;i++){ if(text[i]=='x') sit++; else stand++; } if(sit-stand>0){ int diff = (sit-stand)/2; for(int i=0;i<t...
4a1afe15-1ca6-4a4a-b892-49115209a98b
8
@Override public void setUnixPermissions(String path, UnixPermissions perms) throws PathNotFoundException, AccessDeniedException, UnsupportedFeatureException { if (hardlinks) { //Get hard link paths String[] hardlinks = getHardLinks(path); if (hardlinks.length > 0) path = hardlinks[0]; } ...
3aacd1f5-c8e1-4032-8b13-5d11f059519d
6
public Match findId(Match m) { Match found = null; PreparedStatement pst = null; ResultSet rs = null; try { pst=this.connect().prepareStatement("select * from Matches where equipea=? and equipeb=? and scorea=? and scoreb=?"); pst.setString(1, m.g...
7942062c-e7f5-4fa3-a4a2-9410dc8d4f3d
7
public static void walkDefmacroTree(Cons tree) { { Stella_Object name = tree.rest.value; { PropertyList self000 = PropertyList.newPropertyList(); self000.thePlist = Cons.extractOptions(tree, null); { PropertyList options = self000; MethodSlot method = null; if (Stella_Ob...
6c8462f9-8fac-4118-9125-cf7e36777ecf
3
public int execute() { boolean forceQuit = false; // Is there a --force param? if( this.getParamCount() != 0 ) { if( this.getParamAt(0).getString().equalsIgnoreCase("-f") || this.getParamAt(0).getString().equalsIgnoreCase("--force") ) forceQuit = true; else this.getFactory().getServer().getLogger()....
03400072-8c13-415d-ae1f-6f172d4048ee
0
public double increaseDamage(double damage){ double temp = damage - weaponItem.getAttackScore(); return temp; }
153c44e7-bd81-4ec3-9a7c-5de4d823f94b
1
public void addDebito(String nomeCliente, double acrecimo)throws ExceptionGerentePessoa{ Cliente c = getCliente(nomeCliente); if(acrecimo >0){ c.addDebito(acrecimo); }else{ throw new ExceptionPessoa("Tentativa de adocionar d��bito com valor negativo"); } }
35c1cfa1-8b79-4546-863a-490b9a24a694
7
public void build() { Material block = Material.getMaterial(98); int x = this.x; int z = this.z; for (int y = this.y; y < height + this.y; y++) { x = this.x; z = this.z; for (int i = 0; i < width; i++) { // draw the north edge for (int j = 0; j < length; j++) { Location loc = new Location...
f68d4a91-ac0e-40c4-a1f3-63d91501d599
4
public static void openImageAction () { String userhome = System.getProperty("user.dir"); JFileChooser openFC = new JFileChooser(userhome); //let the user browse for an image openFC.setAccessory(new ImagePreview(openFC)); openFC.setAcceptAllFileFilterUsed(false); // not all files are accepted openFC.addC...
f84f434c-6431-49d7-b85a-c6bf8212f583
6
public void synchronizeEconomy(boolean accounts, boolean ecoplayers) { try { if (accounts) { for (int i = 1; i <= getGreatestId(Economy.accountTable, "id"); i++) synchronizeAccount(i); } if (ecoplayers) { for (int i = 1; i <= getGreatestId(Economy.ecoPlayerTable, "uuid"); i++) for (...
bbadbf56-41ed-433f-9a84-3e5f4f16ad5c
3
public static UserStatusEnum getStatusByName(String name) { if (StringUtils.isEmpty(name)) { return null; } for (UserStatusEnum status : values()) { if (StringUtils.equals(status.name(), name)) { return status; } } return null; }
18a25a17-1c02-40fa-bf4c-6f2d8c9bc8ef
1
private static List<String> splitValuesOrEmpty(String[] strings, int index) { if(index<strings.length) { String[] values = VALUES.split(strings[index]); return Arrays.asList(values); } return Collections.emptyList(); }
52edfbfd-c1d5-408c-9e32-825a72baf103
1
public static void main(String[]args) { BigInteger n = BigInteger.valueOf(2); n = n.pow(1000); BigInteger sum = BigInteger.valueOf(0); while(n.compareTo(BigInteger.ONE) > -1) { sum = sum.add(n.mod(BigInteger.TEN)); n = n.subtract(n.mod(BigInteger.TEN)); n = n.divide(BigInteger.TEN); } ...
bf1ceaeb-a019-47ef-90f1-1d6b5f3bcdf4
4
public void insert(Node node) { if(this.indent < node.indent) { if(this.children.size() > 0) { if(this.children.get(0).indent != node.indent) throw new RuntimeException("children indentations must match"); } this.chi...
cda82e28-6724-4efe-9002-1a9aca166a4a
1
private JMeterHTablePool(Configuration config, int poolsize,byte[] tableName, final boolean autoFlush,final long writeBufferSize) { tablePool = new HTablePool(config, poolsize, new HTableFactory() { @Override public HTableInterface createHTableInterface(Configuration config, byte[] tableName) { try { ...
4e8decdb-d7b0-454d-81e8-65f8fc209862
2
private static String getShortName(final String name) { int n = name.lastIndexOf('/'); int k = name.length(); if (name.charAt(k - 1) == ';') { k--; } return n == -1 ? name : name.substring(n + 1, k); }
e643a04a-5c93-4bc5-b298-e7c0435fd4f0
4
@Override public int decidePlay(int turn, int drawn, boolean fromDiscard) { double[] playVotes = new double[6]; for (int i=0; i < cylons.size(); i++) { int vote = cylons.get(i).cardPositionForReal(game, rack, drawn); playVotes[vote] += weights.get(i); } double bestVote = 0; int pos = 0; for (int...
dcf66516-b271-4888-ac20-0a1b00a8b662
2
public static boolean enableNagles(SocketDescriptor sock, boolean enable) { try { sock.channel.socket().setTcpNoDelay(!enable); } catch(java.net.SocketException e) { vlog.error("Could not " + (enable ? "enable" : "disable") + " Nagle's algorithm: " + e.getMessage()); return fa...
28d570fe-39ef-46d0-9c5a-c6cdefe45f02
1
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { String text = request.getParameter("textBox"); String target = request.getParameter("target"); String sub = request.getParameter("sub"); if(text != null & target != n...
202ab8bb-98ba-4b6f-8b9c-bc8c88b91c0e
5
public String adaptadorFomatoHora(String tiempoSolicitado) { String tiempoSolicitadoAdaptado; switch (tiempoSolicitado) { case "15 minutos": tiempoSolicitadoAdaptado = "00:15:00"; break; case "30 minutos": tiempoSolicitadoAdaptado =...
e9b0d94a-4e00-4dd3-8a46-6267e0d414d6
7
double splitInfoDiscrete(int i) { String[] attributeValues = data.getAttributeValues(i); String[] array2 = data.getAttributeRange(i); int p_values = array2.length; //store number of instances having belonging to a certain class int[] nk = new int[p_values]; for (int j = 0...
f8fd89ae-1d3d-412b-8749-7d05e63a5d5d
7
@Override public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception { if (splitted[0].equals("npc")) { int npcId = Integer.parseInt(splitted[1]); MapleNPC npc = MapleLifeFactory.getNPC(npcId); if (npc != null && !npc.getName().equals("MISSINGNO")) { npc.setPosition(c.get...
91811347-7408-4a83-b05d-896e73318e7b
8
public boolean hasCollided(int Xa, int Ya) { int xMin = 0; int xMax = 7; int yMin = 3; int yMax = 7; for (int x = xMin; x < xMax; x++) { if (isSolidTile(Xa, Ya, x, yMin)) { return true; } } for (int x = xMin; x < xMax; x++) { if (isSolidTile(Xa, Ya, x, yMax)) { return true; } } for...
0cb8fcf6-5319-40ce-85d1-cc97fb4228ef
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...