method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a4ebc518-81f1-46c3-be25-77cb034a68eb
5
public Integer monthIndex(String candidateMonth) { if (candidateMonth == null) { return null; } candidateMonth = candidateMonth.toUpperCase(); // First, try for an exact match Integer monthIndex = monthMap.get(candidateMonth); // If no match, try an abbrev of ...
6a396ecd-d340-469d-b211-9b197674e0b8
3
public Persistence() { // AQUI LOS RECUPERO (usarlo cuando abres la iu) try { FileInputStream fis = new FileInputStream(pathDB); ObjectInputStream ois = new ObjectInputStream(fis); Database database = (Database) ois.readObject(); activityService.setActivities(database.getActivities()); bookingService...
b808fdf6-07cb-40b5-a9a3-5d0a0d9f10ea
5
public static void handleEvent(int eventId) { if(eventId == 1) { System.out.println("Exit load game menu selected"); Main.loadGameMenu.setVisible(false); Main.loadGameMenu.setEnabled(false); Main.loadGameMenu.setFocusable(false); Main.mainFrame.remove(Main.loadGameMenu); Main.mainFrame.ad...
e06cecdf-9bf1-4d3e-ac4a-bcbcc6713626
7
public boolean exist(char[][] board, String word) { if (board == null || board.length == 0 || word == null || word.length() == 0) { return false; } for (int i = 0; i < board.length; i++) { char[] rowArray = board[i]; for (int j = 0; j < rowArray.length; j++)...
a5d2a5ba-157d-4d80-b11f-c1086b6d7c00
1
@Override public void run() { if(animationStage == 1) { //System.out.println("Animation stage updated to 2!"); animationStage = 2; } else { //System.out.println("Animation stage updated to 1!"); animationStage = 1; } }
7908913c-b752-4aa2-a57e-03bf58adb759
8
public static void main(String[] args) { boolean displayConsole = true; if (args.length > 0) { // it has arguments if (args.length == 1 && args[0].equalsIgnoreCase(Main.help)) { System.out.println("Starts the KOI server"); System.out.println("\nArguments:"); System.out.println(Main.noConsoleArg +...
64959610-4d70-4db4-907e-5dbb02a8c527
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GrowthRate that = (GrowthRate) o; if (Double.compare(that.rate, rate) != 0) return false; return true; }
4d395dc8-d7ba-4a91-b5e2-1affb85b63bb
0
public Ticker(int tickrateMS) { rate = tickrateMS; s2 = Ticker.getTime(); }
6736e905-14b0-4991-bf49-e32b840d451b
5
private static final String unescapeHTML(String s, int start) { int i, j, k, l; i = s.indexOf("&", start); start = i + 1; if (i > -1) { j = s.indexOf(";", i); /* we don't want to start from the beginning the next time, to handle the case o...
0bddff50-c66a-40df-ae10-1ee3645b9d5c
8
@Override public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) { if(command.getName().equalsIgnoreCase("mb")) { if(args.length == 0){ // TODO show plugin help getLogger().info("Plugin help coming soon!"); ...
50d5dc3c-150d-4be8-a524-1ac9a1ae28b1
9
public boolean isValidSudoku(char[][] board) { if ((board == null) || (board.length % 3 != 0) || (board.length != board[0].length)) return false; for (int y = 0; y < board.length; y++) { for (int x = 0; x < board.length; x++) { if (board[y][x] == '.') { continue; } if (isValidInRow(x, y, boar...
13310c6e-e2e2-4bc4-a098-de3af5d5379b
0
public void setModifiedDate(Date modifiedDate) { this.modifiedDate = modifiedDate; }
fc29e02b-02cd-4a5f-9a46-71d429cea8a1
7
private static int partition(int data[], int left, int right){ // pre: left <= right // post: data[left] placed in the correct (returned) location while (true){ // move right "pointer" toward left while (left < right && data[left] < data[right]) right--; if (left < ri...
ce36507c-8ab8-42d5-85f9-b378a78feb35
6
public DatagramURL(String url) throws MalformedURLException { if (url == null) { throw new MalformedURLException("URL is null"); } if (!url.startsWith("udp://")) { throw new MalformedURLException("URL is not using the udp protocol"); } int portSep = url.indexOf(':', 6); if (portSep == -1) { t...
78367df8-0012-4c2d-a046-e0cdffbc52c7
3
public void setAttribute(String nazwa, String wartosc) { DataRow parametry = new DataRow(); parametry.setTableName(nazwa); parametry.addAttribute("name", wartosc); for(AbstractAttribute atrybut : attributes) { if(atrybut.getType().equals(nazwa)) { ...
69061c34-37aa-4291-8514-80f7ffc8055a
8
public static void main(String [] args) { boolean done = false; for (int a = 1; a < 1001 && !done; a++) { for (int b = 1; b < 1001 && !done; b++) { for (int c = 1; c < 1001 && !done; c++) { if (a+b+c == 1000 && (a*a + b*b == c*c)) { System.out.println(a*b*c); System.out.println("a,b,c" + a +...
b8882d15-6915-4e4e-8140-ff6a1e281327
7
private static void rsaEncGenKeysText(CryptobyConsole console) { scanner = new Scanner(System.in); String privateKey; String publicKey; // Set Default Key Size keySize = 1024; do { System.out.println("\n"); System.out.println("Choose Key Size in ...
736ae3d2-7621-4f40-a25b-89c48180b814
3
public void writeError(String toWrite, Boolean severe) { if (severe) { if (toWrite != null) { this.log.severe(Assignment.logPrefix + toWrite); } } else { if (toWrite != null) { this.log.warning(Assignment.logPrefix + toWrite); } } }
ffb4b96a-e1b0-4530-b388-41c07de2464b
5
public static void main(String[] args) { // TODO code application logic here long startTime = 0, elapsedTime = 0; // Parses the command line arguments and collects all data in memory Util sudoku = new Util(args); // Constructs Sudoku Boards and stores them in an array Sudoku...
88eaff7f-a2b6-4f0a-aed9-719b137c9461
2
public static List<Article> selectArtcile() { String query = null; List<Article> listearticle = new ArrayList<Article>(); ResultSet resultat; try { query = "SELECT * from ARTICLE "; PreparedStatement pStatement = (PreparedStatement) ConnectionBDD.getInstance().ge...
9e103975-fbde-4d1e-b2c1-c94f2519a0e2
8
private String scan(OCRImage image, String identifier, boolean spaces, int spaceDistance, int brightness, double tolerance) { ArrayList<CharacterDataMap> temp = getCharacterArray(image, brightness, spaces, spaceDistance); ArrayList<CharacterDataMap> characters = characterMap.get(identifier); String str = ""; fo...
a27aee0e-75b9-4100-861f-95fe7d5dc2aa
3
public void setResteAFaire(double resteAFaire) throws IllegalArgumentException{ // La user story est modifiée uniquement si son statut est planifié et que le resteAFaire est > 0 if(this.getEtatUserStory() == EtatUserStory.PLANIFIEE && resteAFaire>=0){ this.resteAFaire = resteAFaire; this.setChanged(); ...
e8e2b6d9-5b47-4e6e-afbd-2175f6e72277
1
public static boolean inAWTEventThread() { try { return javax.swing.SwingUtilities.isEventDispatchThread(); } catch (Throwable e) { return false; } }
70089cf5-7693-4b21-b53f-ca442b64cadb
6
private synchronized void processOutputs() { try { // write status - this has the highest transmission priority, thus it is executed first if thread gets interrupted early hmi.dataOut.writeInt(Command.OUT_STATUS.ordinal()); hmi.dataOut.writeInt(GuidanceAT.getCurrentStatus().ordinal()); hmi.dataOut.f...
9261b325-54a4-4654-9b31-4c46c776b7a9
3
private boolean clickedOnAcePile(MouseEvent e) { return e.getX() >= X_BOARD_OFFSET + CARD_WIDTH * 6 + CARD_X_GAP * 6 && e.getX() <= X_BOARD_OFFSET + CARD_WIDTH * 7 + CARD_X_GAP * 6 && e.getY() >= Y_BOARD_OFFSET && e.getY() < Y_BOARD_OFFSET + CARD_HEIGHT * 4 + CARD_Y_GAP * 3; }
e1744220-b7cb-4f2b-960c-07007a1bae82
4
private void checkCollision(){ for (int i= 0; i < 4; i++){ int pX= this.player.getX(); int pY= this.player.getY(); int gX= this.ghosts[i].getX(); int gY= this.ghosts[i].getY(); if ((pX == gX) && (pY == gY)){ if (this.ghosts[i].isEatenBy(this.player)) killGhost(i); else { this.isDead= ...
94596987-d393-4905-9516-1031c0d55d02
6
public void performSaveAsCommand() { JFileChooser fileChooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter( "Timeflecks Database Files", "db"); fileChooser.setFileFilter(filter); boolean success = false; do { int returnVal = fileChooser.showSaveDialog(menu); ...
aba20803-eb06-4470-98a4-f4c7ccb55762
5
public static int RentsPerMonth(String monthYear) { try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } int x =0; //ophalen van de data uit de db....
26a44b08-fa4c-48ac-8736-14f065a062a2
3
private void dropClient() { if (anInt1011 > 0) { processLogout(); return; } gameScreenCanvas.initDrawingArea(); aFont_1271.drawANCText(0, "Connection lost", 144, 257); aFont_1271.drawANCText(0xffffff, "Connection lost", 143, 256); aFont_1271.drawAN...
2aea69bf-0e2a-4b0c-a4b8-a4b05d789b3a
5
@Override public final double days(final GregorianCalendar from, final GregorianCalendar to) { if (0 < from.compareTo(to)) return -this.days(to, from); final GregorianCalendar f = this._Adjust(from); final GregorianCalendar t = this._Adjust(to); double difference = Time...
b30f4697-c110-42d1-b49e-350bdcd3c71a
6
public Map<Integer, Restaurant> readCSVFile(String csvFile) { Map<Integer, Restaurant> restMap = new ConcurrentHashMap<Integer, Restaurant>(); BufferedReader br = null; String line; try { br = new BufferedReader(new FileReader(csvFile)); while ((line = br.readLine()) != null) { String[] csvLine = line...
4009e66e-13b0-4f5d-a918-0022d32a24b7
0
public BusStop(int busStopNumber) { //initialize the bus stop busStop = new PriorityQueue<Person>(); //set the initial priority at stop priority = 0; //set the bus stop number this.busStopNumber = busStopNumber; //set minimum passenger this.minimumPass...
cb77f20c-33f1-43ad-aea5-36ce154429fd
0
public int getWidth() { return width; }
2ff63c0e-b44a-47c1-ac45-762cf30ca291
8
public void build () throws ExceptionInvalidParam { if (upperAngleBound <= lowerAngleBound || upperHeightBound <= lowerHeightBound || destWidth <= 0 || destHeight <= 0 || sourceModule == null || destNoiseMap == null) throw new ExceptionInval...
c06f6029-4db2-4925-9990-c68a69f666a6
1
public void sendServerMessage(String message) { for (int i = clients.size() - 1; i >= 0; i--) { clients.get(i).getWriter().println("伺服器公告:" + message + "(廣播)"); clients.get(i).getWriter().flush(); } }
efad4656-a6fa-44bc-8491-e6a3c171ebc4
2
@Override public State nextState(Random random) { State newState; int value = random.nextInt(100); if (Utils.isBetween(value, 0, P_NM)) { newState = new Modified(); } else if (Utils.isBetween(value, P_NM, P_NU)) { newState = new Unmodified(); } else { newState = new Deleted(); } retu...
949df5a6-4ea7-497a-a4e7-e864bdb5b18b
3
public String getQuote(){ String quote = null; try { crs = qb.selectFrom("qotd").all().executeQuery(); if(crs.next()) { quote = crs.getString("qotd"); } } catch (SQLException e) { e.printStackTrace(); } finally { try { crs.close(); } catch (SQLException e) { e.printStackTrace(); ...
84929725-45b3-4d6d-8c60-97e71b4b9987
3
public static List<Tag> constructTags(Response res) throws WeiboException { try { JSONArray list = res.asJSONArray(); int size = list.length(); List<Tag> tags = new ArrayList<Tag>(size); for (int i = 0; i < size; i++) { tags.add(new Tag(list.getJSONObject(i))); } return tags; } catch (JSONExce...
724790f4-ad87-402f-9091-dfae0ceef04a
3
@EventHandler public void onPlayerDamage(EntityDamageByEntityEvent e) { if (invulnerable) if (e.getEntity().getType() == EntityType.PLAYER) if (this.getPlayers().contains(e.getEntity())) e.setCancelled(true); }
09a371e7-94a5-4358-9733-46cf052bf1f6
7
@Override public void mouseClicked(MouseEvent e) { if(e.getButton() == MouseEvent.BUTTON3) ColorUsedPanel.this.model.setColor(c); else if(e.getButton() == MouseEvent.BUTTON1){ AlienFXProfile profile = profileModel.getProfile(); Color changedColor = c; if(profile != null){ for(AlienFXProfile...
04e088a5-6011-4d1d-a70a-7edf4689ee8c
1
@Override public boolean accept(File file) { if (this.isExtension) return file.getName().toLowerCase().endsWith(this.keyword); return (file.getName().toLowerCase().indexOf(this.keyword) >= 0); }
5dcbce7f-b856-481f-bd18-b91d8d060fc0
9
protected BufferedImage getScaledUpInstance(BufferedImage img, int targetWidth, int targetHeight, Object hint, boolean higherQuality) { int type = BufferedImage.TYPE_INT_ARGB; BufferedImage ret = (BufferedImage) img; int w, h; if (higherQuality) { // Use multi-step technique: start with original size...
900d4ae5-4f20-46c2-b997-8af88d976f97
6
public String[] dataCacheToArray(ArrayList <String> dataCache, String dataField){ /* * @param: (ArrayList <String> dataCache, "link" || "seed" || "leech" || "size") * example (BuildDataCache(String[] foo), "size")) will return all the torrent sizes in a string array. * Parses the SizeStats ArrayList into...
64644d1f-27d3-47da-87c1-5b77dc7da8e3
7
public Polygon2D deleteVertexBefore(int k) { int n = vertex.length; if (n < 4) return this; float[] x = new float[n - 1]; float[] y = new float[n - 1]; if (k > 0 && k < n) { for (int i = 0; i < k; i++) { x[i] = vertex[i].x; y[i] = vertex[i].y; } for (int i = k + 1; i < n; i++) { x[i - ...
5d031476-3580-46a4-8b2c-6e5a58f16f92
6
protected static void extractComments(Metadata metadata, XHTMLContentHandler xhtml, VorbisStyleComments comments) throws TikaException, SAXException { // Get the specific know comments metadata.set(TikaCoreProperties.TITLE, comments.getTitle()); metadata.set(TikaCoreProperties.CREATO...
bee31bf6-9238-421a-a7de-abfbb1210dfa
1
private List<RouteLeg> createRoute(String string) { List<RouteLeg> route = new ArrayList<RouteLeg>(); for (int index = 1; index < string.length(); index++) { route.add(new RouteLeg(string.substring(index-1, index), string.substring(index, index+1))); } return route; }
de21e349-8a0e-4d8f-a405-b4d932651ff7
4
public void input(ArrayList<Action> history, int handStrength) { int numRaises = 0; for(Action a : history) { if(a == Action.RAISE) { numRaises++; } } int ahs = adjustedHandStrength(handStrength); if(historyToHandStrength.get(numRaises) == null) { int[] histogram = new int[] {0,0,0,0,0,0,0,0,0...
832e7fc8-b1ff-43c2-815b-d07fe4c5993e
6
public void rebondProjectilesStructures(Projectiles proj, Structures struc) { if (proj.getPosition().getX() + proj.getBound().getX() > struc.getPosition().getX() && proj.getPosition().getX() < (struc.getPosition().getX() + struc.getBound().getX()) && proj.getPosition().getY() + proj.getBound().getY() > struc.getPosit...
ea4c0454-a201-48ac-aa9d-8f7f95149fa7
6
private static EnumOS2 getOS() { String s = System.getProperty("os.name").toLowerCase(); if (s.contains("win")) { return EnumOS2.windows; } if (s.contains("mac")) { return EnumOS2.macos; } if (s.contains("solaris")) { return EnumOS2....
200857c1-2df7-48e1-ba1e-983d66375b49
5
private void objectString(J_PositionTrackingPushbackReader var1, J_JsonListener var2) throws J_InvalidSyntaxException, IOException { char var3 = (char)this.readNextNonWhitespaceChar(var1); if(var3 != 123) { throw new J_InvalidSyntaxException("Expected object to start with { but got [" + var3 + "]."...
c2ee2763-6e0e-47d2-8f23-4d26baf36dd5
5
private InterfaceCommand getCommand(DebuggerVirtualMachine dvm) { UserInterface.print(": "); StringTokenizer tokenizer = null; InterfaceCommand command = null; try { tokenizer = new StringTokenizer((new BufferedReader(new InputStreamReader( ...
899bcc94-2fa4-4d6b-b0c8-060e49417ea1
9
protected int setArmorModel(EntityPlayer par1EntityPlayer, int par2, float par3) { ItemStack var4 = par1EntityPlayer.inventory.armorItemInSlot(3 - par2); if (var4 != null) { Item var5 = var4.getItem(); if (var5 instanceof ItemArmor) { Ite...
b319c979-fdca-48e9-b5f5-00c577987aee
2
private void sortEntitiesToMap() { // Iterate the entities that need rendered and check if they're // visible for (Entity entity : entityList) { Spatial entitySpatial = entity.getComponent(Spatial.class); // I'll obviously offer an overloaded contains method for // spatials in the future (potentially) ...
12f53035-ba5b-4381-9549-dac7d314b689
0
@Override public Long getSocialId() { return socialId; }
36b65321-82fd-4b6f-b3ee-28806ec7bc3d
6
@EventHandler public void BlazeRegeneration(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.getBlazeConfig().getDouble("Blaze.Regen...
4096cc06-2b54-4e49-b75e-edaa2e4d8712
4
public Map<String, Link> makeLinkMap(Map<String, Mass> massMap){ Map<String, Link> linkMap = new HashMap<String, Link>(); NodeList[] linkArray = {springs, muscles}; for (NodeList linkType: linkArray){ for (int i = 0; i < linkType.getLength(); i++) { Node node = linkType.item(i); if (node.getNodeType...
8f54a695-07c0-4891-a8e9-1b96487fd896
0
public void setCurrentLine(int lineNumber) { environmentStack.peek().setCurrentLineNumber(lineNumber); }
1994472e-136f-4f68-b761-98273e5484fc
5
@EventHandler public void onInteract(PlayerInteractEvent e){ Player p = e.getPlayer(); if(e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && p.getWorld().getName().equalsIgnoreCase("kitpvp") && e.getClickedBlock().getState() instanceof Sign){ Sign sign = (Sign) e.getClickedBlock().getState(); if(sign.getLine(...
796f85a7-3f62-4c4a-9d9b-e47322ec1e6c
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Activity other = (Activity) obj; if (project == null) { if (other.project != null) return false; } else if (!project.equals(other.projec...
eefca225-516e-446c-91a1-2ef3f4ef753c
5
public static final void copyDirectory(File source, File destination) throws IOException { if (!source.isDirectory()) { throw new IllegalArgumentException("Source (" + source.getPath() + ") must be a directory."); } if (!source.exists()) { throw new IllegalArgumentException("Source directory (" + sour...
9e101fab-e376-45cf-8d0c-5c0da5362054
5
public static GetProjects_Result getProjects(Database database, GetProjects_Param params) { Logger.getLogger(API.class.getName()).log(Level.FINE, "Entering API.getProjects()"); GetProjects_Result result; try { ValidateUser_Result vResult = validateUser(database, new Validate...
33418b25-3b19-49a3-ad4f-d3c64c6b8e60
9
public static void main(String[] args) { //Define loop to go through each number for (int i = 2; i <= 69; i++) { //if i is less than 20 and divisible by 2 if (i <= 20 && i % 2 == 0) { //output number System.out.println(i); //if i is between 21 and 41, and has been incremented by 3 } else if (i ...
ede62a72-528f-4496-89c6-2ab838757702
6
public static void swapWords(Text text) { log.trace("Subtask N5"); LinkedList<Sentence> allElements = (LinkedList<Sentence>) text.getAllElements(); for (Sentence sentenceOrListing : allElements) { if (sentenceOrListing.getClass() != Listing.class) { int indexFirst = 0...
70afc495-be34-4905-a6ca-dc3bfd6b124a
6
public JSONObject countMetadataColors(JSONObject[] countMetadata, Color[] colors, float[] weights) throws TinEyeServiceException { MultipartEntity postEntity = new MultipartEntity(); JSONObject responseJSON = null; if (weights.length > 0 && colors.length != weights.length) ...
8c67fef7-5d33-4a34-9290-ceca8cbb33e2
5
public void actionPerformed(ActionEvent e) { String nick = GUIMain.userList.getSelectedValue().toString(); if (nick.startsWith("@")) { nick = nick.replace("@", ""); } else if (nick.startsWith("$")) { nick = nick.replace("$",...
b4f4c084-71b0-485a-9bc2-df601775f919
2
private void updateBalance(TextField operation, BigDecimal value) throws IOException{ if(operation.equals(addField)){ balance = balance.add(value); } else if(operation.equals(subtractField)){ balance = balance.subtract(value); } balance = balance.setS...
5668e022-aaaa-49f6-af4a-54acfdc9aeb1
9
public static void ConstructBox(int side) { for (int i = 1; i <= side; i++) { if (i == 1 || i == side) { for (int j = 1; j <= side; j++) { System.out.print("$ "); } } else if (i != 1 || i != side) { for (int k = 1; k <= side; k++) { if (k == 1 || k == side) { ...
2781faaf-c2a2-4e13-9fcb-991dd18e5028
6
public float calculate(List<Book> liste) { float result = 0f; try { List<BundleBook> listBundleBook = new ArrayList<BundleBook>(); for (Book bookActu : liste) { boolean inserted = false; for (BundleBook bundleActu : listBundleBook) { if (!bundleActu.contains(bookActu)) { bundleActu.addBoo...
bdfa6b30-abeb-4a75-aebf-97fe71997adb
0
public void setjScrollPane1(JScrollPane jScrollPane1) { this.jScrollPane1 = jScrollPane1; }
e78c4197-1112-4d81-a5c3-14a73654ed76
9
public IToken nextToken() { if (m_currentOffset >= (m_docOffset + m_docLength)) { return Token.EOF; } IToken result = Token.UNDEFINED; int startOffset = m_currentOffset; int length = 0; try { // Get line information IRegion lineRegion ...
5d3bee53-d7a1-443c-a418-811c7d58a449
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...
553c02f8-b14e-4f25-a310-bb29a8df9410
3
public void setFrame(int frameNum, byte[] theFrame) throws SoundException { if(frameNum >= getAudioFileFormat().getFrameLength()) { printError("That frame, number "+frameNum+", does not exist. "+ "The last valid frame number is " + (getAudioFileFormat().getFrameLength(...
cf4f9a92-cbae-48ac-b72d-95097523cce4
4
public byte[] encrypt(byte[] input) { int kl = key.length, il = input.length; int iterations = il / kl; if(il % kl > 0) iterations++; for(int i = 0; i < iterations; i++) { byte[] keystream = new byte[kl]; salsa20.crypto_stream(keystream, kl, nonce, 0, key); int lim = (i+1) * kl; // In the la...
4dcaf4e1-f64e-4492-af53-4629bdb1886e
4
private List<SpriteInfoBlock> parseMetadata(String data) throws IOException { // Prepare a "syntax tree" to return List<SpriteInfoBlock> nodes = new ArrayList<SpriteInfoBlock>(); // Split the metadata into individual lines and parse them individually String[] lines = data.split("\n"); for(String line :...
cb291a66-59c6-4333-b7cd-567d30567eb2
0
public ArrayList<DonneeArgos> getPositions() { return positions; }
b64a90ec-b077-498d-9262-2d6ff4f3e1ff
1
public void updateTimePanel () { panelStartTime.removeAll(); JPanel tripComponentPanel = new JPanel (new GridBagLayout ()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; for (Object o: tripListModel.toArray()) { TripComponent tc = ...
78e3fb8b-615d-4110-bdea-ded8a365a669
9
@Override public boolean equals(Object obj) { Point p = (Point)obj; if(this.type== p.type && Math.abs(this.x - p.x) < 0.00001 && Math.abs(this.y - p.y) <0.00001 && this.a.id == p.a.id){ if(this.b != null && p.b != null) { return (this.b.id == p.b.id)?true:false; } else if(thi...
94934981-eb2c-4c8a-9e9c-8c1ded14aa32
0
public void start() { ticks=System.currentTimeMillis(); }
cca6c55c-c383-43a8-a41b-2fc674705490
7
public Object nextContent() throws JSONException { char c; StringBuilder sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new StringBuil...
553c5891-24dd-4674-a8db-ae3a749f26db
7
public static boolean checkSumUsingHash(int[] A, int x) { // Time complexity - O(n) if(A == null || A.length < 2) return false; int i, flag = 0; Map<Integer, Integer> map = new HashMap<Integer, Integer>(); for(i = 0; i < A.length; i++) map.put(A[i], i); for(i = 0; i < A.length; i++) { if(map.get(x - ...
385ac7e0-2072-48e5-9cac-809612c501fb
2
private void start() { try { System.out.println("Accepting connections."); while (true) { // recieve new connections net = new Network(this, ssocket.accept()); Thread t = new Thread(net); t.start(); } } c...
b34cffe5-22cf-48a5-b53a-f7423d567d31
5
Node applyExtensionRule2( Node node, int edgeLabelBegin, int edgeLabelEnd, int pathPos, int edgePos, Rule2Type type ) throws MVDException { Node newLeaf,newInternal,son; // newSon if ( type == Rule2Type.newSon ) { if ( debug ) System.out.println("rule...
b3f9cf05-2820-45cc-9279-c7bd114a8ac1
7
@Override public void Lands (Player P) { //If nobody owns it if (Owner == -1) { //Ask if you want to buy. Game.requestBuy(P, this); } //If you land on enemy players shipping line else if (Owner != Game.players.indexOf(P)) { ...
18e513b2-570e-40b6-a69c-9c34767603aa
1
public static boolean isSimilarDel(String a, String b, int similarityAcceptError) { a = Normalizer.normalize(a, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "").toUpperCase(); b = Normalizer.normalize(b, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "").toUpperCase(); if (a.equals(b)) return true; retur...
6808d463-99ed-4ad1-b955-4c48ff425d2a
0
@Override public String toString(){ return "CellCreature("+ID+")"; }
a5bad364-63ba-4231-9130-110b39ff1711
5
private static boolean loadConfig() { File file = new File(configFilename); serverList = defaultServerList; port = defaultPort; authList = new HashMap<String, String>(defaultAuthList); if (file.exists()) { System.out.print("Load config ... "); Document doc = null; try { DocumentBuilderFactory fac...
0dd0ca5d-e171-4709-9cf8-f4b2375a567a
7
public double outputValue(boolean calculate) { if (Double.isNaN(m_unitValue) && calculate) { if (m_input) { if (m_currentInstance.isMissing(m_link)) { m_unitValue = 0; } else { m_unitValue = m_currentInstance.value(m_link); } } else { //node is an output. m_unitValue = 0...
14490297-8996-43b4-9b2f-3164cc150ca0
8
public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Please enter number of rows for a matrix operation"); int rows = Integer.parseInt(reader.readLine()); System.out.println("Please enter number of columns f...
be28d948-4b77-4516-ba4e-81270e1b7345
5
final void method3940(int i) { if (anIDirect3DVertexShader9794 == null && ((((DirectxToolkit) this).aClass251Array8113 [((DirectxToolkit) this).anInt8175]) != Class348_Sub42_Sub18.aClass251_9685)) { if (Class239_Sub18.aClass251_6030 == (((DirectxToolkit) this).aClass251Array8113 [((Dire...
0c2775a5-287d-4c58-8db1-b83489b494a6
0
public String batchSubscribe(final BatchSubscription batchSubscription) throws MailChimpException { return post("/lists/batch-subscribe", batchSubscription, new Function<BatchSubscription, String>() { @Override public String apply(BatchSubscription input) { return gson.toJson(input); } }); ...
5d59b464-9276-4cc7-9bc5-1e145c53a418
8
public int getResult() { sqrs.add(1); sqrs.add(4); for (int sum = 6; ; sum++) { if (sum % 300 == 0) { System.out.println(sum + " debug "); System.out.println(sqrs.size() + " siize "); } for (int i = sum - 3; i > sum / 2; i--) { ...
4aa6e54f-f6c6-4b5b-8c1a-e064bbf07de5
1
@Override public boolean hasNext() { if(current!=null){ return current.getNext()!=null; }else{ return false; } }
c3af2244-73e0-40d8-ac5e-51e69c351ed7
4
public void run() { for(;;) { try { ++x; if(x==(wd)) x=0; repaint(); Thread.sleep(20); if(stopflag) break; }catch(Exception ee){} } }
68fa3e6d-ea14-4469-946c-a9a0deea0c16
2
@Override public JSONObject main(Map<String, String> params, Session session) throws Exception { JSONObject rtn = new JSONObject(); try { JSONArray jaUserId = new JSONArray(params.get("aUserId")); long[] aUserId = new long[jaUserId.length()]; for(int i=0;i<jaUserId.length();i++) { aUserId[i] = ja...
264ff210-380a-44c3-985a-943b810bd031
8
public static double dist(Mat src1, Mat src2, NormType normType) { assert(src1.cols == src2.cols && src1.rows == src2.rows); if (src1.isEmpty()) { // is this proper way? return norm(src2, normType); // if src1 is empty , return norm of src2 } if (src2.isEmpty()) { ...
03a92905-3097-442f-a120-36ccddcbcc48
1
public void visitTypeInsn(final int opcode, final String type) { buf.setLength(0); buf.append(tab2).append(OPCODES[opcode]).append(' '); appendDescriptor(INTERNAL_NAME, type); buf.append('\n'); text.add(buf.toString()); if (mv != null) { mv.visitTypeInsn(opcode, type); } }
be898489-3288-4e87-ad86-5329c85d53a1
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); }
e799de14-803d-425a-ba78-bd258d081e91
4
@Override public void mouseClicked(MouseEvent e) { if(isEmpty()) { return; } for(UIElement ui : uiElements) { if(e.isConsumed()) { return; } if(ui.getBoundsAsRect().contains(((MouseEvent) e).getPosition())) { ui.fireEvent(e); } } e.consume(); }
11f2c430-5f47-4385-83bc-cbd9c9012a6b
9
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TestIntervalCategoryDataset)) { return false; } TestIntervalCategoryDataset that = (TestIntervalCategoryDataset) obj; if (!getRowKeys().equals(...
37a27fd4-2eea-4be4-9672-91c7865a360d
9
private void print() { if ( ( getCurrentTreePanel() == null ) || ( getCurrentTreePanel().getPhylogeny() == null ) || getCurrentTreePanel().getPhylogeny().isEmpty() ) { return; } if ( !getOptions().isPrintUsingActualSize() ) { getCurrentTreePanel().setParam...