method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
efbcd29e-f246-4d09-9182-de20242763f0
6
public double[] mittelWert() { boolean fertig = true; int i = 0; double[] werte = new double[2]; double temp = 0; ArrayList<Double> list = new ArrayList<>(); try { ResultSet set = read("SELECT WERT1, WERT2 FROM OPERATION ORDER BY ZEIT DESC"); ...
30800fc3-6ee9-4a5f-b093-1c21597e7cf6
6
private void apply_helper(byte[] buff_, int buffsize_, int maxbuffsize_, ITrieHandler func_, Object arg_) { // If this node is a subscription, apply the function. if (refcnt > 0) func_.added (buff_, buffsize_, arg_); // Adjust the buffer. if (buffsize_ >= maxb...
483d1097-ef07-4c51-b015-d2349ff98c49
8
public void putAll( Map<? extends Short, ? extends Long> map ) { Iterator<? extends Entry<? extends Short,? extends Long>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Short,? extends Long> e = it.next(); this.put( e.getKey(),...
8e7bef13-dfa7-42f6-a5f8-d3ff27ac7445
1
public void createBullet(AbstractEntity emitter) { Bullet bullet=getFreeBullet(); if (bullet!=null) { bullet.enable(); bullet.fire(emitter); } }
0a8d9a2c-833a-4ac4-9dd6-48dce64cb1ea
9
public Scacchiera() { super(); this.setSize(600,625); this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); this.addWindowListener(new WindowListener() { @Override public void windowClosing(WindowEvent we) { if(JOptionPane.showConfirmDialog(we.getW...
f7f709ba-677c-47aa-b165-8c47fe885052
8
public Vector2f checkMapLineCollision(Line collisionLine){ int collWidth; int collHeight; int rectX; int rectY; Vector2f testPoint = null; List<Vector2f> intersectionList = new ArrayList<Vector2f>(); for(int i = 0; i <= tileMap[0].length-1; i++){ for(int c = 0; c <= tileMap.length-1; c++){ if(tileM...
a95867f8-c497-4323-aa54-58de9e26b2ee
4
@Override public void onChannelJoin(ChanJoinMessage msg){ if(ConnectionInfo.enableBot) { //System.out.println(msg.getSource().getHostname()); if (msg.getSource().getHostname().equalsIgnoreCase("cpc15-haye15-2-0-cust917.17-4.cable.virginm.net") && (!(msg.getSource().getNick().equalsIg...
1a3337c2-aa17-45cc-9c88-b57655643f26
6
public ArrayList CheckForMatches(){ ArrayList<ArrayList> matchList = new ArrayList(); //search horizontal greater than 2 for (int row = 0; row<gridSize; row++){ for (int col = 0; col<gridSize-2; col++){ ArrayList<Card> match = getMatchHoriz(col, row); if (match.size()>2){ matchList.add(match); ...
bf50e706-a73a-4d23-99ab-1dfb3160fd18
1
public void updatePiece(Piece[] _piece){ int i; piece=_piece; for (i=0; i<piece.length;i++){ createPiece(piece[i],i); } }
5ff1a470-cc00-499a-bccc-3a78d04e89be
4
public void addButton(List<positionNode> information){ final List<positionNode> position = information; //количество блоков p=position.size()/16; SecondPagePanel = new JPanel[p+1]; for(int i =0 ; i <= p;i++){ SecondPagePanel[i] = new JPanel(); SecondPagePanel[i].setMaximumSize(new Dimension(900...
eb825ef8-a228-4f62-8236-b4dd4326c214
5
public boolean compare(Rank rank) { if (this == Owner) return this.compareTo(rank) <= 0; else if (this == Admin) return this.compareTo(rank) <= 0; else if (this == Mod) return this.compareTo(rank) <= 0; else if (this == Friend) return this.compareTo(rank) <= 0; else if (this == Producer) ...
54626337-fc70-4672-adde-597c5574d33e
5
public void determineBestAction() { if (this.detectPlayer()) { this.attack(player); } else if (this.detectPlayerRange()) { Path p = new Path(game.getMaze(), this.location, player.location); if (p.getNumTurns() < 3) { this.setLocation(this.location.getNeighbors()[p.getDirArray() .get(0)]); thi...
bfd02235-94db-407d-9e97-d4912e0edbee
0
public Person1(String pname) { name = pname; }
e1a70091-f6a1-4e9c-b7ac-42b43737f659
1
public int extract() { if (size == 0) throw new ArrayIndexOutOfBoundsException("the array is already empty"); int max = heap[0]; heap[0] = heap[size-- - 1]; siftDown(0); return max; }
5da891fc-4ce8-48ed-9c01-bf93ae930e82
0
public String getMessage() { return message; }
ed23199d-90f1-4f77-9fef-8d3dba64356e
6
@Override public void start() { while (ProjectInfernoServer.isRunning()) { try { // Create a new socket for connecting player. Socket socket = ProjectInfernoServer.server.accept(); // Recieve the clients Username. ObjectInputStre...
2ff54145-21e8-4540-b6f5-139021c2ccd0
6
@Override public void actionPerformed(ActionEvent e) { //System.out.println("DeleteAction"); OutlinerCellRendererImpl textArea = null; boolean isIconFocused = true; Component c = (Component) e.getSource(); if (c instanceof OutlineButton) { textArea = ((OutlineButton) c).renderer; } else if (c instan...
f83a97f0-1616-43de-9d20-ac5c51077d82
5
public void visitFormalTypeParameter(final String name) { if (type == TYPE_SIGNATURE || (state != EMPTY && state != FORMAL && state != BOUND)) { throw new IllegalStateException(); } CheckMethodAdapter.checkIdentifier(name, "formal type parameter"); state = FORMAL; if (sv != null) { sv.visitFormalTyp...
5d01926f-f7bb-496f-92a2-80a780d7341a
3
public static GameBaseEntity getEntity(String entity, int id) throws Exception{ for(GameBaseEntity it : entityList) { String[] str = it.getClass().getName().split("\\."); if(str[str.length-1].equals(entity) && it.getId() == id) { return it; } } ...
e58324b6-f214-4ed9-9417-f6c1d2ab0437
7
public boolean equals(Object other) { if ( (this == other ) ) return true; if ( (other == null ) ) return false; if ( !(other instanceof ParametrizacionTrazaId) ) return false; ParametrizacionTrazaId castOther = ( ParametrizacionTrazaId ) other; return ( (this.getModCodTarcker()==castOth...
cec4e68a-0c47-4a16-9acf-2e5d05321de2
5
private static String getHash(String filePath) { try { MessageDigest md = MessageDigest.getInstance("SHA-1"); FileInputStream fis = new FileInputStream(filePath); byte[] dataBytes = new byte[4096]; int nread; while ((nread = fis.read(dataBytes)) >= 0) { md.update(dataBytes, 0, nread); } byte[...
5f01a579-f25f-41f9-8ed1-d90bf7c08be3
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...
a8568808-b971-4084-81b1-a2767856aa70
8
private <T> T convertToPrimitive(String value, Class<T> clazz) { if (clazz.isAssignableFrom(String.class)) return (T)value; if (clazz.isAssignableFrom(byte.class)) return (T)((Object)Byte.parseByte(value)); if (clazz.isAssignableFrom(short.class)) return (T)((Object)Short.parseShor...
4a3b58f5-084a-4a73-b43d-9be4945d788f
2
@Override public String toString() { if (reversed) { reverse(); } Element tmp = firstElement; String result = ""; while (tmp != null) { result += tmp.getValue() + " "; tmp = tmp.getNextElement(); } return result; }
384c2d36-b097-4935-85b1-a3cd40d69f5a
6
@Override public void parseArgs(String[] args) { for (int i = 0; i < args.length; i++) { // Argument starts with '-'? if (args[i].startsWith("-")) usage("Unknow option '" + args[i] + "'"); // Options else if (genomeVer.isEmpty()) genomeVer = args[i]; else if (proteinFile.isEmpty()) proteinFile = args[i...
486c9ab8-f9f2-4376-9314-97db5bf72618
3
@Override public EntidadBancaria insert(EntidadBancaria entidad) { PreparedStatement preparedStatement; Connection connection = connectionFactory.getConnection(); try { preparedStatement = connection.prepareStatement("INSERT INTO entidadbancaria(nombre, fechaCreacion, codigoEntid...
8cdf15d6-7322-4869-8323-0b1d14d9cef2
7
public void drawChart(Graphics g, int startX, int startY) { // All 'next node' calculations are handled in here //TODO ArrayList<Task> children = breakdown.getChildren(); // this is what we are renderng if (children.isEmpty()) { // draw line from start to finish, nothing to ...
360f2469-19b8-40d1-8c62-48e9936d6f72
4
public void Render(Graphics2D g, ImageObserver renderer) { super.Render(g, renderer); for (Sensor sensor : m_sensors) { if (sensor instanceof SelfRendering) ((SelfRendering)sensor).Render(g, renderer); } for (MechanicalDevice device : m_devices) { if (device instanceof SelfRendering) ((SelfR...
76be25af-9371-4f9d-92c1-ba23c80e0765
7
static void repaint(RepaintType type){ try{ switch(type){ case Preview: preview.repaint(); break; case NewThumb: mainGUI.thumbPanel.repaint();//not onResize break; case MainPanel: mainGUI....
71066370-c5d4-49d4-a167-41d7b9dbcd94
4
TreeNode next() { TreeNode head = queue.poll(); if (head == null) { if (!queue.isEmpty()) queue.offer(null); return null; } if (head.left != null) queue.offer(head.left); if (head.right != nu...
c22f7358-a7ae-4487-a03f-3087655f460d
9
public boolean similar(Object other) { try { if (!(other instanceof JSONObject)) { return false; } Set<String> set = this.keySet(); if (!set.equals(((JSONObject)other).keySet())) { return false; } Iterator<St...
36d3980b-f7f9-4415-93f9-75b105365fd5
4
@Test public void testMatches() { Deck d = new Deck(); ArrayList<Card> cards = new ArrayList<>(); for (int i = 0; i < d.getSize("regular"); i++) { cards.add(d.DrawNext()); } int max = 0; for(Card c : cards) { fo...
a6963138-fe54-48c6-8e18-0de81499c971
2
public boolean hasValues() { for (int i = 0; i < count(); i++) { if (hasMoreValue(i)) return true; } return false; }
d9a023c1-3e27-4155-85ba-ef0fe9b3916d
5
public static JMenu buildMenu(String name, String[] items, String[] ...strings) { int subIndex = 0; JMenu menu = new JMenu(name); for (String itemName : items) { if (itemName.equals("-")) { menu.addSeparator(); } else { String action = itemName; if (itemName.contains("<")) { action = itemNa...
9cc33121-a27f-46f5-a33b-b9984526044f
8
private void saveUrl(String filename, String urlString){ BufferedInputStream in = null; FileOutputStream fout = null; try { try { HttpURLConnection conn = null; if(useProxy){ System.getProperties().put("http.proxyHost", proxyHost); System.getProperties().put("http.proxyPort", proxyPort); ...
fae9d221-718d-4766-bb82-e96a79770ed1
3
@Override public void draw(Graphics2D g) { if (active()) { Canvas canvas = GUI.player.graph.canvas; radius = 50. * Math.sqrt(1.0 / canvas.zoom); x = (radius * canvas.zoom + 10 - canvas.offX) / canvas.zoom; y = (radius * canvas.zoom + 10 - canvas.offY) / canvas...
34b5e96b-1305-46c3-a72c-7a57205aa5d1
8
public static String getDefaultConfigPath() { String configPath; String osName = System.getProperty("os.name"); if (osName.equalsIgnoreCase("windows 7")) { configPath = getBasePath(); } else if (osName.equalsIgnoreCase("windows 8")) { configPath = getBasePath(); ...
dd28fc01-a1e3-4f3e-9f96-4c20fbb35b3c
2
@Override public void display(Boolean showCorrect) { System.out.println(prompt); if (answer!=null && showCorrect){ System.out.println("The answer is: " + answer); } }
c97b2e3c-6065-468b-af86-c65e8b6f7f7d
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 Manufacturer)) { return false; } Manufacturer other = (Manufacturer) object; if ((this.manufacturerId == null &...
a5044432-a7da-4c84-90a7-494588f35260
5
private static double getEuclidDistance ( double[] x , double[] y , Matrix features) { assert(x.length == y.length); double distance = 0; for (int k = 1; k < x.length; k++) { if (x[k] == MISSING || y[k] == MISSING) { distance += 1; } else { int attributeValues = features...
991d1c52-6957-4344-9baa-cb6860c40a16
6
public static void addByChance(LivingEntity entity, MobAbilityConfig ma) { if (ma == null || !isValid(entity)) return; if (ma.villagerRate <= 1.0 && ma.villagerRate != 0.0) { // If the random number is lower than the villager rate we turn it into a villager if (ma.villagerRate == 1.0F || RandomUtil.i...
36f0bf05-95a6-4639-94cc-f878b2ff1e4b
5
@Override public void run() { super.run(); while (gameScreen.isRunning()) { if (new Random().nextFloat() > 0.50f) { gameScreen.newAmmoBox(new AmmoBox(gameScreen, start)); } if (new Random().nextFloat() > 0.50f) { gameScreen.newHeart(new Heart(gameScreen, start)); } if (new Random().nextFloat...
54a8cef1-93f6-4165-91a7-e65ae018c1d8
5
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 times = Integer.parseInt(line.trim()); int amo...
abcdb51c-0c32-4d3c-ad67-7feb8236ca90
4
public void hasBeenActivated(Editor editor) { if (editor == this) { Code.debug("hasBeenActivated"); EditorActionManager eam = getEditorActionManager(); eam.enableFormatActions(true); eam.enableGenericActions(true); eam.enableDocumentActions(true); if (hasFile()) { if (is...
6e981899-e2d3-4f72-82a1-836259b4fca0
6
private static void computeSCCs() { // reset all nodes to unexplored for (int i = 0; i < nodes.length; i++) { nodes[i] = 0; } // iterate over all vertices and compute DFS for (int i = nodesSortedByFinishTime.length-1; i >= 0; i--) { if(nodes[nodesSortedByFinishTime[i]] == 0) { // node is unexplore...
33095024-8a7b-4c9a-844f-3eb01eb75392
9
int insertKeyRehash(byte val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look u...
d8695eb5-188b-4a33-aed0-16bac9b77cc5
5
public synchronized void handleEvent(StreamEvent evt) { if("SourceDetails".equals(evt.getEventName())) { String details = new String((byte[])evt.getEventObject()); String[] lines = details.split("\n"); ArrayList greeting = new ArrayList(); greeting.add("ICY 200 OK"); for(int i = 0; i < lines.length; i+...
5e2ebf6a-71f5-4be5-9557-ad74b9792853
4
private Object handleObje(Object tos, String id, String ref) { if (tos instanceof MediaContainer) { if (ref == null) { Media media = new Media(); ((MediaContainer)tos).addMedia(media); return media; } else { MediaRef mediaRef = new MediaRe...
3084af75-9f9c-44f8-9b6c-8f8eeed9b4bc
7
public String undoTask() { int indexOfCommandToUndo = Data.commandList.size() - 1; if(indexOfCommandToUndo < 0) { return "No previous step detected!"; } else { Command commandToUndo = Data.commandList.get(indexOfCommandToUndo); String commandType = commandToUndo.getCommand(); if(commandType.equals("ad...
ca9e84bc-d1cb-47c6-a69b-ec39c5aa3fb9
5
public void Solve() { HashMap<Integer, BigInteger> partitions = new HashMap<Integer, BigInteger>(); partitions.put(0, BigInteger.ONE); partitions.put(1, BigInteger.ONE); int n = 2; while (true) { int pentagonalIndex = 1; int pentagonal = Pentagonal(pentago...
2b344c2f-392c-4daa-8545-35f5acf77d21
0
public String getName(){ return "Accept by Final State"; }
cfd54754-d093-474c-818b-640794c1f9c9
8
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BulkWriteException that = (BulkWriteException) o; if (!writeErrors.equals(that.writeErrors)) { ...
ac0120b4-e606-45fa-acf7-cf574e8f7614
7
public static void main(String[] args) throws Throwable{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); mAdy=new boolean[30][30]; String ant = null; TreeSet<Integer> letras = new TreeSet<Integer>(); for (String line; (line = in.readLine())!=null; ) { if(line.charAt(0)=='#')break;...
1dcf1ae8-305a-40a8-befc-7cf642683e42
2
@EventHandler public void onJoin(PlayerJoinEvent e) { Player p = e.getPlayer(); if ((!plugin.randomText.contains(p)) || (!p.hasPermission("AntiP12a.ignoreplayer"))) { RandomString.random(); String rand = RandomString.string; plugin.randomText.add(p + ...
2b8683a3-f5bd-4120-b1d4-b527fde8c797
5
public void parse(PDFObject shaderObj) throws IOException { // read the axis coordinates (required) PDFObject coordsObj = shaderObj.getDictRef("Coords"); if (coordsObj == null) { throw new PDFParseException("No coordinates found!"); } PDFObject[] coords = coordsOb...
f65bb576-f243-4afe-90ee-db18ba645e97
0
private void c_SCPage(){ c_SCPane = new JPanel(); c_SCPane.setBackground(SystemColor.activeCaption); c_SCPane.setLayout(null); SCT_p50.setText(Float.toString(db.getClinic().getDiscount(0))); SCT_p18.setText(Float.toString(db.getClinic().getDiscount(1))); SCT_np.setText(Float.toString(db.getClinic().getDi...
1f2a7b61-945c-474d-89ba-b602f593db3d
1
@Override public String getPersonAsJSON(Integer id) throws NotFoundException { EntityManager em = emf.createEntityManager(); List<Person> persons = new ArrayList<>(); Person person = em.find(Person.class, id); persons.add(person); if (person == null) { throw new ...
dcc386a5-4abf-4cf0-b741-2ab1aa9ba2de
9
private boolean canFlipVertical(long binPosition, boolean goesDown){ boolean hasFlippableDisk = false; long searchPosition = binPosition; if(goesDown && (binPosition & 0x00000000000000FFl) == 0) searchPosition = binPosition >> 8; else if( !goesDown && (binPosition & 0xFF000...
d0d41f64-817e-4463-b50a-01b76873f528
5
@Override public void actionPerformed(ActionEvent e) { switch(e.getActionCommand()){ case ("BeadImage"): if (this.image_loader.getFilePath().isEmpty()) { JOptionPane.showMessageDialog(this, "No Image has been loaded", "Error", JOptionPane.ERROR_MESSAGE); } else { BufferedImage image...
3b9c1a97-76d1-41cf-bfe6-51129930c90d
0
private Combination<Colors> generateAttemptCombination2() { List<Token<Colors>> attemptTokens = new ArrayList<Token<Colors>>(); attemptTokens.add(new Token<Colors>(Colors.O)); attemptTokens.add(new Token<Colors>(Colors.R)); attemptTokens.add(new Token<Colors>(Colors.Y)); attemptTokens.add(new Token<...
07bee82d-d830-4957-9a16-93aafdbba27d
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Employe other = (Employe) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; ...
f1333cd9-8053-4113-9f93-a3b356239553
0
@Override public int hashCode() { int result = name.hashCode(); result = 31 * result + age; return result; }
0e351b1f-731d-4ae1-9811-317ccfbae707
6
private void populatePlants() { Random ra = new Random(); Plant plant; for (int i = 0; i < plantCount; i++) { int n = ra.nextInt(Plant.NUM_OF_PLANT_TYPES + 1); if (n == 0) { ++n; } switch (n) { case 1: plant = new Plant(Plant.GREEN_PLANT); plants.add(plant); grid.addPlant(plant); ...
6f5aedcd-42cf-4e48-9b55-7c4614529779
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...
a600b0b5-86a8-4c2b-95ff-de79b8bb1073
9
public static void scrapePatchCategoryPage(String rootURL, String categoryURL, String categoryName, String theme, PreparedStatement stmt) { System.out.println("------------\nScraping results page "+categoryURL+"\n--------------"); Document doc = null; try { doc = Jsoup.connect(cate...
63a48641-fb9c-42ab-86ca-515326b3e88b
0
public BufferedImage getImage() { return OSI; }
8677bbc0-e7ee-47cc-ad23-ebb35268145d
6
@Override public Zone parse(String filename) { Zone zone = new Zone(); try { BufferedReader br = new BufferedReader(new FileReader(filename)); String strLine; // Read File Line By Line while (!(strLine = br.readLine()).equalsIgnoreCase("$") || (strLine = br.readLine()) != null) { ...
9e477fbc-30c4-471c-a5f7-4fe2e85a8717
3
Film(String URL, StringBuilder sourceCode) { int tableStart = 0; int tableEnd = sourceCode.indexOf("id=\"Cast\""); int ulStart = 0; int ulEnd = sourceCode.indexOf("id=\"Cast\""); boolean flag = true; while (flag) { ulStart = sourceCode.indexOf("<ul>", ulEnd + 10); if (ulStart != -1) { ...
8df0a76f-5ab0-42ea-8bc3-f5cc4e8f2352
6
public void keyPressed(KeyEvent e) { super.keyPressed(e); if (e.getKeyCode() == KeyEvent.VK_ENTER) { new Clavier(optionCourante, points, questions); } // se deplacer dans les options vers le bas if (e.getKeyCode() == KeyEvent.VK_DOWN) { if (optionCourante...
cfe13ccf-584d-4b31-930f-9246da1c4838
7
@Override public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if (src == drawLine) { switch (currentMode) { case LINE: shopPath.closePath(); case MOVE: currentMode...
9e8aabdc-80e6-47c5-ab17-41f0caa1170c
0
public String getHeader(String name) { return header.get(name); }
39214ee3-783c-4ae5-bf4d-bf667cf7faf8
7
private ArrayList<Pos> canSetDirection(Pos setPos, Stone myColor) { ArrayList<Pos> retDirectionList = new ArrayList<Pos>(); // 第一条件 石がないこと if (getColor(setPos) == Stone.NONE) { ArrayList<Pos> directionList = Pos.getToAllDirection(); for (Pos direction : directionList) { // 探索の開始位置をセット Pos nawPos =...
488d701f-d8d0-4cd1-9aab-ada2c3f42995
7
@Test public void placeFiguresKnight() { HashMap<String, Integer> figureQuantityMap = new HashMap<>(); figureQuantityMap.put(KNIGHT.toString(), 4); FiguresChain figuresChain = new Knight(figureQuantityMap); Set<String> objects = new HashSet<>(); objects.add(EMPTY_BOARD_SIZE...
92f2b821-d2e0-4ce0-9813-074e1ed6694a
3
public void closeConection(Connection conn) { try { if (conn != null && !conn.isClosed()) { conn.close(); conn = null; } } catch (Exception e) { log.log(Level.WARNING,"The following error occurred trying to close the connection: " + e.getMessage()); } }
a6803eed-e4e7-4870-93a7-59887d1eb43b
6
public BTPosition<T> getSecondMax(BTPosition<T> root) { if (root == null)// empty tree return null; if (root.getLeft() == null && root.getRight() == null)// just one node return null; // more than two nodes BTPosition<T> current = root, lastNode = null; while (current.getRight() != null) { lastNode...
a5827065-c2c5-4c82-964f-1f73ddb81fa3
5
Variant str2seqChange(String line) { try { String recs[] = line.split("\t"); // Parse chomo, position, ref and alt from recs[1] String chrPos[] = recs[0].split("_"); Chromosome chromo = genome.getChromosome(chrPos[0]); int pos = Gpr.parseIntSafe(chrPos[1]) - 1; // Parse 'ALT' String alt = chrP...
d8273508-4979-45f3-95d1-b14b7d1bf9a1
6
public static int[] primeList(int maximum) { boolean[] list = new boolean[maximum + 1]; int primes = 0; // O(n) for (int i = 0; i <= maximum; i++) { list[i] = true; } list[0] = false; list[1] = false; for (int i = 0; i <= maximum; i++) { ...
587087f4-98fd-49bd-a0b1-119eb3567893
8
private void antialias(int ch, int gr) { int sb18, ss, sb18lim; gr_info_s gr_info = (si.ch[ch].gr[gr]); // 31 alias-reduction operations between each pair of sub-bands // with 8 butterflies between each pair if ((gr_info.window_switching_flag !=0) && (gr_info.block_type == 2) && !(gr_info.mixed...
117f6951-ba66-463b-8692-177258d665d3
7
public static Class<?> sendClass() throws IOException, InterruptedException, ClassNotFoundException, InstantiationException, IllegalAccessException{ String location = "C:/Users/Amey/workspace/example3/exp.jar"; ArrayList<String> classNames=new ArrayList<String>(); ZipInputStream zip=new ZipInputStream(new FileIn...
87f7e0ee-6990-460a-b575-cf2e02e6b6cb
5
public World(Tile topTileArg, String filename, int dimensionArg){ dimension = dimensionArg; topTile = topTileArg; leftTile = topTile; while(leftTile.leftDown != null){ leftTile = leftTile.leftDown; } rightTile = topTile; while(rightTile.rightDown != null){ rightTile = rightTile.rightDown; } bottomTil...
460065dc-d749-4042-b20f-e8a6f3058f08
9
public static void main(String[] args) { Locale.setDefault(new Locale("en", "US")); Scanner input = new Scanner(System.in); double x = input.nextDouble(); double y = input.nextDouble(); double x1 = 12.5, y1 = 8.5; double x2 = 22.5, y2 = 8.5; double x3 = 17.5, y3 = 3.5; double ABC = Math.abs(x1 * (y2...
07235030-a870-4912-8b9e-3d9dc0afc376
7
private void checkCollision() { for(int m = 0; m <= usableIndex; m++) { for(int n = 0; n <= usableIndex; n++) { if (n != m) {//checks to see if comparing the same object xDistance = (double) objects[m].getCenterX() - objects[n].getCenterX(); yDistance = (double) objects[m].getCenterY() - ob...
cd019f8d-fd2d-4f96-b2e5-0965c704fd15
2
private boolean pickduringobservation(int[] bowl, int[] record) { System.out.println("we are in the pickduring observation"); System.out.printf("\n the score for this bow is %d\n", score(bowl)); if (score(bowl)>average(record)*1.5 && score(bowl)>=max) return true; else return false; }
3aeb246c-5af4-4821-ba92-adf9ccf9a1b3
6
static public Map<Utente, List<Documento>> utente2docs(List<Documento> docs, String nomePermesso) { if (docs == null || nomePermesso == null) return null; Map<Utente, List<Documento>> mappa = new HashMap<>(); for(Documento doc: docs){ PermessoAccesso permessiUtente = doc.getPermessoAccesso(nomePermesso); ...
2a1d08dc-c064-4e94-ac8d-448aecf007e1
6
private void cubeMetaInfoAction() throws DocumentException, XmlTypeErrorException { Document document = DocumentHelper.createDocument(); Element root = document.addElement("properties"); CubeMetaInfoXmlDriver cubeMetaInfoXmlDriver = new CubeMetaInfoXmlDriver( xmlReque...
131a1dd7-912a-42e6-88c5-700d1c7d81d0
0
public void setClientContacts(ArrayList<ClientContact> clients) { mClientContacts = clients; }
8617e8d6-ea61-43d8-b011-b697f78ca2b2
0
public LSystemAction(LSystemEnvironment env, String string, Icon icon) { super(string, icon); environment = env; }
d0acbb90-6657-4447-aea6-7643f577cdbd
8
void load(){ theoriesSplittedsRead = original.split("END"); for(int i=0;i<theoriesSplittedsRead.length;i++) if(theoriesSplittedsRead[i].contains("THEORY BalanceX IS")) balanceXRead = theoriesSplittedsRead[i]; for(int i=0;i<theoriesSplittedsRead.length;i++) if(theoriesSplittedsRead[i].contains("TH...
dbd9a265-735f-4b0f-a081-21da1b19b910
3
private void ComboBoxes(){ if(getGameType()== CONNECT) { m_ComboPlayer1Type.removeAllItems(); m_ComboPlayer2Type.removeAllItems(); m_ComboPlayer1Type.addItem("Human"); m_ComboPlayer1Type.addItem("Computer: Easy"); m_ComboPlayer1Type.addItem("Computer: Hard"); m_Com...
17cfbc41-0b96-45db-9420-4974c11d8d99
8
public String [] getOptions() { // Currently no way to set custompropertyiterators from the command line m_UsePropertyIterator = false; m_PropertyPath = null; m_PropertyArray = null; String [] rpOptions = new String [0]; if ((m_ResultProducer != null) && (m_ResultProducer instanceof Opt...
446666ec-7a8f-4caf-ba7f-0689908da803
1
public void shuffle() { ArrayList<Card> shuffledDeck = new ArrayList<Card>(); while (this.deck.size() > 0) { shuffledDeck.add(this.deck.remove((int) (Math.random() * this.deck .size()))); } this.deck = shuffledDeck; }
b2dcf56c-c57e-499d-b45e-ebc0483ade76
2
@Override @SuppressWarnings("SleepWhileInLoop") public void run() { while(true) { repaint(); try { Thread.sleep(5); } catch (InterruptedException ex) {} } }
45520402-dabf-4835-a321-7305abeb25c2
3
public void update(){ if(delay == -1) return; long elapsed = (System.nanoTime() - startTime) / 1000000; if(elapsed > delay){ currentFrame++; startTime = System.nanoTime(); } if(currentFrame == frames.length){ currentFrame = 0; playe...
e4a4ebb6-7864-4af9-aa4e-1d6b573ea4c2
6
protected void enterState(State<TransitionInput> previousState, State<TransitionInput> newState, State<TransitionInput>... submachineStates) { // To accommodate submachines and avoid unnecessary callbacks when transitioning states within a submachine, // exitCurrentState() only exits currentState (and sets it to nu...
7e2d3c44-f077-4111-a6e4-4d0ecbb07558
8
@Override public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { String[] possiblities; String part; switch (args.length) { case 2: BoundingBoxPreviewType[] types = BoundingBoxPreviewType.values(); ...
8b45b040-d085-4248-b654-53a0f4ab3eb2
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://...
a4e33ca6-9d91-4aa6-9c87-62204e9bc37e
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('...
8f5161c4-2e00-4e77-b883-4a55349733e7
4
public void lisaaTuote(Tuote t) throws DAOPoikkeus, SQLException{ //avataan yhteys Connection yhteys = avaaYhteys(); //Alustetaan kyselyt String lisaaPizza ="INSERT INTO Tuote(nimi, numero, hinta, aktiivinen, tuoteryhmaID) values(?,?,?,?,?)"; String lisaaTaytteet = "INSERT INTO TuotteenTayte (tayteID, tuoteID) ...
a5c0af2a-c00e-4b0c-8bc3-2eca8be94398
6
public static boolean clean(final Player player, Item item, final int slotId) { final Herbs herb = getHerb(item.getId()); if (herb == null) return false; if (player.getSkills().getLevel(Skills.HERBLORE) < herb.getLevel()) { player.getPackets().sendGameMessage( "You do not have the required level to cle...
9c32b941-b25d-490b-80fb-a9a9861182ce
0
public boolean isInitialized() { return initialized; }