method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4805434a-acdb-4b53-9ce2-a59a10325c23
0
@Override protected void fireEditingStopped() { super.fireEditingStopped(); }
4e2c6b2e-5bfb-4ac6-9891-a233b0afe2d0
0
public int getMinRANGE() { return inventory.getItem(0).getMinRANGE(); }
8ce94ca4-4543-4fc1-b127-324619e92af7
1
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerJoin(PlayerJoinEvent e) { if (e.getPlayer().hasPermission("playtime.updatenotice")) { e.getPlayer().sendMessage(this.message); } }
5c47ab1d-9483-48d9-ae75-71462f98dfad
1
public List<String[]> getAttributes() { List <String[]> l = new ArrayList<String[]>(); String[] s = new String[2]; s = new String[2]; s[0] = "CAT2OSMSHAPEID"; s[1] = getShapeId(); l.add(s); if (ttggss != null){ l.addAll(ttggssParser(ttggss)); } return l; }
6cf650d8-ce4c-445c-a0f7-df9a19f3e16b
6
private boolean promptForNew(boolean brandNew) { // SO NOW ASK THE USER FOR A LEVEL NAME String levelName = JOptionPane.showInputDialog( view, LEVEL_NAME_REQUEST_TEXT, LEVEL_NAME_REQUEST_TITLE_TEXT, JOptionPane.QUESTION_MESSAGE); ...
1200226d-5ca3-4a62-ba5c-7f4c69ec956a
0
public AttributesButtonCellEditor(AbstractAttributesPanel panel) { super(new JCheckBox()); this.panel = panel; }
cd7b7d98-3fc9-4641-a1a6-c0a14a212788
8
public void selectChoice() { boolean cease; String _open = "Open new account"; String _log = "Log into existing account"; String _help = "Help"; String _quit = "Quit"; do { cease = false; do { try { prompt...
2053ae45-16c3-4b01-9c57-bed29fd8d916
9
public static String normalize(final String s) { if (s == null) { return ""; } final StringBuffer str = new StringBuffer(); final int len = s.length(); for (int i = 0; i < len; i++) { final char ch = s.charAt(i); switch (ch) { ...
e78882df-9ab3-4a95-a2d3-30f7b4ab109a
4
public void cliqueFinTour() { /* en mode conquete, confirmé, et possède au moins un territoire (sinon il ne peut pas redéployer...) */ if( joueurEnCours.getPeuple().getTerritoiresOccupes().isEmpty() ){ new WinWarn("Veuillez tout d'abord prendre au moins un territoire"); }else if((etape == 0 || etape == 1) && G...
a4305e6a-4198-4a80-9117-13b622069eb5
1
private boolean jj_2_74(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_74(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(73, xla); } }
a0e3333a-6224-44b6-b0e9-b9707adf3359
2
public void execute( Stack stack ) { for (int i = actions.length-1; i >= 0; i--){ if( Compiler.extendedDebug ){ //System.out.println(actions[i]); } actions[i].execute( stack ); } }
9826914f-adb6-4902-80e4-06bbca4bca47
8
public static HDRExposure scaleTo( HDRExposure exp, int width, int height ) { if( !aspectRatioPreserved(exp.width, exp.height, width, height) ) { throw new UnsupportedOperationException("Cannot change aspect ratio"); } double scale = width / exp.width; if( scale == 0 ) { return new HDRExposure(0, 0); ...
919f2423-d41b-41e1-ba1f-147f7d679e28
3
private void CommandNewSource( boolean priority, boolean toStream, boolean toLoop, String sourcename, FilenameURL filenameURL, float x, float y, float z, int attModel, floa...
167ff953-e8ba-4407-823e-0cd18ee8a117
7
public static File getWorkPath(String workDir){ String userHome = System.getProperty("user.home", "."); File workingDirectory; switch (getPlatform().ordinal()) { case 0: case 1: workingDirectory = new File(userHome, '.' + workDir + '/'); br...
d47fb407-050d-46c9-bd93-6f638485db73
6
public void tabSpecificProcess(String s) { if(s.startsWith("/nick")) { if(action == -1) { addMessage("Changing default nick to " + s.substring(6) + "."); Main.saveDefaultNickname(Main.user); } else { getServer().changeNick(s.substring(6)); addMessage("Nick changed to " + s.substring(...
f3f1bd40-6ecd-43b7-a5d0-9f5c97699f9a
1
Object[] getAttribute(String elName, String name) { Hashtable attlist; Object attribute[]; attlist = getElementAttributes(elName); if (attlist == null) { return null; } attribute = (Object[]) attlist.get(name); return attribute; }
f71175a4-b988-4195-8c77-834b5b43e653
9
@Override public void run() { char read; try { while ((read = (char) inputStream.read()) != -1) { if (read == '\n' || read == '\r') { command = inputBuffer.toString(); printOutputStream.print("\r\nServer: " + command + "\r\n"); inputBuffer = new StringBuffer(); } else if (read == '\u007f'...
40f5bac0-83d6-4e2a-a54b-091bfa2d7a5b
0
public void setPhoneNumber(int phoneNumber) { this.phoneNumber = phoneNumber; }
adbaa08a-0a4b-486a-8cb2-fa3b0d8a0ef3
9
private void jComboBoxServerContractsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxServerContractsActionPerformed System.out.println("In Action for Server Combo main tab"); /*String nymID = Utility.getKey(nymMap, (String) jComboBox1.getSelectedItem()); String assetI...
31ce7886-4d32-4129-8d9c-3b036d8f45e9
2
public static VisitBathroom getSingleton(){ // needed because once there is singleton available no need to acquire // monitor again & again as it is costly if(singleton==null) { synchronized(VisitBathroom.class){ // this is needed if two threads are waiting at the monitor at the ...
4c29db97-f199-4f5f-8852-d3513f881796
4
private SQLite() { this.prefix = "storm__"; this.dbg = true; String dbPath = "jdbc:sqlite::memory:"; try { Class.forName("org.sqlite.JDBC"); this.con = DriverManager.getConnection(dbPath); } catch (SQLException e) { if (this.dbg) { e.printStackTrace(); } } catch (ClassNotFoundException ...
62318d8c-fcee-4c5e-a50e-ede880272854
7
private boolean testSign(Player player, Block block) { Sign sign = null; if (block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST) sign = (Sign) block.getState(); if (sign != null) if (sign.getLine(0).equals( "" + ChatColor.GRAY + ChatColor.BOLD + "["...
b76fe174-4a80-47ec-b7f7-c0b4710c3cec
4
public double computeSimilarity(int user1, int user2) { double sim = 0; // generate arrays containing ratings from users which rated both movies List<Integer> sharedMovies = findSharedMovies(user1, user2); if (sharedMovies.isEmpty()) { return sim; } Double[] userOneRatings = new Double[sharedMovies.si...
ecd5cb46-a1da-44c5-9275-d2c94d569dec
8
@SuppressWarnings("deprecation") public static void main(String[] args) { HashMap<String, ArrayList<Integer>> finalMap = new HashMap<String, ArrayList<Integer>>(); HashMap<String, HashMap<Integer,Integer>> dayCountForStnMap = new HashMap<String, HashMap<Integer,Integer>>(); HashMap<Integer, String> stationIdName...
d9fa9c8d-ec96-4174-a047-722d4657f5eb
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); if (string...
8a4686f4-327a-4938-95d4-05ae17b81c60
8
public static void main(String[] args) throws Exception { if(args.length < 2) { System.out.print("Usage : scdecoder -f <file> \n" + " : scdecoder -s <string1> [string2] ...\n"); return ; } String argument; if(args[0].equals("-f")) { argument = args[1]; ...
879eccc9-055f-48b9-b92c-1e3e638cdde5
7
@Override public void run() { Envelope e = null; try { /* * Loop to check for incoming messages. */ while((e=(Envelope)in.readObject()) != null) { //Special server message that adds to the user list. if(e.sender().equals("Server") && e.message().equals("Join.")) { user...
bcfcac05-d2b6-430d-b2a1-fd0bb8d7eb6d
9
protected void processKeyEvent (java.awt.event.KeyEvent e) { // TODO: Convert into Actions and put into InputMap/ActionMap? if (e.getID()==KeyEvent.KEY_PRESSED) { switch (e.getKeyCode()) { case KeyEvent.VK_LEFT: boolean extend = e.isShiftDown(); int offs = Math.max(leadSelectionIndex-1, 0); c...
fbea9aff-81a8-4b01-99f3-9d3e2fe5338a
3
public void closeChannels() { try { if (socketChannel != null) { socketChannel.close(); } if (serverChannel != null) { serverChannel.close(); } } catch (IOException e) { stdOut.printError(TAG + " Error while clos...
72cf5064-aa1b-4342-82c9-b1b8dfa73bb8
4
private static byte[] decryptBloc(byte[] input){ byte[] tmp = new byte[input.length]; int t,u; int aux; int[] data = new int[input.length/4]; for(int i =0;i<data.length;i++) data[i] = 0; int off = 0; for(int i=0;i<data.length;i++){ data[i] = ((input[off++]&0xff))| ((input[off++]&0xff) << 8) |...
40ccc09b-df7c-48cb-875d-a8c9e17af0e4
9
public static String parseAndExecute(String statement, Map<String, String> parameters, DB db) { String result = null; List<String> sqlParams = new ArrayList<String>(); StringBuffer sb = new StringBuffer(); int prevIdx = 0; int idx = -1; while(((idx=statement.indexOf("{", idx+1)))>=0) { log.finest(sb.t...
47f5cbf5-8f29-4f56-b253-ad6999c222f1
0
public void makeSallary() { method1(); method2(); method3(); }
2066ac4e-d0a2-45b5-aadd-9ef68b21ac44
7
private void powrotDoOknaGlownego() { widokUstawien.setVisible(false); if(oknoMacierzyste.equals("OknoGlowne")) widokUstawien.widokGlowny.setVisible(true); if(oknoMacierzyste.equals("OknoDolacz")) widokUstawien.widokGlowny.widokDolacz.setVisible(true); if(oknoMacierzyste.equals("OknoUtworz")) widokUst...
98442600-a00a-4bab-9499-45bd2e02b727
7
public void run() { println ("This program find the largest and smallest numbers."); int n = readInt ("? "); if ( n == SENTINEL) { println ("The program is terminated by your input of the setinel number. "); } /* variable amountInput is for counting the amount of numbers we've input. * variable largestN...
3d3cfa57-222c-4f5c-a426-74ef25cb74f5
0
public static byte[] decrypt(byte[] data, String key, String algorithm) throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, BadPaddingException, IllegalBlockSizeException { Key k = toKey(SecurityCoder.base64Decoder(key), algorithm); Cipher cipher = Cipher....
075b03a7-e93f-4851-bef6-21c52a61fdb6
4
private static BigInteger findPrime(BigInteger number) { boolean prime = false; Random r = new Random(); while (!prime) { prime = true; for (int j = 0; j < 100; j++) { BigInteger a = BigInteger.valueOf(number.compareTo(BigInteger .valueOf(Integer.MAX_VALUE)) == -1 ? (int) number .intValue() ...
9a2e8d2f-c734-492b-9b4a-de4356ac5702
6
public final DccChat dccSendChatRequest(String nick, int timeout) { DccChat chat = null; try { ServerSocket ss = null; int[] ports = getDccPorts(); if (ports == null) { // Use any free port. ss = new ServerSocket(0); ...
44780b5f-5882-4235-9d95-b478a7baf67d
6
public static void main(String args[]) { /* 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://down...
f75b962e-081e-4e27-9674-7800f1d8c8f9
8
public static ArchiveDataKindCombination getADKCombination(boolean oa, boolean on, boolean na, boolean nn) { List<ArchiveDataKind> dataKinds = new ArrayList<ArchiveDataKind>(); if(oa) dataKinds.add(ArchiveDataKind.ONLINE); if(on) dataKinds.add(ArchiveDataKind.ONLINE_DELAYED); if(na) dataKinds.add(ArchiveDataKin...
8528361d-45af-48f1-b66a-c13cd5824e0f
4
private void paivitaTetriminonTippuminen() { if(pelitilanne.onTauolla() || pelitilanne.peliOnPaattynyt()) return; int vauhti = pelitilanne.arvo(Pelitilanne.Tunniste.VAIKEUSTASO) * 50; if(vauhti >= 500) vauhti = 450; if(pelitilanne.tiputusAjastin().on...
67de65fe-8092-4537-9c6d-1a7a32c75df7
7
public void run() { try { s = new ServerSocket(GAME_PORT); incoming = s.accept(); inStream = incoming.getInputStream(); outStream = incoming.getOutputStream(); in = new BufferedReader(new InputStreamReader(inStream)); out = new PrintWriter(...
16f221da-df77-4424-abfd-fc7ad026a507
3
public int getSpawnpointNumber(){ int spawnpoints = 0; Tile currentJTile = topTile; for(int j = 0; j < dimension; j++){ Tile currentKTile = currentJTile; for(int k = 0; k < dimension; k++){ if(currentKTile.tileType == TileType.SPAWN){ spawnpoints++; } currentKTile = currentKTile.rightDown; ...
e307b9e0-de8b-469a-93f3-f0109ad2e60d
2
public void inOrder() { // 1 Linker Knoten, 2 Konten selber , 3 Rechter Knoten if (left != null) { left.inOrder(); } print(); if (right != null) { right.inOrder(); } }
beb46d0a-24db-4f8b-b6e9-55364db40a0e
1
public void updateReward(State s) { double outputReward = s.stateScore(); if (outputReward != 0) { visits++; double alpha = (double)(1/(double)visits); double secondpart = alpha * gamma * outputReward; double firstpart = (1-alpha) * reward; reward = firstpart + secondpart; } }
1dcec763-1362-4fdf-b78b-69deaff7c05e
0
public FlowersTile(Sprite sprite, String id){ super(sprite, id); }
0f5e3bce-ffe4-4db8-877f-ee351cbbc46c
0
public static StateManager getInstance() { return ourInstance; }
56c68d42-045b-44b6-b56d-ef9a0d0bd1f8
4
@Override public boolean equals(Object obj) { if (obj instanceof AbstractAnswer) { AbstractAnswer o = (AbstractAnswer) obj; if ((ignoreCase == o.ignoreCase) && variants.size() == o.variants.size() && o.variants.containsAll(variants)) { ...
195d224f-754e-4da4-b9d8-0209e30d1cd8
6
void countFile(String fileName) { String fl = fileName.toLowerCase(); if (fl.endsWith(".bam") || fl.endsWith(".sam")) countSamFile(fileName); else if (fl.endsWith(".vcf") || fl.endsWith(".vcf.gz")) countVcfFile(fileName); else if (fl.endsWith(".bed") || fl.endsWith(".bed.gz")) countBedFile(fileName); else th...
20d9b5ea-d516-46d6-bc90-3b39238b193e
9
private void SetItem() { if (!jtfTitle.getText().isEmpty()) title = jtfTitle.getText(); if (!jtfAuthor.getText().isEmpty()) author = jtfAuthor.getText(); try { if (!jtfRating.getText().isEmpty()) rating = Integer.valueOf(jtfRating.getText()); if (jtfLength.getText().isEmpty()) length ...
b0c619e3-c923-411c-a16a-04ec382ec594
6
static Smelter[] siteSmelterStrip( final ExcavationSite site, final Service mined ) { final World world = site.world() ; final Tile init = Spacing.pickRandomTile(site.origin(), 4, world) ; final Smelter strip[] = new Smelter[2] ; final TileSpread spread = new TileSpread(init) { protec...
ecd2c5b1-f225-42bb-a45a-76549bdfef5b
2
public void setMessage(String message) { this.message = message; if(this.message != null && this.message.equals("")) this.message = null; }
633cc596-d333-42cb-9e97-eaa0d1b876ab
3
public void setElement(int i, int j, double a) { if (i == j + 1) lower[j - 1] = a; else if (i == j) diag[i - 1] = a; else if (i == j - 1) upper[i - 1] = a; else System.out.println("(i,j) liegt nicht auf der Tridiagonalen!"); }
7d3d662e-4a45-438f-99b2-ad4c7c5559e3
7
protected java.security.cert.X509Certificate[] getX509Certificates(SSLSession session) throws IOException { Certificate[] certs = null; try { certs = session.getPeerCertificates(); } catch (Throwable t) { log.debug("Error getting client certs", t); return null; } if (certs == null) return null;...
5eb69dfa-bd00-42d5-96ae-d837ad715aa2
9
static protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos...
58ab2662-fdc8-4ed5-b114-12f938025be6
6
public static DataEntry[] getKNearestNeighbours(List<DataEntry> dataSet, final double[] x, int k){ Comparator<DataEntry> distanceComparator = new Comparator<DataEntry>(){ @Override public int compare(DataEntry arg0, DataEntry arg1) { double distA = distance(arg0.getX(), x); double distB = distance(arg1....
aca40446-ccf7-44e1-a22d-f54dbd6d4400
1
public static List<String> decodificarActualizacion(String actualizacionJSON) { List<String> resultado = new ArrayList<String>(); JSONParser parser = new JSONParser(); try { Object objeto = parser.parse(actualizacionJSON); JSONObject objetoJSON = (JSONObject) objeto; String cantFilas = (String) objetoJSO...
efa10aa1-d32e-4686-a031-273762ed02dc
2
public void output() { mSender.sendMessage(ChatColor.GOLD + "Rules being exceeded currently: "); if(mReport.isEmpty()) mSender.sendMessage(ChatColor.GREEN + " None"); else { for(Entry<GroupSettings, StringBuilder> entry : mReport.entrySet()) mSender.sendMessage(ChatColor.YELLOW + " " + entry.getKe...
9f75079c-8882-4df6-9500-acade6796427
5
public String describePages() { StringBuilder sb = new StringBuilder(32); int sz = pages.size(); for (int i = 0; i < sz; i++) { boolean oddIndex = ((i % 2) == 1); boolean closingRangeForSinglePage = false; if (oddIndex) { closingRangeForSingleP...
40fbdfe7-39f5-4bcf-a6e0-43b5ddec85c9
5
public int[] maxHeapify(int[] A, int position, int heapSize){ int positionLeft = left(position); int positionRight = right(position); int largest = position; //store the largest element between left right and parent if(positionLeft <= heapSize && A[positionLeft] > A[largest]){ largest = positionLeft; ...
ef6e5ee7-b389-4550-91c2-e5220e9ef331
1
private JTextField getJTextFieldSpellDictionaryFilename() { if (jTextFieldSpellDictionaryFilename == null) { jTextFieldSpellDictionaryFilename = new JTextField(); } return jTextFieldSpellDictionaryFilename; }
c603fdf3-271b-42da-8cda-eb0b21940fc8
4
public static List<ShopAddressInfo> getShopAddresses(int shopId)throws HibernateException { List<ShopAddressInfo> shopAddressList = null; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try { // Begin unit of work session.beginTransaction(); String hqlString = "select sa from Sh...
4b545ac3-7cce-422b-b51f-1625e655520f
9
public void checkCollision(Dimension rec) { boolean alive = true; for(int i = snakeLength; i > 0; i--){ if((i > 4) && (X[0] == X[i]) && (Y[0] == Y[i])) alive = false; } if(Y[0] >= rec.height) alive = false; if(Y[0] < 0) alive = false; if(X[0] >= rec.width) alive = false; if(X[0...
8f5d3950-d259-4217-a1d2-ed95a3c97948
4
public void createXmlFromTemplate(String templateFileName, String fileName, HashMap<String, String> hmap) { try { DocumentBuilder rBuilder = init(); Document rDoc = rBuilder.parse(templateFileName); Element rRoot = rDoc.getDocumentElement(); DocumentBuilder wBuil...
f2712126-97db-497a-a127-3a9f8c64e8b1
3
public void run() { setName(this.getClass().getSimpleName() + " [" + actors.playerId + "]"); setPriority(NORM_PRIORITY + 2); while (gameState != STATE_STOPPED) { int frames = waitForNextFrame(); for (Updateable c: callbacks) c.update(gameState == STATE_P...
8630d341-dcc8-4e7a-9fdb-d82757788de2
7
private ClassLoader getBaseClassLoader() throws LogConfigurationException { ClassLoader thisClassLoader = getClassLoader(LogFactoryImpl.class); if (useTCCL == false) { return thisClassLoader; } ClassLoader contextClassLoader = getContextClassLoader(); Class...
dacfab51-08bb-4dbc-a26a-b9ff105e04d8
4
public static Set getSet(int id) { Set set = new Set(); Node node = nodeList.item(id); set.height = new Integer(node.getAttributes().getNamedItem("height").getNodeValue()); NodeList nnm = node.getChildNodes(); set.entities = new Entity[nnm.getLength()]; for (int j = 0; j < nnm.getLength(); j++) { ...
73e2bae0-c1d4-4abe-8f5d-40bc89e20f70
8
public void buildClassifier(Instances insts) throws Exception { m_Filter = null; if (!isPresent()) throw new Exception("libsvm classes not in CLASSPATH!"); // remove instances with missing class insts = new Instances(insts); insts.deleteWithMissingClass(); if (!getDoNotReplaceMi...
774acad4-8594-4ccb-9791-925afab18b0e
2
public String getRate(String r){ if (r == null)return null; int pos = r.lastIndexOf("="); r = r.substring(pos + 1); pos = r.lastIndexOf("."); r = r.substring(0, pos + 6); if (r.contains(",")){ pos = r.lastIndexOf(","); r = (r.substring(0, pos)...
2449bbdb-3c3f-4a15-8ab1-22b7df3d814b
7
public void rescale(){ double xmin = Double.MAX_VALUE; double xmax = Double.MIN_VALUE; double ymin = Double.MAX_VALUE; double ymax = Double.MIN_VALUE; for(drawNode N : nodes) { xmin = xmin < N.x ? xmin : N.x; xmax = xmax > N.x ? xmax : N.x; ...
78ac1f88-167b-4d2c-a85e-027eaf3c6d4e
2
public boolean playerOnPoint(Player p){ Block b = p.getLocation().getBlock(); return Team.blockMaterialIsTeamMaterial(b) || Team.blockMaterialIsTeamMaterial(b.getRelative(BlockFace.DOWN, 1)) || Team.blockMaterialIsTeamMaterial(b.getRelative(BlockFace.DOWN, 2)); }
b987ea4c-d542-4eb1-bcfb-4420635bff21
0
@Override public void removeExtension(String ext) { extensions.remove(ext); }
41c211fd-bcf0-4293-adcb-6de2c0acff13
7
public addGUI(final String lastData) { answer = true; setTitle("20 Questions"); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { Main.exitCheck(getContentPane()); } }); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); setBounds(0, 0, 384, 288); ...
ec8d56e9-6a99-4a62-a225-47523140d22e
5
public void dispose() { for (int i = 0; i < resources.size(); i++) { Object obj = resources.get(i); if (obj != null && obj instanceof Resource) ((Resource) obj).dispose(); } resources = new ArrayList(); if (menu1 != null) { menu1.dispose(); menu1 = null; } if (menu2 != null) { menu2.dispose(); m...
83915167-5902-4a46-a262-4ffe28affefc
4
private String buildItemString(ItemStack[] items) { StringBuilder sbItems = new StringBuilder(); StringBuilder sbAmount = new StringBuilder(); StringBuilder sbDurability = new StringBuilder(); StringBuilder sbEnchants = new StringBuilder(); for (ItemStack item : items) { int itemId = 0; int amount = 0;...
74e23747-afbc-4cba-bf28-e4456c7b0a2f
5
@Override public Handshakedata translateHandshake( ByteBuffer buf ) throws InvalidHandshakeException { HandshakeBuilder bui = translateHandshakeHttp( buf, role ); // the first drafts are lacking a protocol number which makes them difficult to distinguish. Sec-WebSocket-Key1 is typical for draft76 if( ( bui.hasF...
05b61ac6-5fe3-45d2-a76b-95e4ad5be865
6
@Override public boolean runTest(){ return ((notString("candy").equals("not candy")) && (notString("x").equals("not x")) && (notString("not bad").equals("not bad")) && (notString("bad").equals("not bad")) && (notString("not").equals("not")) && (notString("is not").equals("not is not")) && (no...
959e8b23-4586-482b-838b-50a286f70314
7
public String toString(){ String s = ""; if (value == 1) s += "Ace"; else if (value == 11) s += "Jack"; else if (value == 12) s += "Queen"; else if (value == 13) s += "King"; else s += "" + value; if (suit == 0) s += " of clubs"; else if (suit == 1) s += " of diamonds"; else if (suit == 2) s+= " of h...
496fbb9d-3616-419a-bdd6-8a2056569f9e
7
public double parseDouble() throws IOException { int sign = 1; int c = nextNonWhitespace(); if( c == '+' ) { // Unclear if whitespace is allowed here or not c = read(); } else if( c == '-' ) { sign = -1; // Unclear if whitespace is a...
89f4cddc-aefd-4842-9e75-17cd165211dd
8
public void updateFileLinksOnWindows() { if (currentFiles == null) { currentFiles = getFiles(); } toUpdate.clear(); List<ServerFile> toDelete = new ArrayList<>(); for (ServerFile file : currentFiles) { if (file.getFlag() == ServerFile.DELETED) { file.tryDelete(getController().getConfig().getProper...
4088dd67-c090-498e-944f-646508fd76ad
5
private static void manageArgs(String[] args) { for (int i = 0; i < args.length; i++) { switch (args[i].trim().toLowerCase()) { case "nogui": nogui = true; break; case "server": startServer = true; break; case "port": if (i < args.length - 1) { port = parsePositiveInt(arg...
ed081da9-8164-4d3f-b815-2573af8087c8
2
public void setCity(String city) { if(city == null || city.isEmpty()){ throw new IllegalArgumentException(); } this.city = city; }
e9471174-588e-4d07-a9fb-0a4f9970218c
1
public void setType(ReleaseType type) { if (type == null) throw new IllegalArgumentException("Release type cannot be null"); this.type = type; }
e362e6b5-f547-4efa-b5bc-a59794ff6f03
3
private static void Search(int[] array2) { // TODO Auto-generated method stub if(array2.length == 1){ return; } if(key == array2[(array2.length)/2]){ exists = true; }else{ if(key < array2[(array2.length)/2] ){ array2 = Arrays.copyOfRange(array2,0, array2.length/2); Search(array2); ...
d4500dba-cd2d-4583-9e20-dfeed1c4c5e8
6
public void create(){ init = true; String sound; float yOff=0; //initial body shit switch(ID){ case"boulderFist": yOff = -1.2f*height; break; default: //do nothing special } //define hitbox physics PolygonShape shape = new PolygonShape(); shape.setAsBox((rw)/PPM, (rh)/PPM); bdef....
8cfdf91c-5835-491a-8cf8-ff34994575da
6
public void drawImage(int i, int k) { i += drawOffsetX; k += drawOffsetY; int l = i + k * DrawingArea.width; int i1 = 0; int j1 = imageHeight; int k1 = imageWidth; int l1 = DrawingArea.width - k1; int i2 = 0; if (k < DrawingArea.topY) { int j2 = DrawingArea.topY - k; j1 -= j2; k = DrawingArea...
00030104-e246-438d-bdf8-52dbd27dfa44
1
@Override public Box recupera(Integer id) throws RemoteException, ObjetoNaoEncontradoException { Box box = h.get(id); //If there is a object in box, return it, other wise throws a exception if(box != null) { return box; } else //throws a exception ...
ff6ddcc4-5738-4b95-9b71-644bdb114a14
8
public boolean checkId(String id) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { conn = getConnection(); pstmt = conn.prepareStatement("select id from member where id=?"); pstmt.setString(1, id); rs = pstmt.executeQuery(); if (rs.next()) { return true;...
0f354e6c-ebc3-4fb4-a37b-883b234bd23d
4
private void removeAny(Gameboy gb, List<ListState> listStates, StateBuffer initialStates) { HashMap<Integer, ListState> listStateMap = new HashMap<>(); for (ListState listState : listStates) { for (State state : initialStates.getStates()) { State s = listState == null ? state : listState.toState(g...
09fb3789-bdf4-4ff4-8772-33236db70dea
7
@Override public void importRead(String path) { InputStream is = null; try { is = new FileInputStream(path); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } InputStreamReader isr = new InputStreamReader(is); Scanner scan = new Scanner(is); // skip ...
d1439424-7a13-43b6-a3b1-e2d1562073a0
9
private void setCIMs(IModel<Double, CTDiscreteNode> model, SufficientStatistics lData[]) throws RuntimeException { // Parameter calculation NodeIndexing nodeIndexing = model.getNodeIndexing(); for( int iNode = 0; iNode < nodeIndexing.getNodesNumber(); ++iNode) { CTDiscreteNode node = model.getNode(iNode); i...
76737956-4969-4a63-b7c4-8a88da50bf72
5
public void render(Screen screen, int xScroll, int yScroll) { screen.renderSprite(tileset.getBackground(), 0, 0, 0, false); // Render background first // Then the tiles screen.setOffset(xScroll, yScroll); int x0 = xScroll >> 4; int x1 = (xScroll + game.getScaledWidth() + 16) >> ...
1b181c2d-0498-46fa-9f4c-56ec5a27df23
8
public boolean attemptDirection(String dir, double x, double y) { Rectangle nextLoc = new Rectangle(boundingBox); boolean isDirectionFree = false; if(dir.equals("up")) { nextLoc.setLocation( (int)(x+0*speed), (int)(y-1*speed) ); if(room.isLocationFree(nextLoc,isEaten)) { ...
5b44376c-2025-47ba-8d9e-f7cad710aedc
4
public boolean equals(Object o){ StockItem nimi=(StockItem)o; return nimi.getId()==getId() && nimi.getName()== getName() && nimi.getDescription()== getDescription() && nimi.getPrice()== getPrice() && nimi.getQuantity()==getQuantity(); }
76d3c69d-301a-4471-bbe1-fc0df844ee37
1
public static void main(String[] args) { while(condition()) System.out.println("Inside �while�"); // do // System.out.println("Inside �do-while�"); // while(condition()); System.out.println("Exited �while�"); }
c0992772-9a59-4e16-a396-d17773f69dfb
1
private void determineTransitions() { remainingTransitions = new HashSet(); State[] states = minDfa.getStates(); for (int i = 0; i < states.length; i++) remainingTransitions.addAll(minimizer.getTransitionsForState( states[i], minDfa, dfa, tree)); }
6de9d9ae-6f9e-429f-ad17-ad3f2da8547a
4
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Pose other = (Pose) obj; if (type != other.type) { return false; } return true; }
826b9da0-bf87-42d0-80d6-f4ab4441278e
4
@OnLoad public void onLoad() { super.onLoad(); TeamModel team = null; if(getParis_sched()!=null) { if(paris_team_select == Teams.HOME) team = DataStore.getTeam(((ScheduleTeamModel)getParis_sched()).getSched_home_team_id()); else if(paris_team_select == Teams.AWAY) team = DataStore.getTeam(((Schedu...
1693c344-86d8-4405-9ff9-440abc6b31a7
3
String getHandleFileResult(final AndroidDevice aDevice, SubType subType, String localFile, String remoteFile) { try { switch (subType) { case PULL: aDevice.getDevice().pullFile(remoteFile, localFile); break; case PUSH: aDevice.getDevice().pushFile(localFile, remoteFile); break; default...
61b2a2e6-3a94-4feb-b9bc-4afd10929395
3
public int isCurrencySlot(int slot) { if (slot == smallCurrencySlot) return smallCurrency; if (slot == mediumCurrencySlot) return mediumCurrency; if (slot == largeCurrencySlot) return largeCurrency; return 0; }
d5771485-7d46-4052-ae7c-7d4bf5d3ab63
8
@EventHandler(priority = EventPriority.HIGH) public void onPlayerDie(EntityDamageByEntityEvent event) { Entity entity = event.getEntity(); if (entity instanceof Player) { Player victim = (Player) entity; Entity entity2 = event.getDamager(); if (entity2 instanceof Player) { Player damager = (Player) en...