method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
32fdb486-644a-474a-a2f5-998bf4e193c9
8
public int findIndexLetter(char ch) { if(Character.toLowerCase(ch)=='a') {return 0;} if(Character.toLowerCase(ch)=='b') {return 1;} if(Character.toLowerCase(ch)=='c') {return 2;} if(Character.toLowerCase(ch)=='d') {return 3;} if(Character.toLowerCase(ch)=='e') {return 4;} if(Character.toLowe...
4b8bd8a6-9947-4217-a24f-62b564627858
3
public static void setQtCaddie (String idr, char signe) throws BDException { String requete = null; if (signe != 'd') requete = "update lecaddie set qt = (select qt from lecaddie where idr="+idr+")"+signe+"1 where idr="+idr; else requete = "delete from lecaddie where idr="+idr; Statement stmt = null; C...
f1496bf3-c270-45fd-bdba-794b83618639
0
public int GetRecentBus() { return recentBus; }
25dfc95d-0205-43cc-bfb6-508fde1ea731
7
public void tick() { int xa = 0; int ya = 0; if (input.isMovingWithKey) { if (input.up) ya--; if (input.down) ya++; if (input.left) xa--; if (input.right) xa++; } else { xa = input.mouseX; ya = input.mouseY; } if (xa != 0 || ya != 0) { move(xa, ya); } }
6637b63a-9fbf-4cdc-afa8-e2fdd2f5d8ce
0
@Override public int getYearsExperience() { return super.getYearsExperience(); }
768d188c-593e-4340-9a12-ed0b0fe11b02
6
public void run() { timeUntilStart = 120; while (Status.isStatus(Status.IN_LOBBY)) { for (; timeUntilStart >= 0; timeUntilStart--) { if (timeUntilStart == 0) { // Hier begint de game break; }// Dit zorgt ervoor dat er om...
85801db7-8009-4e4a-8748-38c56fbf21b6
1
@Override public void addCategory(Category category) { PreparedStatement pStmt = null; try { pStmt = conn.prepareStatement("INSERT INTO CATEGORY (description) VALUES (?);"); pStmt.setString(1, category.getDescription()); pStmt.executeUpdate(); } catch (SQLException e) { e.printStack...
c8f9b70d-c35d-4d65-a173-31cc680c9c1b
3
private void key(byte key[]) { int i; int koffp[] = { 0 }; int lr[] = { 0, 0 }; int plen = P.length, slen = S.length; for (i = 0; i < plen; i++) P[i] = P[i] ^ streamtoword(key, koffp); for (i = 0; i < plen; i += 2) { encipher(lr, 0); P[i] = lr[0]; P[i + 1] = lr[1]; } for (i = 0; i < slen;...
86267132-a5d7-4601-bd9e-46f3e7bd7d5a
5
@BeforeTest @Test(groups = { "BST", "Insertion" }) public void testBSTInsertion() throws DuplicateKeyException { Integer count = 0; Reporter.log("[ ** BST Insertion ** ]\n"); try { timeKeeper = System.currentTimeMillis(); for (int i = 0; i < seed; i++) { bTree.put(randomArray[i], randomCharArray[i]);...
82c50838-a276-45a4-86cc-c5ccef333a92
3
public List<String> getQueryNames() { List<String> names = new ArrayList<String>(); try { NodeList nodes = Utilities.selectNodes(this.doc, "/c:settings/c:queries/c:query", this.namespaces); if(nodes != null) { for(int i = 0; i < nodes.getLength(); ++i) { Node node = nodes.item(i); Attr attr =...
cd2ffb04-7807-4a23-a908-0d314456ce7c
6
@EventHandler public void ZombiePoison(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.getZombieConfig().getDouble("Zombie.Poison.D...
613426c9-b7ba-4e3a-9298-911e24a7e241
9
public static void testOrchestrator(int maxIterations) { int climateControlErrorCounter = 0; int climateControlEventCounter = 0; int dailyWakeupErrorCounter = 0; int dailyWakeupEventCounter = 0; int luminanceManagementErrorCounter = 0; int luminanceManagementEventCounter = 0; for (int i=0; i<m...
32c39c63-af12-4f70-9646-903cf1727d22
8
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TypeRef other = (TypeRef) obj; if (isList != other.isList) { return false; } if (isMap ...
bb37ac00-ba68-41a2-94d7-5d63f5572715
4
private void checkExpiryTime() { double referenceTime = Double.MAX_VALUE; LinkedList<ScheduleItem> removedRes = new LinkedList<ScheduleItem>(); Iterator<ServerReservation> iterRes = reservTable.values().iterator(); while(iterRes.hasNext()) { ServerReservation sRes = iterRes.next...
6473932d-abe7-405e-9669-b73e7b1566d4
8
public static boolean truePropositionsIteratorDnextP(TruePropositionsIterator self) { { Iterator cursor = self.propositionCursor; Proposition proposition = null; if (cursor == null) { return (false); } loop000 : for (;;) { if (cursor.nextP()) { proposition = ((Prop...
6de346f6-9bbc-41dd-ad40-1b19c4eb7078
3
@Override public boolean onKeyDown(int key) { if(super.onKeyDown(key)) { return true; } if(key == Keyboard.KEY_TAB) { Application.get().getHumanView().addScreen(ConsoleFactory.create()); return true; } else if(key == Keyboard.KEY_E...
316a3302-eccd-4ec5-8085-5174498bcb1e
8
@Override public JobTrackerACK heartBeat(TaskTrackerReport report) { report.printReport(); JobTrackerACK rst = new JobTrackerACK(null, null); rst.newAddedTasks = new ArrayList<Task>(); rst.rcvTasks = new ArrayList<TaskStatus>(); while (this.taskList.size() > 0) { synchronized (this.taskList) { ...
e253854c-53b0-4984-bf8d-85abfe55a1e1
3
public void changeState(int option){ switch(option){ case 0: this.isOkay = true; break; case 1: this.isInjured = true; this.isOkay = false; break; case 2: this.isInjured =false; this.isDead = true; break; } }
2306fa8c-fdde-40e1-a07d-1cd9fd364aac
8
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String submitButton = (String) request.getParameter("submit_btn"); int adminUserID = Integer.parseInt(request.getParameter("admin_userid")); int targetUserID = Integer.parseInt(request.getParamet...
603ca704-64dc-47f5-ad40-5837856eb6a1
6
private int readString(boolean verbatim) { read(); prepareString(); do { // check escapes switch (_val) { case (char) -1: throw new ScoreException("Unfinished string"); case '\n': case '\r': if (!verbatim) throw new ScoreException("Cannot have a line break in a single-line string...
26d69dc1-de5e-46f2-a750-a95cd67a281b
5
public void cadastrar(Consulta consulta) throws Exception{ if(consulta.getCodMedico() == null){ throw new Exception("Medico não foi selecionado !"); } if(consulta.getCodPaciente() == null){ throw new Exception("Paciente não foi selecionado !"); } if(consu...
40a2c7ca-8eff-4950-b457-ee435f9b07fe
7
private Solution recursiveDLS(Node node, int limit) { closed.add(node.getState()); boolean cutoffOccured = false; if (goalTest(node.getState())) return new Solution(node); if (node.getDepth() == limit) return new Cutoff(); for (Node child: node.expand()) if (!closed.contains(child.getState())) { Soluti...
5a058146-d668-4dfb-b555-4d7b48d75570
0
public InetAddress getInetAddress() { return addr; }
d9410ae4-05c6-4652-b40b-9b8c06e1a63e
8
@SuppressWarnings("unchecked") private void updateShadow(Point2D mousePosition) { if (mousePosition == null) { getCanvas().setShadow(null); return; } Board board = getBoard(); if (board.isGameOver()) { return; } List<Move> moves = new LinkedList<Move>(); // Are we trying to jump? int x = (...
50b63477-4590-43ac-93f4-499c741ff2d3
5
public static ArrayList<MeetingRoom> searchRoomByName(String name) { try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<MeetingR...
268c160c-ddee-4ad9-ae6a-8ecb92489903
5
public static void main(String[] args) throws InterruptedException { if (args.length != 4) { exitWithError(); } String dataStructure = args[0]; int nrThreads = Integer.parseInt(args[1]); if (nrThreads < 1) { exitWithError(); } int nrItems = Integer.parseInt(args[2]); if (nrItems < 1) { exitWi...
931e3edb-40a1-48bf-833f-825f7eb6b310
2
public void run() { try { while (true) { TimeUnit.MILLISECONDS.sleep(100); System.out.println(Thread.currentThread() + " " + this); } } catch (InterruptedException e) { System.out.println("sleep() interrupted"); } }
345350c5-fc98-44ee-be95-8a3febdc10b9
8
private boolean handleTraverseHandle(KeyEvent e) { EditPart focus = getCurrentViewer().getFocusEditPart(); if (focus.getSelected() == EditPart.SELECTED_NONE) return false; getCurrentViewer().reveal(focus); AccessibleHandleProvider provider; provider = (AccessibleHandleProvider) focus .getAdapter(Acces...
d504dd1f-6a45-4dbb-afd4-66a4e62b6875
5
private void buildMapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buildMapActionPerformed int x,y; try{ x = Integer.valueOf(this.xField.getText()); y = Integer.valueOf(this.yField.getText()); } catch (Exception e){ this.warningsLabel.setText("Must enter...
0bd7a956-635b-414d-863f-3c67e5f0720d
7
public static Cons cppGetConstructorDefinitions(Stella_Class renamed_Class) { { Cons constructordefs = Stella.NIL; { Slot slot = null; Iterator iter000 = renamed_Class.classSlots(); Cons collect000 = null; while (iter000.nextP()) { slot = ((Slot)(iter000.value)); ...
2156ad31-ad1d-49b9-a2da-918177bc2b4c
1
public void checkStock(){ if (this.stock<this.minS){ this.inOrderCost(hitungOrderCost(this.maxS-this.stock)); this.reCountCost(); this.stock=this.maxS; } }
8d8a3114-8b53-4fa1-bf61-2fbc084d143e
7
public <T> int updateDB(String query, ArrayList<T> sqlParam){ PreparedStatement ps = null; int rs = 0; try{ ps = conn.prepareStatement(query); int i = 1; for (T a : sqlParam){ //System.out.println(a.getClass()); if (a.getClass() == String.class){ ps.setString(i, (String)a); //System.ou...
c9cd8b64-7db3-451a-a099-2f38596daf06
2
private String readResource(String filename) { StringBuilder builder = new StringBuilder(); try { FileInputStream stream = new FileInputStream(new File(resPath + filename)); try { Reader reader = new BufferedReader(new InputStreamReader(stream)); char[] buffer = new char[8192]; int read; whi...
c2a4911c-6021-4255-ab08-b46e551cc5a1
2
public boolean isInReferrerString(String referrerString) { for (String alias : aliases) { if (referrerString.toLowerCase().indexOf(alias.toLowerCase()) != -1) return true; } return false; }
29d6bd8a-525a-45bc-9646-94b73f14aaa6
8
public boolean stem() { int v_1; int v_2; int v_3; int v_4; // (, line 133 // do, line 134 v_1 = cursor; lab0: do { // call prelude, line 134 if...
b7460e14-aaca-4b70-9c79-9605185f1151
7
void setPreferences(Preferences pref) { cacheCheckBox.setSelected(ConnectionManager.sharedInstance().isCachingAllowed()); dayField.setValue(HistoryManager.sharedInstance().getDays()); if (pref == null) return; connectTimeoutField.setValue(pref.getInt("Connect Timeout", 5)); readTimeoutField.setValue(pre...
d8958967-1989-469e-80f0-c1dcd2558b70
0
public Field getField() { return field; }
0f4be775-1442-4dbc-93a1-29d354e1fe36
3
private int getNameIDFromUser(String prompt){ while(true){ try { String Name = getUserInput(prompt); if (Name.equals("NONE")) return 0; return RunFileGame.getPlayerIDFromName(Name); } catch (WrongNameException e) { System.out.println("FUCK OFF THATS NOT A NAME"); } } }
6ccb41fe-0b57-43ef-a584-7ee15e702e99
1
public void send(Object data) { if(!connection.isConnected()) return; connection.sendTCP(data); }
809e52ae-76a3-4f8b-b707-d41ea9fb0c88
7
private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 3; i++) { try { JJCalls p = jj_2_rtns[i]; do { if (p.gen > jj_gen) { jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; switch (i) { case 0: jj_3_1(); break; case 1: jj_3_2()...
a4b55349-4321-44fe-a676-799269f79fa1
4
private void applyVocation(Background v, Actor actor) { ///I.say("Applying vocation: "+v) ; for (Skill s : v.baseSkills.keySet()) { final int level = v.baseSkills.get(s) ; actor.traits.raiseLevel(s, level + (Rand.num() * 5)) ; } for (Trait t : v.traitChances.keySet()) { float...
21f08f58-bd22-4ca7-9441-0c0e556dd41a
2
@Override protected void setPanelPerson(Contestant c, boolean newContestant) { super.setPanelPerson(c, newContestant); btnSetStatus.setEnabled(GameData.getCurrentGame().isSeasonStarted()); if (newContestant || c == null) { // we don't want any rows selected ListSelectionModel m = table.getSelectionMod...
6c59ec82-6570-400a-9501-c15069b3913f
8
public boolean containsValue( Object val ) { byte[] states = _states; V[] vals = _values; // special case null values so that we don't have to // perform null checks before every call to equals() if ( null == val ) { for ( int i = vals.length; i-- > 0; ) { ...
613d9719-d99f-4b0a-8dbc-2889379d0e14
7
@SuppressWarnings("unused") @Override /** When you click on a specific button it goes to a specific tutorial * @param arg0 the action event which triggers actionPerformed and contains the information */ public void actionPerformed(ActionEvent arg0) { String id = ""; if (arg0.getSource() == rules) { id...
2af65e98-ba94-466a-9b56-9609f7a1b2de
8
public void getWarden() { r = random.nextInt(y); warden = derp.get(r); locwar = new Location(warden.getPlayer().getWorld(), -140, 69, -110); cell1 = new Location(warden.getPlayer().getWorld(), -114, 68, -109); cell2 = new Location(warden.getPlayer().getWorld(), -116, 68, -109); Bukkit.broadcastMessage(Cha...
1b4522d2-d1f5-4fd4-9695-43eb311cee08
0
public String getEvento() { return tipoEvento.getText(); }
82c746b4-de5f-447e-912e-b4ee3410bbb7
3
private void modifySuperclass(CtClass orgclass) throws CannotCompileException, NotFoundException { CtClass superclazz; for (;; orgclass = superclazz) { superclazz = orgclass.getSuperclass(); if (superclazz == null) break; try { ...
716f60f7-d3c6-4c77-86c1-6640f1d18e82
6
private void validate() throws RrdException { if(!isValidConsolFun(consolFun)) { throw new RrdException("Invalid consolidation function specified: " + consolFun); } if(Double.isNaN(xff) || xff < 0.0 || xff >= 1.0) { throw new RrdException("Invalid xff, must be >= 0 and < 1: " + xff); } if(steps <= 0 || ...
a2e37e3e-b74d-4dec-acc5-e2432b538db0
6
public final double grad(int par1, double par2, double par4, double par6) { int var8 = par1 & 15; double var9 = var8 < 8 ? par2 : par4; double var11 = var8 < 4 ? par4 : (var8 != 12 && var8 != 14 ? par6 : par2); return ((var8 & 1) == 0 ? var9 : -var9) + ((var8 & 2) == 0 ? var11 : -var...
1bd288f8-bbf6-4351-9139-7e9fb6c1ab8c
3
public void deletarLista(List<T> ts) throws org.hibernate.exception.ConstraintViolationException, ValidacaoException { try { transacao = session.beginTransaction(); session.clear(); session.flush(); for (T t : ts) { session.delete(t); }...
445afad1-f32c-4603-9488-810ad5f16d79
7
public List<HipchatUser> getStandupUsers() { List<HipchatUser> remaining_users = new ArrayList<HipchatUser>(); List<String> user_names = current_room.getConnectedUsers(); List<HipchatUser> users = new ArrayList<HipchatUser>(); for ( String user_name : user_names ) { HipchatUser user = hippy_bot.findUser(u...
ad77d9af-d8ec-4b68-a5da-0e199ce1387c
3
public void visitInitStmt(final InitStmt stmt) { print("INIT"); final LocalExpr[] t = stmt.targets(); if (t != null) { for (int i = 0; i < t.length; i++) { if (t[i] != null) { print(" "); t[i].visit(this); } } } println(); }
adf8ebcb-a255-49b8-b1e3-aaaa5dd9e063
6
public void DeleteVulnerabilityFiles(DatabaseAccess JavaDBAccess, String TargetPHPFileSelectedComboBox) { int TARGET_PHP_FILES_ID = 0; PreparedStatement ps = null; Connection conn = null; try { if ((conn = JavaDBAccess.setConn()) != null) { System.out.printl...
9c61a48f-1053-4363-a393-0ebc76ac79b3
6
@Override public void actionPerformed(ActionEvent e) { //System.out.println("PasteAction"); OutlinerCellRendererImpl textArea = null; boolean isIconFocused = true; Component c = (Component) e.getSource(); if (c instanceof OutlineButton) { textArea = ((OutlineButton) c).renderer; } else if (c instanc...
ad6713d1-eb43-48bd-bae3-3728a46053b8
9
int insertKeyRehash(float val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look ...
313b5836-46e9-430f-b0f7-f1879cf11fb2
0
@Override public void actionPerformed(ActionEvent e) { importOutlinerDocument(getProtocol()); }
071163ac-67fc-49bf-a731-238b00273f40
5
public static ArrayList<ChatPlayer> getPlayersListeningToChannel(String channel) { ArrayList<ChatPlayer> plays = new ArrayList<ChatPlayer>(); for (ChatPlayer play : players) { boolean forced = Bukkit.getPlayer(play.name) != null && MCNSAChat3.permissions.has(Bukkit.getPlayer(play.name), "mcnsachat3.forcelisten."...
b25d878c-782d-46ff-9174-8c82e3332fd5
0
public synchronized void terminate() { enabled = false; active = false; }
6d430c03-500e-4f01-b411-c3870f6316e8
7
protected AttrTypes testsPerClassType(int classType, EstTypes estTypes) { // in none of the estimators yet is the estimation depending on the class type // since this could change the basic structure taken from checkclassifiers is kept here // test A: simple test - if can estimate AttrTypes at...
4cba13fe-33a6-4a9a-a6f5-cb7b3d5ac4c0
2
public static Vector3f parseDirection(String data) { String[] lines = data.split("\n"); for (String line : lines) { String[] parts = line.split(":", 2); if (parts[0].equals("d")) { return ParseVector3f(parts[1]); } } return null; }
01489a59-6bf5-40fb-aca1-c20badb86e73
5
@Override public void stopService() { try { deregisterFromServer(); } catch (ConnectionException ex) { LOG.warning("Server could not be reached for deregistration."); } disconnectFromServer(); try { if (serverSocket != null) { ...
1fa566ee-cf6c-4114-b751-3f3b6448dd3e
2
public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String name = req.getParameter("name"); User user; try { // First try to find if the user exists user = UserDAO.find(name); if (user != null) { HttpSession session = req.getSession(true); ...
08ac228f-5876-4668-8a2f-d3fa1cda99ef
0
public String [] getDestTermid() { return DestTermid; }
85f510db-b3bb-4f0d-9d26-a6bbebe03299
0
public ArrayList<ClientContact> getClientContacts() { return mClientContacts; }
bf36d0f0-ab13-4400-a46b-d7cab30129a7
0
@Test public void testGetDictionary() { assertTrue(_dictionary.getDictionary().size() > 0); }
cd15b079-2974-4459-99eb-b2851be339f0
2
public void deleteByPerformer(String sPerformer, Long epochTime) { EntityManager em = PersistenceManager.createEntityManager(); try { em.getTransaction().begin(); List<Openchatroomsmessage> ochrms = em.createNamedQuery("Openchatroomsmessage.GetByUserAndTime", Openchatroomsmessage.class) .setParameter...
faad5877-c5b6-4f1a-b510-b18b70ccce81
9
@Override public boolean writeOperation(SocketChannel s, ByteBuffer buffer) throws IOException { buffer.clear(); Main.state = ServerState.SYNCHRONIZING; if(ido != null){ buffer.put(HexConverter.toByte(Main.ID)); buffer.putInt(514); buffer.put(HexConverter....
b04c2a9a-12ee-4524-935c-070d8c1b1694
5
public static boolean inModalState() { for (Window window : Window.getWindows()) { if (window instanceof Dialog) { Dialog dialog = (Dialog) window; if (dialog.isShowing()) { ModalityType type = dialog.getModalityType(); if (type == ModalityType.APPLICATION_MODAL || type == ModalityType.TOOLKIT_MO...
d45c0949-89e9-42b1-be97-0ec87016886e
6
private void executeAction(String action){ switch(action.toLowerCase()){ case "turnleft": turnLeft(); break; case "turnright": turnRight(); break; case "moveforward": moveForward(); ...
020261d2-e069-40fe-b532-effc45122408
4
public void run() { threadStarted(); while (!isInterrupted()) { Runnable task = null; try { task = getTask(); } catch (InterruptedException ex) { } if (task == null) { brea...
455887ec-cefb-4708-97f4-8dcf7ba6fc8a
0
public void setAltitude(double altitude) { this.altitude = altitude; }
9a9c6aa2-e6fb-4644-84e7-dedd17089b16
1
public void setWindowTitle() { int s = this.playersTurn.time; String time = String.format("%02d:%02d:%02d", s/3600, (s%3600)/60, (s%60)); this.window.setTitle(this.isActive ? "Chess: " + this.playersTurn.getName() + "'s turn (" + time + ")" : "Game ended"); }
f61552af-09e0-43d5-b2e2-410f9be3570a
9
public static void main(String[] args) { if (args.length > 0) { if (args[0].equals("read")) { try{ map = MMStore.readMap(mapFile); //System.out.println("Read in map of size: " + map.totalSize()); System.out.println("Read in map of size: " + map.size()); Iterator iter = map.keySet().it...
5fc01cef-f2e4-49bd-b60a-35de3cf2cbce
7
@Override public String getDescription(Hero hero) { long duration = (Integer) SkillConfigManager.getSetting(hero.getHeroClass(), this, Setting.DURATION.node(), 60000); boolean cancels = (boolean) SkillConfigManager.getSetting(hero.getHeroClass(), this, "AttackCancels", true); String base = Stri...
c912c6f0-fdb6-43b3-9fe8-5736a6f1c729
1
@Override public void updateAudioObject(int objectId, double volume, double pitch, boolean shouldLoop) { if (objectId == 0) { return; } AudioObject object = objects.get(objectId); object.volume = volume; object.pitch = pitch; object.loop = shouldLoop; }
33a27f39-2cd0-49dc-9bd5-f0f8fd8f0004
2
public static ArrayList<String> load(String filename) { Scanner file_scanner = null; ArrayList<String> stringArray = new ArrayList<String>(); try { file_scanner = new Scanner(new File(filename)); //Connection to the file using the Scanner object } catch (FileNotFoundExc...
48f69674-2052-446f-93be-f8be84eba095
8
public static void main(String args[]) { FopsDB db = new FopsDB(); Gson gson = db.getGson(); GsonBuilder builder = new GsonBuilder(); List<Rule> rules = new ArrayList<Rule>(); List<Staff> faculty = new ArrayList<Staff>(); /* Construct Rules */ status("Constructin...
d0dacc62-3a85-40cb-b2af-6fb9c0ff4b53
6
public static void copyFolder(File src, File dest) { try { if(src.isDirectory()) { if(!dest.exists()) { dest.mkdir(); System.out.println("Directory copied from " + src + " to " + dest); } String files[] = src.list(); for(String file : files) { File srcFile = new Fi...
4695cd51-ae4b-4792-bd2f-1430ed59d3b2
7
private static void loadOptions() { File inputFile = new File("haven.conf"); if (!inputFile.exists()) { return; } try { options.load(new FileInputStream("haven.conf")); } catch (IOException e) { System.out.println(e); } String h...
9b358d6f-ed3c-4f1c-b137-ccb475d4f9e2
8
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof CategoryLineAnnotation)) { return false; } CategoryLineAnnotation that = (CategoryLineAnnotation) obj; if (!this.category1.equals(that.getCategory1())) { ...
ce41c231-afda-4335-b74e-56475b7a0f69
8
public static void main(String[] args) throws Exception { String env = null; if (args != null && args.length > 0) { env = args[0]; } if (! "dev".equals(env)) if (! "prod".equals(env)) { System.out.println("Usage: $0 (dev|prod)\n"); ...
d6a52dc3-447f-4374-8c48-09c9b41d9bef
3
public void setKey(String key) { byte[] keybyte = key.getBytes(); if (keybyte == null) { throw new RuntimeException("No key"); } else if (keybyte.length < 16) { throw new RuntimeException("Key too short"); } // Change bytes for ints IntBuffer intBuf = ByteBuffer.wrap(keybyte).order(ByteOrder.BIG_ENDI...
a786e197-badd-4d81-aa5e-872ce6993750
7
public PageInfo parse_stream_page(RandomAccessFile s, long offset) throws IOException { long[] result = new long[3]; // [header_size, payload_size] byte[] p_header = new byte[OGG_PAGE_SIZE]; // buffer for the page header byte[] scratch; int bread = 0; // number o...
fd7df8dc-cab0-449f-a1d8-175de83e7b54
0
private Command TestSteps2() { // TODO Auto-generated method stub getDriver().get("http://www.google.com/webhp?complete=1&hl=en"); return null; }
580330af-4dc2-43d5-b4a5-1e3911e2bcfd
3
private Boolean checkForCommas (File dataFile) { m_delimiter=""; try { m_fileScan = new Scanner(dataFile); } catch (FileNotFoundException e) { return false; } m_fileScan.useDelimiter(m_delimiter); while(m_fileScan.hasNext()){ ...
4cc92f8e-51df-4cc0-9f6a-dc3f964952ce
5
protected void processEndSimulation() { resList_.clear(); arList_.clear(); if (regionalList_ != null) { regionalList_.clear(); } if (globalResList_ != null) { globalResList_.clear(); } if (globalResARList_ != null) { glob...
83a42962-7784-48b6-99f7-93e545bfea11
5
public int largestRectangleArea(int[] height) { if (height.length == 0) return 0; int maxArea = height[0]; Stack<Integer> stack = new Stack<Integer>(); int[] h = Arrays.copyOf(height, height.length + 1); int i = 0; while (i < h.length) { if (stack.isEmpty() || h[i] >= h[stack.peek()]) { stack.pus...
e662b87f-1548-4e66-a4ca-64072dc1cf89
4
public double getDiffuseLayerCapPerSquareMetre(){ if(this.psi0set && this.sigmaSet){ return this.diffCap; } else{ if(this.sigmaSet){ this.getSurfacePotential(); return this.diffCap; } else{ if(this.ps...
b8eca465-8fa8-4493-8650-9a7430ed93d2
1
@Override public void setVisible(boolean visibility) { super.setVisible(visibility); button.setVisible(visibility); lineNumber.setVisible(visibility); if (pShowIndicators) { iComment.setVisible(visibility); iEditable.setVisible(visibility); iMoveable.setVisible(visibility); } else { iComment.setV...
8bf2cc4c-ca5f-4ba2-9bd1-51842c565c4c
1
public boolean doTransformations() { StructuredBlock last = flowBlock.lastModified; return CreateCheckNull.transformJikes(this, last) || CreateClassField.transform(this, last); }
1021c8ec-ef35-4c6f-98f5-408cb9a056a2
5
private static void parseFrameworkConfig(Element framework) { List<?> children = framework.getChildren(); Iterator<?> iterator = children.iterator(); while(iterator.hasNext()){ Element child = (Element)iterator.next(); String fieldName = child.getName(); // test whether this child has attributes ...
11211b46-ff3d-4370-8129-bfd6cdc7174d
8
int skipTo(int target) throws IOException { if (!haveSkipped) { // first time, load skip levels loadSkipLevels(); haveSkipped = true; } // walk up the levels until highest level is found that has a skip // for this target int level = 0; while (level < numberOfSkipLevels - 1 ...
03e95ad8-6dda-43c2-98d1-f15679b3ba80
1
private Set<String> extractFillColors(Document document) throws XPathExpressionException { Set<String> colors = new HashSet<String>(); Element root = document.getDocumentElement(); XPathExpression xPathExpression = xml.compileXPath("descendant::*[@fill]/@fill"); NodeList nodeList = (Nod...
67ffa029-060b-45d7-b72b-ed62b6dcff1a
0
public Grille setBooleans(boolean[][] grid) { this.grid = grid; return this; }
58c88093-ccd8-47c4-9646-337476d6da6d
1
protected void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed if(JOptionPane.showConfirmDialog(rootPane, "Você tem certeza que deseja cancelar?")== 0){ this.dispose(); } }//GEN-LAST:event_btnCancelarActionPerformed
75e87b64-ded2-4ec8-b936-4a451bc91408
8
public static Skolem insertElementComputation(Skolem list, IntegerWrapper narg, Stella_Object element) { if (!(Logic.enumeratedListP(list))) { return (null); } { int n = narg.wrapperValue; Vector elements = list.definingProposition.arguments; int nelements = elements.length() - 1; Li...
9129902d-4bb3-40bd-a3f5-b4b85aac2841
8
public Object nextValue() throws JSONException { char c = nextClean(); String s; switch (c) { case '"': case '\'': return nextString(c); case '{': back(); return new JSONObject(this); case '[': ...
4c33bb5f-c7e7-4051-bada-826dce996a35
3
public void run() { while(running) { while(Log.hasNewEntry()) { textArea.append(Log.getNextEntry() + "\n"); } try { sleep(10); } catch (InterruptedException e) { yield(); } } }
b15dba03-d32f-4493-aa7c-86baf668c6e2
7
public void onDraw(Graphics g, int viewX, int viewY) { if ((status&World.ST_INVISIBLE)!=0) { return; } int offs = x % 8; if (!done) { //x+=move; g.drawArc(((x-2)-viewX)*3, ((y-10)-viewY)*3, 4, 4, 0, 360); g.drawLine(((x...
a64dac5a-f5d0-4dbb-9ced-07a28e27aa94
7
public static void send(Socket socket, Vector<String> vector){ System.out.println("Sending " + vector.size() + " files"); try { PrintWriter server = new PrintWriter(socket.getOutputStream()); // Tell them how many files server.println(vector.size()); for(S...