method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
bc63c800-95ca-404e-be1d-eae82ed15bb4
6
public void addingDivida() throws Exception { try { novodatainicio = selectedDivida.getDatadeinicio(); novadescricao = selectedDivida.getDescricao(); novaempresa = selectedDivida.getEmpresa(); novoexercicio = selectedDivida.getExercicio(); nov...
72b6099e-d796-46ac-bd20-2ba8d7f60a29
1
public static void stringParser() { String s = "a,b"; String[] s2 = s.split(","); for(int i=0;i<s2.length;i++) { System.out.println(s2[i]); triggerAR(s2[i]); } //triggerAR("VTRWV"); }
1a958daf-d151-46b9-8ba0-1d18d99d5ffc
0
public Cuenta getDestino() { return destino; }
f9c0a0f0-84a8-44b5-9634-3bfed7d4f938
4
protected void write(String event, int numMachines) { if (!record_) { return; } // Write into a results file // Now, we keep the moment of the failure in a results file for this res FileWriter fwriter = null; try { fwriter = new FileWrit...
495a3cd8-564f-4ca4-b112-c847bd62d3f5
4
public static void processShortcut(byte id) { switch(id) { case 0: { AreaSelection.enable(); break; } case 1: { ScreenCapture.captureScreen(Util.getGraphicsDevice()); break; } case 2: { new TextInputFrame(); break; } case 3: { TextUpload.uploadFromClipbo...
1d5068ed-ee73-4a75-928e-b4e35592a438
4
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int k = Integer.parseInt(line); StringBuilder out2...
76f2a9e6-07e4-40d9-a52f-f439d41c78b2
8
protected boolean checkParentDirs(String path, boolean create_if_absent) throws IOException { String[] components=Util.components(path, File.separator); if(components == null) return false; if(components.length == 1) // no parent directories to create, e.g. "data.txt" ret...
b8d2bdbf-e534-4734-8f27-ddcf6a020687
3
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (this.getClass() != obj.getClass()) { return false; } NamedBinaryTag other = (NamedBinaryTag) obj; return this.valueEquals(other); }
38596b04-d17d-4f7f-ac59-73c0ec7e069c
5
public void nextLevel(){ level++; if (level >= 10){ level = 10; ifi.setEnabled(false); } Runnable changePic = new Runnable() { public void run(){ String pic = "hangman" + level + ".gif"; BufferedImage myPicture = null; try { if (!iidenki.IS_JAR) {myPicture = ImageIO.read(new File(pi...
38d0bf83-a866-4fef-9bf4-8a82697b8e5f
2
public static String joinStrings(String...strs){ if(strs!=null){ StringBuilder sb = new StringBuilder(); for(String str:strs){ sb.append(str); } return sb.toString(); }else{ return ""; } }
7988a6cb-88b9-46f5-9452-cce400babdc8
2
public String receive() { String msg = input.nextLine(); if (msg.equals(ProtocolStrings.STOP)) { try { socket.close(); } catch (IOException ex) { Logger.getLogger(ChatClient.class.getName()).log(Level.SEVERE, nul...
2a751d43-a922-47e9-9bd3-349f845cf024
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...
6235cf31-97bd-4e40-a46a-701debbbc4b5
1
public synchronized void updateLength(int delta) { queueLength += delta; if (queueLength > maxQueueLength) { maxQueueLength = queueLength; } }
2dc8268f-efcb-42c5-b9ca-dcc2c0dfcc38
2
private static XYDataset createDataset() { XYSeries n = new XYSeries("n"); XYSeries lg = new XYSeries( "lg(n)"); XYSeries square = new XYSeries("n^2"); XYSeries sqrt = new XYSeries("sqrt"); XYSeries power = new XYSeries("n^n"); XYSeries exp = new XYSeries("e^n"); for (int k = 1; k <= 10; k++) { ...
b1feca01-1aea-4d93-8352-6982e1825ee8
2
boolean setTo(Voie to) { if (to.equals(this.to)) { return false; } if (this.to != null) { this.from = this.to; this.fromAt = this.toAt; } this.to = to; toAt = System.currentTimeMillis(); return true; }
80237e93-8fe5-4bc5-8049-9c7e17f4109d
3
private void txtMother_NameKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMother_NameKeyPressed if (evt.getKeyCode() == 38) { txtHome_telephone_Number.grabFocus(); } else if (evt.getKeyCode() == 40) { jCheckBox1.grabFocus(); } else if (evt.getKeyCode() == 37) { txtMemb...
236a877a-0c68-4c43-b210-61a478953e0b
5
@SuppressWarnings("unused") public void checkScroll() { // get the x and y position in pixels int xPos = (int) (this.xIndex * this.zoomFactor); int yPos = (int) (this.yIndex * this.zoomFactor); // only do this if the image is larger than normal if (this.zoomFactor > 1) { // get the rectangle that define...
fe6c510b-1f32-47a2-9385-ffaa301154a6
5
@Override public boolean init() { for (Npc n : npcs.getNpcs(Filters.npcId(NPC_ID))) { if (n != null) { try { if (n.getSpeech().contains(players.getLocalPlayer().getName())) { sleep(3000, 5000); //sleeps incase it's the old man tele...
f8550a68-015a-438c-acc2-ba24ce8ff660
2
public void writeString (int pTamano) { JSONObject obj = new JSONObject(); JSONArray list = new JSONArray(); //LeerTexto leer = new LeerTexto(); // //String [] vieja = leer.leerArreglo("CROSSWD.TXT"); String [] nueva = new String [pTamano] ; //Lista <String> nuevo = ne...
dca242a8-a5da-4459-bb9d-cde967f9ad99
9
@Override public void onEvent(final FizzBuzzEvent event, final long sequence, final boolean endOfBatch) throws Exception { switch (fizzBuzzStep) { case FIZZ: if (0 == (event.getValue() % 3)) { event.setFizz(true); } ...
8d323e36-b83d-4d0f-a365-edbdeb0aa516
8
@Override public void simpleUpdate(float tpf) { Vector3f camDirection = cam.getDirection().clone().multLocal(0.6f); Vector3f camLeft = cam.getLeft().clone().multLocal(0.4f); camDirection.y = 0; camLeft.y = 0; if (s==20) { salud=3; } i...
0457a9e9-8811-444b-bedd-d13b36aa95f8
4
public ResultSet executeQuery(String query) throws SQLException { // Create a statement ResultSet resultSet = null; try { connect(); System.out.println("Executing query:"+query); Statement statement = getConnection().createStatement(); // Execute a statement if(query.contains("insert") || query.co...
c0322adb-a526-4467-9e3f-66bf2751a3ec
9
public int compareTo(HotTestDetails comp) { int result = 0; if (m_minimize) { if (m_merit == comp.m_merit) { // larger support is better if (m_support == comp.m_support) { } else if (m_support > comp.m_support) { result = -1; } else...
5e4cb007-bb73-4269-ae0b-7f943750d1b1
6
public void run() /* The frames of the animation are drawn inside the while loop. */ { long beforeTime, afterTime, timeDiff, sleepTime; long overSleepTime = 0L; int noDelays = 0; long excess = 0L; Graphics g; gameStartTime = System.nanoTime(); prevStatsTime = gameStartTime; beforeTime = gameStartTime...
ed44ac6b-164a-4fb2-b8ae-047e72163dfa
5
public GridTile getAdjacentTile(Action a) { GridTile newTile = null; try { if(a.equals(Action.UP)) { newTile = world.getTiles().get(getX()).get(getY()-1); } if(a.equals(Action.DOWN)) { newTile = world.getTiles().get(getX()).get(getY()+1...
bc86f300-4fe9-45a3-934e-eb4866c844d9
7
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...
e916aeef-9b09-4b22-9aa6-ec042b0302a8
8
public synchronized void disconnectionNotification(String eventName, Object source) { if (eventName.compareTo("trainingSet") == 0) { if (m_trainingProvider == source) { m_trainingProvider = null; } } if (eventName.compareTo("testSet") == 0) { if (m_testProvider == source) { m...
305fd338-fb9f-4fe7-86b5-673921246fb5
4
public static boolean hasFly(Pokemon[] pokemon) { for (Pokemon aPokemon : pokemon) { if (aPokemon != null) { for (int j = 0; j < 4; j++) { if (aPokemon.move[j] == Pokemon.Move.FLY) return true; } } } ...
36a42b8a-05c6-44b2-b366-6cd1713d7113
1
public void setConfiguration(Configuration last) { java.util.List list = new LinkedList(); int height = 0; int width = 0; while (last != null) { Icon icon = ConfigurationIconFactory.iconForConfiguration(last); width = Math.max(width, icon.getIconWidth()); height += icon.getIconHeight() + ARROW_L...
370491a1-2817-4137-82db-45d7c58cee1d
2
public String countAndSay(int n) { if (n == 0) return null; String s = "1"; for (int i = 1; i < n; i++) { s = count(s); } return s; }
24ac29fb-4fea-40fa-90b0-6494bb4317f7
3
@Override protected boolean perform(final CommandSender sender, final Command command, final String label, final List<String> args, final Region region) { String key = RegionExecutor.parse(args, 0, "<Option>", sender); if (key == null) return false; key = key.toLowerCase(); if (!thi...
8338ccd0-842c-4fbc-aaeb-b6f1f6bd3931
4
@Test public void addMeetingNotesNormalTest() { contacts2 = generateListOfContacts2(); Calendar currentDateTime = Calendar.getInstance(); currentDateTime.setTimeInMillis(currentDateTime.getTimeInMillis() + 1000); //create a meeting for a future meeting today +1000 ms int id =...
4e858b19-073b-489d-ad38-e7396397cb43
3
public Connection getConn() { try { if(this.conn == null || this.conn.isClosed() ) { Class.forName("com.mysql.jdbc.Driver"); this.conn = DriverManager.getConnection( MessageFormat.format("jdbc:mysql://{0...
8f7132d1-774a-499d-96c7-22d14966733a
7
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof DefaultEmail)) return false; DefaultEmail that = (DefaultEmail) o; if (!content.equals(that.content)) return false; if (!date.equals(that.date)) return false; if (!from.equals...
a76b0860-e1bf-4912-a1ad-4747d91aa51e
4
private void addDirectCell (java.util.List<Point> adjoiningCells, Point adjoiningCell, Point parentCell) { if (isCellOutOfField(adjoiningCell) || isCellWall(adjoiningCell) || isCellClosed(adjoiningCell) || isCellOpened(adjoiningCell)) { return; } adjoiningCells.add(adjoiningCell); ...
4631a612-3932-4fc3-a1f7-23c2c601654c
2
public void randDnaSeqTest(int numTests, int lenMask, long seed) { Random rand = new Random(seed); for( int t = 0; t < numTests; t++ ) { String seq = ""; int len = (rand.nextInt() & lenMask) + 10; // Randomly select sequence length seq = randSeq(len, rand); // Create a random sequence if( verbose ) Sy...
32b48238-911c-4c7d-b820-242c58b35145
0
public RoomEntity() { setId(System.nanoTime()); }
171c1d02-8b41-4273-b810-72cb5679a1aa
7
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Options other = (Options) obj; if (!Objects.equals(this.u, other.u)) { return false; ...
5689b298-b6da-4ea2-ad9d-5e5691fa2412
0
@Override public String toString() { return "fleming.entity.Usuario[ idUsuario=" + idUsuario + " ]"; }
4b1fe8f0-b896-455e-9c99-2ced2409b874
6
public void sendGameResults() { Map<String, String> result = new HashMap<String, String>(); String doctor = null, killed, hilled = null; result.put("action", "game-results"); killed = night_actions.get("hill"); hilled = night_actions.get("kill"); for (Map.Entry<String, String> entry : cards.entrySet()) ...
36618223-fdd4-409c-b0f1-7cba146954b2
5
@EventHandler public void dragon_duel(EntityDamageByEntityEvent e) { if(e.getDamager().getType() == EntityType.ENDER_DRAGON && e.getEntityType() == EntityType.PLAYER) { Player p = Player.class.cast(e.getEntity()); if(PluginVars.isDueling(p)) { e.setCancelled(true); return; } new NPCGenerator().ge...
76e7005f-60e1-4a42-bd9e-81c73ea5efb5
8
@Override public void paintComponent(Graphics g) { super.paintComponent(g); switch(rank){ case 2: drawBamboo(g, 49, 13, Color.BLUE); drawBamboo(g, 49, 34, MYGREEN); break; case 3: drawBamboo(g, 49, 13, Color.BLUE); drawBamboo(g, 35, 34, MYGREEN); drawBamboo(g, 63, 34, MYGREEN); break; c...
60fcf7ea-3899-4733-845b-0506b43fb8b6
1
public MapFrame() { // Set X and Y sizes displayXSize = 900; displayYSize = 550; // MAP CANVAS basecanvas = new BaseCanvas(); // Initiate a new instance of a canvas. basecanvas.initCanvas(0, 0, 900, 550, this, Color.GREEN); // Set the BG colour to orange. basecanvas.setOpaque(false); terraincanvas ...
35dd161a-467e-432b-92c4-0c98e3fe62a3
0
public String getName() { return name; }
98f976be-3bcf-43cf-9611-a8ec39b8b68b
4
public void replaceBreakContinue(BreakableBlock block) { java.util.Stack todo = new java.util.Stack(); todo.push(block); while (!todo.isEmpty()) { StructuredBlock[] subs = ((StructuredBlock) todo.pop()) .getSubBlocks(); for (int i = 0; i < subs.length; i++) { if (subs[i] instanceof BreakBlock) { ...
dc1d5d37-faac-4b08-917e-1f88f09c603b
7
public static String[] getPortIdentifiers() { String ports = null; try { ports = System.getProperty("microedition.commports"); } catch (final SecurityException e) {} if (ports != null) { final StringTokenizer st = new StringTokenizer(ports, ","); final String[] portIds = new String[st.countTokens()]...
46fd72d3-2b83-43e0-99a3-29e66b1e6a15
7
public void CheckForUnusedWorlds() { // normal boxels for (MultiverseWorld world : master.getMVCore().getMVWorldManager().getMVWorlds()) { boolean[] isBoxResult = isBoxel(world.getName()); if (!isBoxResult[0]) { continue; } if (!isBoxResult[1]) { continue; } if ((world.ge...
0a003c46-7622-4611-b87f-bed325164f0b
7
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { // check if program folder exists, else create File programFolder = new File(SETTINGS_DIRECTORY); if (!programFolder.exists()) { if (!programFolder.mkdirs()) { JOptionPane.showMessageDialog(n...
c70d633c-6428-4948-bad2-90083062d048
0
public void turnOff() { System.out.println("灯关了!"); }
72def7e6-f3d8-42de-861d-f33a13ddcc25
4
private static void processNeighbors(NeighborHandler nh) { for (int i = nh.x - 1; i < nh.x + 2; i++) { for (int j = nh.y - 1; j < nh.y + 2; j++) { if (!Field.arePointsNear(i, j, nh.x, nh.y)) { continue; } if (!Field.getInstance().isInsideField(i-1, j-1)) { continue; }...
3a4cf56f-53f8-4a82-bdd3-5907c1a439ad
8
public void addMenuPanelInit() { addMenuPanel = new JPanel(); // generate panels formmated compononents JLabel menuInstructionLabel = generator.createLabel(addMenuPanel, "Please Choose an Item from each Menu Below", ""); menuInstructionLabel.setFont(new Font("Dialog", 1, 20)); JLabel mainMenuAppChoiceLabel...
8a35910c-74f0-4948-a3a5-78c75d29f238
3
@Override public void caseAGetlengthExp(AGetlengthExp node) { inAGetlengthExp(node); if(node.getLength() != null) { node.getLength().apply(this); } if(node.getDot() != null) { node.getDot().apply(this); } if(node.getHexp() !...
ea0fae32-e856-45ef-8241-06b598f9d9a4
3
static boolean tablesAreEquals(HashMap<String,HashSet<ArrayList<String>>> prev,HashMap<String,HashSet<ArrayList<String>>> cur ){ Set<String> keySet = prev.keySet(); for(String leftPart : keySet){ HashSet<ArrayList<String>> prevRightPart = prev.get(leftPart); HashS...
f187cf3f-0695-4cf6-91ee-4c6be3bb28b8
7
@Override protected boolean createPath(Lane start) { /*if(fPathList.get(fStart.hashCode() + fEnd.hashCode()) != null) { fPath = new LinkedList<Lane>(fPathList.get(fStart.hashCode() + fEnd.hashCode())); return true; }*/ fClosedList = new ArrayList<Lane>(); fOpenList = new SortedNodeList(); Graphics2D...
def381a1-8cfc-483c-be24-8b434cffa2e2
4
public BorderField(int[] initialValue, Color bg, String fieldTitle) { if ((initialValue != null) && (initialValue.length != 4)) { throw new IllegalArgumentException(); } if (bg == null) { bg = Color.WHITE; } if (fieldTitle == null) { fieldTit...
f9b8cf6e-3499-4868-abfa-cd4c9fc94147
4
private void method97(Mobile mobile) { int i = mobile.anInt1547 - Client.loopCycle; int j = mobile.anInt1543 * 128 + mobile.anInt1540 * 64; int k = mobile.anInt1545 * 128 + mobile.anInt1540 * 64; mobile.x += (j - mobile.x) / i; mobile.y += (k - mobile.y) / i; mobile.anInt...
b5ec7e5e-d028-44a6-883b-7a53af7a525b
5
public static boolean next_permutation(int[] vec) { int tmp; for (int i = vec.length - 2; i >= 0; i--) if (vec[i + 1] > vec[i]) for (int j = vec.length - 1; j >= 0; j--) if (vec[j] > vec[i]) { tmp = vec[i]; vec[i] = vec[j]; vec[j] = tmp; for (int k = i + 1, l = vec.length - 1; k ...
6829e61c-91e3-4302-869f-1e8338e063b2
4
public boolean inBlockedTile(int xWorld, int yWorld) { Point mapCoord = new Point(xWorld, yWorld); Rectangle r = null; int x, y; Tile t; for(int i = 0; i < 64; i++) { for(int j = 0; j < 46; j++) { r = null; x = (((i * tileWidth) + tileW...
dff507c8-e4e0-4111-b297-1508386fb3a4
0
@Override public String getServletInfo() { return "Short description"; }// </editor-fold>
9de77f71-f646-4738-b2c2-3e867b0e895a
0
public Category(int id, String naam) { this.id = id; this.naam = naam; this.subcategories = new ArrayList<SubCategory>(); }
f3b90483-b5fc-4e8d-81e4-a4ccd35b4429
2
@Override public void run() { Helper.replaceFlower(this); msFlower = System.currentTimeMillis(); while (Main.currentGame == this) { character.setBounds(x * 32, y * 32, 32, 32); character.setIcon(rotation.icon); flower.setBounds(fx * 32, fy * 32, 32, 32); int maxTimer = Helper.getMaxTime...
7cfa1211-69b4-4599-8bd8-b7c1db38abea
9
@EventHandler public void onPain(EntityDamageByEntityEvent event) { if(event.getEntity() instanceof Player && event.getDamager() instanceof Player){ Player target = (Player) event.getEntity(); Player attacker = (Player) event.getDamager(); if(mainClass.CombatPlayers.contains(attacker)) { if(mainClass.Co...
3cb1e426-dffd-4f83-8900-3acf4dac1d53
9
public static boolean equalsCollection(Collection c1, Collection c2) { if (c1 == null && c2 == null) { return true; } else if ((c1 == null && c2 != null) || (c1 != null && c2 == null)) { return false; } else if (c1.size() != c2.size()){ return false; } else { Iterator it = c1.iterator(); Itera...
2be7d9cd-55cf-4481-bbc3-91631707b22d
4
public ArrayList<ArrayList<String>> toStringArrayListOfStringArrayLists(final String[][] aasData) { ArrayList<ArrayList<String>> alalData = new ArrayList<ArrayList<String>>(); if(aasData==null) { ArrayList<String> alData = new ArrayList<String>(); for(String sField : getAsFields()) { alData.add(sField); ...
bd015928-505e-4444-8606-5ab54968782d
8
private double getAxisVal(int loc) { switch(loc){ case 0: case 7: return -1; case 1: case 6: return -.5; case 2: case 5: return .5; case 3: case 4: return 2; default: return 0; } }
d1e1950d-5157-411b-b5bd-bf8ee4366875
3
public static void calculate() throws IllegalArgumentException { if(inputInts.length == 0) { throw new IllegalArgumentException("Otillräckligt med argument!"); } // Init lowest value lowest = inputInts[0]; // Walk through the array and find the lowest value for(int i2 = 0; i2 < inputInts.length; i2...
5b8a9581-d2b5-4c11-9742-009ec1125f82
4
private List<Integer> findSharedMovies(int user1, int user2) { List<Integer> sharedMovies = new ArrayList<Integer>(); HashSet<Integer> user1Movies = userRatedMovies.get(user1); HashSet<Integer> user2Movies = userRatedMovies.get(user2); if (user1Movies == null || user2Movies == null) { return sharedMovies; ...
80997e7f-35f7-4908-af81-3a27060e9a39
3
@Override public void paintComponent(Graphics g) { super.paintComponent(g); Pixel[][] pixels = game.getDisplay(); for (Pixel[] row : pixels) { for (Pixel pixel : row) { game.getPixelType(pixel.id).draw(pixel, game, g); } } List<Animatio...
4b202302-bc11-476f-99ad-2cce7e399afe
9
public ShapeSubparce(SimpleFeature f, String tipo) throws IOException { super(f, tipo); shapeId = "SUBPARCE" + super.newShapeId(); // Para agrupar geometrias segun su codigo de masa codigoMasa = ((String) f.getAttribute("MASA")).replaceAll("[^\\p{L}\\p{N}]", "")+"-"; if (lSub.isEmpty()){ readSubparce...
74a901cb-1af8-4bfa-86f6-42638cfbb82e
3
public void update(DodgeballManager mm, CubeSerializable ta, CubeSerializable sa, Location newLoc) { if(health <= 0) { this.health = 10; player.setAllowFlight(true); player.setFlying(true); player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Int...
690fb8f7-97d2-438a-9040-ca1b037f57eb
4
public BinarySearchTreeNode<T> getSuccessorNode() { /** * Case 1: Node has right child * If a node X has a right child, then node X's successor node is the * minimum value of the right child node (i.e., you perform the minimum * operation on that right child). The result of performing the minimu...
ed502528-b8f6-40be-8f5e-97e5fff82ee2
7
PointHeaterDialog(final MDModel model) { super(new BorderLayout()); setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Increasing selection zone >>>>>>")); sizeButton = new JRadioButton[5]; JPanel panel = new JPanel(new GridLayout(1, sizeButton.length, 10, 10)) { public I...
0b044ec9-a010-48bf-849f-c10a67348de9
6
void printLights(boolean[] llights, boolean[] rlights) { System.err.println("##### Setting traffic lights #####"); for (int i = 0; i != nsegments + 1; ++i) { if (i != 0 && llights[i-1] == true) System.err.print("<"); else System.err.print(" ")...
0e53dde7-b4a3-47b5-b0a8-dbbb037d9bfd
3
public void ConsultarEP(String user, String clave) throws SQLException { // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. try{ Conexion.GetInstancia().Conectar(); ResultSet consulta=Conexion.GetInstancia...
62a0ca28-4d82-431f-9a39-1be50a4fa264
4
@SuppressWarnings("boxing") @Override public LinkedList<Character> search(Node problem) { frontier.clear(); //remove previous nodes from previous puzzles etc Map<String, Integer> map = new HashMap<>(); addToFrontier(problem); //start queue with initial problem node while (!frontier.isEmpty()) { Node node =...
87791da9-5322-4866-8bfa-b2ba783704c3
6
public static double floor(double x) { long y; if (x != x) { // NaN return x; } if (x >= TWO_POWER_52 || x <= -TWO_POWER_52) { return x; } y = (long) x; if (x < 0 && y != x) { y--; } if (y == 0) { ...
78d1e920-a720-4503-a189-41bd62c91fd7
0
public JMenuItem getImportDataMenuItem() { return importDataMenuItem; }
8f360ff0-4aad-423b-9a3a-c9599b08ed4f
8
public void saveValue() { // если записать null, то при чтении произойдёт Exception String values = new String(""); values = ((SMSNumber.getString() == null)?"":SMSNumber.getString()) + "&" + ((SMSText.getString() == null)?"":SMSText.getString()) + "&" + ((ServerPath.getString() == null)?"":Serv...
ba8c518b-2e63-4978-a3d3-409b47d56e85
5
private void doFinish( String containerName, String fileName, IProgressMonitor monitor) throws CoreException { // create a sample file monitor.beginTask("Creating " + fileName, 2); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IResource ...
2178d6dd-9a9b-4f6c-911e-50de39c1e02e
7
public NeuralNetwork(int input, int hidden, int output) { this.neuronCnt = input + hidden + output; for (int i = 0; i < input; i++) { // input layer Neuron neuron = new Neuron(); inputLayer.add(neuron); } Neuron bias = new Neuron(); f...
c05dd5e3-25a9-496e-8ea6-9873a1c906f6
8
public static void main(String[] args) { ProductInfoCallable_ForFutureTask callable1 = new ProductInfoCallable_ForFutureTask(1000); ProductInfoCallable_ForFutureTask callable2 = new ProductInfoCallable_ForFutureTask(2000); FutureTask<ProductInfo> futureTask1 = new FutureTask<ProductInfo>(callab...
559cfff1-9c5b-4f0d-ac25-d1718a9c9a18
5
protected KeyStore getKeyStore() { // init a new keystore with the Raven certificate, KeyStore keyStore; try { keyStore = KeyStore.getInstance("JKS"); keyStore.load(null, new char[] {}); // Null InputStream, no password CertificateFactory factory = CertificateFactory .getInstance("X.509"); Certif...
edf0bb84-cc50-4d7f-b593-d536b299518d
2
@Override public void Actualizar(Object value) { Session session = null; try { Liga liga = (Liga) value; session = NewHibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.update(liga); session.getTransaction...
0f688c6c-7d21-49c7-8734-8082aff3fc9a
9
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { ProjectTableModel tstm = (ProjectTableModel) table.getModel(); int modelRow = table.convertRowIndexToModel(row); int modelColumn = table.convertColumnIndexToMode...
76af52f1-f232-4edb-9160-30eb7234a4d4
9
private int calcDiscaunt(int mySum){ try { Connection con = db.getConnection(); Statement statement; List<Integer> discountList = new ArrayList<Integer>(); String query1 ="SELECT amount_sum FROM discounts;"; statement = con.createStatement...
4bfbff91-8180-4e97-8a9f-bb21cfdf1c19
1
public static void checkSeparator(ByteBuf ucpPacket, String afterFieldName) { if (ucpPacket.readByte() != 0x2F) { // the separator is '/' (0x2F) throw new IllegalArgumentException("Separator expected after " + afterFieldName); } }
18c5adbc-0835-4b17-9e53-86073a5ce709
2
public void setParams(Map<String, String> global) throws Exception { String timeoutValue = global.get("http-timeout-ms"); if (timeoutValue != null) { try { timeout = Integer.parseInt(timeoutValue); } catch (Exception e) { Logger.getLogg...
908c5192-932e-49de-a7a8-06601fb283c2
0
@Override public void destroy() { super.destroy(); parent = null; targetParent = null; }
0efa2a5d-e237-42fe-90be-d5316b86a47e
4
private static void addFilesUnder(File root, List<File> files, FileFilter fileFilter) { if (! fileFilter.accept(root)) return; if (root.isFile()) { files.add(root); return; } if (root.isDirectory()) { File[] children = root.listFiles(); for (int i = 0; i < children.length; i++) {...
f8856b95-eb6b-48f1-bb4a-73c69b0f5468
0
public static String getSkillName(int skillId) { return skillsMap.get(skillId); }
dccdb37a-66e7-473e-bd19-590384f131d3
2
public static boolean isValidHouseNum(String houseNum) { if (houseNum == null) return false; return houseNum.matches("\\d+") && houseNum.length() <= 4; }
4c81c1b9-81d4-48b9-bc59-e0759726f0c1
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final NodeArgumentArray other = (NodeArgumentArray) obj; if (this.data.length != other.data.length) { ...
933cdb26-c3d7-440e-aab5-3af24f7e81c5
8
public String stemmingString(String context){ ArrayList<Integer> spaceList = new ArrayList<Integer>(); ArrayList<String> newWortList = new ArrayList<String>(); int lastSpace = 0; String newContext = ""; spaceList.add(0); for(int i=1; i<context.length(); i++){ if(context.charAt(i) == ' ' || context.charAt(...
92a8b58c-ee59-4b8f-a39d-82bb5b027443
2
public static TreeMap<Double,Integer> rhythmRound(TreeMap<Double,Integer> rhythmTreeIn){ TreeMap<Double,Integer> rhythmTreeOut = new TreeMap<Double,Integer>(); Iterator<Double> rhythmIterator = rhythmTreeIn.keySet().iterator(); while(rhythmIterator.hasNext()){ double origKey = rhythmIterator.next()...
164efc08-c805-4b79-bcb7-bdf9f5a441ec
5
public static ArrayList<Position> getReachablePosition(GameBoard board, int col, int row, boolean defend) { Piece p = board.getPiece(Position.get(col, row)); switch (p.getType()) { case Piece.ROOK: return getReachableRookPosition(board, p, col, row, defend); case Piece.KNIGHT: return getReachableKnight...
c9b78121-a25f-40a0-ba59-cadae9998d27
9
public static void printToken(Symbol s) { System.err.print(tokenToString(s)); String val = null; switch (s.sym) { case TokenConstants.BOOL_CONST: System.err.print(" = " + s.value); break; case TokenConstants.INT_CONST: val = ((AbstractSymbol)s.value).getString(); System.err.print(" = " + val)...
5393f173-742b-4031-80b6-efe4b7fad5eb
6
public static void initBase() throws LWJGLException { if(System.getProperties().containsKey(Game.CMDLINE_FPS)) { fps = Integer.parseInt(System.getProperty(Game.CMDLINE_FPS)); } else { fps = FPS; } if(System.getProperties().containsKey(Preferences.CMDLINE_...
a573c04b-c960-49a7-95cd-cd618e685f33
9
public void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException{ String email = request.getParameter("email"); String password = request.getParameter("password"); System.out.println("EMAIL : "+email+"\tPASSWORD : "+password); Base base = new Base(); try { ...
a51057a0-dc8f-45af-833e-777292cc3ba0
3
public static void ver(Cancha cancha){ int[][] dimension=new int[220][155]; int x,y; for(int i=0;i<11;i++){ x=cancha.getEquipoX(0).getJugadorX(i).getPosX(); y=cancha.getEquipoX(0).getJugadorX(i).getPosY(); dimension[x][y]=1; x=cancha.g...
06f14279-095f-4822-af0f-9dc94e033080
2
public static void handleGetEventsReply(HTSMsg msg, HTSPClient client) { Collection<String> requiredFields = Arrays.asList(new String[]{"events"}); if (msg.keySet().containsAll(requiredFields)){ //TODO } else if (msg.get("error") != null){ //TODO } else{ System.out.println("Faulty reply"); } }