method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f1b98b17-b375-4dd9-8d06-2680a42b7dc8
8
@Override public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) { final java.util.Map<String,String> parms=parseParms(parm); final String last=httpReq.getUrlParameter("AUTOTITLE"); if(parms.containsKey("RESET")) { if(last!=null) httpReq.removeUrlParameter("AUTOTITLE"); retu...
3c8e44c7-8eb1-412f-8c0d-25f6433731c4
7
public static void main(String[] args) { //sets look and feel, creates the questionTree, and then moves on to the first GUI try { //get Windows look and feel if possible for(javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager .getInstalledLookAndFeels()) { if("Windows".equals(info.getName...
a851e28a-4dd2-4224-b36b-96bf0886d676
9
private static TypeDesc parseTypeDesc(String src, int[] pos) { // Skip leading whitespace. skipWhitespace(src, pos); int i = pos[0]; int length = src.length(); if (i >= length) { return null; } int startPos = i; char c = src.charAt(i); ...
47ce7fd8-efe9-4320-bc5c-ba0f6f4cb3c6
4
protected boolean learnFromEpoch() { sampleIndex = 0; epoch++; if (sse < 0.001d || isHalted()) { return haltCalibration(); } myNetwork.learnFromErrors(); if (!isRunning()) { if (interruptCalibration()) { return true; } ...
03430291-c678-4bdb-b74f-10a04954e01e
7
private boolean isVarLocal(FunctionTrace ft, String varName) { if (ft == null || varName == null || varName == "") { System.out .println("Error: Empty variable or trace passed to isVarLocal"); System.exit(-1); } // Find varName in ft's variable list List<VariableDesc> vDesc_list = ft.f_decl.var_desc...
c4b59f9b-b360-4b9e-9064-7ff4e720ea3c
3
public int sqrt2(int x) { // binary search solution long i = 0; long j = x/2+1; while(i <= j){ long mid = (i+j)/2; System.out.println(i+ " " + j + " " + mid + " " + mid*mid); long s = mid*mid; if(s == x) return (int)mid; if(s < x) i = mid+1; else j = mid - 1; ...
f0dbcebb-e796-4363-9adf-af90fb14554a
0
@Test public void test_get_long() { Assert.assertEquals(8989l, getLong("b_local_port")); }
4b50bd88-4cda-4473-8c37-0f2bd63f0130
4
@Override public Object getValueAt(int row, int col) { switch (col) { case 0: return data.elementAt(row)[0]; case 1: return data.elementAt(row)[1]; case 2: return data.elementAt(row)[2]; case 3: return data.elementAt(row)[3]; } throw new IllegalArgumentException( "Cannot retrieve from sel...
f4b878ce-81c5-4fb6-b17d-f44301445826
7
public static Action getAction(final short actionID, final MDModel model) { if (actionID == COUN_ID || actionID == MEAS_ID || actionID == TRAJ_ID || actionID == RAVE_ID || actionID == WHAT_ID || actionID == MARK_ID || actionID == SELE_ID) { Action a = new AbstractAction() { public void actionPerformed(Acti...
1d3970a6-fb27-4c07-8ef2-1837654f177c
8
@Override public void i3locate(MOB mob, String mobName) { if(mob==null) return; if((!i3online())&&(!imc2online())) return; if((mobName==null)||(mobName.length()==0)) { mob.tell(L("You must specify a name.")); return; } if(i3online()) { final LocateQueryPacket ck=new LocateQueryPacket();...
80bd1338-26ec-40d2-b7ad-173fbc6e46af
5
protected void authenticateUser() throws LoginException { if (!(_currentRealm instanceof MultipleLoginRealm)) { String msg = sm.getString("jdbclm.badrealm"); throw new LoginException(msg); } final MultipleLoginRealm jdbcRealm = (MultipleLoginRealm)_currentRealm; ...
75444fdf-6b8c-4976-adc2-cf38529c166c
5
private static int dfaMenu(DFA dfa){ String menu = dfa.toString()+"\n\n"+ "1. Enter Words\n"+ "2. Print out Alphabet\n"+ "3. Print GRAIL transition table\n"+ "4. Back\n"+alwaysMenu(); Scanner dfaScan = new Scanner(System.in); int input; String answer; do{ System.out.println(menu); input ...
7294fb8b-c0ca-438b-9641-b639b07f380d
1
public void updateProduct(Product product) { try { beginTransaction(); session.update(product); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); } finally { closeSesion(); } }
35304026-d2dd-4eea-b67c-22095b047f4b
7
public PNGDecoder(InputStream input) throws IOException { this.input = input; this.crc = new CRC32(); this.buffer = new byte[4096]; readFully(buffer, 0, SIGNATURE.length); if(!checkSignature(buffer)) { throw new IOException("Not a valid PNG file"); } ...
40251151-7430-4c9c-931f-4c5e306519ae
4
@Override public void execute() { if (type == null) { view = new GreenClockView(clock, timezone); view.show(x, y); clock.add(view); } else { switch (type) { case GREENCLOCK: view = new GreenClockView(clock, timezone); view.show(x, y); clock.add(view); break; case REDCLOCK: vie...
e052248b-e839-42e7-8af7-fc14444a082c
7
public BreakH(GenericTreeNode<LayoutParserTreeElement> element, Direction dir, int x, int y, int height, int width) { GenericTreeNode<LayoutParserTreeElement> parent = element.getParent(); // Setup the new element. LayoutParserTreeElement newElementData = new LayoutParserTreeElement(); int newLeft = elemen...
abbe552a-7328-428c-9e28-d07c31bf0fc0
7
private JTextField createConstraintField(String text) { if (text == null) return null; final JTextField tf = new JTextField(text, 50); tf.setFont(new Font("monospaced", Font.PLAIN, 12)); tf.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyE...
5f69b29d-a079-40cf-adcd-ee2261a1a198
1
private void setBalance(BigInteger balance) throws IllegalArgumentException { if (! this.canHaveAsBalance(balance)) throw new IllegalArgumentException(); this.balance = balance; }
011ec655-9bab-44ed-8e09-2dad5058e559
8
public String getColumnName(int colIndex) { String name; int index = colIndex + firstDayOfWeek; if (index > Calendar.SATURDAY) { index = Calendar.SUNDAY; } switch (index) { case Calendar.SUNDAY: name = NAMES_...
fa472af4-6ae2-4ce3-baf6-b078520f55eb
6
public String getColumnData(int i) throws Exception { if (i == 0) return getUserName(); else if (i == 1) return getPassword(); else if (i == 2) return getFirstName(); else if (i == 3) return getLastName(); else if (i == 4) return getEmail(); else if (i == 5) return...
7aa79e90-f33d-4cf9-845c-e729550a437e
5
protected boolean useLabelBounds(mxCellState state) { mxIGraphModel model = state.getView().getGraph().getModel(); mxGeometry geometry = model.getGeometry(state.getCell()); return ((geometry != null && geometry.getOffset() != null && !geometry.isRelative() && (geometry.getOffset().getX() != 0 || geometry ...
5639818e-4815-47aa-8d49-9b22d90bb0e7
5
private void collectGridlet() { System.out.println(super.get_name() + ": Collecting Gridlets ..."); list_ = new ArrayList(gridletID_ + 1); Object data = null; Gridlet gl = null; int counter = 1; // starts at 1, since gridletID_ starts at 1 too Sim_event ev = new ...
679c5e05-e000-4709-af4b-74617765aebb
9
@Override public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException{ res.setContentType("text/html"); Connection con = null; String lausend = null; ResultSet rs = null; PreparedStatement ps = null; Gson gson=new Gson(); ArrayList<CreateByParty> byParty=new Arr...
e412c7fe-2c13-45e9-abf1-7acf388f2691
1
protected final void addJobListener( Class<? extends JobListener> jobListenerType ) { doBind( jobListeners, jobListenerType ); }
2064269f-7370-44db-81ae-f485d91e37ff
9
public HashMap<Integer, ArrayList<Mission>> listeMissionsAttaquesUrgentes() { HashMap<Integer, ArrayList<Mission>> missionsAttaquesUrgentes = new HashMap<Integer, ArrayList<Mission>>(); for (int i = 0; i < colonnes; i++) { for (int j = 0; j < lignes; j++) { if (monstre == Mon...
cd6791be-664c-459f-9608-5b52e8c28d76
3
public static String readTextFile(File f) throws IOException { if (f != null && f.exists()) { String str; Scanner reader = new Scanner(f); reader.useDelimiter("\\Z"); try { str = reader.next(); } catch (NoSuchElementException nsee) { reader.close(); return null; } reader.clos...
7780f8e0-899f-428d-b36c-e2bae71067a5
4
private static void testRename(FileSystem fileSystem, String src, String dest) throws TestFailedException { try { fileSystem.rename(src, dest); if (!fileSystem.pathExists(dest)) throw new TestFailedException("Seems that renaming from " + src + " to " + dest + " did not work"); } catch (PathNotFoundExcept...
6bb0f6ee-8772-4edf-9726-6d0a3c2734d4
2
private boolean jj_3R_62() { Token xsp; xsp = jj_scanpos; if (jj_3_77()) { jj_scanpos = xsp; if (jj_3_78()) return true; } return false; }
560cf1ae-8ca9-4f1b-b5c8-983595acf177
0
public int choiceOptions() { System.out.println("Enter a choice:"); System.out.println("1 - Go (Move Karel one space forward in his " + "current direction)"); System.out.println("2 - Turn Karel Left"); System.out.println("3 - Turn Karel Right")...
0930905a-6aae-406a-9dfc-2ebe2ebcfb79
6
private boolean _jspx_meth_c_forEach_0(PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // c:forEach org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_forEach_0 = (org.apache.taglibs.stand...
5859729a-92d7-462a-a470-ad5fdff9313d
4
public void changeCharacter() { Cell[][] cells = map.getCells(); int x = 0; int y = 0; for (x = 0; x < cells.length; x++) { for (y = 0; y < cells[x].length; y++) { if (map.getCell(x, y).getUnit() instanceof Tank) { ((Tank) map.getCell(x, y).getUnit()).nextImage(); } else if (map.getCell(x, y).g...
23c47eb4-6fc0-4e52-a363-b9aa34b02e32
0
private void jTextPane2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextPane2MouseClicked // TODO add your handling code here: }//GEN-LAST:event_jTextPane2MouseClicked
7fc7a28e-227e-49a8-ab0a-4c7a92ba3c25
0
public void deleteCustomer(Long id) { this.em.remove(this.getCustomer(id)); }
7775e315-0dbd-4eb3-99f1-1d2b24fca921
4
public ArrayList<Node> findVoisin(Node current){ ArrayList<Node> voisins = new ArrayList<Node>(); int x_cur = current.getXpos(); int y_cur = current.getYpos(); if(view_grid.valideCoord(x_cur+1,y_cur)) voisins.add(view_grid.grids[x_cur+1][y_cur]) ; // North if(view_gr...
5a763d50-a3ea-40f1-b00b-befd19524807
4
public void selectCellForEvent(Object cell, MouseEvent e) { boolean isSelected = graph.isCellSelected(cell); if (isToggleEvent(e)) { if (isSelected) { graph.removeSelectionCell(cell); } else { graph.addSelectionCell(cell); } } else if (!isSelected || graph.getSelectionCount() != 1)...
7f44e2f8-d0f6-4cd4-87b3-e8cfa6c7539a
6
public Settings() { setTitle("MobileScriptBuilder - Settings"); setBounds(100, 100, 540, 128); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(null); { JLabel lblNgecoreL...
fa8b43ac-b8ab-416d-a205-75efbe39183c
1
public void updateMinLocalInf(int x) throws InterruptedException { s3.acquire(); if (minLocalInf > x) minLocalInf = x; s3.release(); }
8e506717-6cbe-4b89-bb5b-ec2c0fdc3785
5
public static void loadSigns(){ File fichier_signs = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Signs.yml"); YamlConfiguration signsFile = YamlConfiguration.loadConfiguration(fichier_signs); if(ArenaManager.getArenaManager().getArenas() != null){ for(Arena arena : ArenaManager.getA...
5770eebe-cf64-4983-afea-4d177277510c
7
@Override protected Integer doInBackground() throws Exception { //To change body of generated methods, choose Tools | Templates. if (operation.equals("fc") || operation.equals("it")) { String innerGrade = grade; int rowCount= ((DefaultTableModel)table.getModel()...
c6e4fcfb-6053-4c93-9fc4-33e38089f51f
2
private void renderBlocks(Graphics g){ for (Block b : blocks){ if (b.isVisible()){ g.drawImage(Resources.block, (int)b.getX(), (int)b.getY(), BLOCK_WIDTH, BLOCK_HEIGHT, null); } } }
f8308b94-7050-46cc-9fbd-368a594e94dd
7
@Override public String makeMobName(char gender, int age) { switch(age) { case Race.AGE_INFANT: case Race.AGE_TODDLER: return "puppy"; case Race.AGE_CHILD: { switch(gender) { case 'M': case 'm': return "boy puppy"; case 'F': case 'f': return "girl puppy"; defa...
0aa0d289-3ca0-4ec1-818f-6b14117b08b5
2
private boolean allSitesHasVarFail(int index) { for(int i: sitesHasVar(index).keySet()) { Site site = sitesHasVar(index).get(i); if(!site.isFailed()) { return false; } } return true; }
6235c7df-fe0b-4659-90ac-3ed561e635ee
9
public void drawStaticHud(GL2 gl) { this.gl = gl; if (! player.isAlive()) return; update(); start2D(); //drawEnergy(gl); // Set the crosshair color to green gl.glColor4f(0.0f, 1.0f, 0.0f, 0.0f); if(crosshair != null) { crosshai...
2179a6a5-f9ac-46ff-8774-7a5c1128c2c6
3
private ArrayList<Team> getGroup(int groupId, ArrayList<Team> teams) { ArrayList<Team> group = new ArrayList(); for (Team t : teams) { if (t.getGroupId() == groupId) { group.add(t); } } return group.isEmpty() ? null : group...
41dc4e89-6460-4e16-8849-f5d6686c3f51
9
public void method216(int i, int j, int k, int l, int i1, boolean flag) { int j1 = 256; if(flag) j1 += 0x20000; k -= anInt290; l -= anInt291; if(i == 1 || i == 3) { int k1 = j; j = i1; i1 = k1; } for(int l1 = k; l1 < k + j; l1++) if(l1 >= 0 && l1 < anInt292) { for(int i2 = l; i2 <...
9bb763d6-678a-4aba-9b4c-fd1fcc869c7d
0
@Override public String[] getHelp() { return new String[]{ "ttp group [group] [actions..]", "Group interface" }; }
8298952c-5b6a-4c84-a160-b7f4039979c9
6
public void compareNetworks(String netA, String netB){ General u = new General(); Node[] nA = u.readNetworkFromAdjacencyList(netA); Node[] nB = u.readNetworkFromAdjacencyList(netB); Set<Integer> nodesA = new HashSet<>(); Set<Integer> nodesB = new HashSet<>(); ...
a2f4631b-d7ef-40d1-b5bd-e018ed3d5b0e
4
protected String FormeChange(String name){ Reader reader = new Reader(); String img_path = null; // 返り値 Integer pkmn_num = null; // 番号 String import_path = null; Boolean find = false; try{ // ポケモン名を取得(FC対応) String ary_pkmn[] = reader.txtReader(Const.POKEMONNAME_FORME); // 引数に対応した番号...
cd0f92fb-47a2-4ef4-b7a1-45520201f7a0
4
public void fetch() { // add all start skeletons for (StorySkeleton sequel : start.getSequels()) { unvisited.add(sequel); } while (!unvisited.isEmpty()) { Story curr; try { curr = unvisited.poll().fetch(); } catch (IOExcepti...
017473ee-2452-41ac-aa4d-2c3370b5f541
8
public Register getRegister(int index, String[] instArray) { switch (instArray[index]) { case "R0": return registerFile.R0; case "R1": return registerFile.R1; case "R2": return registerFile.R2; case "R3": return registerFile.R3; case "R4": return registerFile.R4; case "R5": return regist...
fb8b12c4-cdc3-44aa-b6ff-ae33e113d4d1
3
public void setRight(PExp node) { if(this._right_ != null) { this._right_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); ...
11733f9d-5573-4c08-9851-da5f22493379
4
public void act() { if (isTouching(Bullet.class)){ world.kills.incrementInteger(); world.removeObject(this); Greenfoot.playSound("explosion.wav"); return; } if (moveLeft == true) move(2); else move(-2); if (ge...
a2f0d4a6-f93a-447d-a41a-65490d94ff68
2
public Integer getStatusObjectID (String name) { Integer data = null; for (int i = 0; i < this.arr_data.size(); i++) { if (name.equals(this.arr_data.get(i).getDescr())) data = this.arr_data.get(i).getID(); } return data; }
0a58984e-d0be-4fee-a9db-fad52c597dd4
6
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] in = br.readLine().split(" "); int row = Integer.parseInt(in[0]); int col = Integer.parseInt(in[1]); int[][] inArr = new int[row][col]; for (int i = 0; i < row; i++)...
d694d481-d018-4fc7-aba8-98e2a3350e7f
5
public NessusClientData downloadReport(String uuid, String path) throws ParserConfigurationException, SAXException { String c = "/file/report/download"; if(this.url.endsWith("/")) c = c.substring(1); NessusClientData scan = null; /* * Get a client, setup the POST, and execute. */ HttpPost post...
365d2b3e-6deb-42d5-9b09-988a6ba2d422
1
public static void main(String[] args) { Scanner input = new Scanner(System.in); double[] min = new double[3]; for(int i=0; i<3; i++) { min[i] = input.nextDouble(); } Arrays.sort(min); System.out.println(min[0]); }
900f2133-7c05-4ad2-8f4a-913e1e6402b7
8
public void setBounds(int row) { for (int select = 0; select < 30; select++) { if (items[row][select] != null) { if (items[row][select] instanceof Tool) { ((Tool) items[row][select]).setToBigInv(true); } switch (select) { case 0: items[row][select].setBounds(x + 50, y + 78); b...
2d826966-e285-4e9f-9d20-26a0e85172f4
7
protected int nextDir(final Room R) { if(lastDir < 0) lastDir=Directions.NORTH; int dir=lastDir; if(dir >= Directions.CODES().length) dir=0; else dir++; while(((R.getRoomInDir(dir)==null) ||(R.getExitInDir(dir)==null) ||(!R.getExitInDir(dir).isOpen())) &&(dir != lastDir)) { if(dir >=...
c4dfb665-e637-4557-a921-4390018c23e0
1
@Override public void documentRemoved(DocumentRepositoryEvent e) { if (isVisible()) { getModel().removeAllResultsForDocument(e.getDocument()); } }
c6a2909c-f19b-4e4b-9792-541d5977413b
4
private static byte[] crypto(byte[] message, String keyString, int cipherMode, IvParameterSpec ivps) throws GeneralSecurityException { String pair[] = keyString.split("\\s+"); if (pair.length != 2 || !pair[1].matches("^[A-Za-z0-9+/=]+$")) { throw new InvalidKeyException("keyStrin...
45034c75-bebf-4346-ad5a-464073299508
7
private Map getUsers() throws NamingException { String filter = "(" + roleNameRDN + "=*)"; HashMap users = new HashMap(); NamingEnumeration results = this.search(roleBase, filter, new String[]{roleMemberRDN}); while (results != null && results.hasMore()) { SearchResult ro...
85b2ce91-3607-4d16-bb25-25dc83237062
4
public boolean entityJoinedWorld(Entity var1) { int var2 = MathHelper.floor_double(var1.posX / 16.0D); int var3 = MathHelper.floor_double(var1.posZ / 16.0D); boolean var4 = false; if (var1 instanceof EntityPlayer) { var4 = true; } if (!var4 && !this.chunkExis...
44d6e966-2abb-4760-a443-d8eda48895f1
6
public Dataset(String path) { List<String> lines = new ArrayList<>(); try(BufferedReader br = new BufferedReader(new InputStreamReader( new BufferedInputStream(new FileInputStream(new File(path)))))) { while(true) { String line = br.readLine(); if(line == null) { break; } ...
fc677376-4c24-465b-948b-bb56274b5d1d
0
public void push(int x){ ListNode node = new ListNode(x); node.next = top; top = node; }
1e17ef54-1124-4735-bb88-fa849fe215f2
6
public static Set<String> getStopWords(){ HashSet<String> stopWords = new HashSet<String>(); List<String> stopLists = new ArrayList<String>(); File[] files = new File("stopwords").listFiles(); for (File file : files) { if (file.isFile()) { String fileName = file.getName(); String fileEnd = ...
951317f9-8d70-4d30-a149-86a59409e85c
5
public static ArrayList<Member> getAll(){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<Member> memberList = new ArrayList<Member>...
4d9c8760-4074-4f50-ada6-47976deadcc6
7
public static void printExplanationHeader(Justification self, OutputStream stream, KeyValueList mapping) { { ExplanationInfo info = Justification.explanationInfo(self, mapping); String label = info.label; int indent = label.length() + 1; if ((((Keyword)(Logic.$EXPLANATION_FORMAT$.get())) == Logic...
e18dd796-fef7-4294-b879-47b32ecbf149
3
public static void main(String[] args) { try { InputFile in = new InputFile("Cleanup.java"); try { String s; int i = 1; while ((s = in.getLine()) != null) ; // Perform line-by-line processing here... } catch (Exception e) { System.out.println("Caught Exception in main"); e.printStack...
56794bdb-f4c8-4cf6-86ea-6cf4d68f5bec
1
public Builder id(int receivedId) { if (receivedId < 0) { throw new IllegalArgumentException("Id must be integer value more than 0. Received value =" + receivedId); } this.id = receivedId; return this; }
afa4ed2f-bf84-43b7-9664-a19b0b41755e
5
@Override public void keyReleased(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: break; case KeyEvent.VK_DOWN: playerSpriteType = Constants.SPRITE_NORMAL; player.setDucked(false); player.stop(); break; case KeyEvent.VK_LEFT: player.stopLeft(true); player.stop(); break; c...
6c09e2cd-b6bc-4512-91c8-f9350d692aab
0
public int getColumnCount() { return 3; }
8fafde66-84ec-4853-964a-9cf2bac94070
9
public String getPrintString(){ String s=""; s+="ID: "+id+"\n"; s+="Name: "+name+"\n"; s+="Severity: "+severity+"\n"; s+="Likelihood: "+likelihood+"\n"; s+="Weaknesses: \n"; for(String temp: weaknesses){ s+= temp+"\n"; } s+="Prerequisites: \n"; for(String temp: prerequisites){ s+= temp+"\n"...
59138ba7-c95e-4849-88bb-e3a3c789f776
6
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { try { commands.execute(cmd.getName(), args, sender, sender); } catch (CommandPermissionsException e) { sender.sendMessage(ChatColor.RED + "You don't have permission."); } catch (MissingNestedCommandExcep...
5d6b9c4d-7ec1-46eb-9348-a526278d0de2
4
public void loadMatchRecord(String id) { if (!StringUtil.isBlank(id)) { PreparedStatement st = null; ResultSet rs = null; try { conn = dbconn.getConnection(); st = conn.prepareStatement("SELECT * FROM match_record_2013 WHERE id = " + id + " lim...
f842bab3-dd7c-4dc4-81c0-bbaf83f7da9f
0
public void setProcessMode(int processMode) {this.processMode = processMode;}
96620f0b-2575-4cc3-a3b3-ad54d4af977e
6
public void calculatePitch() { if( channel != null && channel.attachedSource == this && channelJavaSound != null ) { // If not using Doppler effect, save some calculations: if( SoundSystemConfig.getDopplerFactor() == 0 ) { channelJavaSo...
1249337a-3279-4769-bdfc-3ef5c5784547
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Product other = (Product) obj; if (pCode == null) { if (other.pCode != null) return false; } else if (!pCode.equals(other.pCode)) ret...
6c0b4d78-af2f-4c75-b2b4-96ae0b976b3d
8
public void decode(Buffer stream, Envelope envelope) { int count = stream.getUnsignedByte(); pairCount[0] = count >> 4; pairCount[1] = count & 0xf; if (count != 0) { unity[0] = stream.getUnsignedLEShort(); unity[1] = stream.getUnsignedLEShort(); int migrated = stream.getUnsignedByte(); for (int dire...
586e8900-04c1-45f2-ad45-7fd152d172d3
0
public static void main(String[] args) { Mine2 frame = new Mine2(); frame.setVisible(true); }
71754e2b-edd4-48f5-bddf-4d9b5c80784b
7
private int height(final int index) { // Left and right children indices int leftChildIndex = getLeftChildIndex(index); int rightChildIndex = getRightChildIndex(index); boolean childIsNull_l = (array.getElement(leftChildIndex) == null); boolean childIsNull_r = (array.getElement...
64d9f6d9-d07c-4504-a311-9cea994b8e1a
2
public static Extractor create(String url){ for (Extractor extractor : EXTRACTORS) { if(extractor.accept(url)){ return extractor; } } return null; }
52a24865-bfa6-4242-a4e2-c41ea6140711
4
public static ClassType resolveClass(String name, List<String> imports) { try { Class.forName(name); return new ClassType(name); } catch (Exception e) { if (imports != null) { for (String prefix : imports) { try { Class.forName(prefix + "." + name); return new ClassType(prefix + "." + ...
a9c59b67-1476-472c-b18e-61b38e7e6caa
9
private double noise3D(double xin, double yin, double zin) { double n0, n1, n2, n3; // Noise contributions from the four corners // Skew the input space to determine which simplex cell we're in double s = (xin+yin+zin)*F3; // Very nice and simple skew factor for 3D int i = fastfloor(xin+s); int j = ...
a5c53349-8e5c-47c7-b1bb-60af0b52147a
2
private BufferedReader fluxEntrant() { if (emetteur != null) { try { return new BufferedReader(new InputStreamReader( emetteur.getInputStream())); } catch (IOException e) { System.out .println("Problème de récupération du flux entrant sur le client."); } } return null; }
e3af2170-743f-4218-8a5b-a96d57f9a9a7
5
private void attachMBlocks() { for (MBlock b : mBlocks) { Point adj = b.getDirectionAdjPoint(); if (gBlock.getAttachedPoints().contains(adj) || gBlock.location().equals(adj)) { if (b.isRemover()) gBlock.removePoints(b.getAdjSidesPoints()); else gBlock.attachBlock(b.location()); ...
b96ab407-b64a-44c9-ab3b-4a92cd9bd76c
2
public ThreadClient threadDisponible(){ for(ThreadClient t : poolThread) { System.out.println("TEST"); System.out.println(t.getEmetteur()); if(t.getEmetteur() == null) { return t; } } return null; }
f960db66-f13a-4e89-accd-4527c907c41a
7
private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated if (!ALREADY_ACTIVATED) { if (debug) logger.log(level.DEBUG, "First-time activation: Starting logcat and DMESG."); if (selectedDevice != null) { getLogc...
a3faf284-91f2-4402-8c17-0ed8f8421b58
7
public void actionPerformed(ActionEvent e) { if ("paused".equals(e.getActionCommand()) && !cutscene) { if (paused) { paused = false; pauseButton.setText("Pause"); } else { paused = true; pauseButton.setText("Why Pause?"); ...
f5c83d9f-1153-440b-a5f4-303f297742d3
8
void toggleSelectionSet(BitSet bs) { /* * toggle each one independently for (int i = viewer.getAtomCount(); --i >= 0; ) if (bs.get(i)) * toggleSelection(i); */ int atomCount = viewer.getAtomCount(); int i = atomCount; while (--i >= 0) if (bs.get(i) && !bsSelection.get(i)) break; if (i < 0) { /...
9e2a68e6-7918-4060-8146-a928198218b5
0
private void updateExpression() { expression.change(ref); }
4725c62d-c12f-4fd2-b036-a874318906b9
9
private static String allowedName(String value) { StringBuffer buffer = new StringBuffer(value); for (int index = 0; index < buffer.length(); index++) { char c = buffer.charAt(index); if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= '...
8dfa91c0-1362-4ee2-8502-1fcb818c1eb5
0
private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed this.buscar(); }//GEN-LAST:event_btnBuscarActionPerformed
0c66b7ab-9ef5-4215-aa88-1ba540de6f0b
8
private final boolean handleControl(int keycode, int[] cursor, boolean alt) { switch (keycode) { case KeyEvent.VK_A: cursor[1] = 0; cursor[2] = length(); return true; case KeyEvent.VK_C: if (this.head > this.tail) { growAndCopy(); } StringBuilder.clip.setContents(new StringSelection(new Stri...
d39231e6-2b9a-4543-820a-2c40750091dd
2
@Override public int[][] applyObstacle(int [][] environment){ for (int i = 0; i < this.w; i++){ for (int j = 0; j < this.h; j++){ environment[x + i][y + j] = Environment.WALL; } } return environment; }
6394e2f3-dbf3-41f2-8ce7-61c83a73e010
8
@Override public void formatTo(Formatter formatter, int flags, int width, int precision) { final boolean leftJustify = (flags & LEFT_JUSTIFY) == LEFT_JUSTIFY; StringBuilder buffer = new StringBuilder(width); int count = 0; for (int i = 0; i < length; i++) { ...
91898eab-828f-49b8-be1c-a57e57db4c1a
3
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int n = Integer.parseInt(line.trim()); int ones = ...
9ef91f20-9c17-420e-8714-1802669b47f9
9
public Collection<Region> loadRegions(final String world) { final BufferedYamlConfiguration worldConfig = this.loadConfig(this.worlds, world); final Set<Region> regions = new HashSet<Region>(); final Set<String> names = worldConfig.getKeys(false); for (final String name : names) { ...
04baef9b-9be4-434e-b0b0-b0477966f6e8
7
public void setLineStyle(final LineStyle style) { if (style.getWidth() != null) { float width_prev = this.lineWidth; this.setLineWidth(style.getWidth().floatValue()); this.lineWidth = width_prev; } if (style.getCap() != null) { this._out(style.getCap().toString() + " J"); //$NON-NLS-1$ } if (style...
4e8a1475-19b9-47e5-9571-fa4d1f81a274
8
@Override public void init() { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.o...
ceb3472f-0fe7-48b3-9b03-90449c4b8c49
2
public void copy(int[] src, int[] dst){ for(int i = 0; i < dst.length; i++){ if(i > src.length-1){ dst[i] = 0; } else { dst[i] = src[i]; } } }