method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f0ae2f7e-0957-469f-b283-ba50a47eb32d
1
public List<String> getKeys() { List<String> keysArray = new ArrayList<String>(); for(int i = 0; i < size; i++) { keysArray.addAll(map[i].getKeys()); } Collections.sort(keysArray); return keysArray; }
bcc54d7b-61ca-43f0-b9a8-91695a01a15a
3
public boolean isInRange(Point lowerLimit, Point upperLimit) { boolean inXRange = x>=lowerLimit.getX() && x<=upperLimit.getX(); if (inXRange) { boolean inYRange = y>=lowerLimit.getY() && y<=upperLimit.getY(); return inYRange; } return false; }
e389143b-8a41-418d-bcfc-5485cce4a3e4
3
@Override public void keyReleased(KeyEvent ke) { if (ke.getKeyCode() == KeyEvent.VK_LEFT) { vasen = false; } if (ke.getKeyCode() == KeyEvent.VK_RIGHT) { oikea = false; } if (ke.getKeyCode() == KeyEvent.VK_SPACE) { hyppy = false; } ...
abccfb31-8eb2-4d46-be76-806d221d5baf
7
@Override public void run() { BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); String userInput; try { while (((userInput = stdIn.readLine()) != null) && exit == false) { if (userInput.equals("")) { exit = true; stdIn.close(); AuctionServer_ServerSocket...
e73aa48e-5efd-4979-b984-91a441f9779d
6
public boolean readFinish(){ return (this.dataSizeLeftInt <= 0 ? true : false) && (this.dataSizeLeftLong <= 0 ? true : false) && (this.fileReceiver == null || (this.fileReceiver != null && this.fileReceiver.finishWrite())); }
43df60ae-02e1-4535-8323-fa696e388a30
4
private boolean isRandomAccessable(Object obj) { return obj instanceof List<?> || obj.getClass().isArray() || obj instanceof ArrayIterable<?>; }
4bdc64bf-d5bd-41ed-ab14-b284dc37ca78
7
public final GalaxyXPreprocessorParser.expression_return expression() throws RecognitionException { GalaxyXPreprocessorParser.expression_return retval = new GalaxyXPreprocessorParser.expression_return(); retval.start = input.LT(1); int expression_StartIndex = input.index(); Object root_0...
014b0e75-cc1e-4be8-80cf-f23c3a61423b
6
@Override public void createFromXML(NodeList attributes) { //weapon = new SpermGun(owner.getID()); // default weapons, for now atleast... for(int i = 0; i < attributes.getLength(); i++) { Node node = attributes.item(i); if(node.getNodeType() == Node.ELEMENT_NODE)...
eeddfd9b-0c7d-4fbb-80ee-3a89a21af973
3
public void setModName(String modName) { this.modName = modName; if (modName.length() != 0) { usingMod = true; modDirName = mainDirName + modPrefix + modName + "/"; if (modFile) { GenericObject mod = EUGFileIO.load(mainDirName + m...
18b9a5b3-85c1-48b0-9045-21f965d7b262
5
private void traverseCage() { final GameObject gate = gate(); if (!ctx.definitions.get(gate).name.equals("Gate")) { return; } if (ctx.camera.prepare(gate) && gate.interact("Open")) { Condition.wait(new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (ctx.chat.vis...
d0f915cc-6fd6-40b2-9732-89f8d4718626
4
void passf4(int ido, int l1, final double cc[], double ch[], final double wtable[], int offset, int isign) { int i, k, ac, ah; double ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4; int iw1, iw2, iw3; iw1 = offset; iw2 = iw1 + ido; ...
75f7b2f1-e21a-4580-bea9-759d36aa0468
2
public static PeriodicTask getTask(List<Partition> lop, String part_name, String task_name) { Partition p = getPartition(lop, part_name); for (PeriodicTask pt : p.getWorkload()) { if (pt.getName().equals(task_name)) { return pt; } } return null; }
2565479e-eb5a-4c45-baf6-3b61bce4896d
3
public static byte[] string2Byte(String hexString) { char[] chars = hexString.toCharArray(); int len = chars.length >> 1; byte[] bytes = new byte[len]; for(int i = 0; i != len; i++) { int position = i << 1; int high = 0; int low = 0; ...
ef55412d-bc0c-4dcf-9682-7f32480ba0e4
6
public static boolean safe(int row, int col, int a[][]) { for(int i=0; i < a.length; i++) { for(int j = 0; j < a.length; j++) { if(a[i][j] == 1) { if(row == i) return false; if(col == j) return false; if(Math.abs(row -i) == Math.abs(col-j)) return false; } } } return true; }
9924a372-9b41-4563-81a0-27293ea9c9f2
5
public int horzDraw() { if(prev==null) hold.setX(xpos); else hold.setX(prev.getButton().getX()+prev.getButton().getWidth()); hold.setY(ypos); hold.setHeight(height); hold.setColor(red, green, blue, alpha); hold.draw(); if(head!=null&&blClicked) head.vertDraw(hold.getX(),ypos-height)...
0b40c353-1827-4e9d-9b07-320fd6de9724
2
public boolean isObjInPool(String c) { // TODO Auto-generated method stub if(pool.containsKey(c)){ if(pool.get(c).hasObject()) return true; } return false; }
0d944eb5-1a51-490e-bc4a-a56938d98d09
5
public static File unpackModFile(String pathModProtocol) { Matcher matcher = patternModProtocol.matcher(pathModProtocol); if (matcher.find()) { Mod mod = Terraria.managerMod.getMod(matcher.group(1)); if (mod == null) return null; try { ZipFile zf = new ZipFile(new File("mods",mod.name+".jar")); ...
c8009fd6-ce0b-4d39-b4b1-e5f9d5d08bcf
8
public static void mouseDragged(MouseEvent mouseEvent) { Iterator<PComponent> it = components.iterator(); while(it.hasNext()) { PComponent comp = it.next(); if(comp == null) continue; if (shouldHandleMouse) { if (comp.shouldHandleMouse(...
bbf7d2e5-f207-4190-b2cd-8a6e46cf4ed2
4
public Collection<Application> getUserApplications(Token t, User u) { HTTPClient client = GoCoin.getHTTPClient(); client.setRequestOption(HTTPClient.KEY_OPTION_PATH,"/users/"+u.getId()+"/applications"); client.addAuthorizationHeader(t); try { //make the GET request client.doGET(client....
1de1b6bd-1ddd-424c-9eca-417ec2542fd5
3
@SuppressWarnings({"unchecked"}) @Override public boolean add(T e) { size = size + 1; /* * Resizing the array if the size is too small. */ if (queue.length <= size) { queue = Arrays.copyOf(queue, size * 2); } int index = size - 1; /...
a434f68e-8727-44eb-95d5-c9a5704e6d9b
3
private void mailTo() { System.out.println(((Row)((TableView)viewTable).getSelectedRowObject()).mail); String mailTo = new String(""); URI uriMailTo = null; //Assembler l'url mailTo = ((Row)((TableView)viewTable).getSelectedRowObject()).mail; mailTo += "?subject=Obj...
588af497-950b-47d1-91fd-a4f58257fbf0
0
public void clearAll() { myLemma.clearDoneCases(); myMessage.setText("All cases cleared."); refresh(); }
f93a3926-becb-4602-a99c-fc1ead3061c1
3
private static Line[] handleTriangle(ArrayList<Point> convexHull) { Line[] out = new Line[4]; //find biggest side Vector[] sides = new Vector[3]; for (int i = 0; i < 3; i++) { sides[i] = new Vector(convexHull.get((i + i) % 3), convexHull.get(i)); } int maxIndex = 0; double maxSide = sides[0].calculateM...
5c43e7b1-9b05-4619-bea0-111ef052b3ca
8
public static String allScores(String fileName) throws IOException {//System.out.println("allScores"); Scanner scan; String[] usernames; long[] wins, losses; int fileLength = 0, win = -1, lose = -1; try { scan = new Scanner(new File(fileName)); } catch (FileNotFoundException ex) ...
440f21c8-727f-4e82-a809-f99eb782817f
6
private void refreshMediaPane() { DefaultTreeModel treeModel = (DefaultTreeModel) mediaTree.getModel(); DefaultMutableTreeNode mediumNode = null, setNode = null; int setsCount = 0; // Used to count currently present RDC sets mediaTreeRoot.removeAllChildren(); if(media.size() == 0) { mediumNode = new De...
d4818253-8a66-4264-928e-33bcf47ebed0
7
public ImageIcon getIcon() { // We need the frame to be able to obtain the resource URL of the icon. if (iconNotFound == null) { iconNotFound = new ImageIcon(Resources.getInstance().getResource( "images/IconNotFound.png")); } if (associatedIcon != null) ...
059f197d-d40f-4016-bbc1-ea1f9e4992fc
1
@Override public String toString() { String tabs = new String(new char[depth]).replace("\0", "\t"); String out = ""; for (String label : children.keySet()) { out += "\n" + tabs + attribute + " = " + label + children.get(label); } return out; }
c154607a-ed75-474d-b8f0-ace3ec7566c3
2
private void removeLosses() { if (lossPerTick > 0.0) if (charge >= lossPerTick) charge -= lossPerTick; else charge = 0.0; }
e4343cb7-c4cb-48a9-8926-3df3f2d9a602
9
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) { this.plugin = plugin; this.type = type; this.announce = announce; this.file = file; this.id = id; this.updateFolder = plugin.getServer().getUpdateFolder(); final File plugin...
08d56071-6957-4d14-9e31-51f25faf04ab
7
public void testExceptions() throws IOException { setNumberOfExpectedWarnings(2); if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "started"); ByteBuffer b = ByteBuffer.allocate(200); b.putInt(-6); //2*10 because chars are 2 bytes. helper.putString(b, HALF1+HALF2); b.putInt(20); helper.do...
68a2aae0-9d8d-4ef8-9175-29537a6fa7cd
6
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final java...
7e3dd946-aed9-43cd-b0d9-a40353205e91
3
@Override public List<Item> getSelectedItems() { List<Item> result = new LinkedList<>(); for( Item item : getItems() ) { if( item.isPrimarySelected() ) { result.add( 0, item ); } else if( item.isSecondarySelected() ) { result.add( item ); } } return result; }
4903a74e-afd8-4235-9e22-e5e4ec3f28b7
4
private void insertEntity(int x, int y, Entity e) { if (x < 0 || y < 0 || x >= w || y >= h) return; entitiesInTiles[x + y * w].add(e); }
ebdf0221-599c-4285-81f1-e2d43c678da8
8
public static CustomStructure parseCustomStructure(File structureFile) { CustomStructure t = new CustomStructure(); try { File fXmlFile = structureFile; DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc ...
94f59965-e4b7-432f-8741-e19346c3266f
0
public int getTapeLength() { return tapes; }
d12d5021-e1cc-459c-b343-19b234bcbe12
6
@SuppressWarnings("unchecked") public static <T extends Number> T sum(T e1, T e2, Class<T> type) { T result = ElementOpUtils.getNeutralMulElem(type); switch (type.getSimpleName()) { case "Byte": return (T) (Byte) (byte) ((Byte) e1 + (Byte) e2); case "Short": return (T) (Short) (short) ((Short) e1 + (S...
53698d09-17a6-4014-9872-79d5c337ca57
1
private void loadTrie() { this.trie = new Trie(); for (Road r : roads) { trie.insertWord(r.getLabel() + " " + r.getCity()); } }
e3593f54-dcd3-4b10-884d-1ae1eb6dabee
5
private static long[] copy(OggFile in, OggFile out) throws IOException { OggPacketReader r = in.getPacketReader(); ArrayList<Long> copyCRCs = new ArrayList<Long>(); OggPacket p = null; OggPacket pp = null; OggPacketWriter w = null; while( (p = r.getNextPacket()) != null ) { if(w == null) { w = ...
8e81c5ea-94e1-49dc-acf2-b1c42ef233ca
5
public int readlink(ByteBuffer path, ByteBuffer link) { String pathStr = cs.decode(path).toString(); if (log != null && log.isDebugEnabled()) { log.debug("readlink: path=" + pathStr); } CharBuffer linkCb = CharBuffer.allocate(link.capacity()); try { int...
6a371196-3663-4610-a3bf-b48c3ac20295
1
public boolean matches( Class<?> clazz ) { return this.superclassOrInterface.isAssignableFrom( clazz ); }
f1e96fee-0619-4006-8d0e-49ed4095c9a2
6
@SuppressWarnings("rawtypes") public static boolean isImplementsInterface(Class c, String szInterface) { Class[] face = c.getInterfaces(); for (int i = 0, j = face.length; i < j; i++) { if (face[i].getName().equals(szInterface)) { return true; } else { Class[] face1 = face[i].getInterfaces(); for...
d7e6d656-0cde-4fce-9dde-f0cae17791e8
2
public Character getCharacter(Tile myPosition) { String name = null; int health = 0; int attack = 0; int stamina = 0; Character newCharacter = null; if (type.equals("Monster")) { name = getDatumValue("Name"); health = Integer.parseInt(getDatumValue("Health")); attack = Integer.parseInt...
283ea8a0-2556-485d-8eb0-b8cc013b6a15
8
public static void main(String[] args) throws IOException { String city = args[0]; String folder = Settings.getInstance().getFolder(); // We create the output file in the folder specified in the arguments. FileWriter outFile = new FileWriter(folder + city + File.separator + "venues.ids"); // Get the information...
aac7b2dc-de8f-478d-9f2d-29501bd7f812
4
public static LinkedList<Tuple<String, LinkedList<Triple<String,String,String>>>> insert(LinkedList<Tuple<String, LinkedList<Triple<String,String,String>>>> list, Tuple<String, LinkedList<Triple<String,String,String>>> elem){ LinkedList<Tuple<String, LinkedList<Triple<String,String,String>>>> result = new LinkedList<...
1980fcae-d2e5-4a1b-9772-7226bcb974b7
4
@Override public void update(int delta) { int oX = getOwner().getX(); int oY = getOwner().getY(); this.aoe.x = oX - (radius / 2) + (getOwner().getW() / 2); this.aoe.y = oY - (radius / 2) + (getOwner().getH() / 2); if (target == null) { if (waited == 0) { ...
7393342e-2301-46b7-b2ce-ab395720e570
4
public Matrix times(Matrix B) { Matrix A = this; if (A.N != B.M) { throw new RuntimeException("Illegal matrix dimensions."); } Matrix C = new Matrix(A.M, B.N); for (int i = 0; i < C.M; i++) { for (int j = 0; j < C.N; j++) { for (int k = 0; ...
9f7a14a2-c627-4dd4-808d-a8fbdf41aec5
9
protected void execute() { // TODO Auto-generated method stub switch(stage){ case 0://init setNextTime(3000); stage = 1; break; case 1://allow speedup, wait if(timeEnd()){ setNextTime(100); stage = 2; load(); } break; case 2://load if(timeEnd()){ se...
66a8c82a-db9a-4f75-8465-d0e72a2412a2
8
@Override public void autoscroll(Point pt) { if (mLastAreaClicked == DirectScrollPanelArea.CONTENT) { if (pt.x < AUTO_SCROLL_MARGIN + mContentBounds.x) { pt.x -= AUTO_SCROLL_MARGIN; } else if (pt.x > mContentBounds.x + mContentBounds.width - AUTO_SCROLL_MARGIN) { pt.x += AUTO_SCROLL_MARGIN; } if ...
0ed2d050-8a53-47f4-bc19-926fa769167d
2
public static void main(String[] args) throws Exception { Socket sock = new Socket("127.0.0.1", 3000); // reading from keyboard (keyRead object) BufferedReader keyRead = new BufferedReader(new InputStreamReader(System.in)); // sending to Server (pwrite object) OutputStream ostream = sock.getOutp...
16fac2bc-b54e-4b1b-a6d3-3c10108fb4ce
1
public static File renameFile(File sourceFile, String newName) { File movedFile = new File (sourceFile.getParent () + File.separator + newName); if (sourceFile.renameTo (movedFile)) return movedFile; return null; }
493fb09d-7f2a-470d-8c7a-564fe0686cef
1
private void LoadContent() { try { //load bg image URL bgUrl = this.getClass().getResource("/raceresources/resources/images/stardust.png"); bg = ImageIO.read(bgUrl); //loading background image //load bg image URL backgroundImageUrl = this....
b4aeac82-d4c1-4d89-8436-e4fdb13931f7
6
public static ArrayList<Term> task1() throws IOException{ System.out.println("Task 1 initiated."); DataBuff reader = new DataBuff(Main.DataFile); HashMap<String,Term> map = Tools.mapcreator(); String stringLine = reader.buffer.readLine(); String[] terms = stringLine.split("\\s+"); for(int line = 0; (str...
4b292463-1b3f-4e6d-a0af-c5beac33c7e2
0
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("SHS Servlet: doGet()"); processRequest(request, response); }
ccfcb0d5-cafc-403e-bc33-560c8b6d0ede
1
public void escribirCompraJAXB(String rutaFichero, LinkedHashMap<Integer, Compra> compras) { rutaFichero = rutaFichero + ".xml"; try { MapCompra mc = new MapCompra(); mc.setMapCompra(compras); JAXBContext jaxbContext = JAXBContext.newInstance(MapCompra.class); ...
26ff1cec-c20e-41d3-9a3c-b984e9de8d2e
7
static int checkBits (int style, int int0, int int1, int int2, int int3, int int4, int int5) { int mask = int0 | int1 | int2 | int3 | int4 | int5; if ((style & mask) == 0) style |= int0; if ((style & int0) != 0) style = (style & ~mask) | int0; if ((style & int1) != 0) style = (style & ~mask) | int1; if ((style & i...
30572cc6-271e-4b34-9e54-960179d04bd9
9
@SuppressWarnings({ "rawtypes", "unchecked" }) public OptionsDialog(final Main main, final String[] values) { super(main.gameFrame, "Options", true); setDefaultCloseOperation(DISPOSE_ON_CLOSE); //setPreferredSize(new Dimension(210, 195)); setLocationRelativeTo(main.gameFrame); getContentPane().setLayout(new ...
ce9d6a70-1609-4597-806f-b6a09966224c
3
public void explore(Community c, List<Node> nodeList){ if(c.getChild1() == null){ DenseVector nodesC = c.getVertexIndexes(); //System.out.println("community: "); Event event = new Event(); for(VectorEntry ve : nodesC){ int id = (int)ve.get(); event.keywords.add(nodeList.get(id).getName()); ...
0fa6cca2-17c4-4bff-8df1-c187bf3ec5e2
9
public synchronized void setButtonAction6D(int button, int action) { if (! (action == TRANSLATE_FORWARD || action == TRANSLATE_BACKWARD || action == GRAB_VIEW || action == ROTATE_CCW || action == ROTATE_CW || action == SCALE_UP || action == SCALE_DOWN || action == NONE)) ...
91d776f4-4677-46c3-b108-5ba1ad7306af
3
public void init() { graph = new WeightedNonDirectedGraphImpl<Integer>(); Scanner scanner = new Scanner(getClass().getResourceAsStream("/dijkstraData.txt")); while (scanner.hasNextLine()) { String line = scanner.nextLine(); String[] split = line.split("\t"); ...
186942e3-be0a-4265-9423-ad0043dc8c0a
3
public void preencherTabela() throws Exception { ArrayList<String> colunas = new ArrayList<String>(); colunas.add("id"); colunas.add("cidade"); colunas.add("estado"); colunas.add("descricao"); Object linhas[][] = new Object[list.size()][]; int i = 0; for (Local local : list) { linhas[i] = formatoT...
c08af49d-e56a-4735-b561-d690d40ca2be
4
public static double score (double []array){ double score =0; double low = array[0]; int tracker = 0; for (int i = 1; i < array.length; i++) { if(array[i] <= low){ low = array[i]; tracker = i; } //System.out.println("l...
5f8d5b42-858d-4fc4-b19c-c4a61de543e7
3
private void lookAtItem(Item item) { System.out.println("Taking a look at " + item.getName() + ":"); System.out.println(item.getDescription()); System.out.println("Weight: " + item.getWeight() + " kg."); if (item.getType().equals("miscellaneous") || item.getType().equals("quest") || item...
9c18786c-32e9-41fe-8fdb-376df28be91a
8
public void keyReleased(KeyEvent e) { int key = e.getKeyCode(); if (key== KeyEvent.VK_SPACE) { } if (key == KeyEvent.VK_LEFT) { dx = 0; } if (key == KeyEvent.VK_RIGHT) { dx = 0; } if (key == KeyEvent.VK_UP) { dy = 0;...
c38bd303-af7a-4a53-8f88-c18ba896fe06
6
private Object createThreadAndInvoke(XValue method, int stepsToExecute, XValue thiz, XValue... args) throws ScriptException { XObjectDataFunc func = XUtils.getDataAs(this, method, XObjectDataFunc.class); String[] params = func.getParamNames(); if (params.length != args.length) throw new IllegalArgumentE...
9a9bbd33-2501-42db-be45-eb840e94fcc3
4
public static void progArguments( String[] args ) { for( int i = 0; i < args.length; ++i ) { switch( args[i].charAt(1) ) { case 'c': console = true; windowMode = false; sourcePath = args[++i]; break; case 'w': windowMode = true; break; case 'v': printVersion = ...
d7d851fd-5281-4efd-a960-3f19e0809416
7
public static int[] RF(String[] h) { int[] r = new int[2]; r[0] = -1; char suit = h[0].charAt(1); if (h[0].charAt(0) == 'J' && h[1].charAt(0) == 'K' && h[2].charAt(0) == 'L' && h[3].charAt(0) == 'M' && h[4].charAt(0) == 'N') { for (String s : h) { if (s.charAt(1) != suit) { return r;//false }...
39b1b72c-9cfb-4ab3-8450-4e9f880a6270
1
public boolean WriteText(String text) { try{ out.writeChars(text+"\n"); return true; } catch(Exception e){} return false; }
7a9e5284-b852-48f9-a861-125d5914c060
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Room room = (Room) o; return index == room.index && localX == room.localX && localY == room.localY; }
70e55327-6373-4ae1-96b8-86923225e77d
4
public void actionPerformed(ActionEvent arg0) { AbstractMessagingModule messageObject = null; // set recipient switch (arg0.getActionCommand()) { case "sms": messageObject = new SmsModule(getApp()); break; case "mail": messageObject = new MailModule(getApp()); break; case "mms": messageObject...
3e2d9e56-acbc-4cde-bba8-91c8534e6a24
2
private void refreshUpPanel (final User user) { usersFilesList = new JList(user.getHistoryFileListModel()); upPanel.removeAll(); upPanel.add(usersFilesList); upPanel.revalidate(); upPanel.repaint(); usersFilesList.addMouseListener(new MouseAdapter() { @Ov...
ffe0f01a-b349-4dc2-becb-7c788b07533b
7
private void validate() { boolean ok = true; if (x.length != y.length || x.length < 3) { ok = false; } for (int i = 0; i < x.length - 1 && ok; i++) { if (x[i] >= x[i + 1] || Double.isNaN(y[i])) { ok = false; } } if (!ok)...
c2834e29-a338-4040-a273-eea7e0b6859a
8
protected void processScriptBlocks(List<String> scriptBlocks) { if(generateStatistics) { for(String block : scriptBlocks) { statistics.getOriginalMetrics().setInlineScriptSize(statistics.getOriginalMetrics().getInlineScriptSize() + block.length()); } } if(compressJavaScript) { for(int i = 0; i ...
06d24d22-3398-496f-9e35-1d6ce2695cd0
6
public boolean estCleValable(String k) { /* * La mthode vrifie que la clef est non nul est de longueur au moins gale 26 * Puis si c'est le cas, la mthode verifie que le texte contienne au moins un mot commencant * par chacune des lettres de l'alphabet */ if(k.equals("")) { JOptionPane.showMessageDia...
ea0c1c80-3337-4013-a6ba-5b4206209c24
0
public static Date addMonth(Date date, int month) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.MONTH, month); return calendar.getTime(); }
d631c697-f5e1-4449-a031-7ead81d7c513
4
@Test public void neighbourListDoesNotCauseEndlessLoops() { l.addVertex(v); Vertex[] add = new Vertex[10]; for (int i = 1; i < 10; i++) { add[i] = new Vertex(i); l.addVertex(add[i]); } for (int i = 1; i < 6; i++) { l.addEdge(v, add[i]); ...
a7aa9987-09cb-4ce5-903a-9914eac9e260
0
public CheckResultMessage check23(int day) { return checkReport.check23(day); }
18e1a6f1-a4c9-4560-9821-4dc6e199bbe5
1
public void addStackVar(final StackExpr var) { final int blockIndex = cfg.preOrderIndex(var.block()); if (StackPRE.DEBUG) { System.out.println("add var " + var); } stackvars[blockIndex].add(var); }
d1a7bf14-a8e5-4e11-9e5e-a53152417bb3
7
private int getPoints(int row, int col, int color, int rowchange, int colchange) { int i = row, j = col, points = 0; while (true) { if (i < 0 || j < 0 || i > 7 || j > 7 || board[i][j] == EMPTY) return 0; else if (board[i][j] == color) r...
b880a262-90ba-404e-ac68-2c5b56e252e8
1
public static void main(String args[]) { unitTest(); for (int i = 0; i < args.length; i++) { String test_url = args[i]; unitTestParseAssemble(test_url); } }
d1e89eb2-baa2-462e-9573-277fffe00c61
8
@Override public void executeTask() { waitForDefaultGateway(); String defGateway = DCServer.GetDefaultGateway(); System.out.println("====================================="); System.out.println("Looking for server"); System.out.println("Default gateway: " + defGateway); System.out.println("================...
619f4a20-8356-4b13-a4dd-975e35c29e28
0
protected void setHeight(int _height) { this.height = _height; updateAspectRatio(); }
66f879b6-d0b0-4044-a061-0b6e5b0c3124
3
public static Home getSimilarHome( BSPlayer player, String home ) { for ( ArrayList<Home> list : player.getHomes().values() ) { for ( Home h : list ) { if ( h.name.toLowerCase().contains( home.toLowerCase() ) ) { return h; } } }...
0a38e298-eafc-4129-93a8-a7d2e2fa2f12
0
public void ajoutFinListeMetadonnee(Metadonnee m) { listeMetaDonnees.add(m); }
00248d5e-1b1b-4702-8a38-cc06c15d0c02
1
private static void clearListeners(TaskParameters taskParameters) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Thread" + Thread.currentThread().getId() + ":清空任务队列"); } tasks.remove(taskParameters); }
8289a029-b060-4fd3-b0f6-762b65469ae4
0
public void actionPerformed(ActionEvent event) { Universe.frameForEnvironment(environment).save(false); }
aaaf81fb-8273-4538-86f5-59d168352f0c
5
public static void main (String[] args) { String string_in = new String(); @SuppressWarnings("unused") String string_tmp = new String(); char gen_art = '0'; char gen_nom = '0'; char gen_agg = '0'; char lastchar_art; char lastchar_nom; char lastchar_agg; int space_1; int space_2; int length; ...
e546c9d6-2115-4101-a149-1dc0fbcbac25
2
public String printParkInfo() { String text=""; if(getParkList().size() == 0) { text="目前没有管理任何停车场!"; } int emptyNum = 0; int totalNum = 0; for(int i = 0; i < getParkList().size(); i ++) { Park park = getParkList().get(i); text = text + " 停车场编号:" + park.getCode() + "\n"; text =...
aabd4535-0a4d-4fa8-9109-207b31736715
5
public void run() { canvas.createBufferStrategy( 2 ); BufferStrategy buffer = canvas.getBufferStrategy(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gd.getDefaultConfigura...
35e61bb9-9d9f-4661-a384-96a496b5c9cf
1
public String toString() { StringBuilder s = new StringBuilder(); for (Item item : this) s.append(item + " "); return s.toString(); }
3f126971-b5bc-4f0b-a0c0-0021d5dfefa4
6
public LinkedHashMap<String, Double> ranking(int amount) { Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; LinkedHashMap<String, Double> Ranking = new LinkedHashMap<String, Double>(); try { conn = iConomy.getiCoDatabase().getConnection(); ps = conn.prepareSt...
49e82b5c-a705-4c08-bae3-4d16b33ec87b
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Producto)) { return false; } Producto other = (Producto) object; if ((this.idProducto == null && other.idProduc...
885db82b-4220-47a2-a333-0dadc3fbcf00
5
public boolean checkStatus(String status){ String bookStatus=status.toLowerCase(); if (bookStatus.equals("lost") || bookStatus.equals("checked-in")|| bookStatus.equals("in-queue") || bookStatus.equals("available")) return true; else if (status.isEmpty()) return true; else re...
73eee115-c9b4-4940-9ebe-f8cca6cff3c5
3
public AnyType get(int pos) { if (head == null) throw new IndexOutOfBoundsException(); Node<AnyType> tmp = head; for (int k = 0; k < pos; k++) tmp = tmp.next; if( tmp == null) throw new IndexOutOfBoundsException(); return tmp.data; }
7b7f8da1-0ecf-4156-94b6-a90397e5ab9b
7
@Override public Object getValueAt(int rowIndex, int columnIndex) { Object value = null; Supplier supplier = service.getSuppliers().get(rowIndex); switch(columnIndex) { case 0: { value = supplier.getName(); break; } case 1: ...
048ce292-e454-4498-a02d-544b5c18446e
7
protected void validatePairings() { if (!pairingsToTestNext.isEmpty()) { pairingsToTestNext.retainAll(pairings); for (WorldCoordinate coord : pairingsToTestNext) { int x = coord.x; int y = coord.y; int z = coord.z; World wo...
e8d8f466-c4ba-4085-b29e-43812a1a5b04
1
public Crew[] generateCrews() { Crew[] crewList = new Crew[fetchCrewsList().length]; for (int i = 0; i < fetchCrewsList().length; i++) { crewList[i] = new Crew(fetchCrewsList()[i]); } return crewList; }
dd9539c5-9f0e-4d41-abf6-d677f02a1b02
6
public ScreenshotDemo() { MinuetoFont fontArial16; // Font used to write framerate. MinuetoImage imageFramerate; // Text use to display framerate. MinuetoStopWatch mswWatch; // Timer used to calculate framerate. MinuetoColor color[] = new MinuetoColor[5]; // Array of color. Random ranNumGenerator;...
f2f7107b-651f-441d-b966-ebad1d88c266
5
@Override public final void mouseWheelMoved(MouseWheelEvent e) { mouseWheelScrolled(e); // TODO make this mess better! TScrollBar scrollBar = null; double distanceToScrollBar = Double.MAX_VALUE; for (TComponent c : tComponents) { // If c is a TScrollBar if (c.getClass() == TS...
ddee220f-503e-4189-b027-9f429eda0ff1
6
public void run() { while(true) { if(!muerto && !escaleras) { actualiza(); //Se actualiza y checa colision checaColision(); ajustarCamara(); repaint(); } else if(muerto) { init(); reset("nivel" + nivelActual +".txt"); muerto = false; } else if(escaleras) { in...
985e7668-e800-4699-a792-2429b807cebe
6
void checaColision() { //colision de flappy con borde superior del juego if(flappyObj.getPosY() <= 5) { gameover = true; } //colision de flappy con piso if(flappyObj.intersecta(floor)) { gameover = true; System.out.println("Ch...