method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5a788df0-cf6f-4a37-bbc9-3b3729b474dd
7
public void editLink(String classOneName, String classTwoName){ for (int i=0;i<components.size();i++){ if (components.get(i).name.equals(classOneName)){ for (int j = 0; j<components.get(i).links.size(); j++){ if (components.get(i).links.get(j).classTwoName.equals(classTwoName)){ //blank icon b...
30533496-9dbd-417b-9a54-f3e9bd833cc4
6
@RequestMapping("multiDel") public String multiDel(String[] ids,String flag){ if(ids ==null ||ids.equals("")){ if(flag =="listAll" || flag.trim().equals("listAll")){ return "forward:/rescue/getAllMess"; }else{ //request.setAttribute("status",flag); return "forward:/rescue/getStatusMess?status="+ f...
0e7a38d9-080f-4334-9d22-73e31f9cf1d0
4
public static List<Object[]> generateBatchQueryArguments(Object[] args, BatchDefinition batchDefinition) { // 获取批量SQL/Shell的批数,即@BatchParam对应的几个数组的最小length int batchSize = -1; Integer[] batchParamIndexes = batchDefinition.getBatchParamIndexes(); for (int i = 0; i < batchParamIndexes.length; i++) { int index ...
f0c364a1-95a1-48b9-b8a5-9824e5444e1e
2
public void save(String fileName) { try { OutputStream file = new FileOutputStream(fileName); OutputStream buffer = new BufferedOutputStream(file); ObjectOutput output = new ObjectOutputStream(buffer); output.writeObject(map.getData()); output.close(); buffer.close(); file.close(); } catch...
26a16d3e-5839-4f68-a7f3-f0c40fc15ebc
8
public static String findLongest(String input) { //maintain this to record boolean [][]isPalindrome = new boolean[input.length()][input.length()]; int maxLength = Integer.MIN_VALUE; int start = -1; //first find single length palindromes for( int i = 0; i< input.length();...
8cef792e-f2d7-4cd4-8299-ccdafcb2a31d
5
public boolean collectTypeInfo() { typeInfo.clear(); for (int i = 0; i < moduleNum; i++) { int rowPoint = 0; while (true) { String line = ""; for (int j = 0; j < 5; j++) { String cell = null; if (typeTable[i].getValueAt(rowPoint, j) != null) { cell = (String) typeTable[i].getValueAt(ro...
66f54627-8063-48e7-93db-0f39697e404f
8
public void run() { try { while (!isInterrupted()) { int msg = is.read(); if(msg == -1) return; switch (msg) { case OpCodes.DISCONNECT: return; case OpCodes.SET_IDLE: { monitor.setMovieMode(false); break; } case OpCodes.SET_MOVIE: { monitor.setMovieMode(true); b...
266f9100-96e6-4bb8-8e98-9b2327376043
9
private void handleMessage(RoomMessage room_message) { if (!changing_room ) { if ( bot_data.enablePlusPlus ) { //TODO maybe I can make a special type of command that can get all text instead of matching on command? //can use to run standup and plusplusbot? handlePlusPlusBot(room_message); ...
904e398d-8ac3-4c44-8d7c-e0c728267ce3
4
public static void graphDepthFirstTraversal(String[][] edgeList){ if(edgeList.length == 0){ return; }else{ ArrayList<String> discovered = new ArrayList<String>(); timeStamp = 0; for(String[] edge : edgeList){ String node1 = edge[0]; String node2 = edge[1]; if(!dis...
0e859033-7262-4436-b435-36f781efad67
1
public void reducePlayerHealth(String userName){ try { cs = con.prepareCall("{call reducePlayerHealth(?)}"); cs.setString(1, userName); cs.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } }
4916ab59-e2b9-4fd8-b24e-5078536e0af9
1
public double[] nextDoubles(int n) throws IOException { double[] res = new double[n]; for (int i = 0; i < n; ++i) { res[i] = nextDouble(); } return res; }
6668acf8-5a51-4911-9a9f-9516a171550b
0
public Abrir() { initComponents(); }
c2dbaa3b-0c85-4464-8292-d75fbcab49cc
8
public void placePieceOnBoard(Position myFreeposition, List<Position> freePositions) { freePositions.remove(myFreeposition); int x = myFreeposition.getX(); int y = myFreeposition.getY(); Position tmp = new Position(x, y); for (int xx = x, yy = y; xx < did.getN() && yy < did.getM(...
e644ad15-1c4d-48c6-afe6-e769f9834e44
9
@SuppressWarnings("unchecked") public Map<String, Object> readDaily(String file) { Map<String, Object> result = new LinkedHashMap<String, Object>(); try{ // Open the file FileInputStream fstream = new FileInputStream(file); // Get the object of DataInputStream ...
39dc517b-d82b-4d9a-8b27-6342ce9a452f
5
@Override public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("Terminate Scouting")) { //Terminate Scouting Button was Pressed //Check if Good Quit or not if(MainGUI.numConnected == numFinished) { //Nullify Communication Threads for(int k = 0;k<=5;k++) { ...
8677b272-c7d8-4a26-afaf-10401ecaedb8
0
@Override public Set<String> getEntities() throws DataLoadFailedException { return getList("entities", "name"); }
4a69de43-3a62-407d-8285-be864c9fe4e8
9
public void actionPerformed(ActionEvent event) { if(event.getSource() == humanButton) { isHuman = true; isElf = false; isDwarf = false; } else if(event.getSource() == elfButton) { isHuman = false; isElf = true; isDwarf = false; } else if(event...
c2351516-f2fa-4901-8e4a-cefd0d852796
0
@Override public void setPhone(String phone) { super.setPhone(phone); }
c0502d24-52a1-4ed4-a449-859e987438ec
4
public HashMap<String, Integer> fillFoldersWithFiles(int minFileSize, int maxFileSize) throws FoldersNotCreated, IOException { if (!this.foldersCreated) { throw new FoldersNotCreated(); } FileWriter fstream = new FileWriter(this.fsFolder + files_created); BufferedWriter out = new BufferedWriter(fstream); ...
7b9ead9f-eb03-4711-86e8-38935f488765
7
@Override public String execute() throws Exception { if (!this.userService.verifyLeader(cid, this.userService.getCurrentUser().getUid())) return LOGIN; System.out.println("-------------------- cid:" + cid + " account:" + account + " oldJob:" + oldJob + " newJob:" + newJob + " -------------------- "); if...
4facc956-d444-4573-a50e-e4598cf20817
4
private Node getNext(Node u) { if (u.right == null) { Node n = u; do { u = n; n = n.parent; if (n == null) return null; } while (u == n.right); //got nullpointer return n; } Node n = u.ri...
eac95969-955d-4e4d-950c-e58254e0a0c8
5
@Override public void actionPerformed(ActionEvent e) { // CLEAR ALL THE LISTS! DefaultListModel<ImageIcon> listModel = (DefaultListModel<ImageIcon>)imageSlider.iconList.getModel(); listModel.removeAllElements(); listModel.clear(); imageSlider.imageList.clear(); // Get the results depending o...
c217f9ab-3c8d-4a27-a7d7-cffb7080edd0
7
@Override public void executeCommand(CommandSender sender, Command cmd, String[] args){ CommandHelper helper = new CommandHelper(sender, cmd); Player player = (Player) sender; //Usage: /ghostsquadron map <create/delete> <name> if(args.length == 3){ if(args[0].equalsIgnoreCase("map")){ if(args[1].e...
7dc4f042-c8aa-4767-b8ac-947df8fd9891
1
public void enter(Miner miner){ //if the miner is not already located at the goldmine, he must //change location to the gold mine if (miner.getLocation() != Location.goldmine) { System.out.println(miner.getName() + " Walkin' to the goldmine"); miner.changeLocation(Location.goldmine); } ...
d67adade-5a78-4fcd-a07c-8926d4a5b199
3
public void parseCards() { for (String msg : read) { for (CardData list : CardData.values()) { if (list.name.toLowerCase().equals(msg.toLowerCase())) { cards.add(processedCard(list)); } } } }
d5f5c21e-6d5b-4511-8fc8-5b78d633605b
9
public int[] searchRange(int[] A, int target) { int[] out = {-1, -1}; if (A == null || A.length == 0) return out; int start = 0; int end = A.length - 1; while (start <= end) { int mid = start + (end - start)/2; if (A[mid] < target) ...
1ed0ee77-166c-4f55-993e-d3c82a3ea40c
6
private static int hexToBinNibble(char c) { int result = -1; if ((c >= '0') && (c <= '9')) result = (c - '0'); else { if ((c >= 'a') && (c <= 'f')) result = (c - 'a') + 10; else { if ((c >= 'A') && (c <= 'F')) ...
c81f4987-f345-4137-a1cf-edf60ebfca7a
1
public static int sumScores(Scores obj) { int total = 0; // total up all the stored scoreds in the paramter object for (int i = 0; i< obj.grades.length; i++) { total = total + obj.grades[i]; } return total; }
4e681efd-a3d4-4350-b45e-f95300610bf9
9
@Override public void gerer(Commande commandRyan, Commande commandAlex) { HashMap<String, Boolean> estGele_atPre = new HashMap<>(); estGele_atPre.put(ryan().nom(), super.estGele(ryan().nom())); estGele_atPre.put(alex().nom(), super.estGele(alex().nom())); estGele_atPre.put(slick().nom(), super.estGele(slick()...
e32da01f-4488-4615-b68f-56f4f58ebe2c
9
private Collection<? extends Node> getDropNodes(BlockType type, int x, int lowestY, DropDirection dd) { ArrayList<Node> result = new ArrayList<Node>(); switch(dd){ case UP: if(type==BlockType.Corner){ result.add(Node.getNode(Coordinate.getCoordinate(x, lowestY))); result.add(Node.getNode(Coordinate.get...
c911141f-3542-467f-a343-b080c6082cbb
8
private boolean evaluatePairing () { int toprank = 0; int botrank = 0; int topind = 0; int botind = 0; for (int i=Rank.NUM_RANK-1; i>=0; i--) { //int rankhashi = _rankhash[i]; int rankhashi = (int)((_Rankhash>>(4*i)) & 0xF); if (rankhashi > toprank) { botrank = toprank; ...
bd262d5b-3029-4f4c-8b8f-08a9c09873bf
5
private boolean addPosition(KrakenState state, XYLocation kingLocation,XYLocation location, ArrayList<KrakenMove> list,XYLocation finalLocation){ if (state.distance(kingLocation, location, finalLocation)){ if (state.isEmpty(finalLocation)){ list.add(new KrakenMove(location, finalLocation)); return fa...
f9c6bdb0-ffe1-4dcd-aa44-91efda4fadbb
5
public static byte[] createChecksum(String filename) throws FileNotFoundException { InputStream fis = new FileInputStream(filename); try { byte[] buffer = new byte[1024]; MessageDigest complete = MessageDigest.getInstance("MD5"); int numRead; ...
fd2caa30-86fc-44b4-b84d-f663801b2370
4
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); int[] nm = readInts(in.readLine()); int n = nm[0], m = nm[1]; Dijkstra G = new Dijkstra(n + 1); G.init(n + 1); int[] cost = readInt...
393870e5-0e1b-4b08-ba38-c6e6dafc9193
0
public String getDate() { return date; }
debd9343-5830-4bce-b33e-0fa61c023a70
1
private Integer score(String name) { int sum=0; for(byte b:name.getBytes()){ sum+=b-'A'+1; } return sum; }
cb64a564-4cfc-4607-812e-cb4391246e8c
9
private boolean isPower(int n) { if (n == 0 || n == 1) return true; HashMap<Integer, Integer> frequencyMap = new HashMap<>(); for (int i = 2; i <= n; i++) { while (n % i == 0) { if (frequencyMap.get(i) == null) frequencyM...
eceb2fdc-a942-4efc-9d84-5d8c7d5353ad
4
private static boolean newAngleBeforeOldAngle(AngleInterval newAngle, AngleInterval oldAngle) { return newAngle != null && (oldAngle == null || ((oldAngle.leftAngle < oldAngle.rightAngle && newAngle.leftAngle < oldAngle.rightAngle) || oldAngle.leftAngle > old...
0fffce91-3c46-43bd-b045-e65a44f663df
5
public String toString() { try { java.io.StringWriter strw = new java.io.StringWriter(); TabbedPrintWriter writer = new TabbedPrintWriter(strw); writer.println(super.toString() + ": " + addr + "-" + (addr + length)); if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_INOUT) != 0) { writer.pr...
4e48210e-5537-42c2-a959-3b22c7c6762f
5
public static void main(String[] args) { // AucBuyout.start(); String login = null; String action = null; if(args.length == 2 && args[1] == "gui") { new Gui(); } else if (args.length == 3) { login = args[1]; action = args[2]; } while(login == null) { login = select_login(); } S...
d399b50a-5dc2-4f64-a5e2-f05b6a17a6e5
9
@Override public int combine(MDDManager ddmanager, int first, int other) { // NOTE: all operations do not return a node when merging it with itself (stable states, xor, ...) NodeRelation status = ddmanager.getRelation(first, other); MergeAction action = t[status.ordinal()]; if (action == MergeAction.ASKME) { ...
6ef8db45-d03e-431f-9e02-aa147d83fe6a
8
public void Play(){ if(Hero.x != x) if(Hero.x > x){ if(!Terrain.checkOccupance(x+width+deltax, y+(height/2)+deltay)) x+=deltax; } else { if(!Terrain.checkOccupance(x-deltax, y+(height/2))) x-= deltax; } if(Hero.y != y) if(Hero.y > y){ if(!Terrain.checkOccupance(x+(width/2), y+height+deltay...
8b405811-ecc3-4bfe-ac8d-7ab64343ec32
2
public void info(String... msg) { if (!open) throw new RuntimeException("Cannot log new items: the log has closed!"); if (parent != null) parent.info(msg); else { Object[] args = new Object[msg.length - 1]; System.arraycopy(msg, 1, args, 0, msg.length - 1); logQueue.offer(new LogItem(Level.INFO, St...
bd060e3d-c2da-4847-8ce0-8da603a84a6c
0
@Override public void mouseClicked(MouseEvent e) {}
807b4ac6-a378-44c9-9d5b-17a9fdfdfffe
1
public void itemStateChanged(ItemEvent evt) { if (evt.getSource() == chb_alarmon) { clkinput.alarmOn = evt.getStateChange() == ItemEvent.SELECTED; clkinput.getSemaphoreInstance().give(); clkcanvas.repaint(); } }
dda8dc7e-be2f-4965-bbf6-1338dc4a0938
5
public void validate() throws FtpWorkflowException, FtpIOException { if (this.getLines().size() <= 0) throw new FtpIOException("000", "Did not receive any reply!"); if (ReplyCode.isPermanentNegativeCompletionReply(this)) { if (getReplyCode().intern() == ReplyCode.REPLY_530.intern()...
435d5cbc-1993-46a1-8b99-4cae959eaaff
6
private void knightBottomBottomRightPossibleMove(Piece piece, Position position) { int x1 = position.getPositionX(); int y1 = position.getPositionY(); if((x1 >= 0 && y1 >= 2) && (x1 <= 6 && y1 < maxHeight)) { if(board.getChessBoardSquare(x1+1, y1-2).getPiece().getPieceType() != board.getBlankPiece().getP...
7f1ac52c-a6c9-43de-af64-07ad7bde231e
5
private void parseLine(int vertexCount) { String[] rawFaces = null; int currentValue; vertices = new Vertex[vertexCount]; for (int i = 1; i <= vertexCount; i++) { rawFaces = words[i].split("/"); // v currentValue = Integer.parseInt(rawFaces[0]); vertices[i - 1] = object.getVertices().get(currentVal...
0de867c0-5c6a-474e-9d54-cbd68458e2d3
9
public Expression bind(StructuredQName functionName, Expression[] arguments, StaticContext env) throws XPathException { final String uri = functionName.getNamespaceURI(); final String localName = functionName.getLocalName(); String targetURI = uri; boolean builtInNamespace = ...
60e7c30a-7dd9-4c39-bf0d-dd20a3b90269
3
private Color getColor(Edge edge) { if (edge == null) { return Color.WHITE; } else if (edge.getEdgeState() == EdgeState.BURNED) { return Color.GREEN; } else if (edge.getEdgeState() == EdgeState.CLOSED) { return Color.BLUE; } else { return Color.BLACK; } }
a9a27cde-6ded-4fd3-818e-03a7e46cb53d
9
public Rectangle computeScaledBounds(final int zoom, final Dimension size) { final double sDPI = dpi; double width = sWidth * sDPI; double height = sHeight * sDPI; switch (zoom) { case FIT_WIDTH: // FIT_WIDTH { double sw = ((double) size.width) / w...
daabc78b-afdf-4f95-93ab-18577abf01fe
2
public ArrayList<AlumneVo> llistarAlumnes() { //crea ArrayList de persones per guardarles ArrayList<AlumneVo> alumnes= new ArrayList< AlumneVo>(); //connexio amb la bd DbConnection conex= new DbConnection(); try { PreparedStatement consulta = conex.getConnection().prepareStatemen...
d9a64719-bb17-44a0-b49d-0992d1496525
7
private static String infix2postfix(String[] tokens) throws CalcException { double c; String token; postfix = new StringBuilder(); opStack = new Stack<Operator>(); brStack = new Stack<Bracket>(); intStack = new Stack<Integer>(); Operator op; Bracket...
f849bb43-3684-490b-8e06-db6827d02bc7
0
void removeAwaitingResume(DccFileTransfer transfer) { _awaitingResume.removeElement(transfer); }
fa6f4b94-dffb-4022-bb84-ca7cc9fb64b6
8
public void startElement(String uri, String sname, String qname, Attributes atts) { Object context = null; if (!_contextStack.isEmpty()){ context = _contextStack.peek(); } String attrName = atts.getValue(_attribute_name); String attrLabel = atts.getValue(_attribute_label); String attrDesc = atts...
aaa331a4-6306-4d89-9425-180b9dd86175
8
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ServletPrinter sp = null; PreparedStatement stmt = null; Connection conn = null; sp = new ServletPrinter(response, "RegisterUser"); String categoryName, nickname, f...
4b87951c-8f86-494f-b47c-4231979c4309
8
public static void jarviz() { jButton1.setEnabled(false); jButton2.setEnabled(false); for (Shapes.Point point : points) { copyArray.add(point); } bestPoints = new ArrayList<Shapes.Point>(); Shapes.Point cP = points.get(closestPoint()); bestPoints.ad...
e67e2f53-242c-4006-8f28-09904d0c7eff
2
protected static List<CCNode> processNodes(final List<String> nodeNameData, final List<String> nodePositionData, final CCModel model) throws Exception { ArrayList<CCNode> nodes = new ArrayList<>(); /** * Verifiy and add nodes * */ if (nodeNameData.size...
c40d9562-b64d-4da3-b5bc-9cd984d575c6
5
public String translate(String code, Object... args) { if(translations.containsKey(code)) return String.format(translations.get(code), args); if(code == null || code.equals("")) return ""; if(translations.containsKey("translation.missing")) System.err.println(translate("translation.missing", code)); ...
ca9ef331-44ae-4daf-adfc-043d8c0f6fbc
1
*/ private static void initMap(DataRetriever data) { for (int i = 0; i < data.generateFlights().length; i++) { map.put(data.flights[i].toString(), new HashSet()); } }
02b474f7-dcc9-43d1-aef5-687c5c8f55a4
3
public char skipTo(char to) throws JSONException { char c; try { int startIndex = this.index; int startCharacter = this.character; int startLine = this.line; reader.mark(Integer.MAX_VALUE); do { c = next(); if (c...
04718da4-8427-45ef-940c-77c2ac9f008b
3
public boolean isRotation(String s1, String s2){ if(s1.length()!=s2.length()){ return false; } s1 = s1+s1; for(int i=0; i<s1.length()/2; i++){ if(s1.substring(i, s2.length()+i).equals(s2)){ return true; } } return false;...
f31e0079-e944-45d7-b723-85d826c2f7a5
6
@EventHandler public void PlayerInvisibility(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.getPlayerConfig().getDouble("Player.In...
df478944-569d-495a-aff4-aa3cf738409a
8
public void renderPlatformScore(int yp, Sprite sprite) { for(int y = 0; y < sprite.SIZE; y++) { int ya = y + yp; for(int x = 0; x < sprite.SIZE; x++) { int xa = x + (Game.WIDTH/2); if(xa < -sprite.SIZE || xa >= width || ya < 0 || ya >= height) break; if(xa < 0) xa = 0; int col = sprite...
254895c6-5ad6-442e-bc94-5dc0e355cb8b
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
4c2c97e3-177e-4182-b3b5-688c6dc27c82
9
public ArrayList<Restaurant> getAllRestaurants() throws IOException { Document doc; String url; ArrayList<Restaurant> rList = new ArrayList<>(); Set<String> names = new HashSet<>(); int prevSize = -1; for (int i = 1; i <= pages; i++) { if (names.size() == ...
4efddbf4-5633-4b1a-8928-cdb9fbb00393
9
public String getRepositoryForDirectory(final String directory, final String repository) throws IOException { // if there is no "CVS/Repository" file, try to search up the file- // hierarchy File repositoryFile = null; String repositoryDirs = ""; // NOI18N File dirFile = new File...
9df8b3c7-9a55-437f-8ece-79ecf98a393e
3
public static Boolean get(IntBuffer array, int index) { int value = array.get(index >>> 4) >> ((index & 15) << 1); switch (value & 3) { case 0: return false; case 1: return true; case 2: return null; default: throw new AssertionError(); } }
3a3255a5-4571-4236-a32d-c9e49edbf398
9
private boolean isValid(int[][] puzzle, int number, int row, int col){ //if the number is 0 it means it will be an empty box, so no need to check it. if(number == 0 || number > 9){ return true; } //check the column for(int k=0; k<9; k++){ if(puzzle[row][k] == number) return false; ...
e9b91b08-d882-4ad8-841e-15a860874a93
6
@Override public void actionPerformed(ActionEvent e) { // Handle open button action. if (e.getSource() == view.getOpenButton()) { int returnVal = fc.showOpenDialog(view); if (returnVal == JFileChooser.APPROVE_OPTION) { file = fc.getSelectedFile(); // This is where a real application would open the f...
dc0e01fd-4bf0-4b23-9b88-010da2ef812a
1
private void clearColumnDividerHighlight() { if (mMouseOverColumnDivider != -1) { repaintDivider(mMouseOverColumnDivider); mMouseOverColumnDivider = -1; } setCursor(Cursor.getDefaultCursor()); }
8e682159-91c2-4568-9b2a-0541ae49393a
9
* @return true if it worked. */ private boolean viEndWord(int count) throws IOException { int pos = buf.cursor; int end = buf.buffer.length(); for (int i = 0; pos < end && i < count; i++) { if (pos < (end-1) && !isDelimiter(buf.buffer.charAt(pos)) ...
5b0a3eeb-b16f-492f-a708-902a83901298
6
protected int handleInput(Automaton automaton, AutomatonSimulator simulator, Configuration[] configs, Object initialInput, List associatedConfigurations) { JFrame frame = Universe.frameForEnvironment(getEnvironment()); // How many configurations have we had? int numberGenerated = 0; // When should the nex...
2135bc69-5da9-44ae-86bd-0d4bd3413622
0
public void resetSounds() { startClip.stop(); startClip.setMicrosecondPosition(0); warnClip.stop(); warnClip.setMicrosecondPosition(0); overClip.stop(); overClip.setMicrosecondPosition(0); }
8978fa5a-80e3-4897-bf05-29452b18c46f
4
public static void main(String[] args) throws Exception{ int repeated = 0; /* 不断提交MapReduce作业直到相邻两次迭代聚类中心的距离小于阈值或到达设定的迭代次数 */ do { Configuration conf = new Configuration(); String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs(); ...
f8fd665e-0b2b-43b8-90cf-631c92708a83
6
public void method210() { for(int i = 0; i < anInt292; i++) { for(int j = 0; j < anInt293; j++) if(i == 0 || j == 0 || i == anInt292 - 1 || j == anInt293 - 1) anIntArrayArray294[i][j] = 0xffffff; else anIntArrayArray294[i][j] = 0x1000000; } }
98ec9623-ad1e-4da0-9514-794136b4f682
9
@Override public String toString() { if (isEmpty()) return "empty"; String result = ""; Queue<Node> q = new Queue<>(); q.enqueue(root); Node firstOnLevel = null; while (!q.isEmpty()) { Node u = q.dequeue(); if (u == firstOnLevel) ...
039f9c14-a263-49b4-9383-d7bed48bfe04
9
private void borrowerSearch(){ boolean quit; String keyword; //BorrowerModel b = new BorrowerModel(); Class c = b.getClass(); ArrayList<Match> books = new ArrayList<Match>(); Object tempBooks; quit = false; //RETURN TYPES try{ while (!quit){ System.out.println("En...
c83144e2-1c72-4dab-85ee-4d70f00fd5cf
4
private void loadPatientInformation(String patientID) { ResultSet rs = dbQuery.Patient_GetPatientInformation(patientID); if (rs != null) { System.out.println("Patient Information Loaded Successfully."); try { while(rs.next()){ txt_PatientID.setText(rs.getObject("PatientID").toString()); txt_P...
13940fce-1adb-4de4-9688-ebc368b98520
4
public void sendMessageWrapper(String recipient, String nick, String message) { // Split the string first into mutliple lines StringTokenizer token = new StringTokenizer(message, " "); StringBuilder chunk = new StringBuilder(MAXMSGLENGTH); ArrayList<String> lines = new ArrayList<String>(...
94b22260-b8e9-4f97-85ee-80314a0b0832
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Parameter other = (Parameter) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return fals...
b80d2a7f-8f33-49d7-9534-b9b64896290d
3
public void teleport(Player p){ for (GameObject object : World.backgroundTiles) { if(object.getClass() == this.getClass()){ Portal portal = (Portal) object; if(portal.getId() == targetId){ p.setPosition(portal.getX(), portal.getY()); } } } }
934b1a30-5532-4600-81b2-1787b344ca26
0
public WindowAdapter(JFrame frame) { this.frame = frame; }
ca3eb115-bbe7-4d7b-bfa5-a640941bf71d
8
public boolean moveLine(int x0,int y0,int x1,int y1)//让块按照直线走,走完返回true { int x=this.getX(); int y=this.getY(); if(x0==x1&&y0==y1)//not line return true; if(x0==x1)//horizen line { if(y0>y1) y-=5; else y+=5; ...
bf06265e-725f-432f-8f5f-97a47375d830
6
@Test public void generic() { ArrayList<Unit<Integer, String>> haystack = new ArrayList<Unit<Integer, String>>(); int count = 100; for (int i = 0; i < count; i++) { if (i % 3 == 0) { continue; } haystack.add(new Unit<Integer, String>(i, Str...
27c5745c-7627-4748-b0ca-f42795802472
0
@Inject public MarshallerPool(@Named("marshalContext") JAXBContext context) { this.context = context; }
b035731a-de69-46ac-aeba-6f681b4e54a6
3
@SuppressWarnings("unchecked") public ArrayList<T> list() { Cursor c = null; ArrayList<T> r = new ArrayList<T>(); c = getSQLCursor(); if (c.moveToFirst()) { do { try { r.add((T) Model.load(mDB.mContext, E, c)); } catch ...
b9df8ee9-2536-422c-b293-fa97e23d2eaa
8
public static String assign(Person person) { String job = ""; // logic goes here String currentJob = person.getJobArray().get(person.getJobArray().size() - 1); String previousJob = person.getJobArray().get(person.getJobArray().size() - 2); if (person.getDishes()) { if (currentJob.eq...
20328353-2f7a-478b-89ee-e00d48242709
0
public synchronized Queue<String> getUnsearchList(){ return this.unsearchSitesList; }
881673e7-98a5-4494-80af-30b5d08d533b
1
public static boolean isCheckedException(Throwable ex) { return !(ex instanceof RuntimeException || ex instanceof Error); }
3a0751d3-abfd-434d-81c6-11befbf1d89a
8
public static Graph perform( Graph g ) { List< Set<Vertex> > sets = new LinkedList<>(); Edge [] edges = g.edges(); List<Edge> finalEdges = new LinkedList<>(); Queue<Edge> edgeQueue = new PriorityQueue<>(edges.length, new Comparator<Edge>() { public int compare(Edg...
4e3d0734-0471-4f84-80f9-b6abef164f19
7
public static void main(String[] args) throws MalformedURLException { for (int i = 0; i < 2000; i++) { for (int j = 0; j < 1000; j++) { URL url = new URL("http://www.gamestar.de/_misc/betatest/betatest.cfm?pk=" + i + "&pid=" + j); if(verifyLink(url)){ ...
1c80ba69-4e32-43bc-ad29-e2977de3decb
7
public static void addPlayerMove() { do { System.out.println("Please enter the coordinates of your move. (ex. B1)"); Scanner keyboard = new Scanner(System.in); move = keyboard.nextLine(); switch(move.substring(0,1)) { case "A": case "a": row = 0; break; case "B": ca...
33150639-0896-4b08-a2b7-5d82b0840de5
3
@Override public void serialize(Buffer buf) { buf.writeUShort(aliases.length); for (String entry : aliases) { buf.writeString(entry); } buf.writeUShort(arguments.length); for (String entry : arguments) { buf.writeString(entry); } buf.wr...
3e6ae077-0edb-459e-9aa7-cd4605f76a86
7
public int reverse(int x) { boolean negative = false; if (x == Integer.MIN_VALUE) return 0; if (x != Math.abs(x)) { negative = true; x = Math.abs(x); } int result = 0; while (x != 0) { if (result > Integer.MAX_VALUE / 10) { return 0; } else if (result == Int...
cbdf5048-723a-45ed-8168-84fc7948bf85
3
public void showMainInstructions(final int pageIndex) { removeActionListeners(nextButton); removeActionListeners(previousButton); if (pageIndex < Text.TEXT_INSTRUCTIONS.length) { //not last page nextButton.setText(Text.BTN_NEXT); nextButton.setVisible(true); nextButton.addActionListener(new Action...
2fd29c74-a053-4ffe-accf-de2148410307
0
public void setCanEditFollow(boolean canEdit) { canEditColumn[2] = canEdit; }
9b06e088-fa07-4094-baf1-ca5cef70fc18
3
public static boolean isCommand(String command, String message) { String cmd = message.split(" ")[0]; //System.out.println("Len: " + cmd.replace("!", "").replace("/", "").length() + " vs. " + command.length()); if (cmd.replace("!", "").replace("/", "").length() != command.length()) ...
cd6f12c7-d7e6-433f-9d30-32469f3f8f32
4
private void removeReturnLocal(ReturnBlock ret) { StructuredBlock pred = getPredecessor(ret); if (!(pred instanceof InstructionBlock)) return; Expression instr = ((InstructionBlock) pred).getInstruction(); if (!(instr instanceof StoreInstruction)) return; Expression retInstr = ret.getInstruction(); i...
2391e617-516c-4498-8709-9e6d795e48c5
5
private void startGenerating() { // check if number CAN be sorted boolean sortCheck = Lib.checkInput(gui.getTextFields(), gui.getRingNumber()); // if number not sortable throws errorMsg if (sortCheck) { // divide fighters int[] sortingFacts = Lib.PoolDivide(gui.getTextFields(), gui.getRingNumber(...