method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d34bf334-9e9e-44a1-9012-5edc35ce74bd
7
@Override public void handle(StringBuilder line, TemplateReader tpl, Environment env, Appendable out) throws IOException { // get the class name String klass = getArgs(line); // read in the class ClassReader rdr = new ClassReader(); while (true) { line = tpl.next(); if (line == null || (...
685460d0-2fe8-4c6d-b570-8fa1816b26d0
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...
a9cbd156-5824-4613-afa1-afede175dbd8
5
public void loadMdef(String pathToMdef) throws IOException { hashMapMdef = new HashMap<String, String>(); File fileMdef = new File(pathToMdef); BufferedReader brMdef = new BufferedReader(new FileReader(fileMdef)); brMdef.readLine(); // Line read from file String templineMain; // Line for temporar...
cfd11e84-8e5b-43be-9bff-3fc7e426729f
3
public static String getErrorDesc(String scene, ErrorCode code) { String resultMsg = null; if (scene == null || code == null) { resultMsg = "Error Desc not found."; } StringBuilder key = new StringBuilder(); key.append(scene).append('|').append(code.name()); resultMsg = errorDesc.get(key); if (result...
2b612920-ebbc-46d0-b0b8-ef59c539a312
0
@RequestMapping(value = "get.json", method = RequestMethod.GET) public String getModel(ModelMap model) { List<Employee> list = employeeDao.getAll(); model.addAttribute(list); return "jsonView"; }
6df1cc3e-e58d-4612-be07-5ad8b865ca93
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if((affected==msg.source()) &&(msg.targetMessage()==null) &&(msg.othersMinor()==CMMsg.TYP_DEATH) &&(text().length()>0) &&(msg.othersMessage()!=null) &&(msg.othersMessage().toUpperCase().indexOf("<S-NAME> IS DEAD")>0)) { ...
3de74d28-9be1-4b9c-bf8e-6e423084317c
4
public boolean tickAI() { if (current_count != tc.count) { current_count = tc.count; mMove = mBrain.bestMove(new Board(tc.board), tc.currentMove.piece, tc.nextPiece, tc.board.getHeight()-TetrisController.TOP_SPACE); } if (!tc.currentMove.piece.equals(mMove.piece)) { super.tick(TetrisController.ROTATE...
e9c936e5-45b5-46d5-83bd-2b70f4d1a0f0
2
boolean findDuplicate(int []dup){ boolean duplicate=false; for(int j=0;j<(dup.length-1);j++){ if(dup[j]!=dup[j+1]){ duplicate=false; }else{ duplicate=true; break; } } return duplicate; }
9d6df8ce-0f46-4d95-8bdd-79d04d16afd9
4
@Test(groups = { "Integer-Sorting", "Fast Sort" }) public void testShellSortInt() { Reporter.log("[ ** Shell Sort ** ]\n"); try { testSortIntegers = new ShellSort<>( fastShuffledArrayInt.clone()); Reporter.log("1. Unsorted Random Array\n"); timeKeeper = System.currentTimeMillis(); testSortInte...
9781d1aa-9390-42dc-a227-4df6f8412399
8
public void readHeader() throws IOException { byte[] empty = "".getBytes(); inflater.setOutput(empty, 0, 0); inflater.setInput(empty, 0, 0, false); byte[] b = new byte[10]; int n = fill(b); if (n != 10) { if (n > 0) { inflater.setInput(b, 0, n, false); // inflater.next_in_index = n; inflat...
6300a034-151d-4b32-85e8-009dd94cf80f
5
private void constructAbstractGraph(AbstractGraph graph, FiniteStateAutomaton dfa, ArrayList<HashSet> setOfScc){ /** construct an abstract node for each SCC starting from the initial state of * the dfa*/ for(HashSet<State> scc : setOfScc){ StatePlacer sp = new StatePlacer(); AGState node =...
6722d979-6536-4fef-8211-0ff0b9d94265
9
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!plugin.hasPerm(sender, "kill", true)) { sender.sendMessage(ChatColor.YELLOW + "You do not have permission to use /" + label); return true; } if (args.length == 0) return false; if (args[0].equa...
68070759-16e2-4a2e-8655-82e96747e4ad
7
protected void copy_cover_sets(CoverTreeNode query_chi, MyHeap new_upper_k, Stack<Stack<d_node>> cover_sets, Stack<Stack<d_node>> new_cover_sets, int current_scale, int max_scale) throws Exception { new_cover_sets.clear(); for (; current_scale <= max_scale; current_scale++) { d_nod...
96a80011-d270-4830-a644-a00d96ef5b44
5
public static void initClassLoader() { File folder = new File(Nations.getPlugin().getDataFolder() + "/skills/"); if(!folder.exists()) { folder.mkdirs(); return; } PluginClassLoader pluginClassLoader = (PluginClassLoader) Nations.getPlugin().getClass().getClassLoader(); if(pluginClassLoader...
32f575fe-18c0-4c66-8c84-adeae3541700
2
@Test public void testNumberOfDoorways() { int numDoors = 0; int totalCells = board.getNumCols() * board.getNumRows(); Assert.assertEquals(506, totalCells); for (int i=0; i<totalCells; i++) { BoardCell cell = board.getCellAt(i); if (cell.isDoorway()) numDoors++; } Assert.assertEquals(16, numD...
790170cc-e90f-4488-b37b-6520d9d20d6e
0
public int size() { return nodes.size(); }
9cc8831b-327b-428a-a6f1-ce395ea007a1
0
public String getFileName() {return this.filename;}
ec1a5449-a197-48d9-bd8d-ebebe321f5f1
2
public void tell(String user, String message){ if (message==null || message.length()<=0) return; send(user+": "+message); }
002f175d-236c-4a30-9928-6d8e3a96560f
7
final void method272(int i) { anInt277++; if (aBoolean289) { if (aClass206_285 != null) { aHa_Sub2_290.method3764(-17083, aClass206_285); int i_2_ = 16384; aHa_Sub2_290.method3751(aClass206_281, -115); aClass206_285.method1505(0, 0); aClass206_281.method1503(0, (byte) 3); if (aBoolean303) i_2_ ...
f8abb3b0-4cc5-475f-8593-6ad817f7e540
0
public double getSum(){ return summ = this.getEdge()*6; }
e9bd3f93-f01f-4ecb-9806-373a3289db45
8
private static Map<? extends Attribute, ?> fixattrs(Map<? extends Attribute, ?> attrs) { Map<Attribute, Object> ret = new HashMap<Attribute, Object>(); for (Map.Entry<? extends Attribute, ?> e : attrs.entrySet()) { if (e.getKey() == TextAttribute.SIZE) { ret.put(e.getKey(), (...
59e8bd4e-10ec-4e3d-86d3-4151f0fae5d9
8
public static void pprintFunctionTerm(Proposition self, org.powerloom.PrintableStringWriter stream) { stream.print("("); OntosaurusUtil.pprintObject(self.operator, stream); { boolean testValue000 = false; if (self.arguments.length() >= 5) { testValue000 = true; } else { { ...
b6aeee1e-164e-457f-9e24-e48bc8aeac20
0
@Test public void textFieldDoubleTest() { when(focusEvent.getSource()).thenReturn(view.getTimeStepTextField()); when(focusEvent.getComponent()).thenReturn(view.getTimeStepTextField()); view.getTimeStepTextField().setText("0.1"); view.getTimeStepTextField().getFocusListeners()[2].focu...
3deeeeee-1415-4a82-852e-f0d7c54f95ed
3
public void init(){ for(Map.Entry<SootMethod, Set<Loop>> e: NewTest.methodToLoop_map.entrySet()){ for(Map.Entry<SootMethod, Set<Unit>> e2 : NewTest.nonEscNewAlloc.entrySet()){ if(Routes.GetAllRoutes(e.getKey(), e2.getKey()).size() > 0){ System.out.println(e2.getKey().toString()+ " is called from within lo...
1133b217-1c6e-41f3-8c2b-c91734640a06
4
public static void save(Highscore [] highscores,OutputStream out) throws IOException { PrintStream outp = new PrintStream(out); for (int i=0; i<highscores.length; i++) { outp.print(highscores[i].score); outp.print('\t'); if (highscores[i].name.equals("")) { outp.print("`");//XXX backtick indicates emp...
4dfa6cf4-2acd-4319-9f8e-4200558820cf
1
public ResultSet select(String query){ try{ Statement stm = this.con.createStatement(); ResultSet rs = stm.executeQuery(query); // stm.close(); return rs; } catch(SQLException e){ LogHandler.writeStackTrace(log, e, Level.SEVERE); return null; } }
bae755d3-8bd3-46dd-b2ad-7c3861e45bd0
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 until FREE slot or we start to loop ...
e3455f46-8007-4fb1-b325-164303fc2d68
6
public static List<Person> mergeInnerPerson(List<Person> firstList, List<Person> secondList) { if (firstList == null || secondList == null) { return Collections.<Person>emptyList(); } List<Person> _firstList = new ArrayList<>(firstList); List<Person> _secondList = new ArrayL...
648ff7dc-50e7-4a7a-8573-04eebd0afdab
4
private void read (boolean external, int address, byte buf [], int off, int len) throws IOException { int val; int card = external ? 1 : 0; if ((len % BLOCKSIZE) != 0) throw new IllegalArgumentException (); if ((val = get (RIO_SET_READ_PTR, address, card)) == 0 || (val = get (RIO_SET_READ_LEN, ...
3757df9b-30d8-45d9-8c55-639b11f5f71e
3
private Production getProductionForCombination(Production production, String comb) { ProductionChecker pc = new ProductionChecker(); String rhs = production.getRHS(); StringBuffer buffer = new StringBuffer(); for (int k = 0; k < rhs.length(); k++) { char ch = rhs.charAt(k); if (ProductionChecker.isTerm...
76c40401-54c5-4c96-ba14-2d40e85635dc
0
public synchronized int getMaxSize() {return this.max_size;}
5e4024f6-1f80-47db-8dae-405609896233
3
boolean dead(long time, boolean paused) { return (endTime > 0 && endTime <= time) || (endTime == -2 && !paused); }
dba8dcbf-a85c-4aa2-be0d-3123aa389f45
0
public void copy(Point src) { X = src.X; Y = src.Y; }
caed4f3e-c22b-479c-9837-72704b3646b9
9
private synchronized static void syncstart(DSP sound,int sampleRate,int bufferLen) throws LineUnavailableException{ fmt=new AudioFormat(sampleRate,16,2,true,false); AudioSystem.sound=sound.new Port(); new Thread(new Runnable(){ private int bufferLen,bufferPos; private double frameLen; public Runnabl...
5247a65a-cbb7-4308-bd12-9ce75f71b42d
5
private void followPlayer() { if(moving) { if(x > GameCore.spawnEngine.getPlayer().getX()) { x -= movementSpeed; spriteX = 0; spriteY = 32; } else if(x < GameCore.spawnEngine.getPlayer().getX()) { x += movementSpeed; spriteX = 32; spriteY = 32; } if(y > GameCore.spawnEng...
ce2339d2-44f3-441b-a2da-a758e0c96bf2
0
public static void main(String[] args) throws Exception { ApplicationRunTool app = new ApplicationRunTool(); int re = (Integer)app.run(ApplicationRunTest.class,new Integer[]{3,4}); System.out.println(re); }
6af881e3-022a-4cf3-84b6-a7516a8300d5
2
public static CandyTypes fromValue(String v) { for (CandyTypes c : CandyTypes.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
888efe4a-8b7a-4b60-affd-17e8d9828040
7
public static void makeCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { parent.setMaximumSize(new Dimension(Integer.MAX_VALUE, parent.getPreferredSize().height)); SpringLayout layout; try { layout = (SpringLayout) parent.getLayout(); } catch (ClassCa...
b362efd3-dec7-4614-96fd-1da5fe751c8f
8
private boolean isSym(char c) { switch (c) { case ')': return true; case ']': return true; case '}': return true; case '?': return true; case '!': return true; case '.': return true; case '\'': return true; case '\"': return true; } return false; }
da747e2b-ab9a-4324-ad51-4c6fbe897401
3
public void setSelectedPosition (PositionBox position) { PositionBox selectedPosition = getSelectedPosition(); if (!position.equals (selectedPosition)) { if (selectedPosition != null) selectedPosition.setSelected (false); position.setSelected (true); } Champion c = Initialiser.getMainFrame().getMultiList...
613bad54-cda6-4bba-af18-6dfa3d99872e
3
private void check_create_tables() { List<String> tables = (new SQLStatementProcessor<List<String>>("SHOW TABLES") { List<String> process(PreparedStatement s) throws SQLException { ResultSet rs = s.executeQuery(); List<String> out = new ArrayList<String>(); while( rs.next() ) { out.add(rs.get...
03fc23ab-3a54-4e08-adf8-8c74bdca7618
9
@Override public boolean isHomeRoomUpstairs(Room room) { final Room dR=room.getRoomInDir(Directions.DOWN); if((dR!=null) &&(dR.domainType() != Room.DOMAIN_INDOORS_CAVE) &&((dR.getAtmosphere()&RawMaterial.MATERIAL_ROCK)==0)) { if(isHomePeerRoom(dR)) return true; final Set<Room> peerRooms=getHomePee...
b4eb3b39-3fe7-442d-95ec-adc2a16e0a6e
7
@Override public Action play(Hand hand, Blackjack blackjack) { Action result = Action.STAND; if(hand.getScore() >= 21) { return result; } System.out.println(String.format("Play %s. Hit(h), Stand(s), Play Dead(q)?", hand.id)); BufferedReader br = new BufferedRead...
c1ea2965-b024-421b-bc7c-e39be8956b34
1
protected void fireDisconnect(DisconnectEvent evt) { //..if connection is broken, setup to all calls Disconnect = true for (IRemoteCallObject rco : sync.values()) { rco.setDisconnect(true); synchronized (rco) { rco.notifyAll(); } } }
ac63af54-2455-4ca8-941d-65137c63f650
4
private void fillInfoTable() { ((DefaultTableModel) tblEmployeeInformation.getModel()).addRow(new Object[]{ employee.getEmployeeNumber(), employee.getFirstName(), employee.getFamilyName(), employee.isFullTime() ? "Ja" : "Nee", ...
ee12110a-4c11-4282-bec8-1d2b74808a5e
4
@Override public void deserialize(Buffer buf) { super.deserialize(buf); staticInfos = ProtocolTypeManager.getInstance().build(buf.readShort()); staticInfos.deserialize(buf); ageBonus = buf.readShort(); if (ageBonus < -1 || ageBonus > 1000) throw new RuntimeExcepti...
bc69de37-f35e-4bf8-8760-1fa077b6d910
1
@Override public void copyTo(BaseComponent bc) { WeaponsComponent wc = (WeaponsComponent)bc; if(weapon != null) { weapon.copyTo(wc.getWeapon()); } }
30fc9aed-b206-46a3-9ad6-57f6efd9f26a
7
private long solve(long[] a, char[] op) { assert a.length == op.length + 1; if (op.length == 1) { return eval(a[0], a[1], op[0]); } long minVal = Long.MAX_VALUE; int N = a.length; for (int i = 0; i < N-1; i++) { for (int j = i+1; j < N; j++) { ...
350d81e8-30e8-4b45-8a45-c2b6191ffcd5
4
private void permuteHelper(int size) { if (size == num.length) { ArrayList<Integer> list = new ArrayList<Integer>(); for (int i = 0; i < num.length; i++) { list.add(ans[i]); } result.add(list); return; } for (int i = 0;...
bbee31a3-6cf1-42a5-b024-2d0fd6c29453
9
public static final boolean isMulungSkill(final int skill) { switch (skill) { case 1009: case 1010: case 1011: case 10001009: case 10001010: case 10001011: case 20001009: case 20001010: case 20001011: return true; } return false; }
6c9ec78b-8ea4-4fdb-bcf7-c013b00b5a5b
2
public void actionPerformed(ActionEvent event) { if (event.getSource() == add) { GUIAddSpeaker add = new GUIAddSpeaker(); } if (event.getSource() == book) { //SearchMemberScreen searchMember = new SearchMemberScreen(); } }
97ad9c40-855d-406a-a797-d9dfa39f372b
3
public void act(){ if (clicked){ if (counter >= 10){ counter = 0; clicked = false; } else{ counter++; this.setImage (bg[2]); } } else if (selected){ selected = false; ...
a1022e47-3f85-41cb-8926-d0ea796e4008
6
public LSGWTSubscription(LSGWTFieldElement[] schema, String[] group, SubscriptionMode mode) { // adding list of fields (schema) for (int i = 0; i < schema.length; i++) { String field = schema[i].toString(); Integer count = this.fields.get(field); if (coun...
1780c485-e1c8-4a7a-83c0-6747745e66cc
8
public int getId() { Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; int id = -1; try { conn = iConomy.getiCoDatabase().getConnection(); ps = conn.prepareStatement("SELECT * FROM " + Constants.SQLTable + " WHERE username = ? LIMIT 1"); ps.setString(1, ...
4b7a3b29-b8bc-42c8-abb4-c0f368871c9d
8
@Override public Object solve() { boolean found=false; int maxPalindrome=Integer.MAX_VALUE; for(int sum=maxFactor+maxFactor;sum>1;sum--) { for(int first=sum/2;first>0;first--) { int second=sum-first; if(second>maxFactor) break; int product=first*second; if(i...
d36caa0b-9f32-4812-8397-ce7850b1c818
6
public static void main(String[] args){ try { String name = "main3"; int num_rand; ArrayList<JvnObjectImpl> array = new ArrayList<JvnObjectImpl>(); MonObjet o1 = new MonObjet("objet3"); JvnObjectImpl shared_object_3 = (JvnObjectImpl) JvnServerImpl.jvnGetServer().jvnCreateObject(o1); JvnServerImpl.jv...
5ad95f28-7a14-4fcf-b26f-b0fb85ec942c
0
public String getFileFilterInclude() { return this.fileFilterInclude; }
0db6aa60-59df-4457-b998-479a4d4c7399
9
public static int update(String sql, List<Param> params)throws SQLException{ C3p0Pool pool = C3p0Pool.getInstance(); Connection conn = pool.getConnection(); PreparedStatement statement = conn.prepareStatement(sql); if(params!=null){ int i=1; for(Param p:params){ if(p.getColumnType()==ColumnType.Date){...
4ef4e921-3c81-495c-914e-aa90795877db
1
public List<Object> getAny() { if (any == null) { any = new ArrayList<Object>(); } return this.any; }
7653cd84-ce08-48aa-bb68-86702b553883
8
@EventHandler(priority = EventPriority.NORMAL) public void signClick(PlayerInteractEvent event) { Player eventPlayer = event.getPlayer(); String eventPlayerName = eventPlayer.getName(); String playerClass = plugin.getConfig().getString( "player." + eventPlayerName + ".class"); boolean logToConsole = plu...
2393bb72-c246-4d57-8bb7-e3785afed59f
0
public static void main(String[] args) { Initialization initialization = new Initialization(); initialization.setUp(); Statistic statistic = new Statistic(initialization); statistic.begin(); Desert desert = new Desert(initialization.getLengthDesert(), initialization.getHeightDese...
106b8065-50f4-4493-96fd-ae93be83fbb9
9
private void applyOptions() throws SocketException { if (mOptions == null || mSocket == null) { return; } Object[] options = mOptions; Object value; if ((value = options[0]) != null) { mSocket.setTcpNoDelay(((Boolean)value).booleanValue()); } ...
83c12cf2-8976-43a1-9d39-b56402174562
4
public static int extractGid(int[] data, int x, int y, int width, int height) { if (x < 0 || width <= x || y < 0 || height <= y) { throw new IllegalArgumentException("(x, y) lies outside the " + "range denoted by width and height"); } long t = access(data, x, y, width, height); t = maskFlipBits(t); re...
1aaf0724-ed0a-4032-bbc0-ad2d8b67a531
4
public void DumpGrid() { String formatter = "%4s"; System.out.printf("\nDataGrid has the following attributes:" + "\nTitle = [%s]\nMin = %f\nMax = %f\nRows = %d\nCols = %d" + "\nCount = %d " + "\nTotal = %f " + "\nColumn Labels = %s\nRow...
3aeb6a94-26bc-4093-bcf9-de140bf0a1dc
1
public Paddle(boolean isLeft) { isLeftPaddle = isLeft; if (isLeftPaddle) { x = 10; } else { x = CardsPanel.FRAME_WIDTH - 50; } y = 10; v = FRAME_HEIGHT / 400; length = FRAME_HEIGHT / 5; }
36455c46-03d1-4e8f-b880-a059f35b2ad7
2
private int setIntegerInitParameter(String parameterValue, int defaultValue) { if (null != parameterValue) { try { return Integer.parseInt(parameterValue); } catch (Exception e) { return defaultValue; } } return defaultValue; }
7ec5a9fa-cc8b-4e96-8dc1-e239a7227a31
4
@Override public void run () { Integer openCount=0,processCount=0,closedCount=0; Object [] A2 = Counter.getCount(); for (int i=0;i<=A2.length-1;i++) { if ("Open".equals(A2[i])) { openCount++; } else if ("In process".equals(A2[i])...
88b95e44-09b3-4d06-bf77-675d2c724bcb
7
public static void applyBookSol(int[][] input) { BitSet rows = new BitSet(input.length); BitSet cols = new BitSet(input[0].length); for (int i = 0; i < input.length; i++) { for (int j = 0; j < input[0].length; j++) { if (input[i][j] == 0) { rows.s...
b4f1165c-3414-4617-acc9-0f8edeb5a68b
4
public Tile getTile(int x, int y) { if (x >= Realm.WORLD_WIDTH || y >= Realm.WORLD_HEIGHT || x < 0 || y < 0){ return null; } return worldTiles[x][y]; }
abc4819d-d615-4929-a877-ba1dc8ab9cf4
4
public Point move(String direction) { if(direction.equals("N")) location.setLocation(location.getX(), location.getY()); if(direction.equals("S")) location.setLocation(location.getX(), location.getY()); if(direction.equals("E")) location.setLocation(location.getX(), location.getY()); if(direction.eq...
f8092730-0898-4177-b21f-985b98e07895
4
public static InetAddress getMyHamachiIP() { try { if (!CFG.INTERNET) return InetAddress.getLocalHost(); List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces()); for (NetworkInterface ni : interfaces) { if (ni.getDisplayName().equals("Hamachi Network Interface"))...
f59434ae-00a5-4216-b77c-cc48d806ba52
2
private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed Usuario usuario = new Usuario(); int codGerente = Integer.parseInt(txtCodigo.getText()); usuario.setIdUsuario(codGerente); usuario.setTipo("Gerente"); UsuarioBO ...
2cdc498c-3936-49a3-83d3-e4a4795da19b
9
public void run() { try { boolean running = true; while (running) { try { String line = null; while ((line = _breader.readLine()) != null) { try { _bot.handleLine(line); ...
861b97db-fe1b-404b-a5a3-b38998ae763b
2
public static void addLastRoom(Player player) { List<String> inRooms = RoomyLibrary.getRoomsIn(player); if (!Roomy.lastRoom.containsKey(player)) { // add players last room Roomy.lastRoom.put(player, inRooms); } else { if (Roomy.lastRoom.get(player).hashCode() != inRooms.hashCode()) { Roomy.lastRoom.pu...
94919e78-34b6-4e53-86cc-31256b628a3d
2
public double getDouble(String key) { Object value = get(key); try { return value instanceof Number ? ((Number) value).doubleValue() : Double.valueOf((String) value).doubleValue(); } catch (Exception exception) { return 0; } }
0cada544-4a3f-4dca-92f5-9f44394445e3
2
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerTeleport(PlayerTeleportEvent event) { // if knockback is set to 0, simply return if (Config.KnockBack() == 0.0) return; Location newLoc = BorderCheckTask.checkPlayer(event.getPlayer(), event.getTo(), true, true); if...
0c763e28-538f-47a6-a83f-35f8e10b3e59
3
public static void main(String args[]) { Scanner scan = new Scanner(System.in); System.out.println("Digite uma frase:"); String[] phrase = scan.nextLine().split(" "); System.out.println("Digite uma palavra:"); String word = scan.nextLine(); int count = 0; for ...
6a04e3d0-a2ad-4916-8d52-445b1d8f22d2
5
public void move(){ y -= dy; x += dx; if(y <= MAX_TOP) y = MAX_TOP; if(y >= MAX_BOTTOM) y = MAX_BOTTOM; if(x <= MIN_LEFT) x = MIN_LEFT; if(x >= MAX_RIGTH) x = MAX_RIGTH; if (layer2 - v <=0){ layer1 = 0; layer2 = 1000; } lay...
8325d060-5b9f-4b88-a152-d5756c4a01d3
2
public String arrayToString(String[] stringToChange) { // take each part of the array and separate it with ':'s String stringToReturn = stringToChange[0]; try { // start with the first index on the array for (int i = 1; i < stringToChange.length; i++) { stringToReturn = stringToReturn.concat(":"); s...
96e43e6f-7be4-49a7-b5ea-60664f70bf26
9
@Override public double calculateJuliaWithPeriodicity(Complex pixel) { iterations = 0; check = 3; check_counter = 0; update = 10; update_counter = 0; period = new Complex(); Complex[] complex = new Complex[2]; complex[0] = new Complex(pixel);//z ...
b7e92069-3789-45e1-b205-6a9fd430fda9
2
public void setPrivate(final boolean flag) { if (this.isDeleted) { final String s = "Cannot change a field once it has been marked " + "for deletion"; throw new IllegalStateException(s); } int modifiers = fieldInfo.modifiers(); if (flag) { modifiers |= Modifiers.PRIVATE; } else { modifiers ...
d768af08-ebc9-4df7-a008-3b5eabff0456
1
private static MoneyConverter getInstance() { MoneyConverter moneyConverter = SHARED_INSTANCE; if (moneyConverter == null) { moneyConverter = new MoneyConverter(); } return moneyConverter; }
280d96d5-a233-47be-bf9d-4413e0102f5c
5
public ResultSet queryResult(String query) { try { final Connection connection = getConnection(); if (connection == null) { Utilities.outputError("Could not connect to database '" + m_databaseName + "' using '" + m_options.username + "'@'" + m_options.host + ":" + m_options.port + "' using password '" ...
ded44785-c8ef-4bb6-ad4b-bf4cfa094c2d
4
private boolean outOfBounds(int row, int col) { if (row > 7 || row < 0 || col > 7 || col < 0) return true; return false; }
ca37e3b4-c2fa-4dae-a40d-19aa6f72ab18
1
public final int stackSize() { int size = returnType.stackSize(); for (int i = 0; i < parameterTypes.length; i++) size -= parameterTypes[i].stackSize(); return size; }
9bdfb2a8-9d3e-4052-8fb4-a26ddedf6c31
6
@Override public void updateAnimation() { if (dead){ this.movement = movement.ZERO_VECTOR; } if (this.movement.x() == 0){ if (this.animation == catAnimRightWalking) this.animation = catAnimRightStatic; else if (this.animation == catAnimLeftWalking) this.animation = catAnimLeftStatic; } else if (th...
d683ab6c-2b7e-4f87-aeb7-4e315e1311cd
1
@Override public void run() { StatefulContext ctx = new StatefulContext(); flow.start(ctx); // This is not required when using SyncExecutor // By the time we get here, flow is already completed // SyncExecutor runs on the same thread on which "start" is called ...
65ab89a5-6dfa-4785-b84c-75fffa1fe388
4
public void fastAdd( Object obj, int row, int col, int formatId ) { int[] rc = { row, col }; // use default format if( formatId == -1 ) { formatId = 0; } if( obj instanceof java.util.Date ) { String address = ExcelTools.formatLocation( rc ); add( (java.util.Date) obj, address, null ); } el...
67f9118e-d75d-4a17-8c73-23dc4bb69b94
4
protected void read(String mapFileName) { // Read the whole file and split lines String cols = Gpr.readFile(mapFileName); String lines[] = cols.split("\n"); // Initialize data positions = new int[lines.length]; chrNames = new String[lines.length]; ids = new String[lines.length]; id2LineNumber = new Has...
a74d4997-3606-4cdb-94ad-97bd4a40bfaa
0
public Tag() { listeMetaDonnees = new ArrayList<Metadonnee>(); listeTags = new ArrayList<Tag>(); }
b42fde2b-8f1f-4a4e-8de8-6da10fcc3c7b
6
@Override public void actionOnPChoice(int choice, int player) { switch(choice){ case PlayersChoices.LETTER_A_CHOSE : chooseA=true; unitsToRemove=2; plChoice.blank(); break; case PlayersChoices.LETTER_B_CHOSE : reduceHighestTrack(); plChoice.blank(); end(); break; case PlayersChoices.REM...
30f795ef-83d3-4a6d-9612-fbb53c151bbc
9
protected String step5a (String str) { // (m > 1) E -> if(str.length()==1 || str.length()==0 || str.equalsIgnoreCase(" ") || str.equalsIgnoreCase(" ")) return str; if ((stringMeasure(str.substring(0, str.length() - 1)) > 1) && str.endsWith("e")) return str.substri...
3efa0948-69de-4141-b769-c1662c7cf759
5
public void addAddress(HashMap<String, String> adr) { if(adr.containsKey("countryCode")) this.countryCode = adr.get("countryCode"); if(adr.containsKey("state")) this.state = adr.get("state"); if(adr.containsKey("street1")) this.street1 = adr.get("street1"); if(adr.containsKey("street2")) this.street2 = adr.get(...
6853e7cc-e3ca-475a-b70e-dfd6d7689c1c
5
public HashMap<String, Subject> createSubjects() { HashMap<String, Subject> subjects = new HashMap<String, Subject>(); for(String line : courses) { Course courseToAdd = new Course(line); String courseSubject = courseToAdd.getSubject(); //Collection is empty if(subjects.size() == 0){ //add very f...
b6e2039d-6d7f-4ea7-9867-0f50a797f287
7
public void updateImage(BufferedImage selectedImage) { for (int i = 0; i < X.length; i++) { int x = selectionArea.get(i).x - xMin; int y = selectionArea.get(i).y - yMin; int R = (int)Math.round(X[i][0]); int G = (int)Math.round(X[i][1]); int B = (int)Math.round(X[i][2]); if (R >...
a2ff5c9f-cc4c-4da9-b44d-1023f5dcd4a3
7
private GroupNode getGroupNodeInstance( G group ) { GroupNode[] buckets = mGroupBuckets; final int hash = (group == null ? 0 : rehash( group.hashCode() )); final int idx = hash & (buckets.length - 1); GroupNode g = buckets[idx]; while( g != null ) { if( ha...
1b83a65b-eff1-40ac-a434-6ed5eeb09f95
1
public void setString(String value, int offset){ byte[] stringBytes = value.getBytes(); for (int i=0; i<stringBytes.length; i++){ bytes[offset++] = stringBytes[i]; } }
a78f3dcf-9a96-4bd6-aa65-6edad6fda321
0
public Integer getIdPerfil() { return idPerfil; }
4c849142-d5cf-46dd-aeab-b25d7dce938f
2
public void testWithers() { LocalDate test = new LocalDate(1970, 6, 9, GJ_UTC); check(test.withYear(2000), 2000, 6, 9); check(test.withMonthOfYear(2), 1970, 2, 9); check(test.withDayOfMonth(2), 1970, 6, 2); check(test.withDayOfYear(6), 1970, 1, 6); check(test.withDayOfWee...
fec152af-6fee-410c-8538-85d0c02df943
7
public Integer isExitValid (Integer currentRoom, String trigger, String username, PrintWriter out) { for (Map.Entry<String, String[]> exit : environmentExits.entrySet()) { if (exit.getKey().startsWith(currentRoom + ":")) { String[] tempArray = exit.getValue(); if (tem...