method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6c1c8f7d-1e95-4377-8549-f6ef94f92a0c
2
protected void print() { System.out.println("Print for " + prototype + "------------------"); cfg.visit(new PrintVisitor() { Phi phi = null; public void visitBlock(final Block block) { phi = exprPhiAtBlock(block); super.visitBlock(block); } public void visitLabelStmt(final LabelStmt s...
4db98111-1660-4b0b-807e-435467210fe8
3
private Type parseType() { //System.out.println("parseType"); Type node; switch(showNext().getKind()) { case "ident": node = new NamedType(new Identifier(acceptIt())); break; case "array": node = parseArrayType(); break; case "record": node = parseRecordType(); break; default: node = ...
5e6d57ec-319b-48c4-91f7-301a2f2243a1
1
public static void insertFonction(String libelle) throws SQLException { String query = ""; try { query = "INSERT INTO FONCTION (FONCLIBELLE) VALUES (?); "; PreparedStatement pStatement = ConnectionBDD.getInstance().getPreparedStatement(query); pStatement.setStrin...
39fe7a8b-ec0c-48f5-aef1-ba1b5c8a8e23
2
public static void selectRightText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) { Node currentNode = textArea.node; int currentPosition = textArea.getCaretPosition(); if (currentPosition == textArea.getText().length()) { return; } // Update Preferred Caret Position ...
71ad8518-63e1-4f63-9211-8a00e07d4e6e
8
public static final int getMaxHit(Player player, int weaponId, int attackStyle, boolean ranging, boolean usingSpec, double specMultiplier) { if (!ranging) { int strengthLvl = player.getSkills().getLevel(Skills.STRENGTH); double xpStyle = CombatDefinitions .getXpStyle(weaponId, attackStyle); double...
f6ef56d3-0480-4604-9438-191fcf81777c
4
public static long appendIncrementalUpdate( Document document, OutputStream out, long documentLength) throws IOException { // Iterate over StateManager entries, writing changed objects // (like Annotation, Page, Annots array) to output stream via // IncrementalUpdater ...
c2df1a13-2eb4-4e9e-8448-96c105019be7
0
public void setId(Integer id) { this.id = id; }
9c0a5fae-7922-494c-82a1-acbb29b36f07
3
/* */ protected RIFCSElement(Node n, String name) /* */ throws RIFCSException /* */ { /* 56 */ if (n == null) /* */ { /* 58 */ throw new RIFCSException("Null Node passed to constructor"); /* */ } /* */ /* 61 */ if ((n instanceof Element)) /* */ { /* 63 ...
03d06dd8-e14c-49be-b0e8-c9d28d2921d0
3
@SuppressWarnings("deprecation") @EventHandler public void VillagerSpawn(CreatureSpawnEvent event){ ArrayList<String> firstNames = new ArrayList<String>(); OfflinePlayer[] oln = Bukkit.getOfflinePlayers(); if(event.getEntityType().getName().equalsIgnoreCase("Villager")){ for(OfflinePlayer y : oln){ fi...
d8b4b7f2-0879-440c-96de-60376d7eb7eb
4
public void render(Graphics2D g) { g.drawImage(RL.stone, x, y, width, height, null); if (up) { g.drawImage(RL.stoneVC, x, y - height / 2, 64, 64, null); } if (down) { g.drawImage(RL.stoneVC, x, y + height / 2, 64, 64, null); } if (left) { g.drawImage(RL.stoneHC, x - width / 2, y, 64, 64, null); ...
fe8361ee-418c-4a88-bcc3-4a1adbad1491
9
public void dealerHit() { System.out.println(">Dealer's hidden card was: " + dealerHand.getHand().get(0).toString()); while (dealerHand.getHandValue() < 21) { if (dealerHand.getHandValue() < 17 && !dealerHand.getHValues().contains(11)) { dealerHand.addCard(shoe.dealCard()); System.out.printl...
e108d121-8ee7-4a06-9829-4c6f9c06090d
8
private void memory_stage() { InstructionType type = current_instruction.get_type(); int rt; switch (type) { case lw: memory_result = memory_unit.load_word(alu_result); break; case lh: memory_result = memory_unit.load_half_word(alu_result); break; case lhu: memory_result = memory_unit.load...
24dbf8af-da27-4251-980a-e4fd10805978
2
private static void fillArray(int[] array, int actualDataSpots){ for (int x = 0; x <= array.length -1; x++){ //fills in starting elements if(x <= actualDataSpots -1){ array[x] = x; } else { //fills the rest with -1 array[x] = -1; } } }
26fe98b2-3adc-47db-852e-673848b34136
5
public static String rTrim(final String value) { if (value == null) { return null; } String trimmed = value; int offset = value.length() - 1; while (offset > -1 && (value.charAt(offset) == ' ' || value.charAt(offset) == '\t')) { offset--; } ...
5db2ea52-7cc9-4856-8f12-c9b12768df41
2
public void unpackDat( File datFile, File outFolder ) throws IOException { log.trace("Unpacking dat file " + datFile.getPath() + " into " + outFolder.getPath()); InputStream in = new FileInputStream(datFile); outFolder.mkdirs(); int[] header = readHeader(in); int i = 0; while( i < header.leng...
1387fb0e-5506-4876-a380-52180fb21b33
5
public LineSplitterBrackets(String delimiter, String theBracketLeft, String theBracketRight) { super(delimiter); this.bracketLeft = theBracketLeft; this.bracketRight = theBracketRight; if (bracketLeft.equals(bracketRight)) { bracketFinder = new BracketFinder() { public int...
115aa413-0428-406b-8ec7-f5641359d38f
4
public OdigoiAdd(int editId) { /* * parathiro gia thn prosthiki i tin epe3ergasia odigou, an to editId einai 0 tote kanei prosthiki alliws epexergasia */ con = new Mysql(); id=editId; if(id==0) // vazei ton katallhlo titlo analoga thn leitourgia pou exei epilex8ei setTitle("Prosthiki Odigou"); else ...
74fa7533-d7df-42ac-9bee-99efaf4b8408
0
@Test public void deleteWorksAtEnd() { initializeWithABC(); l.delete(c); assertEquals(b, l.max()); assertEquals(null, l.succ(b)); }
b5dae4e8-a7a9-48f0-a4a6-e1a19eaf99f2
9
@Override public void run(){ if(state == GameState.Running){ while(true){ robot.update(); if(robot.isJumped()){ currentSprite = characterJumped; } else if (robot.isJumped() == false && robot.isDucked() == false){ currentSprite = anim.getImage(); } ArrayList projectiles = robot.g...
f0e4a1e6-6259-47de-a444-ffedadb9364b
1
private void paintTiles(Graphics g) { for (int i = 0; i < tilearray.size(); i++) { Tile t = (Tile) tilearray.get(i); g.drawImage(t.getTileImage(), t.getTileX(), t.getTileY(), this); } }
3e7b18f5-de8b-44c5-bac9-e9d0d61ff9a3
6
private void writeXML(String xml) { String resourceName = System.getProperty(CONFIG_FILENAME_KEY); if (resourceName == null) { return; } else { URL rUrl = ClassLoader.getSystemResource(resourceName); if (rUrl != null) { File file = new File(rUr...
e6e50bec-5126-4455-9883-36833bfb91b7
9
private Map<String, Object> saveMap() { Map<String, Object> map = new HashMap<String, Object>(); map.put("name", name); map.put("main", main); map.put("version", version); map.put("database", database); map.put("order", order.toString()); map.put("default-permiss...
fac77f7b-53c9-498a-99b3-50ffc5618e36
5
@Override public Integer getIdFromDataBase() throws SQLException { Integer id = null; if(numGroup == null){ return id; } else if(yearSupply == null){ return id; } else if (faculty == null || faculty.getIdFaculty() == null){ return id; } ...
302ff2e4-caae-48fb-919f-1b3846d46882
3
public void setAccountTypes(AccountTypes accountTypes) { this.accountTypes = accountTypes; if (accountTypes != null) { selectedAccountTypes.clear(); for (AccountType type : accountTypes.getBusinessObjects()) { selectedAccountTypes.put(type, Boolean.TRUE); ...
39bd7bda-19c6-416d-a337-292344a47153
6
public StringBuffer getOOXML() { StringBuffer cooxml = new StringBuffer(); cooxml.append( "<c:view3D>" ); cooxml.append( "\r\n" ); // rotX == anElev if( anElev != 0 ) // default { cooxml.append( "<c:rotX val=\"" + anElev + "\"/>" ); } // hPercent -- a height percent between 5 and 500. // rotY == a...
1043756e-3122-4a5f-b978-bec2d4d8de2f
8
protected Tuple fetchNext() throws TransactionAbortedException, DbException { /*while (hasMoreChild1Tuples) { while (hasMoreChild2Tuples) { // Loop through every child1 tuple in the cached page for (int i = child1Index; i < child1Max; i++) { Tuple...
4a3ac643-aa9b-4eff-a341-691a5a675c4b
9
protected void runTestOnData(Instances data) { // count numeric atts int numeric = 0; for (int n = 0; n < data.numAttributes(); n++) { if (data.attribute(n).isNumeric()) numeric++; } // perform tests for (int n = 0; n < data.numInstances(); n++) { try { AlgVector v = new AlgVe...
ca4ccd73-40cb-4d0d-b7d9-d482f714351f
8
public void process(ByteBuffer _buffer) { int messageType = _buffer.getInt(); Response response; switch (messageType) { case Response.MSG_CLIENT_REGISTER: _LOGGER.log(Level.FINE, "MSG_CLIENT_REGISTER"); response = registerClient(_buffer.getInt()); ...
5d21d5f7-6113-44aa-85c9-dd49960b08fd
9
protected static Inet6Address getScopedInetAddress(Inet6Address addr) { if(addr == null) return null; Enumeration<NetworkInterface> en; List<InetAddress> retval=new ArrayList<>(); try { en=NetworkInterface.getNetworkInterfaces(); ...
64c9b0ef-73c7-43b1-b1f4-5bbc821a7e82
7
public static commandReturn findCommand(String data){ commandReturn RETURN = new commandReturn(); if(data.indexOf("{COMMAND}") != -1){ String[] commandSplit; String commandNum; String[] commandParams = new String[0]; String commandOther; comma...
bbcb8161-90ed-4ee2-b368-46ba5c8541c9
9
private static String docidFromURL(URL url) throws HostNoGV, NoQuery, NoDocId, DocIdInvalid { /** Google Video */ String queryURL; int startDocId, endDocId; if ((url.getHost() == null) || (url.getHost().indexOf("video.google.com") == -1)) { throw new HostNoGV(); ...
e9cfc8cb-62fb-4bd4-9d15-c2c5ac7fdcc6
9
protected static Ptg calcQuartile( Ptg[] operands ) { Ptg[] aveoperands = new Ptg[1]; aveoperands[0] = operands[0]; Ptg[] allVals = PtgCalculator.getAllComponents( aveoperands ); CompatibleVector t = new CompatibleVector(); double retval = 0; for( Ptg p : allVals ) { try { Double d = new Double...
f4a5c244-78d0-4571-ab7a-a46dcb61aa12
3
public void visit_dup_x1(final Instruction inst) { // 0 1 -> 1 0 1 if (Tree.USE_STACK) { saveStack(); final StackExpr s1 = (StackExpr) stack.pop1(); final StackExpr s0 = (StackExpr) stack.pop1(); final StackExpr[] s = new StackExpr[] { s0, s1 }; manip(s, new int[] { 1, 0, 1 }, StackManipStmt.DUP_X...
619dd280-5105-4b86-9a05-027d98ddf3ae
2
public List<Book> displayAll() { List<Book> bookList = new ArrayList<Book>(); try { // Erforderlicher SQL-Befehl String sqlStatement = "SELECT * FROM bookworm_database.books;"; // SQL-Befehl wird ausgeführt myResultSet = mySQLDatabase.executeSQLQuery(sqlStatement); while (myResultSet.next()) { ...
bf4e43b9-d8d9-48ee-9aaf-1563e501d88e
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...
a499825c-b18c-4cb5-8d61-8ac6b9106d59
6
protected int getAddressingMethod(String code) { if (this.register.equalsIgnoreCase("0")) { this.isIndexed = false; } else { this.isIndexed = true; } if (code.indexOf("*") == -1) { this.isIndirect = false; } else { this.isIndir...
b5b2860d-0613-43c6-83e8-11edafc5e658
9
public void affectEntity(EntityLiving par1EntityLiving, EntityLiving par2EntityLiving, int par3, double par4) { int var6; if ((this.id != heal.id || par2EntityLiving.isEntityUndead()) && (this.id != harm.id || !par2EntityLiving.isEntityUndead())) { if (this.id == harm.id && !par...
a74608c1-b228-48d2-9a28-bd4104f309e8
3
public void addPalavra(String palavra, int numLinha) { int existepalavra = 0; for (Palavra listaPalavra : listaPalavras) { if (listaPalavra.getPalavra().equalsIgnoreCase(palavra)) { listaPalavra.addLinha(numLinha); existepalavra++; } ...
ebe96ca6-c3c5-4b89-b737-cf92d14ec9c5
4
public static DocumentInfo getDocumentInfo(String pathname) { // Handle an invalid pathname if (pathname == null) { return null; } // Check all the recent files for (int i = 0, limit = frameInfoList.size(); i < limit; i++) { DocumentInfo docInfo = (DocumentInfo) frameInfoList.get(i); if (docIn...
3ef9e77f-c0e3-4f3c-bfb1-67f98770c5ed
3
public void addTemplateFields(String initial, String rule, String encoding) throws IOException { LinkedHashMap<String, String> updatingRequestField = requestFields .get(initial); if (updatingRequestField == null) throw new IOException(); if (rule.split("=").length == 1 || encoding.split(":").length == 1...
a22e67ec-1117-4837-918f-2e1ab362193b
9
public int[] retornarCoordenadaDe(int idObjeto){ int[] posicion=null; for(int i=0;i<dimension;i++){ for(int j=0;j<dimension;j++){ if(matriz[i][j]==idObjeto){ posicion=new int[2]; posicion[0]=i; posicion[1]=j; ...
701004cc-9fdc-4dc3-8d76-e5f3986d19dc
9
public static int determineSeed(Output output, ParameterDatabase parameters, Parameter seedParameter, long currentTime, int offset, boolean auto) { int seed = 1; // have to initialize to make the compiler happy String tmp_s = parameters.getString(seedParameter,null); if (tmp_s==null && ...
0b9edccc-f9da-4c74-b8bf-1c331a035660
2
private static void subarray(int i, int j) { // TODO Auto-generated method stub int l=0,m=0; int k=1,n=1; int whowin = none; for(l = 3*i-2 ;l<3*i+1;l++ ){ n=1; for(m = 3*j-2;m<3*j+1;m++){ currentarray[k][n] = totalarray[l][m]; n++; } k++; } whowin = checkarray(currentarray,cross);...
a3335ca5-7803-4f92-91d7-d87f53d6b316
8
@Override public Screen respondToUserInput(KeyEvent key) { switch (key.getKeyCode()) { case KeyEvent.VK_NUMPAD4: player.moveBy(-1,0); break; case KeyEvent.VK_NUMPAD6: player.moveBy(1,0); break; case Key...
4c9713f3-b74f-49c0-8444-82bfef9e6d5e
0
public InfoRequest addEmail(String email) { emails.add(new EmailContainer(email)); return this; }
8e18398e-71ab-4435-8437-c42cac1e915c
9
void generate() { if (rootDoc == null || outputdir == null) { return; } PackageDoc[] pds = rootDoc.specifiedPackages(); for (int i = 0; i < pds.length; i++) { // If -nodeprecated option is set and the package is marked as deprecated, // do not convert ...
419b4965-e4ab-42fc-b350-ffc3267c19dc
9
private void finalizarLlegada(int input, int output) { TorniqueteDAO dao = new TorniqueteDAO(); boolean verif = dao.registrarActualizar(GUI2.torniquete_id); boolean verifHora = dao.registrarActualizarHora(GUI2.torniquete_id); boolean verifDia = dao.registrarActualizarDia(GUI2.torniquete_...
0cbb2e60-8d0a-44b2-8825-4d35fde2a641
1
public void transform(InputStream xmlSourceStream, InputStream xslSourseStream, OutputStream resultStream) { try { Source xmlSource = new StreamSource(xmlSourceStream); Source xsltSource = new StreamSource(xslSourseStream); TransformerFactory transFact = TransformerFactory.newInstance(); Tra...
c611c6d3-d8f0-443a-8f3f-3888023334d5
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('...
f7d1dfae-6dc0-471b-8235-ce25f18cdc86
7
private int getScore(Point[] points) { int playerone=0; int playertwo=0; for(int i=0;i<points.length;i++) { if(points[i].getState()==Board.PLAYER_ONE) { playerone++; } else if(points[i].getState()==Board.PLAYER_TWO) ...
2abcd4b6-0766-41c1-baa8-b690ee52ba68
7
public void run(){ try{ Display.setDisplayMode(new DisplayMode(800,600)); Display.setVSyncEnabled(true); Display.create(); Display.setFullscreen(true); Camera.setCurrentCamera(new Camera(0, 2, 0, 0,0,0)); initGL(); getDelta(); // call once before loop to initialise lastFrame lastFPS = getTime(...
4a611e2c-0d3b-4a2b-ab7a-77084afb671b
9
public void mouseReleased(MouseEvent mouseEvent) { if (treePane.getDragRectangle() != null) { Set<Node> selectedNodes = treePane.getNodesAt((Graphics2D) treePane.getGraphics(), treePane.getDragRectangle().getBounds()); if (!mouseEvent.isShiftDown()) { treePane.clearSelec...
c10cdc12-d6d8-4008-80b8-6aa4cab1d8a7
3
private static String getDir(String paramString) { if (paramString == null) { return null; } File localFile = new File(paramString); if ((localFile.isDirectory()) && (localFile.canRead())) { return localFile.getAbsolutePath(); } return null; }
09254e0d-33bd-4526-a196-1ca108e3ffe8
7
public static void main(String[] args){ EntityManagerFactory emf; EntityManager em; emf= Persistence.createEntityManagerFactory("colectivos.odb"); em= emf.createEntityManager(); //A CONTINUACION SE CARGAN CIUDADES Ciudad ciu; int i; String[] ciudades = {"Y...
bfa6a952-2d76-4e38-9dd2-9288679032ad
6
@Override protected boolean process(Token token) { // start tag, end tag, doctype, comment, character, eof switch (token.type) { case StartTag: insert(token.asStartTag()); break; case EndTag: popStackToClose(token.asEndTag()); ...
11fe6838-4adb-4be2-9209-5f5a23a51771
2
public void calculate_pcm_samples(Obuffer buffer) { compute_new_v(); compute_pcm_samples(buffer); actual_write_pos = (actual_write_pos + 1) & 0xf; actual_v = (actual_v == v1) ? v2 : v1; // initialize samples[]: //for (register float *floatp = samples + 32; floatp > samples; ) // *--floatp = 0.0f; ...
050bf1cb-ca85-4a7e-b10a-1b66de7bca23
6
public void drawModel(Graphics2D graphics, Actor actor, Color color) { Model model = actor.getModel(); if (model == null || !model.isValid()) return; Vec3[][] vectors = model.getVectors(); graphics.setColor(color); int gx = actor.getLocation().getGx(); int gy = actor.getLocation().getGy(); for (Vec3[] ...
98d8c5b4-caa2-480c-87c8-52d4efc622aa
5
@Override protected void inspectContents(File file, String contents) { StringBuffer buf = new StringBuffer(); // Split it into lines StringSplitter splitter = new StringSplitter(contents, getLineEnding()); // Scan each line int totalMatchesForThisFile = 0; int lineCount = 1; while (splitter.hasMore...
6e907025-28ad-41b6-9759-8f16d78c6293
4
public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String[] cards = {"2","3","4","5","6","7","8","9","10","J","Q","K","A"}; String[] faces = {"♣","♦","♥","♠"}; String[] allCards = new String[52]; int caunt = 0; Random random = new Random(51); int randomNu...
8da78130-b4e9-4d19-93b9-4288ed33ef62
2
public Iterable<String> keysWithPrefix(String prefix) { Queue<String> queue = new Queue<String>(); Node<Value> x = get(root, prefix, 0); if (x == null) return queue; if (x.val != null) queue.enqueue(prefix); collect(x.mid, new StringBuilder(prefix), queue); return queue; ...
57870106-236f-49e6-ac07-a801ed27f61d
2
private int setToBeHuffed(){ FactoryOfPlays factory = new FactoryOfPlaysForPlayer(player); if (factory.isEmpty()) return 0; AbstractPlay bestPlay = factory.getBest(); int max = bestPlay.eatNumber(); if (max > 0) player.getBoard().getPiece(bestPlay.getStart()).setHuff(true); return max; }
da806991-10ca-406c-b5d9-75bc32df6706
9
private void pathRek(int x, int y,String path) { if(matrix[y][x]==0) { alignmentPrint(path, y, x); //System.out.println(path); } else { if(y==0) { String temp=path+"I"; pathRek(x-1,y,temp); } if(x==0) { String temp=path+"D"; pathRek(x,y-1,temp); } else { if(m...
80009d83-47e4-441a-8e6b-c696b89eddcb
0
public void setRows(int rows) { this.rows = rows; }
620947bf-2093-47dc-9b13-2b7361316a73
6
public EFontAlign mirror(boolean h, boolean v) { return pos[x == 1 ? 1 : (h ? (x == 0 ? 2 : 0) : x)][y == 1 ? 1 : (v ? (y == 0 ? 2 : 0) : y)]; }
c953dce1-f6ae-4ec9-99d4-3045b0c1164d
1
@RequestMapping(value = "/login", method = RequestMethod.POST) public ModelAndView loginUser(@RequestParam String userId, @RequestParam String password, @RequestParam int department, HttpServletResponse response) { ModelAndView modelAndView = new ModelAndView(); String result = service.login(userId, password...
b57042d7-2940-4965-b213-068d777f35d2
2
public void testPropertyAddNoWrapMinute() { TimeOfDay test = new TimeOfDay(10, 20, 30, 40); TimeOfDay copy = test.minuteOfHour().addNoWrapToCopy(9); check(test, 10, 20, 30, 40); check(copy, 10, 29, 30, 40); copy = test.minuteOfHour().addNoWrapToCopy(39); check(co...
036003b7-d096-44b1-964d-86a1d812b3ea
7
public void backspace() { TextGrid.DataGridCel cel; // Do nothing if we are at the beginning if (rowOffset + colOffset + currentCol + currentRow == 0) { return; } if ((currentCol + colOffset) == 0 && (currentRow + rowOffset) != 0) { // Get a \n in the pr...
e1dd1278-a05e-4b31-a959-a0cd1fe67114
0
public TransformsType getTransforms() { return transforms; }
752cb0b3-f95e-4d8a-9111-1db904a24366
8
public void creat(List[] input,String strFileName) throws RowsExceededException, WriteException, DocumentException{ try { String newFile = strFileName.substring(0, strFileName.length()-4); System.out.println("newfile"+newFile); WritableWorkbook book = Workbook.createWorkbook(new File(newFile+...
c26a86c8-0e7e-4771-a8cb-4a6cb3f9ccdf
9
public void writeFile(){ try{ PrintWriter output = new PrintWriter(fileName); output.println(scores.size()); output.println(madeMoney); for(PlayerPanel p: scores){ boolean gg[] = p.getGoodG(); output.println(p.getName()); ...
256b6282-df86-4dd1-b072-6c6e304a9205
5
public Construct readNext() throws SyntaxError { patternSearch: for (LanguagePattern lp : LanguagePattern.searchValues()) { Symbol symbol = lexer.nextToken(); int start = lexer.getIndex(); for (;;) { switch (lp.tryNextToken(symbol)) { case LanguagePattern.PATTERN_ENDED: return lp.fetchProduct()...
07e12356-3fb6-489e-b33a-b54bc9459683
5
public void renInven() { int index; String oldName, newName; InventoryListObject inventoryListObject; if ( tpContent.getTabCount() > 0 ) { index = tpContent.getSelectedIndex(); oldName = tpContent.getTitleAt( index ); newName = JOptionPane.showInputDialog( Data.getView(), "New ...
ee20c0a8-4c0f-4809-91c6-be175d7ca516
3
public java.lang.Object get(int field$) { switch (field$) { case 0: return to; case 1: return from; case 2: return body; default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } }
9cf94d08-a7e1-4aad-a3f8-288c3df98ff1
2
private void asetaVoittoteksti(String teksti){ char[] voittaja = teksti.toCharArray(); char[] voittoteksti = new char[pelinVoitti.length + voittaja.length]; for (int i=0; i<pelinVoitti.length; i++){ voittoteksti[i]=pelinVoitti[i]; } for (int j=0; j<voittaja.l...
fbec2da6-a144-4305-a710-60febd9208b5
9
public static Class<?> getClass(Type type) { if (type instanceof Class) { return (Class<?>)type; } if (type instanceof ParameterizedType) { ParameterizedType paramType = (ParameterizedType)type; return getClass(paramType.getRawType()); } else if (type instanceof WildcardType) { WildcardType wil...
e4c1e133-b819-4402-81ca-7c085ef50289
2
public void passaTudoPraWait() { lockS.remove(0); if (waitList.isEmpty()) { ArrayList<String> aux = (ArrayList<String>) lockS.clone(); waitList = aux; } else { for (int i = 0; i < lockS.size(); i++) { waitList.add(lockS.get(i)); } ...
bd178ba5-20db-4689-9ef5-3d7018a1247b
5
@Test public void newBoardTest() throws IOException { Server server = makeServer(); //board1 adds correctly assertTrue(server.newBoard("board1")); assertTrue(server.getBoardsHashtable().containsKey("board1") && server.getBoardsHashtable().size() == 1); //board...
ce9ddd1f-bff1-4a66-a965-d044c7951328
5
private void solve() { Scanner scanner = new Scanner(System.in); a = scanner.nextInt(); m = scanner.nextInt(); seed = scanner.nextInt(); scanner.nextLine(); String line = scanner.nextLine(); while (line != null) { char[] encryptedText = line.toCharArray(); for (int i = 0; i < encryptedText.length; i...
4940bf60-ad24-4240-89fb-58fda8c6688c
9
public static StatisticalSummaryValues aggregate(Collection<SummaryStatistics> statistics) { if (statistics == null) { return null; } Iterator<SummaryStatistics> iterator = statistics.iterator(); if (!iterator.hasNext()) { return null; } SummarySta...
d6e7afd5-2419-48a6-ba7b-a454da93dd2f
3
public final void removeBlock() { if (outer instanceof SequentialBlock) { if (outer.getSubBlocks()[1] == this) { if (jump != null) outer.getSubBlocks()[0].moveJump(jump); outer.getSubBlocks()[0].replace(outer); } else outer.getSubBlocks()[1].replace(outer); return; } EmptyBlock eb = ne...
413ec564-19ee-4b36-a37a-113203b7745e
0
@Override public List<String> getGroups() { return (List<String>) groups.clone(); }
0c0bd94d-7855-4d83-9d59-f2e0b1a7cbb3
5
@Override protected void initiate_constraint_feature(int label) { m_phi_Z_x = new double[C][CONT_SIZE]; m_b = new double[CONT_SIZE]; m_q = new double[C]; //Arrays.fill(m_b, 5e-2); if(label == 0) { m_phi_Z_x[0][0] = -1; m_phi_Z_x[1][0] = 1; m_phi_Z_x[1][1] = -1; m_phi_Z_x[2][1] = 1; ...
b7ab4351-850d-4d3a-bf15-75ea8d40f47a
6
public void findSum(TreeNode root,int sum,int curSum,LinkedList<Integer> col){ if(root == null){ return ; } curSum += root.data; col.add(root.data); if(root.left==null&&root.right==null&&curSum == sum){ print(col); } if(root.left!=null) findSum(root.left,sum,curSum,col); if(root.right!=null) ...
9e38d1f1-2afa-4c26-9d7a-8945ce3145f3
4
public void act() { // sends information to expandImage method where it stretches the paddle if(enlarge > -1) { expandImage(getImage().getWidth()+1); // expand by 1 more animation enlarge++; // stop expansion when reached 25 times if(enlarg...
ccc6c95c-ea95-4244-80c3-830e20645700
2
private com.authy.api.User userFromXml(int status, String content) { com.authy.api.User user = new com.authy.api.User(); try { Error error = errorFromXml(status, content); if(error == null) { JAXBContext context = JAXBContext.newInstance(Hash.class); Unmarshaller unmarshaller = context.createUn...
7105f2bd-c9b9-42ee-a979-0876e417ec27
9
public void drawUniverseSchematic(){ schematicContainer.getChildren().clear(); // x and y location to draw components, xt is used to reset x back to original value int x, y, xt; // Positions to start drawing x = 50 + (int)mouseInfo.offX(); y = 50 + (int)mouseInfo.offY(); xt = x; //Draw some...
22fe6400-73bc-4558-99e8-61ee8e340640
2
public final void unpush() { // First, move 'back' one position backwards. if (back_pos > 0) back_pos--; else { back_pos = size - 1; back_chunk = back_chunk.prev; } // Now, move 'end' position backwards. Note that obsolete end chunk ...
3340983d-14e2-44fb-bba5-0026f005251e
9
private TextBlock getCircledCharacter(ILeaf entity, ISkinParam skinParam) { final Stereotype stereotype = entity.getStereotype(); if (stereotype != null && stereotype.getSprite() != null) { return skinParam.getSprite(stereotype.getSprite()).asTextBlock(stereotype.getHtmlColor()); } final UFont font = SkinPar...
96dd7d9b-e85b-4163-b41a-c6f4ed6ffc42
7
public FilledContainer(String name,String containerType, String baseType , HashMap<String, Double> liquids, double... parameters ) { this.parameters = parameters; this.name = name; this.containerType = containerType; this.baseType = baseType; if( containerType.equalsIgnoreCase("straitght") ) { ...
837a2158-83e1-411f-85c7-8b9a37eff881
1
@Override public boolean event(QEvent e) { if (e.type() == Type.Enter) { over.emit(row, col); } return super.event(e); }
c359feaa-878c-4b6c-a275-3282392e5b7e
1
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(getLHS()); // buffer.append("->"); buffer.append('\u2192'); String rhs = getRHS(); buffer.append(rhs.length() == 0 ? Universe.curProfile.getEmptyString() : rhs); // buffer.append('\n'); return buffer.toString(); }
07c1055a-d9d8-486e-8dc7-83de9b007173
7
public void communicate(String host, int port) { // Geranate a socket to conect a server. try (Socket socket = new Socket(host, port)) { // reading thread Thread readT = new Thread(new Runnable() { public void run() { try (BufferedReader sbr = new BufferedReader( new InputStreamReader(socket...
c828f54f-e4fa-41ef-9eb7-fba20db806b0
2
public static void main(String[] args) { try { access = CycAccess.getNewCycAccessInteractively(); helloWorldExample(); exampleConnectingToCyc(); exampleContantsManipulations(); exampleNartManipulations(); exampleAssertionManipulations(); exampleSynchronousQueries(); e...
e84a8dd6-20ff-4ade-a2bd-a336916b0d38
3
private boolean notDelegated(String name) { if (notDefinedHere.get(name) != null) return true; int n = notDefinedPackages.size(); for (int i = 0; i < n; ++i) if (name.startsWith((String)notDefinedPackages.elementAt(i))) return true; return false;...
e8ec4d3d-2ce9-49e2-849f-7bd4db799f14
1
public String getRequests() { String res = ""; for (Iterator<String> e = requests.iterator(); e.hasNext();) { res += e.next(); } return res; }
4dc23443-9494-4e97-9da0-5146aca78adb
5
private void calculateStudentFines(Book book, User user, int monthBack, int dayBack, int yearBack) { int daysInMonth = 31; int monthsInYear = 12; int daysInYear = 366; double totalDaysOut = 0; int yearDiff = yearBack - book.getYearOut(); int monthDiff = monthBack - book.getMonthOut(); int dayDiff =...
a7736044-d4f5-4df9-9702-a6bbc2959b2a
8
public Floor(DataBuffer buffer) { while (true) { int attributeId = buffer.getUnsigned(); if (attributeId == 0) { break; } else if (attributeId == 1) { rgbColor = buffer.getTribyte(); rgbToHSL(rgbColor); } else if (attributeId == 2) { textureID = buffer.getUnsigned(); ...
198bba6e-7d15-49cd-8668-b4d90e2295ca
9
public void sortTheList(String mode) { Vector<Track> sortedList = new Vector<Track>(); int smallest = -1; float smallestValue = 0; while (tracksList.size() > 0) { for (int i = 0; i < tracksList.size(); i++) { float relevantValue = 0; if (mode.equals("bpm")) relevantValue = tracksList.get(i).getB...
3028f7d2-029a-46d6-955a-8dbcee127e99
7
private void createGrid(int m, int n, boolean edges) { double dy = 20 + 50 / Math.sqrt(m); double dx = 20 + 50 / Math.sqrt(n); System.out.println(dx + " " + dy); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { createVertex(j * dx, i * dy, getNewVer...
f3407163-84aa-4191-aa7e-0e88304eb2d5
0
public String getTitle() { return title; }