method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e5a79860-fea8-420e-b673-5437811a4cf9
1
public static String escapeDoubleQuotes(String string) { if (string == null) { return null; } String result = string.replaceAll("\\\\", "\\\\\\\\"); return result.replaceAll("\\\"", "\\\\\\\""); }
b22d4538-ab61-4b37-b021-ac96b6ee51df
7
public void languageAndWordlistCheckMain() { try{ // Open the file that is the first // command line parameter FileInputStream fstream = new FileInputStream("Options.dat"); // Get the object of DataInputStream DataInputStream in = new...
be81fdd2-7b73-4c5e-8b50-77746defe7d0
5
private int knapsack(int n, int capacity, int w[], int v[]) { // dynamic programming if (vKnapsack[capacity] != Integer.MIN_VALUE) return vKnapsack[capacity]; // Find the optimal value that can carried in a knapsack of given // capacity // The optimal value that can be carried is the maximum of the optim...
dbd0d22a-011d-4d83-903d-67cddcbb64f2
4
@EventHandler public void onTarget(EntityTargetLivingEntityEvent e) { if (e.getTarget().getType() == EntityType.PLAYER) { if (e.getTarget().isInsideVehicle()) { if (e.getEntity().getEntityId() == e.getTarget().getVehicle() .getEntityId()) { e.setCancelled(true); e.setTarget(null); if (e.g...
bea040ad-8874-44b6-8b2f-30865d3295cb
7
private void updateAsteroids() { ArrayList<Asteroid> deadAsteroid = new ArrayList<Asteroid>(); for(int i = 0; i < asteroids.size(); i++) { Asteroid a = asteroids.get(i); a.move(); if(CollisionDetector.isColliding(sc, a)) { if(!sc.isShieldActive()) sc.damaged(a.getStrength()); else ...
7cac7489-6cd1-412d-9815-2b5b5aeb8504
4
public SimpleSparqlSimulator(String endpoint) throws MalformedURLException { // read the list of files of queries sparql_queries = new ArrayList<File>(); URL url = getClass().getResource("/"); LOGGER.info("Reading queries (txt files) from " + url.getPath() + SimpleSparqlSimulator.class.getName()); File dir = n...
929d1492-f53c-44c6-8715-6fbd6ec30db0
3
public static BasicBlock find(BasicBlock[] blocks, int pos) throws BadBytecode { for (int i = 0; i < blocks.length; i++) { int iPos = blocks[i].position; if (iPos <= pos && pos < iPos + blocks[i].length) return blocks[i]; } throw new BadByteco...
cd287bdc-a0a4-4f3a-9804-6b25b31c0940
1
public int atualizar(String sql) { Connection conn = this.getConn(); try { Statement stm = conn.createStatement(); return stm.executeUpdate(sql); } catch (SQLException ex) { Logger.getLogger(ConectorMySql.class.getName()).log(Level.SEVERE, null, ex); }...
a8d06867-2be1-432e-ab0c-abed8f1b6a38
1
protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) { if (isSelected) { int vDifference = (int) (boldFontMetrics.getStringBounds(title, g).getWidth()) - textRect.width; textRect.x -= (v...
bd818420-83e3-49b1-9d13-fd2db0694b11
5
public void doFilter(ServletRequest _request, ServletResponse _response, FilterChain chain) throws IOException, ServletException { if (_request instanceof HttpServletRequest && _response instanceof HttpServletResponse) { HttpServletRequest request = (HttpServletRequest) _request; HttpSer...
a420c614-a08d-4142-a524-eec522c2fe18
6
private static void printGame(JSONObject jo) { try { JSONArray champs = Champion.getAllChamps(false); long champId = jo.getLong("championId"); System.out.println("Game " + jo.getLong("gameId")); System.out.println("-----------------------------"); System.out.println("Champion: " + ch...
5aa07a78-1d93-4efd-8614-8de5c6357ab7
0
private void setSelected(SingleScorePanel singleScorePanel) { singleScorePanel.setSelected(true); }
17e7a771-0633-4ccf-819f-062a446b40e2
7
public static void main(String args[]) { String test = args[0]; int up = 0; int down = 0; int left = 0; int right = 0; for(int i = 0; i < test.length(); i++) { switch(test.charAt(i)) { case 'U': up++; break; case 'D': down++; break; case 'L': left++; break; case 'R': right++; brea...
aa9b001d-4cf0-4e7c-826d-4ef5c490afd4
7
@Override public boolean equals( Object obj ){ if (this == obj){ return true; } if (obj == null){ return false; } if (obj instanceof PassengerCar ){ PassengerCar temp = (PassengerCar) obj; return ( this.baggageWeight == temp.getBaggageWeight())&& ( this.passengersCount == temp.getPassenger...
627e2055-d030-4fa6-930e-7aa5c5d3560e
4
public static int[] getRandomOrdering(int Size){ double[] randArray = new double[Size]; for(int n = 0; n < Size; n++){ randArray[n] = Math.random(); } int[] randOrder = new int[Size]; double lowestRand = 1; for(int i = 0; i < Size; i++){ for(int n = 0; n < Size; n++){ if(randArray[n] < lowestRand)...
b88f32a8-5988-4145-9b6a-ad33ae0ca405
0
public void timeAndComputeValue(){ }
1ccb7b48-3b36-4433-b5ec-b2235a0de05e
9
public String rotate(String plainText) { char[] plainTextChars = plainText.toCharArray(); StringBuilder rotatedChars = new StringBuilder(); for (char plainTextChar : plainTextChars) { if ((plainTextChar >= 'a' && plainTextChar <= 'm') || (plainTextChar >= 'A' && plainTextChar <= 'M...
3aa00801-c5f6-4886-87ba-cace8a50673f
2
public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP && !principal.getSalta()){ principal.setSalta(); tiempoCaida = 0; } }
aee1693d-00d9-421b-b975-ed6b749d2c05
3
public void removeOpinion(DataRow row) { boolean result = DataVector.getInstance().dbManager.remove(row); if(!result) { ErrorDialog errorDialog = new ErrorDialog(true, "Nastąpił błąd w usuwaniu opinii: " + row.getName() + ".", "AbstractManager", "Method: removeOpinion(DataRow row...
38914963-8fed-487c-8a2e-918c4298cd6d
1
public String udp2String(Packet packet) { UDPPacket udpPacket = (UDPPacket) packet; //Creates a udp packet out of the packet EthernetPacket ethernetPacket = (EthernetPacket) packet.datalink; //Creates and ethernet packet for layer 2 information methodData += src_macInEnglish = ethernetPacket.getSourceAdd...
42d48e07-ad79-4db7-9899-5c7588c8baea
9
public static void main(String [] args) throws Throwable { if (args.length < 2) { usage(); return; } Class stemClass = Class.forName("org.tartarus.snowball.ext." + args[0] + "Stemmer"); SnowballStemmer stemmer = (SnowballStemmer) stemClass.newInstance(); Reader reader; ...
02e4f113-9f44-4085-8c76-9275d77e190b
0
public String getPassword() { return password; }
8dee17b7-2f86-420e-b327-ef59e049c303
0
public void add(String line) { graph.append(line); }
5910b552-37e3-47d3-b8f5-4b2b4d728124
1
public static boolean isOptionPresent(String cmdLineArg, char option) { boolean result = false; // avoid "--abc" if (cmdLineArg.lastIndexOf('-') == 0) { result = cmdLineArg.indexOf(option) >= 1; } return result; }
171354f1-4315-426b-bd8b-c4474addfe92
0
public long getSeatType() { return this._seatType; }
3e2fc6aa-1744-4148-8956-f9e06c3cdb15
4
public static boolean isOnScreen(Entity paramEntity) { if (paramEntity.getXpos() > ScreenHelper.widthNeg(paramEntity) && paramEntity.getXpos() < ScreenHelper.widthPos(paramEntity)) { if (paramEntity.getYpos() > ScreenHelper.heightNeg(paramEntity) && paramEntity.getYpos() < ScreenHelper.h...
dcea5c20-384d-400f-8943-78dc2256a68a
2
public ListNode rotateRight(ListNode head, int n) { if(null == head || null == head.next) return head; int length = getLengthOfList(head); ListNode tail = getTailOfNode(head); tail.next = head; ListNode pivot = getRotateNode(head, length - n % length); ...
190edb77-5745-4283-bae5-cc5c7f560dff
1
public ArrayList<Record> getNewsfeed() { ArrayList<User> myfriends = getFriendList(); ArrayList<Record> newsFeeds = new ArrayList<Record>(); for (int i = 0; i < myfriends.size(); i++) { User friend = myfriends.get(i); newsFeeds.addAll(QuizTakenRecord.getQuizHistoryByUserID(friend.userID)); newsFeeds.addA...
b6a9c6da-d3fe-48b3-950d-f2aea06649e4
5
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String id = req.getParameter("id"); String password = req.getParameter("password"); if (id == null || id.length() == 0 || password == null || password.length() == 0) { resp.sendError(400, ...
eb20446a-7317-41f1-8dd0-6d1d59542824
6
public void paintComponent(Graphics g){ Graphics2D g2 = (Graphics2D) g; int heightMover = 0; for (int tetIndex = 0; tetIndex<upcoming.size(); tetIndex++){ g2.setColor(controller.getBlankColor()); g2.fillRect(0, heightMover*size, size*6, size); g2.setRenderingHint(RenderingHints.KEY_ANTIALIA...
303df892-b09b-42e4-a9cd-0bcd866dc54a
4
@Override public void deserialize(Buffer buf) { elementId = buf.readInt(); if (elementId < 0) throw new RuntimeException("Forbidden value on elementId = " + elementId + ", it doesn't respect the following condition : elementId < 0"); elementCellId = buf.readShort(); if (e...
f1e75e2a-3da1-4837-9799-25142219d00b
3
@Override public void doAction(Player player) throws InvalidActionException { if (player == null) throw new IllegalArgumentException("Player can't be null!"); if (player.getRemainingActions() <= 0) throw new InvalidActionException("The player has no turns left!"); Position currentPos = player.getPosition(...
fbd0a61c-6351-450f-a132-65d023356f9b
1
void toss(){ Random rand=new Random(); if(rand.nextInt(9)<5){ this.setHeadSide(true); }else{ this.setTailSide(true); } }
365fa54b-ffc6-414b-8bc4-cd6d830153fa
5
private long ticklessTimer() { // Calculate tickless timer, up to 1 hour long tickless = System.currentTimeMillis() + 1000 * 3600; for (STimer timer : timers) { if (timer.when == -1) timer.when = timer.delay + System.currentTimeMillis(); if (tickless ...
6d3c9243-11d5-432f-b51c-11ce0bced97d
2
@SuppressWarnings({ "rawtypes", "unchecked" }) public void getAllInGroup(String group, Map target){ try{ String key; ObjectInputStream objStr; Serializable obj; PreparedStatement prep = this.conn.prepareStatement("SELECT key, value FROM keyval WHERE collection = ?"); prep.setS...
9c939cbb-7e32-4474-972e-3d47e30de5ae
3
public String getConsulDefMap(String arg_dt1) throws SQLException, ClassNotFoundException { ResultSet rs; String sts = ""; Connection conPol = conMgr.getConnection("PD"); if (conPol == null) { throw new SQLException("Numero Maximo de Conexoes Atingida!"); } t...
3a17ee1a-7750-426b-ab3e-44d9364f0564
3
private void btnValiderMembreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnValiderMembreActionPerformed if(jRadioButton1.isSelected()){ jTable1.setModel(new ListMembreNomController(jTextField1.getText())); } if(jRadioButton2.isSelected()){ ...
35233eab-ff71-4500-a9da-45898410a5d0
1
public void fillStocks() { pnlDashboardCenter.removeAll(); stocks = new ArrayList<Stock>(Service.getAllStocks()); Collections.sort(stocks); squareGraphicList = new ArrayList<SquareGraphic>(); selectedSquare = null; for (Stock stock : stocks) { SquareGraphic sq = new SquareGraphic(); sq.addMouseListen...
c4b9fb02-e20f-4c01-87cf-b6454b634824
7
private boolean isStudentInOneLectureAtTheTime(Teacher teacher, List<Group> teachersGroups, Group group, int lectureNumber, LinkedHashMap<String, LinkedHashMap> dayTimeTable) { boolean mandatoryConditionsMet = true; if (group != null) { // System.out.println("Grupe idejimui: " + group.getGrou...
6cf8a078-b6c9-4d18-8df7-9c70ba3c1b46
8
public void paintComponent(Graphics g){ int x = this.getWidth(); int y = this.getHeight(); g.setColor(Color.GRAY); if(n==0) {g.setColor(Color.blue);} if(n==1) {g.setColor(Color.red);} if(n==2) {g.setColor(Color.green);} g.fillRect(0, 0, this.getWidth(), this.getHeight());...
8b1d1250-dc18-4ab8-b9b0-0752afbddc60
0
public static int chooseFile() { Scanner in = new Scanner(System.in); String[] files = FileLister.getFilesArrayString(); FileLister.listFiles(files); System.out.println(">Enter a file number"); int selection = in.nextInt() - 1; return selection; }
bfcab2a8-fd27-4568-9644-7c9d6cda1ac4
8
public void buildClassifier(Instances instances) throws Exception { // can classifier handle the data? getCapabilities().testWithFail(instances); // remove instances with missing class instances = new Instances(instances); instances.deleteWithMissingClass(); double sumOfWeights = 0; m...
1044a308-8f09-484f-bc72-07a9f86571ec
6
public List<String> summaryRanges1(int[] nums) { List<String> result = new ArrayList<String>(); if(nums.length<1) return result; int start = nums[0]; int end = 0; int i = 0; while(i<=nums.length-1){ if(i+1 == nums.length || nums[i+1] != nums[i]+1 ){ end = nums[i]; if(end == start){ resul...
20b252df-0da5-4097-800f-b163722ad9f4
3
public String toString() { ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE) .append("username", this.username) .append("enabled", this.enabled) .append("accountExpired", this.accountExpired) .append("credentialsExpired", ...
7bed44a0-566d-4d95-a04e-f862328e9892
7
public int getAxisWidth(Graphics g) { int i; width = 0; if (minimum == maximum) return 0; if (dataset.size() == 0) return 0; calculateGridLabels(); exponent.setText(null); if (label_exponent != 0) { exponent.copyState(label); exponent.setText("x10^" + String.valueOf(label_exponent)); } ...
dbc53f3e-35af-42b0-b217-d75b281db3e7
4
Acceptor(TerminateSignaller terminateSignaller, ServerSocket serverSocket, ThreadModelType threadModelType, ExecutorService executorService, Serializer serializer, Class<T> serviceInterface, Class<V> serviceObjectClass, ThreadPoolOverflowPolicy threadPoolOverflowPolicy) throws Serv...
0f43cdfb-111c-4032-9244-dfaf2496abdb
0
@Override public int getColumnCount() { return columnNames.length; }
124a25b1-c44f-43ee-b4ea-ab8696ca70d2
3
public static boolean isGetter(Method method) { if(!method.getName().startsWith("get")) return false; if(method.getParameterTypes().length != 0) return false; if(void.class.equals(method.getReturnType())) return false; return true; }
689a6ae0-3763-4451-ae10-328450d4c598
4
private String postRequest(String URL, String request) throws IOException { HttpPost hp = new HttpPost(URL); //StringEntity ent = new StringEntity(request, "UTF-8"); StringEntity ent = new StringEntity(request, HTTP.UTF_8); hp.setEntity(ent); hp.addHeader("Authorization", "Bas...
469a7d9c-1e34-4879-b044-99adf831d735
5
private GenericConverter getRegisteredConverter(Class<?> sourceType, Class<?> targetType, Class<?> sourceCandidate, Class<?> targetCandidate) { ConvertersForPair convertersForPair = converters.get(new ConvertiblePair(sourceCandidate, targetCandidate)); return convertersForPair == null ? null : conve...
03d502fd-730d-425b-9cfd-4478c9af7aae
9
public int process() { Stack<Character> stack=new Stack<Character>(); InputReader in=new InputReader(getClass().getResourceAsStream("/balexp.txt")); String line=in.readLine(); for(int i=0;i<line.length();i++) { char ch=line.charAt(i); switch(ch) { case '(': case '[': case '{':stack...
fbc0dd67-20c1-491b-85fc-5bf6bb831d0a
6
public void executeLookupAction(String base, String sourceLocale, String targetLocale){ log("lookup in base \"" + base + "\" from locale \"" + sourceLocale + "\" to locale \"" + targetLocale + "\":"); log(); log("reading target word storage from disk..."); WordStorage sourceWordStorage = (WordStorage)WordSto...
fa41a8e8-6a9f-4129-9bbe-c3c24f975fb1
9
public BadNetwork(Channel leftIn, Channel leftOut, Channel rightIn, Channel rightOut) { leftIn_ = leftIn; leftOut_ = leftOut; rightIn_ = rightIn; rightOut_ = rightOut; currentState = Status.NOMSG; /* Swing */ netLbl = new JLabel("Network"); netBtnFail = new JButton("Failure"); netBtnSuccess ...
142682aa-1dcb-4887-a50f-c151b7275535
3
private static void printCharacters(ArrayList<Character> characters) { Comparator<Character> chars = new Comparator<Character>() { // TODO compares Characters by level, strength and armour // note that this soln isn't quite correct, // find the bug and fix it @Override public int compare(Character c...
4e73f744-b772-4cbf-b284-1df67ff809cf
5
private boolean containsEnemyWool(TeamPlayer p, CTFTeam team) { Wool w = new Wool(this.GoalTeam.getColor()); //Check for wool for (ItemStack m : p.getPlayer().getInventory()) { //If item in inventory is wool if (m != null && m.getType().equals(Material.WOOL)) { System.out.println("Got...
b39cc7be-83f4-49ba-b43f-bf14593383b5
7
protected void calculateAverageContingencyMatrix() { // Initialize the matrix double[][] newMatrix = new double[super.classesNumber()][super.classesNumber()]; for(int i = 0; i < newMatrix.length; ++i) for(int j = 0; j < newMatrix[0].length; ++j) newMatrix[i][j] = 0.0; // Sum all the performances ma...
14ebea22-6b09-47e5-946b-a0b7ae93e27c
0
public String getShopUrl() { return shopUrl; }
3e3df11e-fe91-403c-b7d5-995fb1295a72
9
protected static void createDescriptor() { try { InputStream descriptorStream = ResultParserParseControllerGenerated.class.getResourceAsStream(DESCRIPTOR); InputStream table = ResultParserParseControllerGenerated.class.getResourceAsStream(TABLE); boolean filesystem = false; if(descri...
623fea8b-dc20-4157-8084-cf1cd27be20b
1
@Override public int compare(StopRange arg0, StopRange arg1) { int stops1 = arg0.end - arg1.start; int stops2 = arg1.end - arg1.start; int rs = Integer.compare(stops1, stops2); if(rs == 0) { rs = Integer.compare(arg0.start, arg1.start); } return rs; }
ee6a1e15-ea94-4492-83ad-ea840412887a
0
public void update() { value = neighbours.size(); }
0eaf84f6-20f8-4f1e-a0b0-178d910e3eeb
1
public boolean EliminarAfecta(Afecta p){ if (p!=null) { cx.Eliminar(p); return true; }else { return false; } }
0b3bd67a-3bb5-44ee-8df8-14cda4344e70
4
public static int maxProfit(int[] prices) { int profit=0; if(prices.length <=0) return profit; int minPrice=prices[0]; for(int i=0;i<prices.length;i++){ profit=prices[i]-minPrice>profit?prices[i]-minPrice:profit; minPrice=prices[i]<minPrice?prices[i]:minPrice; }...
c6e14828-cccd-4819-8f52-262e3d54c319
2
public void set(String seqStr) { if( seqStr == null ) { length = 0; nmer = 0; } else { nmer = 0; setLength(seqStr.length()); // Create binary sequence char seqChar[] = seqStr.toCharArray(); int i; for( i = 0; i < length; i++ ) rol(seqChar[i]); } }
d46ca780-069e-443b-8eb1-6266c0447d8f
4
public double value(StateObservation a_gameState) { boolean gameOver = a_gameState.isGameOver(); Types.WINNER win = a_gameState.getGameWinner(); double rawScore = a_gameState.getGameScore(); if(gameOver && win == Types.WINNER.PLAYER_LOSES) rawScore += HUGE_NEGATIVE; ...
8d4efed2-bfa7-4e12-a064-b9aaca43c8e3
2
public ZElement chercheElement(int x, int y) { for (int i = zelements.size() - 1; i >= 0; i--) if (getElement(i).isSelected(x, y)) return getElement(i); return null; }
3be76cc9-ddb5-490e-bdfe-5f03b1d9f88b
3
public void draw(int windowX, int windowY, int xStart, int yStart){ for (int x = 0; x < Standards.MAP_TILES_TO_DRAW; x++){ for (int y = 0; y < Standards.MAP_TILES_TO_DRAW; y++){ int cx = x + xStart; int cy = y + yStart; if (isOnMap(cx, cy)){ int drawX = x * Standards.TILE_SIZE; int ...
84475a6a-a5a1-41c8-b8e6-6c2ad80a826c
4
public void notifyAdd(UpdateTag... tags) { if (updateExec == null || updateExec.done) { updateExec = new UpdateCall(); SwingUtilities.invokeLater(updateExec); } for (UpdateTag ut : tags) { if (!updateExec.mods.contains(ut)) updateExec.mods.add(ut); } }
692fb200-0348-4e82-8ba8-86600ff2912d
7
@Override public String requestPro(HttpServletRequest request, HttpServletResponse response) throws Throwable { request.setCharacterEncoding("utf-8"); MultipartRequest multi = null; int sizeLimit = 10 * 1024 * 1024 ; @SuppressWarnings("deprecation") String savePath = request.getRealPath("/upload"); ...
a423f063-020f-4952-a13a-1c7fcdfb1991
0
@Override public String getName() { return NAME; }
8be7dff9-0460-4c9e-9995-1948549389ec
3
public Base(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "href": href = Href.parse(this, v); break; case "target": target = Target.parse(this, v); break; ...
15561e20-8a0f-46b5-9e0f-5acca2ce3240
7
@Override protected void doAction(int option) { switch (option) { case 1: listAllSongs(); //lister alle sange op break; case 2: songSearch(); //søger en bestemt sang break; case ...
a81ebef1-fc7d-4b30-956a-3a5327a63cc4
8
static public List<Class<?>> getMapTypes(String str_className, String str_fieldName) { List<Class<?>> lcla_types = new ArrayList<Class<?>>(); try { Class<?> lcl_class = Class.forName(str_className); Field lcl_f = lcl_class.getDeclaredField(str_fieldName); Type lcl_type = lcl_f.getGenericType(); if (lc...
f29cdc5b-a001-4299-9044-bfea0bef5fb4
7
private void moveToNextParam() { JTextComponent tc = ac.getTextComponent(); int dot = tc.getCaretPosition(); int tagCount = tags.size(); if (tagCount==0) { tc.setCaretPosition(maxPos.getOffset()); deactivate(); } Highlight currentNext = null; int pos = -1; List<Highlight> highlights = getParamet...
0077f2c8-b5d8-4690-9b44-85d1cb933447
8
public SetDeck() { try { Gson g = new Gson(); URL url = new URL("http://128.199.235.83/icw/?q=icw/service/all_ic_of&user=624"); try { HashMap<String, ArrayList<Double>> temp = g.fromJson(new InputStreamReader(url.openStream()), HashMap.class ); ArrayList<Double> cardString = temp.get("data"); try...
12c459b0-ac65-4062-8f4e-56be324ae1f4
6
public void generateHorizontalCorridor(MapRegion room1, MapRegion room2, String[][] dungeon) { // Etäisyys lähekkäimpien seinien välillä int distance = room2.getX1() - room1.getX2(); // Valitaan alku- ja loppukoordinaatit siten, että polku ei koskaan kulje huoneen kulmasta int startY...
209982d3-1a86-4900-be82-b58d8e2159a8
4
private String pickMobSpawner(Random var1) { int var2 = var1.nextInt(4); return var2 == 0?"Skeleton":(var2 == 1?"Zombie":(var2 == 2?"Zombie":(var2 == 3?"Spider":""))); }
8d7a019e-d840-45ba-ac90-2d8e8474577e
0
public Type getType() { return this.type; }
36d81adc-33ec-4ff9-8a3f-0c87f64b69c6
1
public boolean isStore(Chest chest){ if(chest==null) return false; return stores.containsKey(chest); }
1ad8f53b-e30e-4e1a-9823-26c585d2df26
8
public void remove(Object removedObject) { Object[] tempArray; int numberOfFindElements = 0; if (object == null||object.length==0) { throw new IllegalArgumentException( "There is no elements in Arraylist! Nothing could be deleted!"); } for (int i = 0; i < object.length; i++) { if (object[i].equa...
bc77054a-0897-4b38-a40c-68c7245ae64a
3
private String login(String username,String password,String randCode) throws IOException{ URL url = new URL("https://kyfw.12306.cn/otn/login/loginAysnSuggest?loginUserDTO.user_name="+username+"&userDTO.password="+password+"&randCode="+randCode); HttpsURLConnection con = (HttpsURLConnection) url.openConn...
644e0c73-1d19-40fd-b706-589b15a3c795
2
@Override public void update(){ if(hitPoints <= 0) die(); super.update(); for(Shield shield : shields) shield.update(); }
bd19657b-9091-4157-85ad-4088ddbe8743
4
public GridCell cell(int row, int col) { if (row < rows && col < cols) { if (row < 0 || col < 0) { return null; } return gridCells[row][col]; } return null; }
048d5916-98a8-4c98-9bc8-7b561a7730b5
0
@Test public void shouldReturnAreaOfTenForTwoByFiveRectangle(){ Rectangle rectangle = new Rectangle(5, 2, 0, 0); assertEquals(10, rectangle.area()); }
ab784abe-2d8a-45bb-9070-3928f949b5fa
2
* @param active Whether or not the active version of the color is needed. * @return The background color. */ public static Color getListBackground(boolean selected, boolean active) { if (selected) { Color color = UIManager.getColor("List.selectionBackground"); //$NON-NLS-1$ if (!active) { color = Color...
40261a74-fb3c-485f-8b36-045dae74a4e2
9
public static boolean ananlysisNJCM(AnalysisOutput o, List<AnalysisOutput> candidates) throws MorphException { int strlen = o.getStem().length(); boolean success = false; if(strlen>3&&(o.getStem().endsWith("에서이")||o.getStem().endsWith("부터이"))) { o.addElist(o.getStem().substring(strlen-1)); ...
337f5c5f-d51d-47aa-8c32-c18dc351470f
1
public void removePreviousGlied() { SchlangenGlied oldPreviousGlied = previousGlied; previousGlied = null; if (oldPreviousGlied != null) { previousGlied.removeNextGlied(); } }
79f18a1e-cb85-4586-8961-8da9b228576e
6
private void escribirTeam(Piloto pilot) { int lectura = 0; String cadenainicio = ""; String cadenamedio = ""; String cadenafinal = ""; String nuevoarchivo = ""; Scanner s; try { s = new Scanner(pilot.getFile()); while ...
ba96067d-e7df-4879-90e9-42f6836d0c90
3
@Override public int observed(String sequence) { char seq[] = sequence.toUpperCase().toCharArray(); int cpg = 0; for( int pos = 0; pos < (seq.length - 1); pos++ ) if( (seq[pos] == 'C') && (seq[pos + 1] == 'G') ) cpg++; return cpg; }
2d27ba1d-f487-46e2-8643-f8c0a12a76e0
3
@Override public UserDTO getUserByLogin(String login, String pass) throws SQLException { Session session = null; UserDTO user = null; try { session = HibernateUtil.getSessionFactory().openSession(); user = (UserDTO) session.createCriteria(UserDTO.class) ...
f9c95030-0a51-4a56-b25f-6a1266c8b087
2
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { String data; try { if (request.getParameter("id") == null) { data = "{\"error\":\"id is mandatory\"}"; } else { Cl...
1f46f124-c302-469f-8162-8b0cd48e9b85
7
@Override public void execute(CommandSender sender, String[] arg1) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (arg1.length < 1) { sender.sendMessage(ChatColor.RED + "/" + plugin.setWarp + " (name) [private]"); return; } ...
b65af617-8c70-4a59-b74d-c3f1216024a2
3
public boolean load(String audiofile) { try { setFilename(audiofile); sample = AudioSystem.getAudioInputStream(getURL(filename)); clip.open(sample); return true; } catch (IOException e) { return false; } catch (UnsupportedAudioFileException e) { return false; } catch (LineUnavailableException...
f8fd0415-b8f2-4097-bb66-3c6d1895e920
5
@Override public void processEvent(Event event) { if(event.getHeader().getEventType().equals(LogEventType.ROTATE)) { try{ processRotateEvent(event); } catch (SQLException ex) { } } else if(event.getData() instanceof RowsIEventData) { i...
8530ad90-cf54-429f-9aad-d745ea56ae45
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
eedc4b08-0a67-4762-92fb-f63e6d9ca5e5
4
public JsonObject toJSON() { JsonObject obj = new JsonObject(); Gson gson = new Gson(); obj.addProperty("title", title); obj.addProperty("project", project); // Add contributors for(String key: contributors.keySet()) { if(!contributors.get(key).isEmpty()) obj.add(key, gson.toJsonTree(contributors.g...
c6b1b139-006f-4dfe-ae5e-a6949ab97c43
0
private void initView() { super.setLayout(new BorderLayout()); initGrammarTable(); JPanel rightPanel = initRightPanel(); JSplitPane mainSplit = SplitPaneFactory.createSplit(environment, true, 0.4, new JScrollPane(grammarTable), rightPanel); add(mainSplit, BorderLayout.CENTER); }
2175f529-a726-4ee1-9c13-64aaa57c8975
5
public static List<Actor> getActors(String urlString) throws TvDbException { List<Actor> results = new ArrayList<>(); Actor actor; Document doc; NodeList nlActor; Node nActor; Element eActor; try { doc = DOMHelper.getEventDocFromUrl(urlString); ...
d9300bf6-101c-4751-a52a-96bbae633001
0
public static String createPath(String folderName, String fileName) { return folderName + System.getProperties().getProperty("file.separator") + fileName; }
9a8ba1c9-4017-4c94-80c9-820b3927fe86
9
private void removeDataNode(DFSNode dataNode){ ///// System.out.println("dataNode is " + dataNode.getIp() + ":" + dataNode.getPort()); ///// for(DFSBlkDataNode dbdn : this.dataNodes){ if(dbdn.getIp().equals(dataNode.getIp()) && dbdn.getPort() == dataNode.getPort()){ ...
292daf4a-17b7-45ea-9347-e5d7bcc8e7f6
0
public float getK() { return k; }