method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6f6f18f3-b3c0-4d9c-838b-950d5ee630cb
0
public void setLastName(String lastName) { this.lastName = lastName; }
a81b74b4-6fcf-44d7-b1e0-5b6103f18208
4
public void doDamage(Enemy e) { //isSplitting added for debug purposes if (Math.random()<0.1 || isSplitting()) { setSplit(false); Enemy newEnemy; try { newEnemy = e.getClass().newInstance(); newEnemy.setActionListener(listener); e.getRoad().enter(newEnemy); newEnemy.setHP(e.getHP()/2); }...
3c7cd9c7-56a9-4aa0-a4b8-4d15ef145201
8
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if (cmd.getName().equalsIgnoreCase("ar") || cmd.getName().equalsIgnoreCase("antirelog") || cmd.getName().equalsIgnoreCase("ar...
3903aed0-2ee0-4bdd-b537-8dabc4cdfed7
4
public String getRosterNames() { if ((trip == null) || (trip.getRosterCount() == 0)) { return "<?>"; } String r =""; for (int i = 0; i < trip.getRosterCount(); i++) { if (i > 0) r = r + ", "; r = r + trip.getRosterName(i); } return r; }
b9d54957-1469-4e4c-95ea-8d8f0bfc32d3
9
public void selectPosition(int position, char playerToken) { // Select the position switch (position){ case 1: this.setPosition(0,0, playerToken); break; case 2: this.setPosition(0,1, playerToken); break; case 3: this.setPosition(0,2, playerToken); break; ...
235829ea-2c80-481f-8242-6b2a2a721196
5
@Override public Object getValue() { Name n = getName(); try { Ptg[] p = n.getCellRangePtgs(); if( p.length == 0 ) { return new String( "#NAME?" ); } if( (p.length == 1) || !(parent_rec instanceof Array) ) { // usual case return p[0].getValue(); } // multiple values; create an ar...
bf6c9a13-0ca5-47f1-9a26-bec97b1a68f4
8
public void archiveResponse(Data data) { synchronized (this) { // aus den Daten das byte-Array anfordern. In dem Array sind die Informationen, // ob die Infoanfrage geklappt hat, gespeichert byte[] requestInfoResponse = data.getUnscaledArray("daten").getByteArray(); InputStream in = new ByteArrayInputStr...
33eefa1a-2516-4227-b22a-400114e874e1
1
@Override public void setPathShape( PathShape shape ) { if( shape == null ) { throw new IllegalArgumentException( "shape must not be null" ); } this.path = shape; }
f0ef351b-80bc-4f73-806d-6dbd8b536c9c
1
public void start() { init(); RenderUtil.initGraphics(); window.setIcon(); if(isRunning) return; run(); }
8eafdf14-ba9c-40f6-b736-b18bc952a9e4
7
public static void main(final String[] args) { /* Just go up to a million for testing sake */ int max = 1000000; int exponentMax = 100; List<Integer> list = new ArrayList<Integer>(); List<Integer> otherList = new ArrayList<Integer>(); for (int i = 3; i < max; i += 2) { otherList.add(i); System.out.p...
b2336af2-5456-4a97-95ec-c2625f901dd0
8
public void update() { if (health <= 0) { dead = true; if (Player.target == this) Player.target = null; deathTimer(); return; } if (!frozen) { anim++; if (anim % 100 == 0) { move = random.nextInt(5); // Comment to freeze movement anim = random.nextInt(50); // Comment to freeze movem...
24f016c7-66ce-4599-a1ed-17b63b9a6e4e
0
public static void runResultView(){ frames.runResultView(); frames.getResultView().setVisible(true); }
5807248b-07e1-4031-acc8-9e6592dc4cce
1
public void remover(InstituicaoCooperadora instituicaocooperadora) throws Exception { String sql = "DELETE FROM instituicaocooperadora WHERE id = ?"; try { PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql); stmt.setLong(1, instituicaocooperadora.getId()); stmt.executeU...
bfafb099-3d93-4740-91de-2679389eeae5
2
@Override public boolean equals(Object object){ if(this.x == ((DCoord)object).x && this.y == ((DCoord)object).y) return true; else return false; }
7bf685f8-4a3d-4731-bea9-bc861aad686d
6
public int getPlayCount(int player_id) { PreparedStatement pst = null; ResultSet rs = null; try { pst = conn.prepareStatement("SELECT times_played FROM ffa_leaderboards WHERE player_id=?"); pst.setInt(1, player_id); rs = pst.executeQuery(); while (rs.next()) { return rs.getInt("times_played"); ...
7d7c5b8b-9c02-41e6-82c0-41939a5f5910
8
@Override protected void onPrivateMessage(String sender, String login, String hostname, String message) { if (!message.startsWith("USERCOLOR") && !message.startsWith("EMOTESET") && !message.startsWith("SPECIALUSER") && !message.startsWith("HISTORYEND") && !message.startsWith("CLEARCHAT") && !message.startsW...
f2cda25d-5654-41a6-b546-fe966bfc13bf
9
public int max(int hori, int verti, int dia) { if (hori >= verti && hori >= dia && hori >= 0) { return hori; } else if (verti >= hori && verti >= dia && verti >= 0) { return verti; } else if (dia >= hori && dia >= verti && dia >= 0) { return dia; } els...
0ecfbad0-7c92-4334-ab2f-3b1da1f8ef2f
6
Fraction findFrction(double x) { boolean negative = false; if (x < 0) { negative = true; x = -x; } double max = 1d; double tmp = x; while ((long) tmp != tmp) { // still has decimal part max *= 10; tmp = x * max; } // denominator minimization via iterative division algorithm long i = (long)...
034b2201-1138-4b05-92bc-d76a7b53b054
3
private void checkRandom(){ int min=100,max=0,total=0; for(int i = 0; i <10000; ++i){ int x = (int) (Math.random()*100); if(min>x) min = x; if(max<x) max = x; total+=x; } System.out.println("Min: "+ min +"Mean: " + (total/10000) +" Max: "+ max + " Total: " + total); }
c377f867-f58f-4a56-abc7-81e1dd78fee5
6
public void readFromXMLPartialByClass(XMLStreamReader in, Class<?> theClass) throws XMLStreamException { int n = in.getAttributeCount(); setId(in.getAttributeValue(null, ID_ATTRIBUTE)); for (int i = 0; i < n; i++) { String name =...
045c0945-5572-4aa6-8f31-0bf92429b4d3
7
public void Solve() { ArrayList<Long> pentagonals = new ArrayList<Long>(); for (int n = 1; n < _max; n++) { long pentagonal = n * (3 * n - 1) / 2; if (pentagonal < 0) { throw new RuntimeException("Overflow for n=" + n); } pentagonals.add(p...
de57a174-81e4-4971-9cae-8502b3250435
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PlayerDescription other = (PlayerDescription) obj; if (id != other.id) return false; if (name == null) { if (other.name != null) retu...
e1d159a7-5f92-433e-b86a-1d60d43f3e30
2
public void sort(double[] pq) { int N = pq.length; // Create heap structure for (int k = N/2; k >= 1; k--) { sink(pq, k, N); } // Move largest item to end of unsorted section of the array while (N > 1) { Helper.exch(pq, 1-1, --N);...
6f9e2e75-28f4-4ffb-8d02-030929a2a271
9
int insertKeyRehash(int val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look un...
cfbf6893-f345-4ed0-8498-faec5d90a2c6
9
private void genererTerrain() { // génération de la grille d'effets (flammes) for (int hauteur = 1; hauteur < grilleJeu.length - 1; hauteur++) { for (int largeur = 1; largeur < grilleJeu[0].length - 1; largeur++) { effets[hauteur][largeur] = 0; } } // generation du millieu du plateau for (int ha...
3a161703-9c91-4886-9bb6-3098ba498bb1
0
public double getCost() { return this.cost; }
c68d5330-cdbd-474f-ac0f-e6077eb160f1
6
public int translateEscapeSequence(int[] buffer) { try { if (buffer[0] == LSB) { switch (buffer[1]) { case A: return TerminalIO.UP; case B: return TerminalIO.DOWN; case C: ...
f4427757-1720-498a-ad52-e3c58eda7c08
7
public static void multiRun() { System.out.println("alpha: "+alpha); int[] numLocs = {10000};//{1000,2000,5000,10000}; double[] detect = {0.01};//{0.005,0.01,0.02,0.05}; long[] duration = {EpiSimUtil.dayToSeconds(100)};//{EpiSimUtil.dayToSeconds(3),EpiSimUtil.dayToSeconds(7),EpiSimUtil.dayToSeconds(10),EpiSimUt...
70380075-871f-43de-a74d-65b119f48905
5
private double[][] createEmptyValueGrid(GeoParams geoParams, Operator operator) { double delta_y = Math.abs(geoParams.geoBoundNW.latitude - geoParams.geoBoundSE.latitude); double delta_x; if (geoParams.geoBoundNW.longitude > geoParams.geoBoundSE.longitude) { //We've wrapped around from 180 to -180, delta_x ...
197c88cd-c958-47c5-a029-a686dc2d583d
8
private double getAxisVal(int loc) { switch(loc){ case 0: case 7: return -1; case 1: case 6: return -.5; case 2: case 5: return .5; case 3: case 4: return 2; default: return 0; } }
fccd42a3-f185-426b-832d-355ab89fbbce
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final VtDataAck other = (VtDataAck) obj; if (acceptedOctetCount == null) { ...
e95343b2-12ea-4ec7-a7f9-2b9da4a9a505
3
public void updateScores(int result) { if (result == 0) { scores.incrementTie(); } if (result == -1) { scores.incrementLoss(); } if (result == 1) { scores.incrementWin(); } }
32e4e603-284d-4d0d-9d02-3fe7293e8135
9
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) { ...
9b42ea56-e410-4439-8ab3-a3bb1a221a95
7
public final void silence_statement_list(SS_scriptset scriptset) throws RecognitionException { try { // SayScript.g:513:48: ( ( silence_statement[scriptset] )+ ) // SayScript.g:513:50: ( silence_statement[scriptset] )+ { // SayScript.g:513:50: ( silence_statement[scriptset] )+ int cnt42=0; loop42: ...
d91ef1fd-447b-449e-b5b5-095246e7a91d
4
public static Set<Month> getMonthBySeason(Season season) { Set<Month> months = new HashSet<Month>(); switch (season) { case SUMMER: { months.add(Month.JUN); months.add(Month.JUL); months.add(Month.AUG); break; } case AUTUMN: { months.add(Month.SEPT); months.add(Month.OCT); months.add(Mont...
36b4480a-acf6-46be-b953-16f7e48c4b30
3
public void guardarArchivoOrigen() { byte c[]; try { clsEnKardex[] arreglo1; arreglo1=lista.toArray(arreglo); FileOutputStream file=new FileOutputStream("kardex.txt"); String n="~"; c=n.getBytes(); file.write(c); ...
4b56028c-6c07-40e2-a0da-255f1fd48216
3
@Override public void addPatient(Patient patient)throws Exception { // Get JDBC Connection Connection conn= JDBCManager.getConnection(); PreparedStatement stmt=null; String sql="INSERT INTO Patient "+ "(HealthRecordNumber,FirstName,LastName,Gender,Age) VALUES "+ "(?,?,?,?,?)"; try { ...
9a1e265b-3fb6-4f1e-801f-677644ba1d0e
9
public void getTwitterTimeline() { try { Twitter twitter = new TwitterFactory().getInstance(); try { RequestToken requestToken = twitter.getOAuthRequestToken(); System.out.println("Got request token."); System.out.println("Request token: " + requestToken.getToken()); System....
c7ce931a-d71c-44bf-9327-b6aeda86f604
7
final public BigDecimal Primary() throws ParseException { Token t ; BigDecimal d ; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case NUMBER: t = jj_consume_token(NUMBER); {if (true) return new BigDecimal( t.image ) ;} break; case OPEN_PAR: jj_consume_token(OPEN_PAR); d = Expres...
a3ea2f03-66f2-4481-af97-2c0d9ec03008
3
public void visitCheckExpr(final CheckExpr expr) { if (expr instanceof ZeroCheckExpr) { visitZeroCheckExpr((ZeroCheckExpr) expr); } else if (expr instanceof RCExpr) { visitRCExpr((RCExpr) expr); } else if (expr instanceof UCExpr) { visitUCExpr((UCExpr) expr); } }
fd2b38bc-7b53-41ad-9596-a1b746244a3a
5
public static ArrayList<File> GetAllFiles(String src, String ext, boolean recurse) { ArrayList<File> ret_files = new ArrayList<File>(); File[] files = new File(src).listFiles(); for (File f : files) { if (f.isDirectory()) { if (recurse) ret_files.addAll(GetAllFiles(f.getPath(), ext, recurse)); ...
f40e2880-6f2b-4248-b835-0129826c7839
5
public void generateParenthesisDFS(int left, int right, String s) { if(right < left) return; if(left == 0 && right == 0){ res.add(s); } if(left > 0){ generateParenthesisDFS(left - 1, right, s + "("); } if(right > 0){ generateParenthesis...
48072a48-2ff2-4f0e-8169-3297535580b5
2
public void damage(int amt) { if(state == STATE_IDLE) state = STATE_CHASE; health -= amt; if(health > 0) AudioUtil.playAudio(hitNoise, transform.getPosition().sub(Transform.getCamera().getPos()).length()); }
f769bffb-1dce-4e51-9ef5-2bd26613ec22
1
public static void main(String... args) { Scanner s = new Scanner("Hello my love"); String token; do { token = s.findInLine(""); System.out.print(token + " "); } while (token != null); }
f62d8a33-789f-4485-b9d4-cfd52dc1e1ff
1
public Hand(Deck d) { ArrayList<Card> Import = new ArrayList<Card>(); for (int x = 0; x < 5; x++) { Import.add(d.drawFromDeck()); } CardsInHand = Import; }
1f354973-0ca0-46b3-ae69-2aff48568216
5
public static String[] getTokensUsingDelim( String instr, String token ) { if( instr.indexOf( token ) < 0 ) { String[] ret = new String[1]; ret[0] = instr; return ret; } CompatibleVector output = new CompatibleVector(); new StringBuffer(); int lastpos = 0; int offset = 0; int toklen = token.le...
9462b059-22c2-428a-8d43-61d9c8d78fbd
5
private void drawNumbers(Graphics2D g2d) { for (int i=0; i<width; i++) { for (int j=0; j<height; j++) { if (numbers[i][j] >= 0) { if (black [i][j] == null || !black[i][j]) { g2d.setColor(Color.black); } else { g2d.setColor(Color.white); } g2d.drawString("" + numbers[i][j], i*SIZ...
c147ae50-b5bf-4a1d-a98f-6b5344f64d9a
5
public String findAlgorithm(Cube cube, TileColor c1, TileColor c2) { int rotation = 4 - (c1.getInt() < 3 ? c1.getInt() - 1 : c1.getInt() - 2); String top = ""; for (int k = 0; k < 4; k++) { for (int i = 1; i < F2L.length; i++) { String alg = F2L[i]; Cube cubeClone = cube.clone(); for (int j = 0; j ...
337e76d3-34ef-43b4-a0fd-f5717dcbc8be
0
public void setDataRegistrazione(Date dataRegistrazione) { this.dataRegistrazione = dataRegistrazione; }
f33258d5-e378-447f-b19e-42d8987431a2
6
public static void main(String[] args) { // args[0] = -d is for debug, -r is for running if (args.length == 0 || args[0].equals("-r")) { runState = runStates.RUN; } else if (args[0].equals("-d")) { runState = runStates.DEBUG; } switch (runState) { case DEBUG: log("Running in DEBUG mode."); gen ...
47787c71-0f2e-4b15-afd8-ecf81d4a1bd7
6
public void run() { if(this.sampleSize==-1) { this.TGA(); } else { String arr[] = this.outputFilename.split("\\.(?=[^\\.]+$)"); double n = this.sampleSize; double sum = 0; double sum2 = 0; d...
bea449e9-b0e7-4eda-aec3-5813a57d8d0b
4
public static void setCellStyleFlags(mxIGraphModel model, Object[] cells, String key, int flag, Boolean value) { if (cells != null && cells.length > 0) { model.beginUpdate(); try { for (int i = 0; i < cells.length; i++) { if (cells[i] != null) { String style = setStyleFlag(model...
dd462cf1-29a5-4e5a-8690-3648a7285e61
4
public static int posteX(int travee,int orientation){ int centreX = centrePositionX(travee) ; switch(orientation){ case Orientation.NORD : centreX -= 25 ; break ; case Orientation.EST : break ; case Orientation.SUD : centreX -= 25 ; break ; case Orientation.OUEST : centreX -= 20 ...
d8711700-1040-4808-81b5-5ea359bffbe8
0
public int getWidth() { return width; }
e18b45b6-3815-4a96-9d32-23e9bc80a305
9
public void playGame(Agent player1, Agent player2) { GameAction p1move, p2move; GameAction[] history = new GameAction[roundsPerGame*2]; player1.matchScore = 0; player2.matchScore = 0; for(int i = 0; i < roundsPerGame; i++) { p1move = player1.getNextMove(i, history, false); p2move = player2.getNextM...
9f559e39-8e66-4f47-a63c-d62800c93591
5
public static Complex log(final Complex value) { if (value == null) throw new NullPointerException("The value is not properly specified."); if (isNaN(value) || isInfinite(value)) return Complex.NaN; if (isOrigin(value)) return Complex.Infinity; double ...
94940a65-c99f-415d-9bce-15a022c91e20
5
private boolean validateValues(String column, String value) throws MobbedException { String type = typeMap.get(column.toLowerCase()); try { if (type.equalsIgnoreCase("uuid")) UUID.fromString(value); else if (type.equalsIgnoreCase("integer")) Integer.parseInt(value); else if (type.equalsIgnoreCas...
a8420e53-5d8d-41af-b4dc-226566e175d5
0
public static void main(String[] args) { Tank t1 = new Tank(); Tank t2 = new Tank(); t1.level = 9; t2.level = 47; System.out.println("1: t1.level: " + t1.level + ", t2.level: " + t2.level); t1 = t2; System.out.println("2: t1.level: " + t1.level + ", t2.level: " + t2.level); t1.level = 27; System.out.p...
406dfb64-e86f-4096-9122-8732c7605e4a
9
@Override public List<Map<String, ?>> Listar_hist_fecha(String FE_MODIF, String idtra) { List<Map<String, ?>> lista = new ArrayList<Map<String, ?>>(); try { this.cnn = FactoryConnectionDB.open(FactoryConnectionDB.ORACLE); String sql = "SELECT * FROM RHVD_MOD_TRABAJADOR \n" ...
8ecffbeb-3e7a-49e6-b3df-b8de070640ea
0
private void chooseBrainActionPerformed(java.awt.event.ActionEvent evt) throws Exception { AntBrain b = new AntBrain(chooseBrain.getSelectedFile().getName()); brains.add(b); numBrainsLabel.setText("Number of Brains(2 Minimum): " + brains.size()); }
92cef712-e1b5-48c9-84f1-24a33836977c
8
private int laskeMiinat(int x, int y){ int miinoja = 0; int yla = y - 1; int ala = y + 1; int vasen = x - 1; int oikea = x + 1; if (onKartallaJaMiina(vasen, yla)) { miinoja++; } if (onKartallaJaMiina(x, yla)) { miinoja++; ...
14458869-f0d5-4dd4-ac73-f4aa668c1adb
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto, asLevel)) return false; if((auto)&&(givenTarget!=null)...
e787bd9b-30e9-4df4-8362-4e8c4ca8b37b
9
static final void method1230(int i) { anInt1517++; FileOnDisk fileondisk = null; try { Class241 class241 = Class240.aSignLink2946.method3631(true, "2", (byte) 126); while (class241.anInt2953 == 0) Class262_Sub22.method3208(1L, false); if ((class241.anInt2953 ^ 0xffffffff) == -2) { fileondisk = (F...
471afeba-8d25-42df-8432-8239e43e1417
8
@Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { Person person = listPerson.get(rowIndex); switch (columnIndex) { case 0: person.setId(Integer.parseInt((String) aValue)); break; case 1: person.setFirstName((String) aValue); break; case 2: person.setLastN...
25c01c58-42b2-42dc-9c3d-265ff37ab713
0
public void show(){ game.getContentPane().removeAll(); menuWrapper.removeAll(); menuPanel.removeAll(); this.prepareSpecificMenu(); this.menuWrapper.add(this.menuPanel); game.add(this.menuWrapper, BorderLayout.CENTER); game.setVisible(true); }
60aebf01-28f8-413a-b967-2f6471953c83
6
public void update(){ up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W]; down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S]; left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A]; right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D]; sprint = keys[KeyEvent.VK_SHIFT]; for(int i=0; i< keys.length; i++...
9cc889f2-0e11-4cc2-b309-e3795f3c60ee
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if((((ClanItem)this).clanID().length()>0) &&(CMLib.flags().isGettable(this)) &&(msg.target()==this) &&(owner() instanceof Room)) { final Clan C=CMLib.clans().getClan(clanID()); if((C!=null)&&(C.getDonation().length()>0))...
9fc13cf7-a24a-45c0-997d-4753c9f95eb8
8
public boolean almostEquals(Object obj){ if (this == obj) return true; if (getClass() != obj.getClass()) return false; Fraction other = (Fraction) obj; if (bottom == null) { if (other.bottom != null) return false; } else if (!bottom.equals(other.bottom)) return false; if (top == null) { i...
ba68de39-97bc-49f7-997c-bd69f16fb1c3
1
public final KeyStroke getAccelerator() { Object value = getValue(ACCELERATOR_KEY); return value instanceof KeyStroke ? (KeyStroke) value : null; }
806a6628-f286-48de-bf09-1a0827d21874
6
public static int scoreForCards( ArrayList<Card> cards ) { int totalScore = 0; for ( Card aCard : cards ) { switch ( aCard.value() ) { case 1: totalScore += 11; break; case 3: ...
a67a4835-b746-4ad3-a340-db0f2bca381a
0
public void pysaytaLiike() { this.xSuunta = 0; }
a8ac751d-d434-4f23-8774-c44d0afa0067
5
public String getCurrentLoanIndex() { Statement stmt = null; int max = 0; try { stmt = con.createStatement(); ResultSet results = stmt.executeQuery("Select * from Loan"); while (results.next()) { String strnum = results.getString("ID"); int intnum = Integer.parseInt(strnum); if (intnum > m...
952be66c-9983-4542-a0db-8e72e7174b7c
2
private int getClosestMatch(){ int lowestMatchFactorIndex = 0; double lowestMatchFactor = 99999999; for (int i = 0; i < this.log.size(); i++){ if (getMatchFactor(i) < lowestMatchFactor) lowestMatchFactorIndex = i; } return lowestMatchFactorIndex; }
d92a9ef4-4719-4d6d-9743-64b6a8b3b143
3
private void init(char[][] array) { int size = GameConfiguration.gameConfiguration_SIZE; this.label = new JLabel[size][size]; this.grid.setLayout(new GridLayout(size,size)); this.infos.setLayout(new GridLayout(1,1)); BorderLayout layout = new BorderLayout(); this.setLayout(layout); for (int i=0; i<size; i...
70bdcba6-8f61-4e6c-8c0c-aad2b0b3dc2a
8
void move() { switch(dir) { case U: y -= Y_SPEED; break; case D: y += Y_SPEED; break; case L: x -= X_SPEED; break; case R: x += Y_SPEED; break; case LU: x -= X_SPEED; y -= Y_SPEED; break; case RU: x += X_SPEED; y -= Y_SPEED; break; case LD: x -= X_SPEED; y...
f819fd97-0385-4632-8680-a78cf019b280
6
public static void processFlower(Client c) { final int[] coords = new int[2]; coords[0] = c.absX; coords[1] = c.absY; Server.objectHandler.createAnObject(c, -1, coords[0], coords[1]); Server.objectHandler.createAnObject(c, c.randomFlower(), coords[0], coords[1]); c.canWalk = true; if (Region.getClippin...
683ef6f2-109a-4ce9-b2e1-78a02fc737b1
2
@Override public void piirra(Graphics graphics) { graphics.setColor(vari); for (KentallaOlija osa : osat){ osa.piirra(graphics); } if (suojakilpi){ int halkaisija = (int)getSuojakilvenHalkaisija(); graphics.drawOval((int)(this.get...
db954dce-dce3-4e84-b293-373e19f49142
4
public void updateFK(String table, String nameColumn, int valueColumn, String nameID, int valueID) { try { con = DriverManager.getConnection(url, user, password); String stm = null; stm = "UPDATE " + table + " SET " + nameColumn + " = '" + valueColumn + "' WHERE " + nameID + " = " + valueID; ps...
37876308-5935-4d6c-94f9-d6649d22b716
1
public static InputSource getFromHTTPS(String adresse){ //String result = ""; URL url = null; System.out.println("downloading..."); try{ disableCertificateValidation(); url = new URL(adresse.replace(" ", "%20")); HttpsURLConnection client = (HttpsURLConnection) url.openConnection(); client....
827a532b-881a-4f2d-a0b6-407f570ebf8b
0
protected void onRemoveNoExternalMessages(String channel, String sourceNick, String sourceLogin, String sourceHostname) {}
3c3ac77c-385c-4bc4-9f9f-4046223602aa
4
static int[] merge(int[] a, int[] b) { if (a == null) throw new NullPointerException("a is null"); if (b == null) throw new NullPointerException("b is null"); int[] result = new int[a.length + b.length]; // Precondition assert result.length == a.length + b.length : "length mismatch"; for (int i = 0; i...
23353900-474c-4797-96e1-69a3e8eb6e8d
7
public void getMovesFromWord ( Word word, int x, int y, Vector<Move> moves, boolean isUpDownCheck ) { for ( int i = 0 ; i < word.length ( ) ; i++ ) { final int xNew = x - ( isUpDownCheck ? 0 : i ) ; final int yNew = y - ( isUpDownCheck ? i : 0 ) ; if ( xNew >= 0 && yNew >= 0 && xNew < Player...
4afc7e61-c4fa-41e0-92be-edf376c2bda2
1
private void compute_pcm_samples0(Obuffer buffer) { final float[] vp = actual_v; //int inc = v_inc; final float[] tmpOut = _tmpOut; int dvp =0; // fat chance of having this loop unroll for( int i=0; i<32; i++) { float pcm_sample; final float[] dp = d16[i]; pcm_sample = (float)(((vp[0 + dvp] * d...
d4a18c72-d32d-4a81-819e-f4322abe7b58
4
public boolean inside(Bullet b){ if(b.getX()>x && b.getX()<x+WIDTH && b.getY()>y && b.getY()<y+HEIGHT ){ return true; } return false; }
abcd6ba8-9b8e-4c91-a613-5e4cc7cd9d45
6
private void method130(int arg0, int id, int rotation, int arg3, int y, int objectType, int plane, int x, int arg8) { SceneObject object = null; for (SceneObject sceneObject = (SceneObject) aClass19_1179.getFront(); sceneObject != null; sceneObject = (SceneObject) aClass19_1179.getNext()) { ...
7d7e9f88-7105-497c-8bdd-662bb2b84955
9
public static void main(String[] args) { InetAddress addr = null; try { addr = InetAddress.getByName(DEFAULT_HOST); } catch (UnknownHostException e) { e.printStackTrace(); } int port = DEFAULT_PORT; if (args.length > 0) { try { ...
c70b454a-483c-40ae-9c8b-1691d6418faf
6
private static File syncAssets(File assetDir, String indexName) throws JsonSyntaxException, JsonIOException, IOException { Logger.logInfo("Syncing Assets:"); File objects = new File(assetDir, "objects"); AssetIndex index = JsonFactory.loadAssetIndex(new File(assetDir, "indexes/{INDEX}.json".replace("{IN...
a1f740a1-f43d-4a78-9877-2e7fd7a3b90d
9
public boolean check_for_zombies() { check(); boolean change=false; Iterator<Entry<String, FileState>> it = m.entrySet().iterator(); while (it.hasNext()) { Entry<String,FileState> pair = it.next(); FileState fs=pair.getValue(); String repo_filename=pair.getKey(); File f...
0d142695-c73d-4327-9403-29200a37b0fd
0
public int getAge() { return age; }
ef1b0104-fb91-4a66-9a9f-75dc7664057a
1
protected byte[] computeSHAdigest(final byte[] value) { try { return MessageDigest.getInstance("SHA").digest(value); } catch (Exception e) { throw new UnsupportedOperationException(e.toString()); } }
b256fc53-d172-4c8e-8f83-c2a20e8e054e
3
public boolean attack(Spinner self, Spinner target) { if (!newSp.contains(target) || !newSp.contains(self)) { return false; //crappy way of handling concurrency issues } float targetEnergy = target.getEnergy(); float selfEnergy = self.getEnergy(); ...
f3b89ed5-4564-44b6-aad5-a771a34310eb
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...
84c70c72-f12e-442c-8f59-6565ad98bcb5
2
public void setHTML(URL url) { // Lazy Instantiation if (!isInitialized()) { initialize(); } try { this.viewer.setPage(url); } catch (IOException e) { System.out.println("IOException: " + e.getMessage()); } }
41c3bdba-8319-488b-afaa-f74d6b44137c
0
public AntAttack() { }
3250ae32-aabe-46f3-bb6b-8584f9f66abe
9
private Version mapFrameworkPackageVersion(Version pv) { if (pv.getMajor() != 1) return null; Version version; switch (pv.getMinor()) { case 7: version = new Version(5, 0, 0); break; case 6: version = new Version(4, 3, 0); break; case 5: version = new Version(4, 2, 0); break; case 4:...
da7f6d5b-68aa-4bf4-b693-3364696e5dfa
6
public boolean onCommand(Player player, String[] args) { File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml"); FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language); if(player.hasPermission(getPermission())){ if(args.length ...
a1e509a6-70e8-444b-bd14-15d16642bf0f
2
public String getPrettyErrors() { String errors = null; if (hasErrors()) { for (String errorMsg : getErrors()) { errors = errors + errorMsg; } } else { errors = "Unknown"; } return errors; }
c1b21f55-76d7-4f96-bbb6-4ff0a51359b9
1
private EntryElement getEntryElement(final ZipOutputStream zos) { if (outRepresentation == SINGLE_XML) { return new SingleDocElement(zos); } return new ZipEntryElement(zos); }
71666d6b-dc77-42bb-9e82-dba3c648baa7
7
private static void paintTextEffect(Graphics2D g, String s, Color c, int size, double tx, double ty, boolean isShadow) { prepareGraphics(g); final float opacity = 0.8f; // Effect "darkness". final Composite oldComposite = g.getComposite(); final Color oldColor = g.getColor(...
162c2ba6-6ee4-4cbf-a2f1-72b91968cb3c
3
public static void countSort (int[] array, int k) { int[] count = new int[k]; int size = array.length; for (int i = 0; i < size; i++) { count[array[i]]++; } for (int i = k - 1; i >= 0; i--) { while (count[i]-- > 0) { array[--size] = i; } } }