method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
de9f25b6-f423-420f-8975-893eeba62a17
4
public Point[] getRefinedRelativeCollisionPoints(Point[] collisionpoints, int maskindex) { // In case the mask is null (= not used), simply returns the same points if (getMask() == null) return collisionpoints; // Removes the collisionpoints that aren't in the mask ArrayList<Point> templist = new Arr...
3a550f4c-928e-4644-a442-ac013ef943cf
2
@Test public void validPosition(){ Tile[][] tiles = new Tile[20][20]; for (int x = 0; x < tiles.length; x++){ for(int y = 0; y < tiles[0].length; y++){ tiles[x][y] = new Tile(new Position(x, y), 0); } } World w = new World(tiles); Position p1 = new Position(-1, 1); assertTrue(!(w.validPosit...
418d4f6e-3012-4532-b833-5eb6f69dcee2
4
public ConvertiblePair(Class<?> sourceType, Class<?> targetType) { if (sourceType == null) { throw new IllegalArgumentException("Source type must not be null"); } else if (targetType == null) { throw new IllegalArgumentException("Target type must not be null"); } this.sourceType = sourceType; this.targe...
00370211-dfcd-44d8-b3a9-5a3dcb8ae5be
9
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = in.readLine(); int n = Integer.parseInt(line); StringBuilder out = new StringBuilder(); for (int i = 0; i < n; i++) { String cad[] = in.readLine().split(" "); ...
899d2109-2bb4-4325-80b1-4c68337eb809
7
public Display displayData(DisplayData data, String title) { if (data==null) { logger.warning("Null data in displayData, not displaying title: " + title); JOptionPane.showMessageDialog(this, "Unable to display data with title " + title + "\n No data found", "Error displaying file", ...
fc361105-6ea8-4857-8421-7d0d49633d86
3
public Move chooseMove(State s) { // remember who we are so we can correctly evaluate states count = 0; me = s.whoseTurn(); // The rest of this function looks a lot like evalMove, except // that it doesn't just track the minimaxvalue, but also the // best move itself. // get a list of possible moves MyList ...
045d1228-c3f0-4c5f-8a81-8cba67bc9552
3
private boolean jj_3R_75() { if (jj_scan_token(LEFTPARENTHESES)) return true; Token xsp; xsp = jj_scanpos; if (jj_3_57()) jj_scanpos = xsp; if (jj_scan_token(RIGHTPARENTHESES)) return true; return false; }
08ba7030-04e6-4c44-b4d1-d7159ac8d9f2
2
public static void main(String[] args) { CountDownLatch latch = new CountDownLatch(3); ExecutorService executor = Executors.newFixedThreadPool(3); for (int i = 0; i < 3; i++) { executor.submit(new Processor(latch)); } executor.shutdown(); try { //...
5ed57c71-a016-4980-b004-63f696ab31a7
6
public void saveGraph(Graph graph, Component c) { this.graph = graph; XMLPetriManager newXML = new XMLPetriManager(); if (getSelectedFile() == null) { jFileChooser = new JFileChooser(); if (graph instanceof PetriNet) { jFileChooser.setAcceptAl...
80c34f8f-966b-400f-9dd1-64981a372ac5
6
public long getSum(long start, long end) { if (this.start == start && this.end == end) return sumVal; long mid = (this.start + this.end) / 2; if (start <= mid && end <= mid) return left.getSum(start, end); if (start > mid && end > mid) return right.getSum(start, end); return left.getSum(start...
4c35fcbd-9eb1-48b6-bd69-823a8ed611eb
1
public int[] decodeInts() { int[] res = new int[decodeInt()]; for (int i = 0; i < res.length; i++) { res[i] = decodeInt(); } return res; }
270cc6ec-8b3d-4a4b-bff6-ac4705d04b61
9
private void dumpNonArray(DumperParameteres par, String ident, Object obj) throws IllegalAccessException { dumpClassName(par, obj.getClass()); par.out.print("{ //var object_"); par.out.print(par.objMap.size() - 1); par.out.print('\n'); String ident2 = ident + par.IDENT; List<Field> fields = allObjectF...
e5a7c378-2402-4414-b403-663e9ee16a0b
9
public void calcRotation(int x, int y){ if(xPos == x){ // middle if(yPos < y){ // top setRotation(180); }else{ setRotation(0); // bottom } }else if(xPos < x){ //left if(yPos == y){ if((xPos%2) == 0){ //bottom left setRotation(120); } else{ // top left setRotat...
b896f817-729b-4ece-8559-c4df1cac2517
8
public static String testableHtml(PageData pageData, boolean includeSuiteSetup) throws Exception { WikiPage wikiPage = pageData.getWikiPage(); StringBuffer buffer = new StringBuffer(); if (pageData.hasAttribute("Test")) { if (includeSuiteSetup) { WikiPage suiteSetup ...
678f5a6f-d04d-479d-aa72-8520048e3e7c
8
private boolean r_verb_suffix() { int among_var; int v_1; int v_2; int v_3; int v_4; // (, line 175 // setlimit, line 176 v_1 = limit - cursor; // tomark, line 176 ...
ea7cc24d-52b8-4b71-91d8-70b627664110
6
public String returnItem(String d, String i) { //variables Boolean validItem; Item currentItem; LibraryCollection myItems = LibraryCollection.getInstance(); String itemID = i; String date = d; validItem = false; while (!validItem) { try { Item myItem = itemsOnFile.getItem(itemI...
638c9cfc-758c-4991-aa43-ff34446f2fc3
4
public void buildDictionary(TrieNode root,String[] words){ for(int i=0;i<words.length;++i){ TrieNode cur=root; for(int j=0;j<words[i].length();++j){ TrieNode next=null; if((next=cur.getAdj(words[i].charAt(j)))==null){ next=new TrieNode(...
4b9b09e7-51f2-4355-9565-db747601ea90
4
public String toString() { if (this.Keys.size() == 0) return "OrderedTable[]\n"; Enumeration localEnumeration1 = this.Keys.elements(); Enumeration localEnumeration2 = this.Values.elements(); StringBuffer localStringBuffer = new StringBuffer("OrderedTable[\n"); while (localEnumeration1.hasMor...
4b9f3060-f835-4372-9a99-f790ba2fbd9c
5
public void readRef(ObjectInputStream s) throws IOException { for (int a = 0; a < 8; a++) { int portIndex = s.readInt(); if (portIndex >= 0) { portSignals[a].internalSignal = mySignals.elementAt(portIndex); } } for (int a = 0; a < myGates.size(...
db2270d3-a1cf-4c1c-a167-86edaeb47da1
4
public Shape getShape(String shapeType){ if (shapeType==null){ return null; } if(shapeType.equalsIgnoreCase("RECTANGLE")){ return new Rectangle(); } if(shapeType.equalsIgnoreCase("SQUARE")){ return new Square(); } if(shapeType.equalsIgnoreCase("CIRCLE")){ return new Circle(); } return null...
ef295ddd-2e41-4f35-b517-518d396fd56f
2
@Override public int getHitCount() { int procentualHit = 0; int totalToHit = 0; for (Ship s : ships) { totalToHit += s.getSize(); } if (totalToHit == 0) { return procentualHit; } procentualHit = hitCount / totalToHit* 100; ret...
0da11fbb-c18d-4657-a64b-a746017e45c8
9
static final void method2349(byte b) { anInt9573++; if (b != 5) { anIntArray9575 = null; } if ((Class290_Sub4.anInt8100 ^ 0xffffffff) <= -1) { long l = Class313.method3650(false); Class290_Sub4.anInt8100 -= -Class181.aLong2157 + l; if (Class290_Sub4.anInt8100 > 0) { int i = (Class290_Sub4.anInt8...
4c709068-10a1-4ee1-8824-a1403d4408b6
3
private void replaceCharactersInBlock(TMState start, String toReplace, String replaceWith){ //this shall be a recursive method, replacing the inside and then the out TuringMachine tm = start.getInnerTM(); for (int i = 0; i < tm.getStates().length; i++) replaceCh...
16824716-3c76-4823-8226-9434c6f6f6fe
8
private static Double getBaseToll(int i) { switch (i) { case 1: return 1.35; case 2: return 2.0; case 3: return 2.5; case 4: return 3.25; case 5: return 4.1; case 6: return 4.8; case 7: return 5.5; case 8: return 6.0; default: return -1.0; } }
2ce3aa42-905e-4b5b-8457-c45efd79605a
2
public void envoyer_ordre_a(int i,String s) throws IOException{ LigneBus val = null; for (LigneBus l : ligne) { if(l.getNumero()==i) val = l; } ConnexionType.CONTROLEUR.envoyer_a(s, val.getSocket()); this.server.console("Controleur n°"+ID+" envoi ordre --> "+s); }
16d37b4e-6098-4d91-a1ab-a16f99ee49cd
8
@Override public void gotoDetail(GoodsStatus gs, String goodUrl) { Document doc = null; try { doc = Jsoup.connect(goodUrl).timeout(0).get(); } catch (IOException e) { logger.error(e.getMessage(), e); gs.setStatus(GoodsStatus.NOT_FOUND); gs.setResult(GoodsStatus.SEARCH_EXCEPTION); return; } ...
ab276f3a-5ba6-4c7e-af8b-326d07af3079
0
public Pfad(Land a, Land b) { first_land = a; second_land = b; }
8dee6ba6-25d3-47f5-9b77-76e0ad45a40f
3
public List<MessageDTO> receiveNewMessages(FolderDTO folderDTO) throws DataProcessingException { Folder folder = folderDAO.getFolder(folderDTO.getId()); if (folder == null) { logger.warn("Folder with name " + folderDTO.getFolderName() + " does not exist"); throw new DataProcessingException(ExceptionType.f...
df083654-d28e-431e-bc64-b1dc0385b7db
2
@Override public void run() { regainOwnership(Toolkit.getDefaultToolkit().getSystemClipboard()); while (!interrupted()) { try { sleep(1000); } catch (InterruptedException e) { LOG.debug(e.getMessage(), e); } } }
ba8583a3-4d76-4f1f-b071-4a78ee2ea29f
1
static void printTree(Tree tree) { if (tree == null) { ; //System.out.println(tree); } else { printTreeRecursive(tree, ""); } }
cbb41482-304b-448a-a6fc-5647b01f47ed
1
public Texture GetTexture(String name) { Texture result = m_textureHashMap.get(name); if(result != null) return result; return new Texture("test.png"); }
3b328d23-a333-4e0a-be39-fd648eff2812
6
public void toteutaOhjaus() { if (kaannaVasen) { kaannaVasen = false; peli.kaannaVasen(); } else if (kaannaOikea) { kaannaOikea = false; peli.kaannaOikea(); } if (pudotaKokonaan) { pudotaKokon...
d0dab154-a69f-49d0-a50c-ba4948137d48
3
private StatementList statement_list(int fallbackLineNumber, int fallbackCharPosition) throws RequiredTokenException { enterRule(NonTerminal.STATEMENT_LIST); List<Statement> statements = new ArrayList<Statement>(); while(firstSetSatisfied(NonTerminal.STATEMENT)) statements.add(statement()); exitRule(); r...
644f007b-a586-403e-8e17-5ab67f5674ff
0
public final void dispose() { //System.out.println("Stoping receiver ..."); stopped = true; receiverThread.interrupt(); System.out.println("MulticastReceiverThread: Stopped."); }
d9912421-1f07-4a08-accd-2b55f83b3ecf
6
public Relationship parseRelation(Id leftId, Id rightId, String relationExpr) { Relationship relationship = new Relationship(leftId, rightId); Map<String,String> styles = new HashMap<String, String>(); Matcher matcher = META.matcher(relationExpr); if(matcher.find()) { parseS...
b9808fa0-2b01-40b6-9b54-d65ce6d292b4
6
public boolean getBoolean(String key) throws JSONException { Object o = get(key); if (o.equals(Boolean.FALSE) || (o instanceof String && ((String)o).equalsIgnoreCase("false"))) { return false; } else if (o.equals(Boolean.TRUE) || (o ins...
624d3ba8-c954-48cd-bf7c-46e0e110bf08
4
public void writeInformation(Description d) { for (Skill s : attributes()) { d.append("\n "+s.name+" "+((int) traitLevel(s))) ; } d.append("\n") ; for (Skill s : skillSet()) { d.append("\n "+s.name+" "+((int) traitLevel(s))) ; } d.append("\n") ; for (Trait t : personality()) { ...
2546b7ba-aa8d-4753-88ab-b5fc8dc64c03
9
public static String szesnastkowo(int a){ String h=""; String tmph = ""; int tmp=0; while (a!=0){ tmp=(a%16); if (tmp<10){ tmph += String.valueOf(tmp); }else if(tmp==10){ tmph +="A"; ...
48362f31-696e-43d6-8665-c5c49ce525b2
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...
8b54a938-9df6-417a-97b6-ce737d288455
9
public int writeVarLong (long value, boolean optimizePositive) throws KryoException { if (!optimizePositive) value = (value << 1) ^ (value >> 63); if (value >>> 7 == 0) { require(1); buffer[position++] = (byte)value; return 1; } if (value >>> 14 == 0) { require(2); buffer[position++] = (byte)((va...
0f8248df-c215-4188-acec-d5a12201d606
2
private void btnEditRuleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditRuleActionPerformed if (tableRules.getSelectedRow() == -1) { return; } Rule rule = RulesManager.getInstance().getRuleByName((String) tableRules.getModel().getValueAt(tableRules.getSelec...
3397ec40-de97-4745-a2e8-f372d594114a
4
protected static StringBuffer typeToString(StringBuffer sbuf, int type, int dim, String cname) { String s; if (type == CLASS) s = MemberResolver.jvmToJavaName(cname); else if (type == NULL) s = "Object"; else try...
44c29493-dcd6-4008-9913-aca0f6c8b856
3
public static void main(String[] args) { new Thread(new LoadingFrame()).start(); new Thread(new USBListenerJob()).start(); Font font = ConfigDao.instance().getConfig().getFont(); Enumeration<Object> keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); ...
cde96c09-9857-4927-b8f2-5962f2f2d012
2
public Bitmap flipY() { int[] temp = new int[pixels.length]; for(int i = 0; i < width; i++) for(int j = 0; j < height; j++) temp[i + j * width] = pixels[i + ( height - j - 1) * width]; pixels = temp; return this; }
3beba124-07de-4a23-af64-52a98b5842dc
7
public Deck(Graphics g){ String cardName = ""; //Goes through each suit, and in each suit it goes through each number creating a card. //if a card has a specific vaulue, it changes the name to represent that vaulue better. //This only applies to face cards. for (int i = 0; i < suitArray.length; i++ ) { ...
9e040746-2993-4ab4-9867-ee2501055892
3
public static void importDatabase(String zipName, List<String> importList) throws ClassNotFoundException, SQLException { String driverName = "org.apache.derby.jdbc.EmbeddedDriver"; String clientDriverName = "org.apache.derby.jdbc.ClientDriver"; String databaseConnectionName = "jdbc:derby:Wi...
b0166361-6f98-4b2f-810c-8b46b6e4b0f3
8
private static boolean printIteration(int[][] array, int y, int x, int step) { boolean isPrinting = false; for (int z = y; z > y - step; z--) { if (checkBoundaries(array, z, x)) { isPrinting = true; System.out.print("\t" + array[z][x]); } }...
2f84d83e-6709-4c41-a220-2e2af9775b26
2
public LinkedList<Stock> getWeakestStocks(int quantity){ LinkedList<Stock> sorted = qs.qsort(stocks, 2); // sort by percentChange LinkedList<Stock> ret = new LinkedList<Stock>(); if (quantity > sorted.size()) quantity = sorted.size(); for (int i = 0; i < quantity; i++){ ret.add(sorted.get(i)); } retur...
44237a5b-32a0-40ab-a24d-1d6db05498d8
9
void initCommandMap () { commandMap = new TreeMap(); commandMap.put(new IrcString("PING"), new commandDefinition(2) { public void action ( IrcCommand c, IrcEventListener l ) { l.onPing( c.getArg(1).toString()); } }); commandMap.put(new IrcString("422"), ...
caa856b9-43d8-4b53-a567-76f36b30140d
9
public Object parse(String s) throws IllegalArgumentException { Object v = null; // Test for null argument if (this == NONE) { if (s != null) { throw new IllegalArgumentException("For NONE, s must be null."); } } else { if (s == null) { throw new IllegalArgumentException("s cannot be null.")...
a4f39f74-984b-4b08-8a15-837286eae72f
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...
ef31b49b-aa16-4b9e-a295-ebbbc78adf87
7
public ArrayList<ArrayList<Integer>> zigzagLevelOrder(TreeNode root) { LinkedList<TreeNode> queue = new LinkedList<TreeNode>(); ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>(); ArrayList<Integer> cur = new ArrayList<Integer>(); if(root == null) return res; ...
12a9da22-9b71-4b93-9e43-b78d3f88a62a
7
public void paging(String path) { totalPage = (int) Math.ceil((double)count / rows); startRow = (cPage-1) * rows+1; endRow = cPage * rows; startPage = (int)((cPage-1)/pageBlock) * pageBlock + 1; endPage = startPage + pageBlock - 1; if(endPage > totalPage) { endPage = totalPage; } if(startPag...
87ba1f05-5a68-4ef8-b6dd-59b6deb9cad8
5
public JSONObject increment(String key) throws JSONException { Object value = this.opt(key); if (value == null) { this.put(key, 1); } else if (value instanceof Integer) { this.put(key, ((Integer) value).intValue() + 1); } else if (value instanceof Long) { ...
ba31250e-0651-4d37-87c9-6473e4cd0a7e
3
@Override protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception { // Will use the first 23 bytes to detect the policy file request. if (buffer.readableBytes() >= 23) { ChannelPipeline p = ctx.getPipeline(); ChannelBuffer f...
e1392cf8-8b96-49b1-b40d-fb636e6b6e46
8
public ArrayList<Integer> unbesuchteN(Spielfeld[][] lab){ ArrayList<Integer> nachbarn = new ArrayList<Integer>(); if(this.linkerN != Rand){ if (lab[this.PositionX-1][this.PositionY].eigenschaft == NORMAL) nachbarn.add(0);} if(this.obererN != Rand){ if (lab[this.PositionX][this.PositionY-1].eigenschaft == NO...
6fd7c682-e5e1-40d9-a38c-2c1277869b41
8
public boolean isLegalMoveTwo(int pieceNumber){ if (board.getBoard()[pieceNumber].getPieceType()==1 || board.getBoard()[pieceNumber].getPieceType()==2){ if (board.getBoard()[pieceNumber].getX()==(BOARDSIZE-board.getBoard()[pieceNumber].getLength()+1)) return false; } else{ if (board.getBoard()[pieceNum...
359b1bac-3e69-4bec-ad57-a9beb10d8ca9
1
public Rule substitute(Term term, Term replacement) { List<Predicate> substitutedConditions = new ArrayList<Predicate>(conditions.size()); for (Predicate condition : conditions) { substitutedConditions.add((Predicate) condition.substitute(term, replacement)); } return new Ru...
e8864d9b-caa0-45de-b3e2-8b27eddd55f9
2
public void draw(Graphics g) { g.setColor(Color.black); for (Wall wall : walls) g.drawRect(wall.getX()-1, wall.getY()-1, wall.getWidth()+1, wall.getHeight()+1); // Shape g.setColor(Color.GRAY); for (Wall wall : walls) g.fillRect(wall.getX(),...
db315cbf-ce44-4250-a2ac-088d70cc5c59
4
public DateFormat getDateFormat(String date){ if(date.matches("[0-9]{4}-[0-9]{2}-[0-9]{2}[ \t].*[0-9]{2}:[0-9]{2}")) setDateFormat("yyyy-MM-dd hh:mm"); else if(date.matches("[0-9]{4}-[0-9]{2}-[0-9]{2}[ \t].*[0-9]{2}:[0-9]{2}:[0-9]{2}")) setDateFormat("yyyy-MM-dd hh:mm:ss"); else if(date.matches("[0-9]{2}\\/...
07163f87-7877-4d09-a565-a3bbf70de0f3
4
static File getLastDir() { String lastSetDir = Settings.getSetting("lastOpenDirectory"); if ((lastSetDir == null) || lastSetDir.equals("")) return null; File lastDir = new File(lastSetDir); if (lastDir.exists() && lastDir.isDirectory()) return lastDir; return null; }
18539169-efcd-4cbc-a1cb-702ee0e7a91c
5
public int[] getLiczbaStatkow() { int liczbyStatkow[] = new int[4]; for(int i = 0;i < l_statek.length; i++) { if(l_statek[i].getRozmiar().equals("jednomasztowiec")) liczbyStatkow[0]++; if(l_statek[i].getRozmiar().equals("dwumasztowiec")) liczbyStatkow[1]++; if(l_statek[i].getRozmiar().equals("tr...
5ac1c32d-a5f6-4623-8c8b-cd5cd18be790
8
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { String parm = (commands.size() > 1) ? CMParms.combine(commands,1) : ""; if((!mob.isAttributeSet(MOB.Attrib.COMPRESS) && (parm.length()==0))||(parm.equalsIgnoreCase("ON"))) { mob.setAttribute(MOB.At...
7f4177c0-4d59-471e-9259-acdd5dcc8788
2
public void loadSpawnEye(){ if (customConfigurationFile == null) { customConfigurationFile = new File(plugin.getDataFolder(), "spawn.yml"); } customConfig = YamlConfiguration.loadConfiguration(customConfigurationFile); Set<String> eyeSet = customConfig.getKeys(false); for (String eyeLocation : ey...
b6ae343a-4d19-4e04-9e94-a3ea57cb7d23
9
public Imports getImports(ClassFile cf) { Imports imports = new Imports(cf.getPackageName()); ConstantPool pool = cf.getPool(); for (int i = 0; i < pool.size(); i++) { ConstantPoolInfo cpi = pool.get(i); if (cpi != null) { if (cpi.getType() == ConstantPoolInfo.CLASS) { // there can be array defini...
42e10869-2e81-476c-8dfe-18f1f6532ed7
2
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if(br == null) { FileInputStream fstream = new FileInputStream(locations[0]); DataInputStream in = new DataInputStream(fstream); br = new BufferedReader(new InputStreamReader(in)); ...
8cf967b2-31e8-48d2-8411-cca25c01c1bc
2
public int spAttack(Character target){ int damage = (int) (5 * Math.random()) + (int) (spAttack * multiplier) - target.getSpDefense(); if (damage <= 0){ damage = 1; } if ( ((int) (100 * Math.random()) + 1) < target.getEvasiveness()){ damage = 0; } target.lowerHP(damage); return damage; }
aadd8e57-5ecf-470e-9fb4-02715347675a
0
public void setNom(String nom) { this.nom = nom; }
ae8e67bf-c67b-4c98-89c3-3f0cb90889dc
3
public ArrayList<String> getBodyPieces(String contentHtml) throws IOException { ArrayList<String> bodyPieces = new ArrayList<String>(); String body = Jsoup.clean(contentHtml, Whitelist.basicWithImages()); String allPieces[] = body.split("\n"); for(String i:allPieces){ if(i.c...
c90b4305-91fa-4393-862b-4cf6cd9eb5be
4
public ArrayList<GameObject> OrganizeForDrawing(ArrayList<GameObject> AL_messy) { //Creating the variables ArrayList<GameObject> AL_organized = new ArrayList<GameObject>(); int numLowest = Integer.MAX_VALUE; int numChecksNeeded = AL_messy.size(); int numInArray = 0; //Organizing the array list if (AL_...
1ca9892f-e859-4bd2-b226-594e5fb435e1
6
void vcfIterate() { // Open file VcfFileIterator vcf = new VcfFileIterator(inFile, config.getGenome()); vcf.setCreateChromos(true); // Any 'new' chromosome in the input file will be created (otherwise an error will be thrown) boolean header = true; for (VcfEntry ve : vcf) { try { if (header) { //...
408e7ceb-ed8c-4ece-96c5-87898ac6bbe8
0
protected void init() { }
c2e4c449-0e6b-4302-bcd8-4364f26ea5ad
8
private void jBDerefActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBDerefActionPerformed try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); } catch (ClassNotFoundException ex) { JOptionPane jOErreur = new JOptionPane("Driver non trouvé " + e...
96a3d17c-4954-495c-859b-216fa3b36a63
7
protected int read() { try { c=in.charAt(pos++); } catch (Exception e) { c=-1; }; column++; if (prevLF) { prevLF = false; line += (column = 1); } else if (prevCR) { prevCR = false; if (c == '\n') { prev...
a6328cf3-a577-4ec4-b76f-89c7c80af51f
0
@Override public String toString() { return "[x=" + x + ", y=" + y + ", z=" + z + "]"; }
f34c3d49-865f-4fc8-952a-0dcc014bfec0
7
public RechtenPanel() { setLayout(new BorderLayout(0, 0)); final JList list = new JList(rolLijst); list.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { JList list = (JList) evt.getSource(); if (evt.getClickCount() == 1) { int index = list.locationToIndex(evt.getPo...
8c5055b4-d3cf-4df7-a48e-8bae18b64d2a
6
public String rearrangeString(int d, String s){ Map<Character, Integer> letterMap = new HashMap<Character, Integer>(); for(int i=0; i<s.length(); i++){ if(letterMap.containsKey(s.charAt(i))){ letterMap.put(s.charAt(i), letterMap.get(s.charAt(i))+1); } else{ letterMap.put(s.charAt(i), 1); } } ...
e4e102d6-a8ff-4178-b280-9a893c2a6b82
1
private void returnQuarter() { final int RETURN_DELAY = 250; Timer returnTimer = new Timer(RETURN_DELAY, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { _returnCoin.setOn(false); } }); ...
0aeba424-59e6-4d95-bee0-f798d965f6f0
5
public boolean find() { for (; offset < bytes.length; offset++) { localRabin.pushByte(bytes[offset]); if (localRabin.getFingerprintLong() == targetFingerprint) { final int i0 = offset - target.length() + 1; final int i1 = offset + 1; if (i0 < 0 || i1 >= string.length()) continue; final St...
8d56cd28-b05c-42f9-9e53-b3078b390ef7
9
protected void clearLines() { int linesCleared = 0; for (int y = 0; y < getHeight(); y++) { boolean lineCleared = true; // find lines to clear for (int x = 0; x < getWidth(); x++) { if (playfield[x + y * getWidth()] == null) lineCleared = false; } // clear line...
8eb4bab2-27d7-4f38-9759-855c5ee8dd05
6
public static void main(final 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 f...
05e41c24-4f0f-49a7-84d5-7055e3129e7a
9
public SmartlingKeyEntry getSmartlingEntry(HttpServletRequest req, HttpServletResponse resp) { Enumeration en = req.getParameterNames(); String locale = ""; String projectid = ""; String fileuri = ""; List<String> allowedParams = Arrays.asList("locale","projectId","fileUr...
e4650cd5-9940-45df-8811-17ac2a080920
0
public boolean getHasBeenRemoved() { return hasBeenRemoved; //You may need to change this }
c87363f7-61c9-4a01-ad2a-78f83663ad46
7
*/ public void testVerySmallReadWrite() throws Exception { ByteBuffer b = ByteBuffer.allocate(4000); log.info("getting all proper connections"); int size = 40; String[] methodNames = new String[size]; for(int i = 0; i < size; i++) { methodNames[i] = "finished"; } TCPChannel[] clients = new TCPChann...
194b873a-63e0-4c4e-9534-9e2583a8d261
0
private void logout(){ db.save(); //save data in db logAc.save(); cardLayout.show(contentPane, "Login"); setJMenuBar(null); //disable the menubar when logout }
922aaae1-ce04-432b-a4e1-a15d21e6f539
2
public int findPunkt(String hornNamn) { int i = 0; for(i = 0; i < this.horn.length; i++) { if(this.horn[i].getName() == hornNamn) { break; } } return i; }
bcd74282-0c0a-42c8-83c4-d06e7d296f9f
9
private void setStateIfMobInteractsWithPlate(World par1World, int par2, int par3, int par4) { boolean var5 = par1World.getBlockMetadata(par2, par3, par4) == 1; boolean var6 = false; float var7 = 0.125F; List var8 = null; if (this.triggerMobType == EnumMobType.everything) ...
7223d576-4ff4-4c28-96e1-778ca9026d76
1
public void testSkipDateTimeField() { DateTimeField field = new SkipDateTimeField (ISOChronology.getInstanceUTC(), ISOChronology.getInstanceUTC().year(), 1970); try { field.set(0, 1970); fail(); } catch (IllegalFieldValueException e) { assertEquals...
f5bbd29a-1f87-4ecc-8a32-1d5808c47962
9
public static Integer getTeamID(String team) throws ParserConfigurationException, SAXException, IOException{ boolean found = Boolean.FALSE; int temp = 0, id = -1, distance = 100; String name; HashMap <Integer, Integer> dLevenshtein = new HashMap<>(); ...
5b56637c-c0f1-4b6b-82c2-450073afdce8
4
public boolean canInsert(final Block block) { final int blockIndex = cfg.preOrderIndex(block); final Def def = operands[blockIndex]; if (def == null) { return true; } if (!hasRealUse[blockIndex]) { if (def instanceof Phi) { final Phi phi = (Phi) def; if (!phi.willBeAvail()) { ...
423d20ab-20ce-4a9e-b5ac-90dbaebd4f15
0
public static void main(String[] args) { System.out.println("The GiftCard Class:"); GiftCard gc = new GiftCard(150); // gc.makePurchase(200); gc.makePurchase(50); System.out.println("Balance: " + gc.getBalance()); System.out.println(gc.getAcceptability()); System.out.println(); System.out...
f7fb2c81-f358-43ea-86ae-539cdad8533f
6
@Test public void testXml2Json() throws FileNotFoundException, IOException, JSONException { Xml2Json x2j = new Xml2Json(); JSONObject jsonObj = x2j.xml2Json(new FileReader(new File("/home/austin/Projects/TCS/wurfl.xml"))); // JSONObject jsonObj = x2j.xml2Json(new FileReader(new File("E:\\LocalGitHub\\TCS_PoC\\...
0cf8d7e7-9262-40a5-9e1c-f5c67076a465
0
@Override public void endSetup(Attributes atts) { super.endSetup(atts); }
255c4c83-9927-49c3-b140-a656544a401a
8
private Node[] getNeighbors(int index){ boolean top = false; boolean bottom = false; boolean left = false; boolean right = false; int count = 0; if(index >= grid.getDim()){ top = true; count++; } if(index % grid.getDim() < grid.getDim()-1){ right = true; count++; } if(index + grid.getDim...
ef6e0ebf-f0b6-4b49-a25b-bb03e55c76b7
6
private void update(int[] x, int bowlId, int round) { if (bowlIds.contains(bowlId+round*nplayer)==false) { info.add(x.clone()); bowlIds.add(bowlId+round*nplayer); } mu=0; for(int[] y:info){ mu+=score(y); } mu=mu/info.size(); sigma=0; scores.clear(); for(int[] y:info){ int s=score(y); si...
f078d3eb-c3cc-41de-870c-d2e722078112
7
private static double maf(Predictors<MultiClassLabel> correct, Predictors<MultiClassLabel> answer) { TIntIntMap tp = new TIntIntHashMap(); TIntIntMap fp = new TIntIntHashMap(); TIntIntMap fn = new TIntIntHashMap(); TIntSet classes = new TIntHashSet(); for(int r=0; r < correct.si...
c924679b-3777-4bb5-83e8-e282d706bd3b
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...
831ccb76-4c7e-47b8-b9a8-ffe4002ed3bb
5
@Override public void initialize(InputSplit arg0, TaskAttemptContext context) throws IOException, InterruptedException { try { reader = new PartitionReader(new OptimusConfiguration(((TRANSInputSplit)arg0).getConfDir())); } catch (WrongArgumentException e) { // TODO Auto-generated catch block e.prin...
c8023187-fe3e-46a5-8a36-9a86af9c40b7
3
public String toString() { StringBuilder output= new StringBuilder("Order id: "); output.append(this._orderId); output.append(System.getProperty("line.separator")); output.append("Order expected cook time: "); output.append(getExpextedCookTime()); output.append(System.getProperty("line.separator")); outpu...
364e5a5e-798a-4023-a05f-9638b0ab2cb8
3
public static void main(String[] args) throws InterruptedException { if (args.length != 1) throw new IllegalArgumentException("Incorect parameters count. Expected count is 1 that is assumed as threads count," + "but current is " + args.length); final int threadsCount = In...