method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9446c31c-afd2-4a32-9b32-6c49bea10f1a
1
public static String bytesToHex(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; for ( int j = 0; j < bytes.length; j++ ) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars); ...
e65fe79d-0ba7-4950-ae44-89a09daf3d1a
5
@Override public int se_connecter(String id, String mdp) { //On verifie que ce n'est pas l'admin. //TO DO: Ici, on ecrit les idée et mdp de passe en dure, à changer et mettre dans le fichier xml if(id == "admin" && mdp =="admin") { etat = Etat_du_controleur.GERANT_CONECTE; return 1; } /* SIN...
9e4df320-d76d-4076-b31a-a678de418310
5
public void keyPressed(KeyEvent e) { int keycode = e.getKeyCode(); System.out.println("key pressed: "); switch(keycode) { case KeyEvent.VK_UP: System.out.println("up"); NewGameMenu.selector.moveUp(); newGameMenu.repaint(); break; case KeyEvent.VK_DOWN: System.out.println("down"); Ne...
6429b60a-e8f5-41ab-8b83-b6c9d8b3664d
3
public static double Phi(double z) { if (z < -8.0) return 0.0; if (z > 8.0) return 1.0; double sum = 0.0, term = z; int i=3; for (; sum + term != sum; i += 2) { sum = sum + term; term = term * z * z / i; } return 0.5 + sum * phi(z); }
52eba172-a738-4937-a230-0ba4b33dcd93
1
public InputStream getInputStream(){ try { return socket.getInputStream(); } catch (IOException e) {} return null; }
932b07b7-8ef2-407e-a90a-fb2f41bc770f
6
@Override protected void process() { super.process(); Monster actor = (Monster) ai.getActor(); currentTarget = newTarget; if (actor == null || currentTarget == null) { terminate(); return; } if (actor.isFeared() && actor.getFearedSource() ...
ba522181-a751-4136-820c-1253f0872d53
5
public static boolean isBalanced(TreeNode root) { if (null == root) { return true; } if (isBalanced(root.left) && isBalanced(root.right)) { int diff = getHeight(root.left) - getHeight(root.right); if (diff < 2 && diff > -2) { return true; } else { return false; ...
53c406a3-bfbe-4abb-a723-b8c22ddb794e
6
private static Map<Integer, List<Integer>> removeEdgeAndContractGraph(Map<Integer, List<Integer>> adjacencyMap, int vertex1, int vertex2){ //Pick the smaller vertex of two. Also replace the vertex no in all other vertices. int base1 = vertex1; //contracting into the smaller vertex int base2= v...
a8311de0-42a4-4240-9156-a89b6460d473
6
public int[] getCityNeighbours(int city) { int cntr = 0; for (int i = 0; i < roads.size(); i++) { String[] s = (String[]) roads.get(i); int c1 = Integer.valueOf(s[0]); int c2 = Integer.valueOf(s[1]); if ((c1 == city) || (c2 == city)) { cntr...
530ad2db-ad7e-4f46-875a-f1f5e590498f
4
private void initSpringConfig(SpringConfiguration springConfiguration, Environment environment) { logger.info("Using configurations: {}", join(springConfiguration.getApplicationContext(), ", ")); SpringPropertyPlaceholderConfigurerConfiguration propConfig = springConfiguration.getPla...
30e8d3ca-8a04-4cbe-b14d-73b89e76f5f2
2
public static double[] getVals(Param p) { Object o = p.getValue(); if (o.getClass() == double[].class) { return (double[]) o; } else if (o.getClass() == Double.class) { return new double[]{(Double) o}; } throw new IllegalArgumentException(p.toString()); ...
135b9e4e-1533-4848-8152-cb5d5791c5f5
1
public void boostprio(int newprio) { if (prio < newprio) prio = newprio; }
0000da1e-32ee-4120-bcbe-fba57c592411
5
public void update(){ for (int i = 0; i < pts.length; i++){ if (pts[i].x + velocity.x < 0 || pts[i].x + velocity.x >= Main.SIZE){ velocity.x *= -1; } if (pts[i].y + velocity.y < 0 || pts[i].y + velocity.y >= Main.SIZE){ velocity.y *= -1; ...
c290fac3-7fcd-4a2c-9f9f-08f92924ebe2
5
public boolean osta(Kortti kortti) { //try catch testausta varten try{ if (raha >= kortti.getHinta()){ raha = raha - kortti.getHinta(); kortit.add(kortti); //laittaa kauppaan uuden kortin ostetun tilalle if (korttiruutu == 1){ ...
f937cd37-719e-4e8a-ac90-91539e7d2b48
9
public void read() throws IOException { //we need to get the current key about our channel //The key returned when this channel was last registered with the given selector, or null if this channel is not //currently registered with that selector SelectionKey key = this.channel.keyFor(this.nioEngineImp.getSele...
36f4bafa-7917-45ed-80fd-b1fed105d225
7
private static String format(double x, int places) { String result = ""; String stack = ""; long t; // put in a minus sign as needed if (x < 0.0) result += "-"; // put in a leading 0 if (-1.0 < x && x < 1.0) result += "0"; else { t = (long)x; if (t < 0) t = -t; while (t > 0)...
9883a3e7-f2bb-4177-91e2-c93e2c1e1d78
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); if (string...
b8ebc2a1-ba99-4300-aae7-072b7ab0eb7e
1
public BTPosition<T> addRoot(T ele) throws NoEmptyTreeException { if (!isEmpty()) throw new NoEmptyTreeException("Tree already has a root"); size = 1; root = new BinaryTreeNode<T>(ele, null, null, null); return root; }
1f72f197-dd0f-4870-8f64-c188c19dfed0
0
public void setContactPos(String contactPos) { this.contactPos = contactPos; }
980a5454-8500-4ec8-a77d-f47edc98486f
2
public static void main(String[] args) { final Object lock1 = new Object(); final Object lock2 = new Object(); new Thread(new Runnable() { @Override public void run() { while (!Thread.currentThread().isInterrupted()) { synchronized (lock2) { synchronized (lock1) { System.out.println(...
1ad07f3b-4f33-4a5c-9544-1222c026845f
8
@SuppressWarnings("unchecked") private static <T extends Number> T parseNumber(String text, Class<T> targetClass) { if (text == null) { throw new IllegalArgumentException("Text must not be null"); } else if (targetClass == null) { throw new IllegalArgumentException("Target class must not be null"); } Str...
55906b6f-e30c-4c12-b6c3-261c4899e4ff
9
public void findRecordN(GeneralizedNode<Node<String>> generalizedNode) { /* Get all the components of given generalized node */ Iterator<Node<String>> gi = generalizedNode.iterator(); boolean similarChildren = false; while (gi.hasNext()) { Node<String> tagNode = gi.next(); ...
5da1706a-a3c3-4f12-93c0-0d87de2c46dd
7
public int evaluate(DBType left, DBType right, int op) { switch (op) { case Expression.EQ: return evaluateEQOrLike(left, right); case Expression.LIKE: if (right instanceof StringType) { right = new StringLikeType(((StringType) right).get()); } return evaluateEQOrLike(left, right); case Expressio...
425f014e-0e0e-463b-88d6-0d0b12799458
7
public String normalTrade() throws MonkeyTalkFailure{ Application app=new ConnectClass().connect(); try { app.tabBar().select("Markets"); app.button("Search").tap(); app.input("_searchField").enterText(cfdMarket, "enter", new Mods.Builder().thinktime(5000).build()); app.label(cfdMarket+"(2)").tap(...
128cce71-702d-490f-988d-533ef6020735
8
private Node<A> select(Node<A> node) { if (node.state.isTerminal() || node.numVisits < EXPAND_THRESHOLD) { return node; } ArrayList<Node<A>> candidates = new ArrayList<Node<A>>(); for (Node<A> n : node.children.values()) { if (n.numVisits < EXPAND_THRESHOLD) { candidates.add(n); } } int size...
328b0630-981f-4a9c-8cdd-bb15a6a616bd
3
@Override public int doStartTag() throws JspException { try { if (nameImg != null && !nameImg.isEmpty()) { JspWriter out = pageContext.getOut(); out.write("<img class='" + classImg + "' id='" + idImg + "' src='"); String path = pageContext.getServl...
19534725-df92-43a7-82d7-16462a186da2
5
public void setSubtotalRow(String countType, int rid, double[] subtotal, HSSFWorkbook workbook, HSSFSheet sheet) { HSSFRow row = sheet.createRow(rid); for (int k = 0; k < 10; k++) { try { switch (k) { case 3: excelUtils.setCellValue(subtotal[0], workbook, k, row, cellStyle.cellFontBoldBorderStyle);/...
456d0f36-efbd-4575-84f3-e841fa490069
5
public int removeDuplicates(int[] A) { if (A == null || A.length == 0) return 0; int current = A[0]; int last = 1; int count = 1; int maxCount = 2; for (int i = 1; i < A.length; i++) { if (A[i] == current) { count++; ...
e336d51b-5279-4ca3-a33b-8c73dc6d6d96
9
private Sentence findTokenSentence(Token token) { if(beforeSentences !=null) { for (Sentence s : beforeSentences) { for (Token t : s.getTokens()) { if (t.getID().equals(token.getID())) { return s; } } } } ...
8c82e9c8-ee19-4837-ac42-b9be771fb381
4
public void makeDeclaration(Set done) { if (type == FOR) { if (initInstr != null) initInstr.makeDeclaration(done); incrInstr.makeDeclaration(done); } cond.makeDeclaration(done); super.makeDeclaration(done); if (type == FOR && initInstr != null) checkDeclaration(declare); }
bfbc6ff7-6d44-4e97-86de-1ada77c36350
4
private void consumeNonExecutePrefix() throws IOException { // fast forward through the leading whitespace nextNonWhitespace(true); pos--; if (pos + NON_EXECUTE_PREFIX.length > limit && !fillBuffer(NON_EXECUTE_PREFIX.length)) { return; } for (int i = 0; i < NON_EXECUTE_PREFIX.length; i++...
0a463e3d-3c1d-4c79-a71f-884d9cb89bba
4
private void playDay() { String role; if (toSee != -1) { if (players2.isSeerDead()) { this.sendNotice(players2.getSeer(), getFromFile("SEER-SEE-KILLED", players2.get(toSee), NOTICE)); } else { if (players2.isDead(toSee)) { this.sendNotice(players2.getSeer(), getFromFile("SEER-SEE-TARGET-KILLED", ...
fbf0dda0-d13a-4f1a-b047-7968289980d0
3
public Path getImage(Brandingsize size) { Path ret = null; switch (size) { case SMALL: ret = this.imgSmall; break; case MEDIUM: ret = this.imgMedium; break; case LARGE: ret = this.imgLa...
2ebba2c0-c589-4225-a0c1-47e724f7a933
3
public static void main(String[] args) { Scanner s = new Scanner(System.in); String str; int temp = 0; int max = 0; System.out.println("Please enter a string of positve integers."); System.out.println("Please enter '-1' to end and find the maximum number...
06e70446-661b-4060-85eb-ceb969034ef6
7
public SplitResult split(String inputText) { if (inputText == null) { return new SplitResult(Priority.NONE, "", "", false, ""); } Matcher completedMatcher = COMPLETED_PATTERN.matcher(inputText); boolean completed; String text; if (completedMatcher.find()) { completed = true; text = completedMatche...
d985fbec-1d5d-42ad-a6e8-ff49a7df88b7
1
@Override public void run() { try { /*Lancement la connexion udp controleur*/ socketServerUdp = new DatagramSocket(Constantes.PortUDPSystem); new ServerUDPBus(socketServerUdp, this).start(); /*Lancement du TCP bus*/ new ServerTCPBus(this).start(); /*Lancement TCP controleur*/ new ServerT...
42752927-5b48-453b-955f-7333822ab652
8
private static HashMap<String, HashSet<Integer>> Compute(List<Integer> usedNumbers, int maxDigits) { if (_maxDigits <= usedNumbers.size()) { throw new RuntimeException("Should have stopped before"); } HashMap<String, HashSet<Integer>> results = new HashMap<String, HashSet<Integer>>(...
1eb26501-3122-49fb-b94c-6d56040bfcdf
3
private static double expint(int p, final double result[]) { //double x = M_E; final double xs[] = new double[2]; final double as[] = new double[2]; final double ys[] = new double[2]; //split(x, xs); //xs[1] = (double)(2.7182818284590452353602874713526625L - xs[0]); ...
b2cba187-f647-4ce3-a9bd-57900f7d2f19
0
static void u(Monster b) { b.menace(); }
8d4d7f92-28af-472c-be4c-a562987249a5
6
public static void startupPowerloom() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/POWERLOOM-CODE", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTE...
c83ec221-d106-498a-bac8-3f63ac75b35b
8
public String toString() { switch (level) { case LOG_OFF: return "off"; case LOG_TRACE: return "trace"; case LOG_INFO: return "info"; case LOG_WARN: return "warn"; case LOG_ERROR: return "error"; case LOG_FATAL: return "fatal"; case LOG_ALWAYS: return "always"; case LOG_ALL: r...
8e067e56-14a8-4f29-a637-aab4ef6f48e5
7
public String toString() { StringBuffer sb = new StringBuffer("<class>" + getClass().getName() + "</class>\n"); if (uid != null) sb.append("<uid>" + uid + "</uid>\n"); if (!layout.equals(BorderLayout.NORTH)) sb.append("<layout>" + layout + "</layout>\n"); sb.append("<width>" + getWidth() + "</width>\n"); ...
9d344c70-928d-4b61-b3c3-ad3788694dd3
5
final void method3381(int i, int i_77_) { anInt7180++; if ((i_77_ ^ 0xffffffff) <= -1 && (i_77_ ^ 0xffffffff) > -129) putByte(i_77_); else if ((i_77_ ^ 0xffffffff) <= -1 && i_77_ < 32768) putShort(i_77_ + 32768); else if (i == 5537) throw new IllegalArgumentException(); }
1f4c4200-0855-4359-a888-481e140dce18
5
public String read_block(char[][] block) { int col=block[0].length; StringBuilder sb=new StringBuilder(); int start_row=0; int total_row=block.length; while(start_row<total_row) { int end_row=start_row+5>=total_row?total_row:start_row+5; //int read=remain_row<5?remain_row:5; for(int i=0;i<col;i++)...
7300f383-a665-47c6-a9aa-70d7ea3d15d5
7
public static TestInstanceInfo findTestInstance(List<TestInstanceInfo> testInstances, String testName, String testInstanceName, Long testSetId) { TestInstance...
1141d5a6-6b4c-47dd-a19a-16af4518e52f
4
* The amount that the other creature is interested in sharing * @return true, if the combination is accepted, otherwise false. */ public synchronized boolean requestCombo(Plant plant, int amount) { if (!hasPartner() && !isAPartner && plants.contains(plant) && amount > 199) { WorldFra...
5adb4454-465e-45ea-a269-4f118cd760a7
4
public static UnplannablePeriodList parse(String in) { if (in.isEmpty()) return new UnplannablePeriodList(); String read = in; UnplannablePeriodList list = new UnplannablePeriodList(); int nextsplit = read.indexOf(','); while (nextsplit != -1 && read.length() > 1) { list.addUnplannablePeriod(Unplannable...
334455f1-2de8-4512-b03f-866803055d67
8
private void parse(){ if(parsenum != 666){ if(outfile != null){ FileWriter fw; try { fw = new FileWriter(outfile); for(int i=0;i<infiles.size();i++){ jade.data.GBParser ca = new jade.data.GBParser(infiles.get(i), parsenum); ArrayList<jade.data.Sequence> seqs = ca.getSeqs(); for(...
d2df765f-9008-4efe-af5f-c2b9d55370dd
8
public void saveGame() { File file = new File("Saved_Games.txt"); FileWriter writer; boolean flag = false; ArrayList<String> data = new ArrayList<String>(); ListIterator<String> iterator; String currentPuzzle = getCurrentPuzzle(); try { Scanner s = new Scanner(file); while(s.hasNextLine()) { dat...
d1c0b92e-5634-45c6-98a3-2f0f6d8a5fbf
8
public boolean importData(JComponent comp, Transferable t) { JTextComponent c = (JTextComponent)comp; withinSameComponent = c==exportComp; // if we are importing to the same component that we exported from // then don't actually do anything if the drop location is inside // the drag location and set shouldR...
ee553f19-373e-4be4-9ba9-eadcc2192e6b
8
public PrunedRotamers<Boolean> DoPruneStericTemplate(int numMutable, int strandMut[][], PrunedRotamers<Boolean> prunedRotAtRes, double stericE){ eliminatedRotAtRes = prunedRotAtRes; if (prunedIsSteric==null){ //no pruning runs done yet prunedIsSteric = new PrunedRotamers<Boolean>(numMutable,strandMut, t...
359e65e3-b9e5-4318-8f25-5073720f19f8
7
@Override public Map generateTiledMap(int width, int height, long seed, ProgressMeter progress) { Random rand = new Random(seed); byte[][] ret = new byte[width][height]; long num = 0; progress.tileGenProgress = 0; progress.stage = "Generating tiles..."; for(int x=0;x<width;x++) { for(int y=0;y<h...
04c2dcd1-85eb-488d-b4c1-cc66ca9c7a26
6
@EventHandler public void WitchFireResistance(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getWitchConfig().getDouble("Witch.Fir...
d6961971-fd83-4872-9a23-d5d1c32e1b5f
2
@Override public void salvar(Secao secao, Evento evento){ try { conn = ConnectionFactory.getConnection(); String sql = "INSERT INTO ingresso (id, idsecao) " + "VALUES ((SELECT NVL(MAX(id),0)+1 FROM ingresso)" + ",(SELECT secao.id " ...
e63e4869-8e6f-4eaf-9445-27db8e4528a3
4
private void checkRent(RentSign rent, Date currenttime) { if (!currenttime.before(rent.getPaytime())) { Player player = plugin.getServer().getPlayer(rent.getOwner()); if (plugin.getEconomy().getBalance(rent.getOwner()) >= rent.getPrice()) { plugin.getEconomy().depositPlayer(rent.getRenter(), rent.getPrice()...
ef860836-29bb-4bac-83d8-4fab155756ca
1
public int maxStack() { if (code != null) { return code.maxStack(); } return 0; }
20a2d0f4-130a-463a-894a-2a98dd948bcf
4
public void calculateKnockback(){ if(knockDir == 0) move(0, (int) -knockback); if(knockDir == 1) move((int) knockback, 0); if(knockDir == 2) move(0, (int) knockback); if(knockDir == 3) move((int) -knockback, 0); knockback -= 0.3; }
bcec397c-8609-4537-a487-8eab2bc4c2c5
9
public int bbandsLookback( int optInTimePeriod, double optInNbDevUp, double optInNbDevDn, MAType optInMAType ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 5; else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) ) return -1;...
449a1e2a-0f30-46d3-8122-3add3ee2b6e2
1
public void setVisible(boolean visible) { if(frame == null) buildGUI(); frame.setVisible(visible); model.doRefresh(); }
43005e78-488e-4b5b-a35d-505c2aec9ce5
5
public static void main(String[] args) { StreamGrabber streamGrabber = new YaStreamGrabber(); try { //streamGrabber.requestTrackList("las ketchup", 1); streamGrabber.requestTrackList("68298"); List<IMusicTrackInfo> musicList = streamGrabber.getTrackList(); if(musicList.isEmpty()){ System.out.pr...
87ffce52-bb54-4b2e-9bf4-28bde4f15a2f
0
@Before public void setUp() throws Exception { createInjector( new QuartzModule() { @Override protected void schedule() { Trigger trigger = TriggerBuilder.newTrigger().withSchedule( SimpleScheduleBuilder.repeatSecon...
7bf7f1c9-7c11-4ac3-991b-d45ebc8408a2
6
private Map<?, ?> createObjectContainer(ContainerFactory containerFactory){ if(containerFactory == null) return new JSONObject(); Map<?, ?> m = containerFactory.createObjectContainer(); if(m == null) return new JSONObject(); return m; }
52ad2437-3f27-4949-be44-be7b926495c0
1
public int get(int row, int clums) { int i = 0; File f = new File("C:/config/config.xlsx"); try { InputStream input = new FileInputStream(f); XSSFWorkbook xssfWorkbook = new XSSFWorkbook(input); XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0); XSSFRow xssfRow = xssfSheet.getRow(row - 1); XSSFCell ...
a861ac7e-0f4e-4692-b739-826a05a525d0
2
public Set<Transition<TransitionInput>> findValidTransitions(TransitionInput input) { Set<Transition<TransitionInput>> validTransitions = new HashSet<>(); for(Transition<TransitionInput> transition : transitions) { if(transition.isValid(input)) { validTransitions.add(transition); } } return validTra...
2b8759b7-192b-4c9c-95aa-1a2748d738a4
2
private static void registrarCD() { boolean salir; String nombre, codigo; float precio; CD cd; do { try { System.out.print( "Introduce el nombre del CD: "); nombre = scanner.nextLine(); System.out.print( "Introduce el cdigo del CD: "); codigo = scanner.nextLine(); System....
121b4959-a309-4576-8f60-96d00079702e
7
private static DisplayMode getDisplayModeFromFile() throws LWJGLException{ Scanner s = null; int targetWidth; int targetHeight; try { s = new Scanner(new BufferedReader(new FileReader("Settings.ini"))); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } ...
0949cd27-24cd-443f-966b-c18ce25fe98e
8
public Plateau(int largeur, int longueur) { my2dArray = new int [largeur][longueur]; //mise en place du plateau // tout est interdit for(int i = 0; i < getMy2dArray().length; i++) { for(int j = 0; j <getMy2dArray().length ; j++) { my2dArray[i][j] = -1;...
439228f0-b10b-4f56-98be-b6761901f63e
7
final String _decodeValue_() throws IllegalArgumentException { if (this.symbol() != '<') throw new IllegalArgumentException(); for (int symbol = this.skip(); symbol >= 0; symbol = this.skip()) { if (symbol == '<') { if (this.skip() != '<') throw new IllegalArgumentException(); } else if (symbol == '>') { ...
345ed4ca-47bc-4a01-beac-0ecb7fa825c5
5
@Override public boolean open() { WidgetChild wc; return MainTabs.ABILITY_BOOK.open() && (this.isOpen() || (wc = Widgets.get(BOOK_WIDGET, component)) != null && wc.visible() && wc.click(true) && new TimedCondition(2000) { @Override public boolean isDone() { return AbilityTabs.this.isOpen(); } }....
53f93137-a802-4a07-affa-7e8a91cc3ce2
7
private static int getDigitValue(char digit) { switch (digit) { case 'I': return 1; case 'V': return 5; case 'X': return 10; case 'L': return 50; case 'C': return 100; case 'D': return 500; case 'M': return 1000; } ...
5f04d1b5-103d-4b2a-baa5-e4ccc05b7eb1
4
public void assignWork(int workType, WorkManager wMan) { boolean assignedWork = false; for (int i = 0; i < minions.length; i++) { if (minions[i].workType == 0 && !assignedWork) { assignedWork = wMan.assignWork(workType, minions[i]); } } if (!assign...
a06adf42-21c8-4c5f-9d98-272446d683b5
7
public boolean keyDown (Event event, int key) { if (wave == null) return false; if (key >= 'a' && key <= 'z') key += 'A' - 'a'; if (key < '0' || key > 'Z') return false; int f = keyFrequencies [key-'0']; if (f == 0) return false; byte[] s = wave.getUlaw(); byte[] d = new byte [s.length...
7e5c767a-1b18-4ebe-9119-2902481905a5
8
private void performRitual( Player player, VoodooChest chest ) { VoodooRitual ritual = chest.getRitual(); log( "Ritual : " + ritual ); if( ritual.getType() == VoodooRitual.Type.CONVERSION ) { chest.convertMaterials( Material.GRAVEL, Material.DIRT, 2 ); chest.convertMaterials( Material.COAL , Material...
46cf088e-7606-4349-9f44-b6a695d0e9e1
2
public ArrayList<Integer> getRow(int rowIndex) { ArrayList<Integer> result = new ArrayList<Integer>(); result.add(1); while (rowIndex > 0) { int previous = 1; for (int i = 1; i < result.size(); i++) { int next = result.get(i); result.set...
ab810533-2d88-48e1-b11b-e4708f7433cf
6
public int findMissingNum(int[] intArray){ int bitCount = (int)(Math.log(intArray.length+1)/Math.log(2)); //in case intArray Length is between 2 pow n and 2 pow n+1, should set bitCount to n+1; if(Math.pow(2, bitCount) < intArray.length); bitCount++; System.out.println("Bitcount="+bitCount); ArrayList<I...
45b42e60-4e96-427f-91e0-4fb4ee105e63
1
public boolean maior(Data d1) { int totalDias = contaDias(); int totalDias1 = d1.contaDias(); return (totalDias>totalDias1)?true:false; }
edf61408-8362-4dcf-8ddb-14fc0411a4cf
5
public String toString() { StringBuffer string = new StringBuffer("(" + first + " ("); try { beforeFirst(); for (int row = first; row <= last; row++) { rs.next(); string.append("("); for (int column = 1; column <= columnCount; column++) { if (rs.getObject(column) == null) {string.append("NULL"...
6a943fb9-a5ef-4302-80f7-056768bafeeb
2
private void genKeys() throws NoSuchAlgorithmException, InvalidKeySpecException { BigInteger tmp; BigInteger testRes; while (true) { tmp = genPrime(KEY_SIZE); testRes = on.divideAndRemainder(tmp)[1]; if (testRes.compareTo(BigInteger.ZERO) != 0) { e = tmp; d = e.modInverse(on); return; ...
bd6263a3-29f5-4640-9677-63c60001a742
9
public void run() { System.out.println("Admin server initialized, listening on port " + m_serverSocket.getLocalPort()); while( true ) { try { m_socket = m_serverSocket.accept(); byte[] buffer = new byte[40960]; Pattern userPwdPattern = Pattern.compile("password:(\\S+)\\s+command:(\\S+)\\sCN:(\\S*)\...
a8e5cf7b-beab-4c50-a09c-07d606110c48
2
public static void rollbackQuietly(Connection conn) { if (conn != null) { try { conn.rollback(); logger.warn("The changes are rollbacked!"); } catch (SQLException e) {/* NOP */} } }
2c633872-d1f7-4daf-936b-41e3edc6616c
5
public org.omg.CORBA.portable.OutputStream _invoke (String $method, org.omg.CORBA.portable.InputStream in, org.omg.CORBA.portable.ResponseHandler $rh) { org.omg.CORBA.portable.OutputStream out = null; java.lang.Integer __method = (java.lang.Integ...
24127505-6fcc-4334-8ce2-f607bbc88cac
3
@Override public void setBounds(int locX, int locY, int width, int height) { int deltaX = locX - getLocationX(); int deltaY = locY - getLocationY(); super.setBounds(locX, locY, width, height); if (solidified) { for (GUIComponent component : subComponents) { ...
bc12b5bf-7c40-4e6a-8046-c3e954d920f2
3
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { System.out.println("CompressingFilter.doFilter()"); if (req instanceof HttpServletRequest) { HttpServletRequest request = (HttpServletRequest) req; System.out.println("CompressingFilter.do...
fe750243-ea21-44e9-927c-70d45e953a8d
5
public void addPart2(Statement statement, String line) { String communication2 = line.substring(10, 63).trim(); counterPartyBic = line.substring(98, 109).trim(); // Reset communicatie String communication = statement.getCommunication(); String transactionCode = statement.getTran...
59048293-a598-49c6-ae4c-f1003de49b49
4
public void storeOfflineXP(String playerName, String worldName, int Amount, String vassalName) { String SQL = "UPDATE " + tblOfflineGains + " SET amount=amount+" + Amount + " WHERE `player` = ? AND `world` = ? AND `vassal` = ?"; int updateSuccessful = 0; Connection con = getSQLConnection(); PreparedStatement ...
71001444-aa08-47f4-b72b-4aaf293e2fe5
0
public Iterator<Neuron> getInputNeuronIterator() { return inputNeurons.iterator(); }
d87a2cfd-0155-4ba8-8056-aff737108a17
1
public static void deleteEmployee(Integer ID) { Database db = dbconnect(); try { String query = "UPDATE employee SET bDeleted = 1 " + "WHERE EID = ?"; db.prepare(query); db.bind_param(1, ID.toString()); db.executeUpdate(...
d9555140-8659-458e-be34-8986c6896991
0
public Float getPrice() { return price; }
6507e672-282a-4654-87a1-b6eea1031bd7
4
public void moveFall(double height) { y = y + (int) getSpeed(); if(((int) y + (height + 5)) == 456) { setSpeed(0); canJump = true; } else if ((int) y + (height + 5) > 456) { setSpeed(0); y = y - 1; canJump = true; moveFall(height); } else if (!canJump && getSpeed() < 10) setSpeed(getS...
cd7ba85e-7bcc-447c-8d56-36bf179dbdfa
3
Map<String, String> generateManifestEntryPropertyMap(String pFilePath, ConfigFileEntry pConfigEntry, ManifestEntry pForManifestEntry){ Map<String, String> lResult = new TreeMap<String, String>(); //1) Start off with properties specified in the config entry for this file lResult.putAll(pConfigE...
f5a80325-4187-4a8e-84d8-f0f4f7912fea
1
int pow(int n, int base){ int res = 1; for(int i = 0; i < n; ++i){ res *= base; } return res; }
a2aefe5e-cc38-4486-9f5e-a1b906be2400
3
public World(Input input) throws SlickException { map = new TiledMap("res/testLevel.tmx"); collisionObjects = Lists.newArrayList(); worldEntities = Lists.newArrayList(); quadtree = new QuadTree(0, new Rectangle(0, 0, map.getWidth(), map.getHeight())); player = new Player(input); viewport = new Viewport(); ...
86392db1-0bac-43d9-84c7-1a9b21a14081
9
public void update() { switch (Controler.getState()) { case Controler.INIT : for(String s : Controler.getJoueurs()){ gamers.add(new Gamer(s)); } board.update(); gamers.getData().getRack().update(); Controler.setCurrentPlayer(gamers.getData().getNom()); Controler.setOk(); break; case Co...
16efcb24-5c39-40ad-8927-ca3fed7b29bb
8
public String read_atom() throws OtpErlangDecodeException { int tag; int len = -1; byte[] strbuf; String atom; tag = read1skip_version(); switch (tag) { case OtpExternal.atomTag: len = read2BE(); strbuf = new byte[len]; this.readN(strbuf); try { atom = new String(strbuf, "ISO-8859-1"); ...
2aacd6c0-2801-4b17-b8b5-f1ea72473c69
7
private Posicion probarPorColumna(int columnaTerreno, int[][] terreno, int[][] casa, Orientacion orientacion) { // asumo que entra boolean entra = true; // variables auxiliares int altoTerreno = terreno.length; int altoCasa = casa.length; int anchoCasa = casa[0].length; for (int filaTerreno = 0; filaT...
26418d7d-743d-41f3-bc34-7f61f8ca5863
0
@Override public String getTmp() {return tmp;}
b74b5334-7323-4124-a4c5-9019644c3c06
0
public String getNome() { return nome; }
a6730673-37dc-4498-8975-842371aba3aa
5
public void askCourse(List<Map<String, Object>> coursesDescription) { System.out.println(this.texts.get("borrow_askCourseID")); String result = ""; for (Map<String, Object> currentCourseDescription : coursesDescription) { Calendar startDate = (Calendar) currentCourseDescription .get("startDate"); Ca...
e0d3ed53-c1d9-489a-9697-d374941e4e11
4
public static void findPartition(String s, int begin, ArrayList<String> pt, ArrayList<ArrayList<String>> result) { if (begin >= s.length()) { ArrayList<String> copy = new ArrayList<String>(); for (int i = 0; i < pt.size(); i++) { copy.add(pt.get(i)); } result.add(copy); } for (int i = begin; i...
5bdef84b-991a-4326-a8d4-cc5e1ad8c927
7
@Override public boolean equals(Object obj) { if(this == obj) return true; if(obj == null) return false; if(getClass() != obj.getClass()) return false; VertexLocation other = (VertexLocation)obj; if(dir != other.dir) return false; if(hexLoc == null) { if(other.hexLoc != null) return f...