method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0b807046-bb14-414f-a165-f478130174de
4
public static void main(String[] args) { List<BigInteger> comb = new ArrayList<>(); int start = 2; int limit = 100; for (int a = start; a <= limit; a++){ for (int b = start; b <= limit; b++) { BigInteger c = BigInteger.valueOf(a).pow(b); if (!comb.contains(c)){ comb.add(c); } } } ...
45ee5665-9f31-4d8e-8cea-b2bf3df1d33d
8
public List<List<Integer>> levelOrderBottom(TreeNode root) { List<List<Integer>> result = new LinkedList<List<Integer>>(); if (root == null) { return result; } Stack<LinkedList<TreeNode>> levels = new Stack<LinkedList<TreeNode>>(); LinkedList<TreeNode> currentLevel = new LinkedList<TreeNode>(); currentLe...
bfdae558-9e43-42c9-bf15-ebea2b4f455e
3
private void initializeResource() { try { final String mappingFileName = "/pinyindb/pinyin_gwoyeu_mapping.xml"; final String systemId = ""; // Parse file to DOM Document setPinyinToGwoyeuMappingDoc(Parser.parse(systemId, ResourceHelper.getResourceInpu...
7b63502d-e6fd-49e9-92d8-c0ba928ff20e
4
@Override public HostRecord addressForHost(String domainName) throws Exception { String fullUrl = requestUrlStub + domainName; URL url = new URL(fullUrl); HttpURLConnection connection = null; //set up out communications stuff connection = null; //Set up the initial connection ...
09260eba-04cc-4c78-92ae-f91c3dde2437
2
public void loadTestMap() { for(int i = 0; i < 64; i++) { for(int j = 0; j < 46; j++) { zoneArray[currentZoneX][currentZoneY].setTile(i, j, 64, "dirtgrass", false, false); } } }
22fcd264-97c7-48a0-9d51-1f10b8a94570
9
Node TransformationalQuery(Node n, ArrayList<String> kw) { exp = new Node(n); steps.clear(); do { AFL.clear(); steps.add(exp.infix()); int max = 0; for (DynamicFormula aKB : KB) { if (aKB.q_simplify(exp)) //if it is applicable ...
0f100001-0974-4eb4-8eaa-83237a4724b9
9
private boolean takeStepNew(int i, int j) { if (i == j) return false; /* init */ double alpha1 = alpha[i]; double alpha2 = alpha[j]; double b_old = b; int y1 = model.getY()[i]; int y2 = model.getY()[j]; double E1 = d(i) - y1; double E2 = d(j) - y2; double s = y1 * y2; // Compute L and H do...
fb611ae1-30e6-4058-bfcd-ca7778a9daee
0
@Column(name = "sale_id") @Id public int getSaleId() { return saleId; }
8601a805-215a-4203-8dfe-f924f5e508b8
3
private static int findShortest(Pair<Integer, Integer> curr, ArrayList<Pair<Integer, Integer>> others) { int totalHeurist = 0; int index = -1; int shortest = Integer.MAX_VALUE; Pair<Integer, Integer> start = curr; while(others.size() > 0){ shortest = Integer.MAX_VALUE; for(int i = 0; i < oth...
d92413e8-2393-431e-b17c-ea928d95e796
2
@Test public void smallInsertTest(){ Fibonacci Fiheap = new Fibonacci(); for (int i = 4; i != 0; i--) { Fiheap.insert(i); } Fibonacci Fiheap2 = new Fibonacci(); for (int j = 4; j != 0; j--) { Fiheap2.insert(j); } Fibonacci unio...
5f73960c-3795-4bd6-8878-d9d9df5c849e
8
protected String get_sub_ct(String digraph, HashMap<Character,Pair<Integer>> map, char[][] square) { assert(digraph.length()==2); char c1=digraph.charAt(0); if(c1=='J') { c1='I'; } char c2=digraph.charAt(1); if(c2=='J') { c2='I'; } StringBuilder sb=new StringBuilder(); Pair<Integer> rc1=map...
53553ec4-ed91-4a23-b6f4-fd0773f2fc8a
0
public String getFatherUrl() { return fatherUrl; }
50c877b2-d059-4196-85df-d938f7838fa1
4
public String toString() { StringBuilder buff = new StringBuilder(); for (int y = height-1; y>=0; y--) { buff.append('|'); for (int x=0; x<width; x++) { if (getGrid(x,y)) buff.append('+'); else buff.append(' '); } buff.append("|\n"); } for (int x=0; x<width+2; x++) buff.append('-'); buff.a...
089cbfaf-aa1e-4e53-93dc-e0ebc7dd4ab0
5
public String sumTask(String a, String b) { int add = 0; StringBuilder res = new StringBuilder(); int m = a.length(); int n = b.length(); if (m < n) { String c = a; int p = m; a = b; b = c; m = n; n = p; } m--; n--; while (m >= 0) { int tmp = (int) (a.charAt(m) - '0') + add; ad...
7c277897-1c68-4714-a3df-6fe6cc9cc2dc
0
public static org.hibernate.SessionFactory getSessionFactory() { return sessionFactory; }
926abc32-8222-49b1-8748-7e7960a8186d
3
public void readCommandLineArguments(String[] args) { //Debug flags if (args.length == 0) args = getDebugArgs(); for (String arg : args) if (arg.toCharArray()[0] == '-') readFlag(arg.substring(1)); }
00b46078-d321-430c-be5c-f93e5fada025
5
public void CreateTextureSetsSkinBodyMale_1RBS() throws Exception { // it copies SkinBodyFemale and changes the textures getting out of RBS folders. SPProgressBarPlug.setStatus("Create texture sets skin Body Male"); for (TXST t : ListRBSTXSTMerger) { if (t.getEDID().contains("SkinBod...
74944a9d-1eea-477b-b2ca-eb6d780ee358
0
public void done() { okButton.setEnabled(true); }
7a02c484-6595-4a83-bd2e-453e82740abd
9
@Override public void run() { if (!fromInteractive) { System.out.println(introMessage); } System.out.println("\nFILE = " + file.getAbsolutePath() + "\n"); // input scanner Scanner sc; try { sc = new Scanner(new FileReader(file)); } catch (IOException e) { System.out.println("ERROR:\n\tFile no...
69a5275f-7cea-42b6-8e12-25a94912371d
7
public int[] searchRange(int[] A, int target) { int[] result = new int[] { -1, -1 }; if (A == null || A.length == 0) { return result; } int pos = binarySearch(A, target, 0, A.length - 1); if (pos == -1) { return result; } int start = pos; int end = pos; while (start >= 0 && A[start] == target) {...
6b72d42d-f726-4ae5-ad3a-a81fb9ac81b6
6
@Override /* * Shrinks or enlarges this panel */ public void actionPerformed(ActionEvent e) { //If this panel's width is below 15 or above 185, the animation is done, and the //width will be set to its max or min value if ((currentWidth < 15 && !show) || (currentWidth > 185 && show)) { currentWidth = sho...
a2e5f799-d5ed-44b1-9063-b8bb246660ed
9
@Override public long periodUntil(DateTime endDateTime, PeriodUnit unit) { if (endDateTime instanceof OffsetTime == false) { throw new DateTimeException("Unable to calculate period between objects of two different types"); } if (unit instanceof ChronoUnit) { OffsetTime end = (OffsetTime) endD...
873241f1-21ec-4589-bff3-4b5e69b3aad6
8
@Override public void recordRoll(int pinsKnockedDown) { assert 0 <= pinsKnockedDown : "pinsKnockedDown = " + pinsKnockedDown + " < 0!"; assert pinsKnockedDown <= 10 : "pinsKnockedDown = " + pinsKnockedDown + " > 10!"; assert (getCurrentBall() == 1) || ((getCurrentBall() == 2) && (((getCurrentFrame() == 10) && ...
de18a12d-876a-403b-8fad-65f0d14d147f
9
private void updateStateTellIngredients(List<Keyword> keywords, List<String> terms) { //We should have come here by a keyword jump and the recipe shouldve been passed or set if (keywords != null && !keywords.isEmpty()) { for (Keyword kw : keywords) { if (kw.getKeywordData().getType() == KeywordType.RECIPE) { ...
36f6aead-0307-4d99-95df-fe9a7824b210
6
public void resetAnimState() { if (stateNew == null) return; if (stateNew.scaleH != 1 || stateNew.scaleV != 1) g.scale(stateNew.scaleH,stateNew.scaleV); if (stateNew.angle != 0) gl.glRotatef(stateNew.angle,0f,0f,1f); if (stateNew.pos.x != 0 || stateNew.pos.y != 0) g.translate(stateNew.pos.x,stateNew.pos.y); ...
b710cc2a-675d-4da3-b22a-496d2337583f
4
public void checkcmd() { a = 1; b = 0; c = 3; for (a = a; b != c; a++) { if (getConfig().contains("cmd" + a)) { } else { b++; } } if (b == c) { if (getConfig().getBoolean("debug") == true) { ...
836bc832-5fe1-4aa4-8647-d4211c0ffd1c
8
private void jButtonPesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPesquisarActionPerformed Material material = new Material(); DadoMaterial dadoMaterial = new DadoMaterial(); if (!jTextFieldTitulo.getText().isEmpty()) { dadoMaterial.setTitulo(jTex...
dcdf753f-3fc0-40e5-a072-0cb25399de7c
3
@Override public void run() { if(implementacao == 1) leitorEescritor(); else if(implementacao == 2) try { naoLeitorEescritor(); } catch (InterruptedException e) { e.printStackTrace(); } }
81929add-8070-4498-a2cf-af311168bb3d
4
public static boolean DeletePrefix(String hostname) { System.out.println("delete");//debug Read(hostname); List<String> todel = new ArrayList<String>();//list to delete for(String s : Prefixes) { String[] split = s.split(" "); if(split[0].equalsIgnoreC...
d7e2b52f-a2cd-439f-a659-31c9e636920b
3
public static void unpackConfig(Archive archive) { Stream stream = new Stream(archive.get("seq.dat")); int length = stream.getUnsignedShort(); if (Sequence.sequenceCache == null) { Sequence.sequenceCache = new Sequence[length]; } for (int i = 0; i < length; i++) { if (Sequence.sequenceCache[i] == null) ...
3d68c494-69f6-40a0-aa2f-984aec765f06
3
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed try { selectedRoom.setName(jTextField1.getText()); selectedRoom.setDetail(jTextField2.getText()); String price = jTextField3.getText(); double price1 = ...
27fd0694-0a3d-4668-b2d0-64a83ffffe00
0
public boolean isPayment() { return payment; }
1cf50eb1-8c9a-4ffe-96dc-7c192d2b4008
6
@Override public Imagem aplica(Imagem imagem) { Imagem novaImagem = new Imagem(imagem.getWidth(), imagem.getHeight()); boolean mudou = true; while(mudou) { mudou = false; int metadeTamanho = (int) Math.floor((float)getTamanho() / 2); ...
045999a8-7422-40e1-98e5-f95288e2b15a
5
public int updateAccel() { double rate = getVelocity(); while (lastRates.size() >= SmartDashboard.getNumber("numPoints")) { lastRates.removeElementAt(0); } lastRates.addElement(new Double(rate)); double avgX = 0; for (int i = 0; i < lastRates.size(); i++) { ...
56fbec4c-8cea-4b71-886a-3c9ffd7ad521
6
public static void updateComponents() { if (ViralSpread.debug) { // Print out all of the connections. System.out.println("----"); for (Person[] c : hardConnections) { System.out.println(c[0] +"\t\t"+ c[1]); } } // Create an ordered copy of the list of connections so that we can modify it. Linked...
8b70d974-7d55-4768-8bf5-1e5915d00002
6
public String getOnePair() { StringBuilder stt = new StringBuilder(); //search for 1 pair. //if found, return the pair and the highest kickers if (cards[0].getRank() == cards[1].getRank()) { stt.append(Character.toString(cards[0].getCharCard())) .append(...
ee4424b9-a437-4d03-918d-a8a0111ab9c0
1
private void popup( int x, int y, Component invoker ){ ContextCapability item = getContext( x, y ); if( item != null ){ item.context( site( x, y, invoker ) ); } }
34a172db-290a-410c-881b-ef04a02df7eb
5
@Override public List<DataRow> select(DataRow parameters) { List<DataRow> wynik = new ArrayList<>(); String stm; String tabelName = parameters.getTableName(); List<DataCell> select = parameters.row; String kolumny = ""; fo...
ee83d68a-12af-4c9e-bc74-d9a7bcededf8
6
public String scanNonWhiteSpaceString() throws StringScanException { StringBuffer sbuf = new StringBuffer(len); int idxSave = idx; char c; skipWhiteSpace(); if (idx == len) { StringScanException e = new StringScanException(idx, "end of input"); idx = idxSave; throw e; } el...
bd9ef4e6-c9e8-42cd-835e-43a30cb99457
7
public void readLevel(String filename, Graphics g) { // Read in the level try { URL level = new URL("http://projects.schwertly.com/adventron/levels/" + filename); BufferedReader br = new BufferedReader(new InputStreamReader(level.openStream())); String strLine = br.readLine(); int index = 0; w...
a905d0a4-250c-4949-945a-8fe75a94b021
4
@Override public boolean equals(Object o){ if (!(o instanceof Creature)){ return false; } Creature c = (Creature)o; if (this.x != c.x || this.y != c.y || !this.dir.equals(c.dir)){ return false; } return true; }
7fe3095d-6c7b-42ef-9e34-c16e85ce8f00
6
private Score[] sortScore(ArrayList<Score> list) { Score[] topScores = new Score[3]; int max = 0; //Checks if the list got 3 elements to fill the topscores list, else create new scores to fill it out if(list.size() >= 3) { max = 3; } else { max = list.size(); for(int i = 0; i < 3 -list.size()...
0501be02-6edf-44c0-9277-28374d3bc192
3
public ArrayList<Double> DwtZigzag(double[][] _pic, int _N, int _x, int _y, int _numCofficient) { //if _numCofficient is bigger than the whole picture, output the whole picture. if (_numCofficient > _N * _N) { _numCofficient = _N * _N; } if (_numCofficient <= 0) { ...
d62a9e5b-1202-46b9-91c0-273f1e57f9c9
6
public static void Draw(Graphics2D gg, int resize) { if (Game.player.get(Game.btl.currentplayer).unitselected) { int size = (int) Math.pow(2, Game.load.Times_Extras); units.Base unit = Game.units.get(Game.player.get(Game.btl.currentplayer).selectedunit); if (unit.moved&&!unit.acted) { Attacking(gg,unit,s...
60e32853-26e4-42d7-9d96-f0f7c5c9d25f
6
public boolean dfs(char[][] board, int i, int j){ if(j>=9) return dfs(board, i+1, 0); if(i==9) return true; if(board[i][j] != '.') return dfs(board, i, j+1); for(int n=1; n<10; n++){ board[i][j] = (char)(n+'0'); if(isValid(board, i, j)) { if(dfs(board, i, j+1)) return true; } board[i][j] =...
2ad0df84-a87b-40f0-9e86-b8bdfc5b31eb
9
public void operaciones(){ int tamarray=0, op; CCliente cliente; String dni=Pantalla.pideCadena("Introduzca nº DNI: "); for(int i=0; i<nregs; i++){//recorro el fichero entero con el for para saber cuantas cuentas tiene el cliente y pasar a crear el array con es...
b2eb9523-2129-4a7e-b1cc-7ecdd7b13edb
2
Map<String, String> getMutableMap() { return new Map<String, String>() { public void clear() { throw new UnsupportedOperationException(); } public boolean containsKey(Object key) { throw new UnsupportedOperationException(); } ...
97dfbe77-809b-4d79-a067-044719e9664f
2
public boolean findStateByName(String name){ for(State state : states){ if(state.mathByValue(name)) return true; } return false; }
ec0de216-ccd5-4c89-8e76-4ab31b15a594
7
private void initParams(){ // init W for(int i=0; i<_m; i++){ for(int j=0; j<_n; j+=2) this._parameters.setWeight(i, j, 0); for(int j=1; j<_n; j+=2) this._parameters.setWeight(i, j, 1); } // init b for(int i=0; i<_m; i+=2) this._parameters.setVisibleBias(i, 0); for(int i=1; i<_m; i+=2) ...
d7bf4266-44bb-4ef0-8f9d-2a07178d9314
8
public static void main(String[] args) { //ObjectFactory objFact = new ObjectFactory(); String movie = ""; Item item = null; while(true) { movie = CLib.input("Movie"); //JAXBContext context = null; try { /*context = JAXBContext.newInstance(Root.class); File file = new File("./omdbapi_text.xm...
1cd29811-76be-47ea-bc04-573babd9f9fe
4
private void btnSignUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSignUpActionPerformed String password = new String(passField.getPassword()); if(!("".equals(txtUserName.getText()) || "".equals(password))){ try { if(createUser()){ ...
4f1141b2-79e6-47ad-9cf7-72fbe41a6088
5
public float[] computeOutput(float[] input) { // проверки if (input == null || input.length != inputSize) throw new IllegalArgumentException(); // вычислим выход final int size = matrix.length; float[] output = new float[size]; for (int i = 0; i < size; i++) ...
7fb059fc-28ce-4349-ae28-ee9874057782
4
private boolean _jspx_meth_c_if_1(javax.servlet.jsp.tagext.JspTag _jspx_th_c_otherwise_0, PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // c:if org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_t...
5d036c65-b4d0-446c-b736-da7ccf94e0d3
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...
2f16831d-279c-4b65-8ebc-3320583a987e
9
public double distance(int x, int y) { if (x >= left && x <= right) { if (y >= top) { if (y <= bottom) { return 0; } else { return y - bottom; } } else { return top - y; } } else if (y >= top && y <= bottom) { if (x < left) { return left - x; } else { ret...
4085197f-40fc-403e-805e-be568ba07d6d
7
public static boolean unplacedArmies() { if (GameData.PLAYER_AMOUNT == 2) { if (GameData.PLAYER_ONE.getUnplacedArmies() == 0 && GameData.PLAYER_TWO.getUnplacedArmies() == 0) { return false; } return true; } else if (GameData.PLAYER_AMOUNT == 3) { if (GameData.PLAYER_ONE.getUnplacedArmies() ==...
90cbfbb7-6409-43b5-bb06-06eaa897276e
7
@Override protected void writeRecords(CompanyCollection companies, CsvWriter csvWriter, Boolean isIncremental) throws IOException { csvWriter.writeRecord(FACT_FILE_HEADERS); csvWriter.flush(); for(Company c : companies) { try {// "VALUE", "TIME", "ACCOUNTS (GEN_ID)", "DATASET (GEN_ID)" // Agresso Da...
128199f3-4aad-491d-8bda-235482901196
7
public void equipDrow() { final Armor chainMail = CMClass.getArmor("DrowChainMailArmor"); if(chainMail!=null) { chainMail.wearAt(Wearable.WORN_TORSO); this.addItem(chainMail); } Weapon mainWeapon = null; Weapon secondWeapon = null; final int weaponry = CMLib.dice().roll(1,4,0); switch(weaponry)...
ca09e2fb-653b-44d2-91da-408e5c8deee5
8
public PingjiaoResultVO getStudentPjResult(CourseVO course) { String sql = "select " + "stustatus," + "tchresult " + "from " + "class " + "where " + "course_grade=? and " + "course_semester=? and " + "course_name=? and " + "student_id=?;"; String[] parameters = { course.getGrad...
31d72aae-25ba-4f7c-b9fb-4846d4df906c
8
static void P(int SMax, int OMax){ int S = 0; int O = 0; int STemp = 0; int OTemp = 0; int OCounter = 0; while(O <= OMax){ S = 0; while(S <= SMax){ //code start OTemp = 0; STemp = S; OTemp = 0; STemp = S; if(STemp == 4){ OTemp = 4; }else{ if(STemp == 2){ ...
f355662c-7a3e-4368-aff5-091eb3370b92
7
@Override public boolean tick(Tickable ticking, int tickID) { if(tickID==Tickable.TICKID_MOB) { if(affected instanceof MOB) { final MOB mob=(MOB)affected; if(myTarget==null) myTarget=mob.getVictim(); if((myTarget!=mob.getVictim()) ||(myTarget==null)) { if(mob.amDead()) ...
df45b377-bf2b-4305-a676-7b7e15eaf7ce
5
public static void deliverQueue() { Runnable resetCommandLimit = () -> { if(!botMessages.isEmpty()) { Iterator it = botMessages.entrySet().iterator(); while (it.hasNext()) try { Entry m = (Entry) it.next(); String s = (String) ...
1d5086aa-5c5c-4936-adef-6f71cac8e069
9
final boolean method2799(int i, int i_1_, int i_2_) { anInt6739++; if ((((Class348_Sub12) this).anInt6747 ^ 0xffffffff) >= (i_1_ ^ 0xffffffff) && ((Class348_Sub12) this).anInt6750 >= i_1_ && i >= ((Class348_Sub12) this).anInt6746 && ((((Class348_Sub12) this).anInt6735 ^ 0xffffffff) <= (i ^ 0...
7f00f575-3804-4330-80e9-e12c23acb006
8
public static void main(String[] args) { // TODO code application logic here int opcion=0; Scanner teclado= new Scanner(System.in); do{ System.out.println("Digite la opcion del ejercicio a evaluar"); System.out.println("Ejercicio 1"); ...
6670b3c9-f11f-48ba-be65-142f044e80cb
0
@Override public Disciplina clone() { return new Disciplina(this); }
f1e7957c-99a4-4e61-a3a2-26bffc1f073e
4
protected int readInt(InputStream in) throws IOException { int numRead = 0; int offset = 0; while (offset < intbuf.length && (numRead = in.read(intbuf, offset, intbuf.length)) >= 0) offset += numRead; if (offset < intbuf.length) throw new RuntimeException( "End of stream reached before reading enough ...
a331b459-0f0b-4f94-be48-2255a8d1d262
4
public String getRandomDate() { Random rn = new Random(); String day; String month; String date; day = Integer.toString(rn.nextInt(28)); month = Integer.toString(rn.nextInt(12)); if (day.length() < 2) { if (day.equalsIgnoreCase("0")) { ...
954adce5-919b-4eb9-b474-f80a092f4e73
8
private static boolean pathsMatch(String p1, String p2) { if ((p1 == null && p2 != null) || (p2 == null && p1 != null)) { return false; } if (p1 == null && p2 == null) { return true; } //at this point neither p1 nor p2 are null if...
86634455-bf69-4c9c-9bc0-f5df68cd9fb6
9
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); HashMap<Integer, Integer> colorNum = new HashMap<Integer, Integer>(); for (int i = 0; i < n; i++) { int color = sc.nextInt(); ...
fb5e1da3-42d2-42d5-bc08-2040dcb863d9
7
public String subraction(String first, String second) { StringBuilder sBuilder = new StringBuilder(); //Stringbuilder int length = first.length(); second = matchLength(length, second); //Matchar längder int carry = 0; int i = 0; if(second.length() > length) //Om second är längre än first { length =...
1ab24351-e197-4322-b65d-882c956ac586
7
private int negB(int dest) { clearFlags(SR_X, SR_N, SR_Z, SR_V, SR_C); int result = -dest; if (msbSetB(result)) setFlag(SR_N); if (isZeroB(result)) setFlag(SR_Z); if (msbSetB(dest) && msbSetB(result)) setFlag(SR_V); if (msbSetB(dest) || msbSetB(result)) setFlag(SR_C); if (isCarrySet()) setEx...
04cb07d5-a214-44d8-8593-4f5430422423
3
public void computePaths(Vertex source) { source.minDistance = 0.; PriorityQueue<Vertex> vertexQueue = new PriorityQueue<Vertex>(); vertexQueue.add(source); while (!vertexQueue.isEmpty()) { Vertex u = vertexQueue.poll(); // Visit each edge exiting u for (Edge e...
f5172aab-4b34-4bd7-8ba7-c3e643fbfbd2
4
@MethodInformation(author="Wolfgang", date="09.12.2012", description="Gives back a double that describes the average of all used Diesel of all sowing DieselTraktor") protected double avgDieselTraktorSeed() throws DivideByZeroException { MyIterator it = (MyIterator) traktoren.iterator(); double sum = 0; int count...
0c4aff7d-38bf-430c-8930-faad4afccfb8
4
public int search(String docs) { int M = pattern.length(); int N = docs.length(); for (int i = 0; i <= N - M; i++) { int skip = 0; for (int j = M - 1; j >=0; j--) { if (pattern.charAt(j) != docs.charAt(i + j)) { // calculate skip value skip = Math.max(1, j - right[docs.charAt(i + j)]);...
2a997af9-ceec-4222-8e68-5711573a861d
0
@Override public String getSubdomain() { return subdomain; }
15c0e62e-aa08-4d0a-be44-bb820f8df283
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the * to str...
ce61fba8-00eb-449a-b1e9-857a4d49cecb
8
@Override protected void internalTransform(Body body, String phaseName, Map<String, String> options) { SootMethod method = body.getMethod(); if (method.getDeclaringClass().getName().startsWith("MethodCounter")) { return; } counterClass = Scene.v().loadClassAndSupport("MethodCounter"); increaseCounte...
9ddf743e-a4de-4f6b-9af7-c6e33bbfaea2
4
@Override protected ArrayList<Row> getSheetValues() { // TODO Auto-generated method stub ArrayList<Row> sheetValues = new ArrayList<Row>(); for(int i=0;i<Integer.valueOf(vehicleCount.getText());i++){ Row sheetRow = new Row(); sheetRow.setData("BuyerNumber", buyerNumber.getText()); sheetRow.setData("Buye...
58bc01d1-d8dc-4caa-b87f-497df072186b
9
@Test public void randomTest() { // Set up a list of all the operations we performed. (That way, // we can replay a failed test.) ArrayList<String> operations = new ArrayList<String>(); // Keep track of the values that are currently in the sorted list. ArrayList<Integer> vals = new ArrayList<In...
4cff1631-0cd6-4979-ba60-5be5978a1a4b
8
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((action == null) ? 0 : action.hashCode()); result = prime * result + ((emagResource == null) ? 0 : emagResource.hashCode()); result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); result ...
8491953c-a5d3-4f04-b442-30d77620edd6
6
static HashSet<ArrayList<String>> plusK(HashSet<ArrayList<String>> left, HashSet<ArrayList<String>> right, int k){ HashSet<ArrayList<String>> res = new HashSet<ArrayList<String>>(); for(ArrayList<String> l : left){ for(ArrayList<String> r : right){ ArrayList<String> union = n...
6eff634c-d751-4697-9446-5a90993895c6
5
public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ /* 2 0 2 10 5 3 5 */ ArrayList<LinkedList<Integer>> arrList; LinkedList<Integer> list; Scanner sc=new Scanner(Sy...
020bb58f-9363-4fdd-a978-12b0d1efd0b8
8
public final static URL getMbRelease(String artist, String album) throws MusicbrainzUrlException { if(artist == null || artist.equals("")) throw new MusicbrainzUrlException("The artist is null or empty"); if(album == null || album.equals("")) throw new MusicbrainzUrlException("The album is null or e...
d785fc5f-3bb4-40a3-afb2-ccf453e4836d
1
public boolean drop(Coord cc, Coord ul) { if (dt) { wdgmsg("drop", cc); return (true); } return (false); }
714df8a2-c932-482c-88bb-8ce78e0efa22
1
public void setParameter(String paramName, String param){ String[] prms = requestParameters.get(paramName); if (prms != null) { List<String> list = new ArrayList<>(Arrays.asList(prms)); list.add(param); requestParameters.replace(paramName, (String[]) list.toArray()); ...
0e252cd4-281f-433a-922a-715563f1c736
7
public ObservableList getneocpData(ObservableList<NEOCP> neocpData) { String nextLine; String failedLines = ""; URL url; URLConnection urlConn; InputStreamReader inStream; BufferedReader buff; List pccp = pccpobjectdesigs(); try { // Create the...
517570c4-f955-42f5-a4dd-f274357f67d2
1
public void enableStatistique(boolean bool){ if (bool == true){ statistique. setVisible(true); panelCentre.setVisible(true); }else { statistique. setVisible(false); panelCentre.setVisible(false); } }
9f76b288-d2a7-4c1d-bbfa-edc0c96e017a
9
public void initialize(FlowChartInstance flowChartinstance, ChartItemSpecification chartItemSpecification) throws MaltChainedException { super.initialize(flowChartinstance, chartItemSpecification); for (String key : chartItemSpecification.getChartItemAttributes().keySet()) { if (key.equals("id")) { idName = ...
5781f1b5-4343-475b-a59a-3609c360625a
7
public void listener(){ try{ ServerSocketChannel ssc = ServerSocketChannel.open(); ServerSocket server = ssc.socket(); Selector selector = Selector.open(); server.bind(new InetSocketAddress(port)); ssc.configureBlocking(false); ssc.register(selector, SelectionKey.OP_ACCEPT); while(true){ s...
24d130f0-0edf-4871-8987-8e3269b52cc5
2
public void cargarComboDepto(){ int codigoEdificio=Integer.parseInt(codEdificio.getText()); Lavanderia l = new Lavanderia(); ArrayList<String> listado = l.listarDeptos(codigoEdificio); if(listado !=null){ for (int i = 0; i < listado.size(); i++) { ...
597141ab-c879-46d3-bbc1-ed704a7bfc91
4
public static Storage createStorage(JSONObject data) throws JSONException { switch (convertType(data.getString("type"))) { case Dir: return new net.elbandi.pve2api.data.storage.Dir(data); case Nfs: return new net.elbandi.pve2api.data.storage.Nfs(data); case Lvm: return new net.elbandi.pve2api.dat...
cc014dbc-2102-4deb-850e-4071e422fa18
8
public static double pow_hi(double x,double y) { if (x < 0) return Double.NaN; else if (x == 0.0) return 0.0; else if (y > 0) { if (x >= 1) return exp_hi(mul_hi(y,log_hi(x))); else if (x==1) return 1.0; else return exp_hi(mul_hi(y,log_lo(x))); } ...
3fa4624d-80e2-4c09-a9e4-a1ec87915400
0
@Override public double distribute(TVC newCon) { return distribute(environment.getConnectionsSortedDown(), newCon); }
bda18fe4-30f1-4f5f-9647-7ba865331d63
9
private void UpdateResultingFPS() { float FPS = 0; if (FPSField.getText().isEmpty()) { FPS = Parent.Camera.GetFPS(); } else { FPS = Float.parseFloat(FPSField.getText()); } if (SkipSecondsButton.isChecked()) { if (SkipSecondsField.getText().isE...
4480ebb8-be5c-4329-962a-c51bcd5b9318
7
public void analyzeBPELProcess(){ //zeigt an, dass hier ein BPEL-Prozess analysiert wird bpelTest = true; XMLParser xmlParser = new XMLParser(); Element bpelRoot = xmlParser.parseXMLFile(bpelFileName); Namespace ns = bpelRoot.getNamespace(); BPELReader bpelReader = new BPELReader(); Vector sources ...
258e8161-e62f-4b63-bbca-623493545d38
2
@Override public void move(int dir){ super.move(dir); if(dir == 3){ animation = rRun; } else if(dir == 2){ animation = lRun; } sprite = animation.getCurrentFrame(); }
01791c46-2683-4bb3-9520-c51bad7f222b
5
public void execCommand(Connection conn, String cmd, ArrayList<String> list, ArrayList<String> errorList) throws RemoteException { try { /* Create a session */ Session sess = conn.openSession(); sess.execCommand(cmd); /* * get the printed information of stdout and stderr. */ InputStream st...
69837475-1382-4eb3-937a-fc7513630764
8
private void checkForInput() { if (getGame().getInputHandler().left.down && getWorldXPos() > 0) { setGoLeft(true); } else { setGoLeft(false); } if (getGame().getInputHandler().right.down && getWorldXPos() < getGame().getWorld().getWorldPixelSize() - width) { setGoRight(true); } else { setGoRight(f...
d091b154-421a-4d00-ae8a-a1f178d9aa72
7
private void updateTile(int var1, int var2, int var3, int var4) { if(var1 >= 0 && var2 >= 0 && var3 >= 0 && var1 < this.width && var2 < this.depth && var3 < this.height) { Block var5; if((var5 = Block.blocks[this.blocks[(var2 * this.height + var3) * this.width + var1]]) != null) { va...
6979b4f9-ef2c-4f27-b288-857f65aa506c
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...