method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b288ead7-0296-4e2c-a284-3939b396b847
3
public void draw(Graphics g) { for (int i = 0; i < bricks.length; i++) { for (int j = 0; j < bricks[i].length; j++) { if (bricks[i][j] != null) { bricks[i][j].draw(g); } } } }
a60ea7a5-09c1-452a-9a80-f8cb5ba6a0ee
3
public boolean sendFrame(Framedata framedata) throws IOException { ByteBuffer b = draft.createBinaryFrame(framedata); // See if we have any backlog that needs to be sent first if (handleWrite()) { // Write the ByteBuffer to the socket channelWrite(b); } // If we didn't get it all sent, add it to the bu...
2dcba174-151c-4d83-8dec-fbd28889529c
2
public GamesFacadeStub(List<ServerModel> serverModels) { super(serverModels); this.gameDescriptionsList = new ArrayList<GameDescription>(); /* this.gameDescriptionsList = new ArrayList<GameDescription>(){{ add(new GameDescription("Empty Game", 0, new ArrayList<PlayerDescription>(4))); add(new GameDescript...
507a3c86-f4d7-4f8f-a88f-0e3ce028798e
0
public void close(){ this.vue.setVisible(false); }
c22fd4bf-1d95-4c30-b882-23543baba024
6
private boolean isDivideOverflow(IDecimal other) { if (CHECK_OVERFLOW && base != 0) { if (base > 0 && MAX_VALUE.base / base < 1 / other.getBase()) { return true; } if (base < 0 && MAX_VALUE.base / base > 1 / other.getBase()) { return true; } } return false; }
1967ecbf-2fdd-48ff-9fbc-a632281c8bf8
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Point other = (Point) obj; if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x)) return false; if (Double.doubleToLongBits(y) ...
fc49d734-2221-4ffd-bd39-f74f1bc4a464
5
public static void makeGame(){ //Creates the map, and fills it with the locations //Link some variables to their files, these files are where the text is stored File name = new File("name.txt"); File enter = new File("enter.txt"); File look = new File("look.txt"); File shortLook = new File("shortLook.txt");...
94ce08db-f679-425c-8b0f-dfa1b4e68ea4
5
private PlayerEffect getWinEffect(RoomType roomType) { PlayerEffect effect = null; int randNum = rand.nextInt(100); switch(roomType){ case DOOR: effect = new UseKeyEffect(); break; case EXIT: effect = new WinGameEffect(); break; case PATH: if(randNum < 30) effect = new IncreaseHealthEffec...
0a0d4a08-2948-4d78-ad57-281e72eddc76
4
public static int maxProfitSingle(int[] prices, int start, int end) { if (start >= end) { return 0; } int max = 0; int low = prices[start]; for (int i = start; i <= end; i++) { if (prices[i] < low) low = prices[i]; int diff = prices[i] - low; if (diff > max) { max = diff; } } return...
5271f940-1c4d-4328-b111-3550b6df0f0f
1
public String getString(String key) throws JSONException { Object object = get(key); return object == NULL ? null : object.toString(); }
778346b6-9741-4485-ba95-56e02670ab48
2
private String formatKeywords(String text) { Matcher ma = this.findKeywords.matcher(text); StringBuffer buffer = new StringBuffer(text.length()); while (ma.find()) { String link = "/wiki/"; link += this.findSpaces.matcher(ma.group(1)).replaceAll("_"); String title = (ma.group(3) == null) ? ma.group(1)...
f1ffe651-c569-4275-9c0c-618742609a7c
2
public static void main(String args[]) { new NewThread22(); // create a new thread try { for(int i = 5; i > 0; i--) { System.out.println("Main Thread: " + i); Thread.sleep(1000); } } catch (InterruptedException e) { System.out.println("Main thread interrupted."); } System.out.println("Main thre...
7119c813-4f8f-408d-a451-d7c2d013eb13
7
public static void checkRank(Player player, int mode, String boss) { long dominionFactor = player.getDominionTower().getTotalScore(); for (int i = 0; i < ranks.length; i++) { DTRank rank = ranks[i]; if (rank == null) break; if (rank.username.equalsIgnoreCase(player.getUsername())) { ranks[i] = new ...
9d9ba536-7440-491e-bf9c-8066c1033a9e
0
@Override public void mouseEntered(MouseEvent e) {}
c9f380b7-4174-4749-afbb-a9dc693501ac
9
@EventHandler public void onCreeperSpawn(CreatureSpawnEvent event) { if(event.getEntityType() == EntityType.CREEPER) { Creeper creeper = (Creeper) event.getEntity(); if(event.getSpawnReason() == SpawnReason.SPAWNER || event.getSpawnReason() == SpawnReason.CUSTOM) { ArrayList<Block> blocks; blocks = new...
cba3bbdf-e47e-4e95-8e83-8341e9f20b63
1
public static int[] toIntArray(Integer[] data) { int[] result = new int[data.length]; for (int i = 0; i < data.length; i++) result[i] = data[i].intValue(); return result; }
51d8d888-8ea1-4b4b-a875-0f4725d3eb63
1
static void mergeTryCatch(FlowBlock tryFlow, FlowBlock catchFlow) { if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_ANALYZE) != 0) GlobalOptions.err.println("mergeTryCatch(" + tryFlow.getAddr() + ", " + catchFlow.getAddr() + ")"); tryFlow.updateInOutCatch(catchFlow); tryFlow.mergeSuccessors(catchF...
947aaf09-b4f5-46c7-871c-e48589f108fc
1
@Override public void destroy() { if(currentSector > -1) { Application.get().getLogic().getGame().getSector(currentSector).releaseLocation(owner); } }
b039c8a0-00da-46c0-8c46-cd17d3356620
1
private static boolean decodeBoolean(String bString){ int b = Integer.parseInt(bString); if( b==1 ){ return true; } return false; }
42aeb1d0-539a-4c09-8ffe-d27be932f6ff
7
private void method484(int i) { if(aBooleanArray1664[i]) { method485(i); return; } int j = anIntArray1631[i]; int k = anIntArray1632[i]; int l = anIntArray1633[i]; Texture.aBoolean1462 = aBooleanArray1663[i]; if(anIntArray1639 == null) Texture.anInt1465 = 0; else Texture.anInt1465 = anInt...
f310295b-8836-41cd-8844-df6e3d238ab7
2
public void clearNodes() { for ( Link<T> link : links) link.visited=false; for ( Summit<T> s : summits) s.visited=false; }
00388189-59bb-4d58-bcd8-9613b1a13f26
8
public int maxProfit(int[] prices) { if (prices.length == 0) return 0; int[] maxProfits = new int[prices.length]; // save the max profits maxProfits[0] = 0; // ordered search int minPrice = prices[0]; int maxProfit = 0; int profit = 0; for (int i = 1; i < prices.length; i++) { profit = price...
c3c92785-9076-4723-9320-6226f6f11804
1
@Override public void update(long deltaMs) { if(!moving) { targetAndShoot(); } }
4e565496-fdc7-487d-bb67-3fd31e5a27f8
1
public Object newArray(String type, int[] dimensions) throws InterpreterException, NegativeArraySizeException { Class clazz; try { /* get the base class (strip leading "[") */ clazz = TypeSignature.getClass(type.substring(dimensions.length)); } catch (ClassNotFoundException ex) { throw new Interpreter...
4ae9ad9c-4558-4db6-965f-346e3edb42b8
7
private void b_searchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_b_searchActionPerformed try { if(j_date_first.getDate() == null || j_date_last.getDate() == null){ JOptionPane.showMessageDialog(rootPane, "Preencha as duas Datas para continuar.", "Relatórios | C...
d0208068-7aa0-49e2-9550-ebf2f77920f1
1
public static void main(String argv[]) { int n = new Integer(argv[0]).intValue(); DESBlock prng = new DESBlock(System.currentTimeMillis()); for (int i = 0; i < n; i++) System.out.println(Long.toString(prng.ecb_encrypt(i), 16)); }
07c43c21-32d7-4ed0-a3d0-08b5bc60a223
8
@Override protected void controlUpdate(float tpf) { if(shot){ Spatial tempBullet = ((Node)spatial).getChild("Bullet" + bulletNo).clone(); tempBullet.setCullHint(Spatial.CullHint.Dynamic); ((Node)spatial).getChild("Collider").setCullHint(Spatial.CullHint.Always); ...
a63c753a-c738-4cfd-b78f-ddae3b6c7811
3
public void run() { Debug.println("Sound.run()"); while(true) { synchronized (fxQueue) { if (fxQueue.peek() == null) { try{ fxQueue.wait(); } catch (InterruptedException e) { continue; } } else { int sound = fxQueue.poll(); playSound(sound); } } } }
205833b5-b0d7-415a-835e-cb67eaa61bf8
4
public ArrayList<String> loadNode() { ArrayList<String> nodes = new ArrayList<String>(); int startLine = 0; for(int lineNumber = 0;;lineNumber++){ String aString = stringLines.get(lineNumber); if(aString.equals("nodes:")){ startLine = lineNumber+1; break; } } for(int lineNumber = startLine;;...
13332189-e744-4b30-a9b9-0f8993aab47f
6
private boolean timeConflict(Request oldRequest, Request newRequest) { int orStartTime = oldRequest.getDate().get(Calendar.HOUR_OF_DAY); int orEndTime = oldRequest.getDate().get(Calendar.HOUR_OF_DAY) + oldRequest.getDuration() / 60; int nrStartTime = newRequest.getDate().get(Calendar.HOUR_OF_DAY); ...
7c13adb3-0792-4746-8bc5-a2272acc60a7
1
public Equipory(Coord c, Widget parent) { super(c, new Coord(0, 0), parent, "Equipment"); ui.equip = this; canhastrash = false; epoints = new ArrayList<Inventory>(); equed = new ArrayList<Item>(ecoords.length); //new Img(new Coord(32, 0), bg, this); for(int i = 0; i < ecoords.length; i++) { epoints.add(new ...
c58115ad-2849-4a0f-8b1d-5041ba2e7e09
9
public void nextWave() { if(stage != Stages.RUNNING) return; playMusic(); int nextWave = getCurrentWave()+1; setCurrentWave(nextWave); if(logoutAtEnd) { player.forceLogout(); return; }else if(nextWave == 1 || nextWave == 11 || nextWave == 21 || nextWave == 31 || nextWave == 34 |...
229e9563-afad-47a2-9811-3aa3e9ab3ede
7
public static int hexToInt(String value) throws NumberFormatException { int result = 0; int multiplier = 1; for (int i = value.length() - 1; i >= 0; i--, multiplier *= 16) { char digit = value.charAt(i); if (digit >= '0' && digit <= '9') result += (digit ...
8a008a2c-2be3-4c07-b051-84ec977f322f
3
@Override public void mirror(int dir) { Tile[][] mirror = new Tile[bounds.height][bounds.width]; for (int y = 0; y < bounds.height; y++) { for (int x = 0; x < bounds.width; x++) { if (dir == MIRROR_VERTICAL) { mirror[y][x] = map[bounds.height - 1 - y][...
7d7c3d2c-40c9-4d0f-936b-a3ff424379e6
1
public boolean ParseCommandPari(String s, Socket socket, Serveur serveur){ String[] requestParams = s.split("/"); //Id match int idMatch = Integer.parseInt(requestParams[1]); //V ou R String equipe = requestParams[2]; int mise = Integer.parseInt(requestParams[3]); UUID uuid = UUID.fromString(requestParams...
0fb36875-6aea-43f4-ad63-5228b42f6512
0
public void setPassword(String password) { this.password = password; }
62f7843f-d04d-4a04-8664-7bfb15cbecc6
9
private void checkType() { if (!type.equals("") && !type.equalsIgnoreCase("sports") && !type.equals("lifestyle") && !type.equals("entertainment") && !type.equals("business") && !type.equals("technology") && !type.equals("science") && !type.equals("politics") && !type.equals("health")) { System.out....
53ea9b09-f2f9-42cd-90d8-3e9b8d75385f
1
public Database() { try { System.out.println("Connecting to database..."); conn = DriverManager.getConnection(DB_URL, USER, PASS); stmt = conn.createStatement(); } catch (SQLException e) { // TODO Auto-generated catch block System.out.println("Connecting to database failed..."); e.printStackTrace(...
3f2a28fc-752a-4a0c-87a9-e2c3d5394fe2
9
public final GalaxyXDefinitionParser.assignment_operator_return assignment_operator() throws RecognitionException { GalaxyXDefinitionParser.assignment_operator_return retval = new GalaxyXDefinitionParser.assignment_operator_return(); retval.start = input.LT(1); int assignment_operator_StartIndex...
dd0e6b5b-7e58-49a5-b4bd-c6f7ef63dca4
0
private void horsligne_active(){ //System.out.println("hors ligne actif"); connexion.setEnabled(true); //conteneurNiv2_2.setEnabled(true); Brep_source.setEnabled(true); BLecture.setEnabled(true); BPause.setEnabled(true); BSuivant.setEnabled(true); BPrecedent.setEnabled(true); ip2.setEnabled(true); ...
618ec01a-e37f-498c-bd8d-d6c2282dee5c
4
public void addBuilding(BuildingModel building, int x, int y) throws GameFieldException { if (!checkPosition(x, y)) { throw new GameFieldException(String.format( "Accesing square with invalid position (%d, %d).", x, y)); } switch (map[y][x]) { case GRASS: buildings[y][x] = building; break; ca...
9b2cb54e-b456-4643-8bf0-fafa4da1ccba
2
public void steppedOn(Level level, int xt, int yt, Entity entity) { if (random.nextInt(60) != 0) return; if (level.getData(xt, yt) < 2) return; harvest(level, xt, yt); }
cf6f5e31-a45c-45ae-a0c5-d234f89329c0
0
public int getPosition() { return movingObject.getPosition(); }
dc4307ef-aa0c-4c24-a8df-f14c947c8cc4
3
public float getStrVsBlock(ItemStack var1, Block var2) { return var2.blockID != Block.web.blockID && var2.blockID != Block.leaves.blockID?(var2.blockID == Block.cloth.blockID?5.0F:super.getStrVsBlock(var1, var2)):15.0F; }
dbf966fb-1c99-42ec-8608-91d21e1e82e0
9
private void procesarMessage(String origen, String tipo, String destino, String message) { try { switch (tipo) { case "c": if (serverAlreadyExists(origen)) { TumpiServer server = getServer(origen); if ("*".equals(des...
3f9bfc7e-536c-49e5-ae2f-e47850c8c3d9
1
void parseProlog() throws java.lang.Exception { parseMisc(); if (tryRead("<!DOCTYPE")) { parseDoctypedecl(); parseMisc(); } }
0761035c-0d04-4b8b-9121-bbf1e089b6ab
7
public void startConsole() throws IOException{ System.out.println("This is DFS client, type help for more information"); String cmdLine=null; while(running){ System.out.print(">>"); try{ cmdLine = console.readLine(); }...
53064930-161d-4f93-8463-ee34880517ca
5
public void body() { // get the destination entity ID this.destID_ = GridSim.getEntityId(destName_); int packetSize = 1500; // packet size in bytes Sim_event ev = new Sim_event(); // an event // a loop waiting for incoming events while ( Sim_system.run...
91f416d5-d7ea-4f80-9906-18e28b64c3ac
7
@Override public String getNextTask() { if (this.initialized == false) { throw new IllegalStateException("Scheudlers must be initialized before they can be used."); } else if (this.scheduleable == false) { throw new IllegalStateException("Task set is not scheduleable."); } refreshTasks(); String nextTa...
89d152de-a96f-436f-8777-808e60e974aa
0
public EvenChecker(IntGenerator g, int ident) { generator = g; id = ident; }
5b82fd89-1bac-480c-8c48-1482393d631f
7
private void onSendMessage(JSONObject data) { System.err.println("EVENT: sendMessage"); // On cree un nouveau msg avec le json data Msg msg = new Msg(data); // On ajoute le nouveau message en DB et on recupere le msg Integer msgId = _msgManager.sendMessage(msg.getContent()); // On ajoute l'id et le sr...
59f74541-8762-4c8c-8650-9549deee1cc4
7
public List<String> getUnionList(List<String> list1, List<String> list2) { List<String> totalList = new ArrayList<>(); if (list1.size() > list2.size()) { for (String obj : list1) { totalList.add(obj); } for (String obj : list2) { if (!totalList.contains(obj)) { totalList.add(obj); } } ...
9a0a3062-63e3-40a9-b99a-a9773a1ac545
9
private void testAbstractMethods(ByteMatcher matcher) { // test methods from abstract superclass assertEquals("length is one", 1, matcher.length()); assertEquals("matcher for position 0 is this", matcher, matcher.getMatcherForPosition(0)); try { matcher.getMatcherForPositio...
1f9224a5-41ed-4c79-ab1b-a1767168efce
7
private int countDecodeWays(String number, int start) { if (start == number.length() - 1 && number.charAt(start) != '0') { return 1; } if ((number.charAt(start) == '1' || number.charAt(start) == '2') && (start + 1) < number.length() && number.charAt(start + 1) >= '0' && number.charAt(start + 1) <= '6'...
8f65ed12-84a0-4443-95a4-8fb3781fe4f7
5
public static void main(String[] args) { String dataFile = DEFAULT_DATA_FILE; int trainingExamples = DEFAULT_TRAINING_EXAMPLES; for(int i = 0; i + 1 < args.length; i += 2) { if(args[i].equals("-f")) { dataFile = args[i + 1]; } else if(args[i].equals("-e")) { trainingExample...
356cdc05-58a3-4c2b-9f70-d3feed379538
3
private int getMaxRemoteMethodId( Class<?> serviceInterface ) { int methodMax = 0; for (Method method : serviceInterface.getMethods()) { RemoteMethod remoteMethod = method.getAnnotation( RemoteMethod.class ); if (remoteMethod != null) { m...
6824748a-7e40-4d7f-8ad8-c2135d4fc922
5
private void escribeDraws() { this.verbose += "\n"; if (!this.draws.isEmpty()) { for (Jugadas jugada : this.draws) { if (this.jugada.compareTo(jugada) < 0) { if (jugada == Jugadas.escalera && gutshot) { this.verbose += "- Draw: " + ...
3dfd334b-2255-42be-a154-8d4d19ce1e88
0
public int GetRecentBus() { return recentBus; }
17f4421d-ee30-4b3a-8aa0-f6a8138ef1c9
5
public void saveObject(String fullPath, SerialDTO dto) { FileOutputStream fos = null; ObjectOutputStream oos = null; try { fos = new FileOutputStream(fullPath); oos = new ObjectOutputStream(fos); oos.writeObject(dto); System.out.println("Write Success"); } catch (Exception e) { e.printStackTrace(...
a73626df-12e5-4a5b-b1ae-e99d2f7e62ea
9
final static void parseGroup(char[] data,int i,int out,Term term,boolean icase,boolean skipspaces, boolean unicode,boolean xml) throws PatternSyntaxException{ Bitset sum=new Bitset(); Bitset bs=new Bitset(); int mode=ADD; char c; for(;i<out;){ switch...
8f95bda8-01cd-4f54-a20b-b1247a708103
9
@Override public Column parse() { if(!this.prepared) { this.prepared = true; StringBuilder sB = new StringBuilder(); sB.append(this.name); String type = this.t.getTextual(); if(this.t == DataType.INT) { sB.append(" INTEGER "); }else if(this.t == DataType.RAW) { sB.append(type.re...
18a75e48-87ed-42f8-865f-8425b91a80ed
6
private static final double grad(int hash, double x, double y, double z) { hash &= 15; double u = hash < 8 ? x : y; if ((hash & 1) != 0) { u = -u; } double v; if (hash < 4) { v = y; } else if (hash == 12 || hash == 14) { v = x; } else { v = z; } if ((hash & 2) != 0) { v = -v; } re...
a5a5dc77-d5ed-48c1-8900-5f7f3920bc18
7
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Digit other = (Digit) obj; if (m_digitValue != other.m_digitValue) { return false; ...
8b3f7743-3225-4ddf-9e7e-b05aa32de028
4
public void testBinaryCycAccess14() { System.out.println("\n**** testBinaryCycAccess 14 ****"); CycAccess cycAccess = null; try { try { if (connectionMode == LOCAL_CYC_CONNECTION) { cycAccess = new CycAccess(testHostName, testBasePort); } else if (connectionMode == SOAP_CYC_...
e026920c-d191-45b7-aef3-d184e284ff2c
4
String getLogCatCapture(final AndroidDevice aDevice, String level) { String log = null; switch (level) { case "VERBOSE": log = aDevice.getShellCommand("logcat -d long *:V"); break; case "ERROR": log = aDevice.getShellCommand("logcat -d long *:E"); break; case "INFO": log = aDevice.getShellComma...
3c9ff4d2-2659-4822-8103-c3ba0545c729
9
public static Cons cppTranslateUnit(TranslationUnit unit) { { Object old$CppCurrentUnitModule$000 = Stella.$CPP_CURRENT_UNIT_MODULE$.get(); try { Native.setSpecial(Stella.$CPP_CURRENT_UNIT_MODULE$, ((Module)(Stella.$MODULE$.get()))); if (unit.theObject != null) { Native.setSpecial(S...
d71eef07-9a23-4401-8fa4-1997d8ddd57b
0
public void setFoo(T foo) { this.foo = foo; }
e30e645d-8ba0-48d6-a666-3ed0bce24240
0
public PropertyContainerImpl() { super(); removeAllProperties(); }
08391059-2b81-4cc0-9d02-9ae0d4bccea1
1
public void addToArray(String string) { // Format string string = formatString(string); // Check if string already exists in array if (!parsedArray.contains(string)) { // Binary search for position to add string parsedArray.add(binarySearch(string, parsedArray), ...
7613c833-61f5-4c4d-9477-3033ba32123f
8
private int optional (int optional) throws KryoException { int remaining = limit - position; if (remaining >= optional) return optional; optional = Math.min(optional, capacity); // Try to fill the buffer. int count = fill(niobuffer, limit, capacity - limit); if (count == -1) return remaining == 0 ? -1 : Ma...
aeee9873-3657-4fa9-ac44-f6d5908c67c9
1
@Override public void execute(DebuggerVirtualMachine dvm) { for (String breakpointLine : breakpointLinesToSet) { dvm.setBreakpoint(Integer.parseInt(breakpointLine)); } }
49c004af-de35-4166-a304-13a1906f4f64
1
@Test public void runTestInactiveActivity() throws IOException { InfoflowResults res = analyzeAPKFile("AndroidSpecific_InactiveActivity.apk"); if (res != null) Assert.assertEquals(0, res.size()); }
4156e400-5b9e-41a7-a103-1127d8397dcb
3
public boolean run(File path1, File path2, File outputDir, String prefix) { long start = System.currentTimeMillis(); // is any pdf pair different foundDifference = false; // get all pdf pairs Set<PDFInfoHolder> pdfInfoHolders = PDFCorpusAnalyser.getSimplePDFInfoHolders(path1, path2, prefix); //...
b1b5a13c-7862-45ed-8685-2360c3136d6a
5
public ClientHandler(Socket sock, MultiQueue<Message> queue, Database database) { this.socket = sock; this.queues = queue; this.database = database; List<RelayMessage> recent = null; try { database.incrementLogins(); recent = database.getRecent(); } catch(SQLException e) { e.printStackTrace();...
bebc7db8-65fe-47e9-8da1-b6ebc38c32ef
2
public boolean isSortAscending(TreeColumn column) { int size = mSortData.size(); for (int i = 0; i < size; i++) { SortData sortData = mSortData.get(i); if (sortData.mColumn == column) { return sortData.mAscending; } } return true; }
aae8e83c-2da3-406a-8316-bd5afba0a5f3
8
public static void paragraph(double x, double y, double x2, double y2, Deque<String> s) { offscreen.setFont(font); FontMetrics metrics = offscreen.getFontMetrics(); double xs = scaleX(x); double ys = scaleY(y); double xs2 = scaleX(x2); double ys2 = scaleY(y2); dou...
4e272186-b95a-4826-982b-0ad0a0ddfe5b
8
public void determineSetup() { if (isFourCardBadugi()) { setup = Setup.FourCardBadugi; } else if (isThreeCardBadugi()) { setup = Setup.ThreeCardBadugi; } else if (isPair()) { setup = Setup.Pair; } els...
4d90a8aa-58ee-4e8f-80c8-f0e30ca0e70f
1
public ResponseVm createIssue( String repositoryName, String fileName, String battleScribeVersion, String platform, boolean usingDropbox, String body) throws IOException { StringBuilder issueBody = new StringBuilder(); issueBody.append("**File:** ").append(fileName) ...
0b811d3c-ed49-43e6-b721-15705b9428a6
0
public static File[] getFilesArrayFile() { File dir = new File("C:\\Files"); File[] files = dir.listFiles(); return files; }
fc907c0f-961b-484a-b57f-32dd194aa827
4
public void mouseDragged(MouseEvent e) { if(e.getX()>x && e.getX()<x+width) { if(e.getY()>y && e.getY()<y+height) { selected=true; } } }
569f6d36-e8b8-4b25-b6e6-fecf00109233
3
private Creature getClosestTarget(ArrayList possibleTargets){ Creature closestTarget = null; if(possibleTargets == null){ closestTarget = null; }else{ closestTarget = (Creature) possibleTargets.get(0); for(int i = 0; i < possibleTargets.size(); i++){ if(distanceBetween(this.parent, closestTarget) > d...
81a23d8b-a65a-4d71-a9db-92cbb5aead5f
7
* @param port * @param queryId * @param taskId * @param subtaskId * @param database * @param parameters * @return Stella_Object */ public static Stella_Object runFetchQuery(String host, int port, String queryId, String taskId, String subtaskId, String database, String parameters) { { Object o...
75f9425c-f819-46ff-8f4f-f446dd846e1e
3
public void sort(TreeSorter sorter) { if (!mChildren.isEmpty()) { for (TreeRow child : mChildren) { if (child instanceof TreeContainerRow) { ((TreeContainerRow) child).sort(sorter); } } Collections.sort(mChildren, sorter); renumber(0); } }
13bfd836-ceea-4fe8-9e6b-efd398115a9a
3
@Override public void reactToChanges(ObservationEvent ev) { Class evClass = ev.getClass(); int value = this.value; if (evClass == CustomSliderEvent.class) { CustomSliderEvent event = (CustomSliderEvent) ev; value = event.getValue(); } else if (ev...
92f1218a-32ba-4b7b-8fa2-017eab91dc98
2
public void rotateClockwise(Board board) { Point[] newRel = new Point[3]; for (int i = 0; i < rel.length; i++) { newRel[i] = new Point(-rel[i].getY(), rel[i].getX()); } if (rotateAlgorithm(board, base, newRel, getKicks()[rotation])) { addRotation(1); } ...
c010132a-b903-4c83-b7b8-e8a1f69a2f4c
4
public static void main(String[] args) { final int port; if(args.length == 0) { port = DEFAULT_PORT; } else if(args.length == 1) { try { port = Integer.parseInt(args[0]); } catch (NumberFormatException e) { Sys...
20b5b4f3-1bdd-42cb-9090-3bf97665acaf
3
@Override public boolean execute(Player player) { if (!this.hasSecondWord()) { GameEngine.gui.println("Take what?"); return false; } if (player.getCurrentRoom().getItemList().hasItem(this.getSecondWord())) { Item item = player.getCurrentRoom().g...
472906b8-9d5b-4dd8-899d-af995c62cae3
9
String codonsOld(Variant seqChange) { int cdsBaseNum = 0; String codonsOld = ""; char currCodon[] = new char[3]; boolean useCodon = false; currCodon[0] = currCodon[1] = currCodon[2] = ' '; for (Exon exon : transcript.sortedStrand()) { int step = exon.getStrand() >= 0 ? 1 : -1; int beg = exon.getStran...
8c582af6-52ed-44df-ad30-5cae1dafa4e3
2
public static final String lastSegment(String segment) { segment = clean(segment); Matcher arrayAtEndMatcher = ARRAY_AT_END.matcher(segment); if(arrayAtEndMatcher.matches()){ return arrayAtEndMatcher.group(1); } int index = segment.lastIndexOf(DOT...
6bf648fa-c337-4277-b436-4c21f4e3598f
9
public static void loadMemory() throws Exception { for(int i=0;i<Memory.ARRAY_ROWS;i++) for(int j=0;j<Memory.WORD_SIZE;j++) Memory.cellarray[i][j]=rnd.nextInt()&62; BufferedReader r=new BufferedReader(new FileReader("test.obj")); int memrow=0; while(true) { String line=r.readLine(); if(lin...
f5bb3bff-9f59-430f-b11e-e804c4e52c33
0
protected JComponent initTreePanel() { return treePanel; }
a8abc07d-31f7-4cf9-adeb-fa813eb25f3e
3
public static List<String> userClassToList(byte[] buf) { if (buf == null) { return null; } LinkedList<String> list = new LinkedList<String>(); int i=0; while (i<buf.length) { int size = unsignedByte(buf[i++]); int instock = buf.length ...
bdbb0e2c-e19b-4d83-918f-34de4223ccb3
5
private void initVehiclePanel() { Object[] columnNames = { "Name", "Initial Location", "Remaining Capacity", "Available At" }; Object[][] data = { { vehicle.getName(), vehicle.getInitialLocation(), vehicle.getRemainingCapacity(), vehicle.getAvailableIn() } }; vehicleTableModel = new DefaultTableModel(...
b4990242-f23c-4c13-ae82-28743b2a09d4
1
public boolean gameFinished() { return (mySea.fleetDestroyed() || theirSea.fleetDestroyed()); }
e3f91878-cb50-4ce9-b4b2-3bd4d5abb245
1
public void setLeftChild(Node child){ left = child; if (child != null) { child.parent = this; } }
841a6be6-159a-49cd-9190-a417edd67018
5
public void move() { if (x <= 1280) offScreen = false; x += dx + dx; y += dy + dy; if (x < 1) x = 1; if (y < 1) y = 1; if (x > 1230) x = 1230; if (y > 670) y = 670; }
35f81fef-9dd5-48c2-9e37-6004e37ee3d8
8
public int lengthOfLIS(int[] nums) { List<ValAndIndex> l = new ArrayList<ValAndIndex>(); for (int i = 0; i < nums.length; i++) l.add(new ValAndIndex(nums[i], i)); int max = l.isEmpty() ? 0 : 1; Collections.sort(l, new Comparator<ValAndIndex>() { @Override public int compare(ValAndIndex o1, ValAndIndex ...
15df8b76-99b7-4d7e-a808-17abff9b4726
7
@Override public void addTile(Tile tile) throws Exception{ ArrayList<Tile> run, group; if(isRun){ run = this.getTiles(); if(tile.colour != run.get(0).colour) throw new Exception(tile.toString() + " is not the same colour as the run " + this.toString()); else if(tile.number == run.get(0).number ...
2c170dda-718c-4d26-9cf3-cc3ef25c39e2
8
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("MesProjets Post"); // recherche du projet à modifier, par son Id Projet updatedProjet = new Projet(); Integer inputProjId = Integer.valueOf(request.getParameter("inputPro...
cfea56e4-bc9d-41fc-85ca-9733efdf5c47
9
public void confirm(String id) { System.out.println(MiscTool.getDate() + ":" + "Start committing..."); confirmPid.add(id); File rootDir = new File(proc.getSDFS().getRootDirectory()); File[] files; boolean flag; while(true) { flag = true; if((files...