method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e35c54cd-ee4c-4c02-83f0-b2626a95b73e
2
public static String doc3k() { if(doc3k != null){ return doc3k; } try { final String location = "data/doc3000.json"; Path resourcePath = Paths.get(location); doc3k = new String(Files.readAllBytes(resourcePath)); return doc3k; } catch (Exception e) { ...
7417c260-ecc5-4b6a-9405-0e58ca8e1382
7
public Vector<WorldMap> readMaps() { try { BufferedReader reader = new BufferedReader(new FileReader(mapFilename)); WorldMap wm = null; String line = reader.readLine(); while (line != null) { line = line.toUpper...
30caf470-88db-4897-9308-d87eb028f861
2
public static void removeIgnore(BSPlayer p, String ignore) throws SQLException{ if(PlayerManager.getSimilarPlayer(ignore)!=null){ ignore = PlayerManager.getSimilarPlayer(ignore).getName(); } if(p.isIgnoring(ignore)){ p.removeIgnore(ignore); SQLManager.standardQuery("DELETE FROM BungeeChatIgnores WHERE pl...
e4585989-8194-4fb5-b055-8b8575107fd3
7
private ArrayList<Case> createSet(ArrayList<Integer> list) { ArrayList<Case> cases = new ArrayList<Case>(); int i = 0; for (Integer type : list) { switch (type) { case 0 : if (i == 0) { cases.add(new Case(i, this, "Start")); } else if (i == list.size() - 1) { cases.add(new Case(i...
95dbbfd4-83ff-4408-a583-1bf5199c31f8
9
public void iterate() { numberOfCells = 0; // On parcourt toutes les cases pour appliquer les règles à chacune for (int y = 0; y <= yMax; y++) { for (int x = 0; x <= xMax; x++) { setActiveSquare(x, y); int sum = bool2int(n()) + bool2int(ne()) + bool2int(e()) + bool2int(se()) + bool2int(s()) + bool2int(...
573e773b-3eae-48bf-bb71-e22fbd44f805
1
private Solve randomSolve(int n) { Solve slv = new Solve(); Random rand = new Random(); for (int i = 0; i < chromosomesize; i++) { slv.Colors.add(rand.nextInt(maxcolor)); } slv.ValueSolve(matr); return slv; }
2065779b-f1c7-44d0-bbb8-1b4c74321ab3
4
@Override public void onControllerAspectChange(SignalController con, @Nonnull SignalAspect aspect) { WorldCoordinate coord = pairings.peekFirst(); if (coord == null) { return; } if (coord.equals(con.getCoords())) { if (aspect != topAspect) { to...
9a1f3626-e313-4d06-bf69-c042492b3922
4
private void cboShapeTypeFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_cboShapeTypeFocusGained // TODO add your handling code here: int shapeIndexDisplayValue = cboShapeType.getSelectedIndex(); if (shapeIndexDisplayValue == 0) { lblFormulaDisplay.setText("Len...
fa7a2117-27ed-4b1b-b96e-971b04d24c31
9
@Override public void nodeSelectionChanged(List<String> selectedNodes) { this.aclDataPanel.removeAll(); if (selectedNodes.size() > 0) { this.selectedNode = selectedNodes.get(0); SwingWorker<List<Map<String, String>>, Void> worker = new SwingWorker<List<Map<String, String>>, Void>() { @Override ...
51db9831-64bf-40e3-8c06-4d296bb4f1b7
8
public PrimitiveOperator combineMidNRightOnRight(PrimitiveOperator other) { boolean[] newTruthTable = new boolean[8]; // the other gate is on the left side - on the LSB newTruthTable[0] = truthTable[((other.truthTable[0]) ? 1 : 0) | 0]; //000 newTruthTable[1] = truthTable[((other.truthTable[2]) ? 1 : 0...
61e1db17-d70c-4c6c-bc0c-39c24c894bc4
8
public static void main(String[] args) { try { test1(); } catch (ArithmeticException e) { e.printStackTrace(); } StdOut.println("--------------------------------"); try { test2(); } catch (ArithmeticException e) { e.printStackTrace(); } StdOut.println("--------------------------------"); ...
14f31419-0805-470c-bb8d-f5646b204700
4
public void loop() { try { if (config.isDebugOn()) System.err.println("Connecting to Hub..."); dcprotocol.connect(); Collection<String> users = dcprotocol.requestConnectedUsersNicks(); if (config.isDebugOn()) System.err.println("Con...
505ce570-cefd-4fb9-99cd-4c91937808be
8
public static boolean updateOperatorCardinality(Operator o, Map<String, Integer> tableAliasToId, Map<String, TableStats> tableStats) { if (o instanceof Filter) { return updateFilterCardinality((Filter) o, tableAliasToId, tableStats); } else if (o i...
5c6a2992-3f63-4d35-9903-8d514a745180
4
public static LinkedListNode addReverse (LinkedListNode n1, LinkedListNode n2) { // returns a new pointer to the head of the list of addition LinkedListNode h1 = n1; LinkedListNode h2 = n2; int carry = 0; // store carry of summation LinkedListNode head = new LinkedListNode(0); // head of the result ...
7e5c2e72-21f9-462a-aa2c-a53e85cecf23
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Preis)) { return false; } Preis other = (Preis) object; if ((this.id == null && other.id != null) || (this.id !...
b112d74a-bd0f-450c-a030-f1e32cf4975d
3
@Override public void start(Stage ps) { primaryStage = ps; longStart(); ready.addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) { if (Boolean.TR...
517be144-26d4-46ab-9100-cf9b78118c68
1
public TestClient(String user) { try { addr = InetAddress.getByName("localhost"); } catch(java.net.UnknownHostException e) { throw(new RuntimeException("localhost not known")); } this.user = user; this.cookie = new byte[64]; tg = new ThreadGroup(HackThread.tg(), "Test client") { public void uncaughtEx...
53ab3178-ea00-434d-b824-495ba60e916c
4
private void percolateDown(int hole){ int child; AnyType tmp = this.array[hole]; for( ; hole*2 <= this.currentSize; hole = child){ child = hole*2; if(child != this.currentSize && compare(this.array[child+1], this.array[child])< 0) child++; if(compare(this.array[child],tmp)<0) this.array[hole] = ...
3ca5201a-caa9-4f4b-a7de-3f1ab12d4568
0
public Labo getLabo() { return labo; }
be98613e-d386-4620-98fc-71a69f172780
2
public String lerString(String msg) { String valor = ""; do { valor = JOptionPane.showInputDialog(null, msg); if (valor.length() < TAM_MINIMO) exibirMsg("Valor deve ter no minimo "); } while (valor.length() < TAM_MINIMO); return valor; }
2d84891d-9c5b-4e34-a720-29838bf645f6
8
public static void main(String[] args) { // Declare the JDBC objects. Connection con = null; CallableStatement cstmt = null; ResultSet rs = null; try { // Establish the connection. SQLServerDataSource ds = new SQLServerDataSource(); ds.setIntegratedSecurity(true); ds.setServerName("localhos...
8c7abfce-d934-4232-8acc-15e43672b48c
2
double getRadiusScale(final Subject subject) { double currentScale = radiusScale; if (subject.meta.type == SubjectType.MOON) { currentScale = radiusMoonScale; } if (subject.meta.type == SubjectType.SHIP) { currentScale = radiusMoonScale; } retu...
8768d372-d298-4b4e-b019-903d38b5546f
5
private void getIPsServidoresArquivo() { try (MulticastSocket mSckt = new MulticastSocket();) { //usuario "escuta" na mesma porta do multicast InetAddress group = InetAddress.getByName(PainelDeControle.IP_MULTICAST); String mensagem = PainelDeControle.USUARIO_EXISTENTE + "-" ...
eb03ac31-ad92-4148-97d3-ac2c85c6b355
3
public void init() { setSize(900, 400); setLayout(new BorderLayout()); // JFrame layout lblStatus = new JLabel(sMessage); lblMoney = new JLabel(sMoney); lblBet = new JLabel(sBet); txtMoney = new JTextField("", 4); arLblPlayer = new JLabel[6]; arLblDealer =...
fe72a517-2591-4989-9c34-ad7d1204f04f
6
@Override public void init() throws ServletException { super.init(); TESTS = new ArrayList<MNTestInterface>(); try { String cfgPath = getServletContext().getRealPath(TESTS_DIR); BufferedReader reader = new BufferedReader(new FileReader(cfgPath)); String test; while ((test = reader.readLine()) != n...
77244534-41ea-4de6-a5e0-e6f8be900203
1
public Asset(String name, URL path) { Name = name; Path = path; try { Image = ImageIO.read(path); } catch (IOException e) { e.printStackTrace(); } }
185bec10-633e-4150-abdf-ce3a428538b3
6
public static void main(String[] args) { if (args.length > 1 && args[0].equals("-test")) { try { System.out.println(toSingleLine(args[1])); } catch(IOException e) { e.printStackTrace(); } } else { if (args == null || args.length...
ac137b95-97bc-4a70-a6aa-04abb09801f0
6
public boolean setField(int maxField, int jobNum, int submitTime, int runTime, int numProc) { // need to substract by 1 since array starts at 0. Need to convert, // position in a field into the index of the array if (jobNum > 0) { JOB_NUM = jobNum - 1;...
c6230972-8016-47d7-8fd2-026359bef464
1
@Override public boolean nextEdge() throws IOException, InterruptedException { try { return getNextObject(); } catch (Exception ex) { throw new IOException(ex); } }
9e516e97-1af8-461e-972f-6aa06df8bdb4
1
public void testToStandardDays() { Period test = new Period(0, 0, 0, 4, 5, 6, 7, 8); assertEquals(4, test.toStandardDays().getDays()); test = new Period(0, 0, 1, 4, 0, 0, 0, 0); assertEquals(11, test.toStandardDays().getDays()); test = new Period(0, 0, 0, 0, 23,...
c67bfe4f-35ad-4d65-95c2-1fd7fb0ceefd
9
public static UnitValue[] parseInsets(String s, boolean acceptPanel) { if (s.length() == 0 || s.equals("dialog") || s.equals("panel")) { if (acceptPanel == false) throw new IllegalAccessError("Insets now allowed: " + s + "\n"); boolean isPanel = s.startsWith("p"); UnitValue[] ins = new UnitValue[4]; ...
639a4d1d-672d-4b44-8d11-b1682a06bea6
3
public void empezarDoble() { for (int i = 0; i < Domino.listaFichaPc.size(); i++) { if (Domino.listaFichaPc.get(i).getCabeza() == MiSistema.parSalida && Domino.listaFichaPc.get(i).getCola() == MiSistema.parSalida) { Domino.listaFichaPc = mst.addFichaTablero(i, true, Domino.listaFicha...
264d531b-3d2f-45a5-8399-c217526c998b
6
public void run() { System.out.println("Running"); setAdjustRadarForRobotTurn(true); setAdjustGunForRobotTurn(true); setAdjustRadarForGunTurn(true); // Creating the custom event EnemyFires addCustomEvent(new Condition("EnemyFires") { public boolean test() { return (enemy != null && enemy.pre...
05cff306-23ba-4f6d-8412-87a8d0a9dab8
8
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) { this.plugin = plugin; this.type = type; this.announce = announce; this.file = file; this.id = id; this.updateFolder = plugin.getServer().getUpdateFolder(); final File pluginFile...
2b25b4d3-e44d-469f-99a0-62cb739ef17a
1
private MinimizeTreeNode getNode() { TreeNode[] selected = treeDrawer.getSelected(); if (selected.length != 1) return null; return (MinimizeTreeNode) selected[0]; }
62e2e38a-91d6-492b-a38d-3e9a3575b997
1
public static ReadYCbCr getInstance() { if (readYCbCrSingleton == null) { readYCbCrSingleton = new ReadYCbCr(); } return readYCbCrSingleton; }
2d771f93-bbbc-4f84-b253-c568b13369ff
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...
c7484568-a647-4907-9429-09c24a662ff0
5
private boolean isFree(int x, int y) throws GameFieldException { assert checkPosition(x, y); if (units[y][x] != null) { return false; } switch (map[y][x]) { case MOUNTAIN: case WATER: case TREE: return false; case GRASS: return true; default: throw new GameFieldException(String.format("Unh...
3f269a82-be03-47ba-b990-52d9e2ee52de
6
public static String escape(String string) { char c; String s = string.trim(); StringBuffer sb = new StringBuffer(); int len = s.length(); for (int i = 0; i < len; i += 1) { c = s.charAt(i); if (c < ' ' || c == '+' || c == '%' || c =...
451ddb18-8f53-4f5d-b65f-28c15ab64652
3
public static void getRegions() { try { Statement s1 = conn.createStatement(); ResultSet rs = s1 .executeQuery("Exec getRegion"); if (rs != null) { while (rs.next()) { int regionID = rs.getInt("regionID"); String controlling = rs.getString("controlling"); int controlValue = rs.get...
30136c4c-ac03-4a3d-8cc3-d71487b4b435
8
protected Array(Element arrayE) throws Exception { String arrayS = arrayE.getTagName(); // get the type of the array if (arrayS.equals("Array")) { String type = arrayE.getAttribute("type"); if (type.equals("int")) { m_type = ArrayType.INT; } else if (type.equals("real")) { ...
9d8bbf89-3e6b-407f-8ed2-acd4d79c4456
6
public ButtonState GetButtonState(String context_name,String action_name) { InputContextKey k = getInputContextKey(context_name,action_name); // order of importance (from least to most): OFF,RELEASED,PRESSED,ON // so if two buttons do the same thing, releasing one and holding the other // will only produce the...
dccef376-35a2-4f8d-8642-5916111c6672
5
public int find(String[] board) { numRows = board.length; numCols = board[0].length(); if (numRows <= 1) return 0; myBoard = new boolean[numRows][numCols]; for (int i = 0; i < numRows; i++) for (int j = 0; j < numCols; j++) { if (board[i].charAt(j) == 'X') myBoard[i][j] = false; else { ...
5a499b36-1bc1-4b78-92e0-b6bc86ce7480
4
public static List<Crawler> readTrackerList() { Scanner s = null; List<Crawler> ret = new ArrayList<Crawler>(); try { s = new Scanner(new File(Settings.TK_FILE_PATH)); } catch (FileNotFoundException e) { Logger.logError("File not found check your configuration!"); } while (s.hasNextL...
3d56aa40-6351-4952-b44d-2f75858061ab
1
@Override public ByteBuffer serialize() { ByteBuffer result = ByteBuffer.allocate(1024); BufferUtil.putString(result, name); result.put(type == PlayerType.PLAYING ? (byte)0 : (byte)1); result.put((byte)Arrays.asList(Side.values()).indexOf(side)); result.flip(); return result; }
527a1089-6fdd-4ab8-904c-18a10c60209a
9
private void processQuery () { // find command terminator int pos = query.indexOf (";\n"); if (pos < 0) return; // extract query to execute String cmd = query.substring (0, pos+1); query = query.substring (pos+2); System.out.println ("SQL cmd: '" + cmd + "'"); // drop previous result resul...
005d776f-9141-47c9-92e9-08c196fb6be5
6
protected int optimalPowWindowSize(BigInteger n) { int expBits; expBits = n.bitLength(); /* try to minimize 2^k + n/(k+1). */ if (expBits > 9065) return 8; if (expBits > 3529) return 7; if (expBits > 1324) return 6; if (expBit...
60ee6a54-7805-4487-9199-f8cab26c43fd
7
@SuppressWarnings("resource") public void LoadStrats(String fName) throws IOException{ BufferedReader in = null; String line; in = new BufferedReader(new FileReader(fName)); while ((line = in.readLine()) != null) { // System.out.println("l: "+line); if (line.contains("<item>")) { String race = "...
a8f5e674-ecb0-4ff0-929f-dee75da336e9
4
@Override public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.white); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_O...
4cda3e13-cf7d-40fe-b214-c1aa8410d057
4
public synchronized DatasetObject getObject(int id) throws Exception{ // System.out.println("ObjectDatbase: Executed getObject!!!!!"); if(offsetFile==null || databaseFile==null) openFiles(indexDirectory); //With persistent offsets long position=id*8; long ...
24755fd2-00ec-48cf-ade8-1aa0e67e49fb
0
public boolean contain(Ticket ticket) { return this.carList.containsKey(ticket); }
e973b394-933a-4e04-aa04-96616d4525dd
0
@Basic @Column(name = "amount") public double getAmount() { return amount; }
4bafc415-7d35-4776-b7be-a296127a363e
4
private void loadPlattformar() { DefaultListModel<Plattform> dlm = (DefaultListModel<Plattform>) listPlattformarHolder.getModel(); dlm.clear(); ArrayList<String> tempal = new ArrayList<>(); ArrayList<Plattform> al = new ArrayList<>(); try { String query = "select pid...
c0bf3dd7-2628-42ac-982d-048500871ee0
3
@SuppressWarnings("unchecked") @Override public double getScore(Object userAnswer) { if (userAnswer == null) return 0; String ans = (String) userAnswer; ArrayList<String> trueAns = (ArrayList<String>) answer; for (int i = 0; i < trueAns.size(); i++) { if (trueAns.get(i).equals(ans)) return score; ...
ec859d74-4604-459c-a0ea-1c4770cfa80e
8
private void generateCallMethod(ClassFileWriter cfw) { cfw.startMethod("call", "(Lorg/mozilla/nb/javascript/Context;" + "Lorg/mozilla/nb/javascript/Scriptable;" + "Lorg/mozilla/nb/javascript/Scriptable;" + "[Ljav...
7dfb16c3-f1ea-497e-8a22-2adec48865d7
4
@Override protected HttpRequest preProcessResponse(HttpRequest in) { if(in.getHeaders() != null){ System.out.println("\nHeaders:"); for (Entry<String, String> entry : in.getHeaders().entrySet()) { System.out.println(entry.getKey() + " => " + entry.getValue()); } } if(in.getCookies() != null){ ...
dd21d46c-b880-49b4-bf99-785b1ddbb8d1
1
static final void indent(Writer writer, int indent) throws IOException { for (int i = 0; i < indent; i += 1) { writer.write(' '); } }
5cbdbb17-5ce0-4c94-8f63-a7348854e794
5
public void actionPerformed(ActionEvent e) { if(e.getSource() == btnSettings) { final SettingsPanel p = new SettingsPanel(); final String[] options = {Lang.getLine("accept_option"), Lang.getLine("cancel_option")}; final JOptionPane pane = new JOptionPane(p, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANC...
d0ce62d5-32be-4a81-97b3-feb919b7dda9
0
public HBox getActionBox() { return actionBox; }
dfb37861-a997-4d5f-8267-1701d2dd050b
4
public int bestAction() { int selected = -1; double bestValue = -Double.MAX_VALUE; for (int i=0; i<children.length; i++) { if(children[i] != null) { double childValue = children[i].totValue / (children[i].nVisits + this.epsilon); childValue = Uti...
d9b286ca-2384-49df-b349-05903ae99471
7
public void Solve() { int[] solutions = new int[_max + 1]; for (int a = 1; a < _max; a++) { for (int b = a; b < _max; b++) { if (_max < a + b) { break; } double sqrtC = Math.sqrt(a * a + b * b); int c = (in...
ee5c7595-ef74-4da5-8815-14cce76f034f
3
public static void search(String fileName, String value) { try { // Open the file c:\test.txt as a buffered reader BufferedReader bf = new BufferedReader(new FileReader("c:\\test.txt")); // Start a line count and declare a string to hold our current line. ...
c50fe426-7985-40fa-8e15-62ca5018de21
8
private void findIntentions(ArrayList<Desire> desires) { ArrayList<Desire> chosenIntentions = new ArrayList<Desire>(); //Assign new intentions. for (Agent a : level.agents) { a.desire = null; } //Shuffle desires. Should be removed in later stages. Collections.shuffle(desires); for (Desire d : de...
e4832303-c221-413f-bb69-5220ecfaec9c
3
private static StaffArrangement parseFiles(String str, File inputFile) throws ParseException, IOException { if (str.isEmpty() || str == null) { throw new ParseException("Invalid Arr File.", 0); } StaffArrangement theArr = new StaffArrangement(); for (String s : s...
069a45cb-ff62-4854-9516-5ae19d6f1154
2
public final static void songMetadata(String path, boolean hlEvaluation, boolean llEvaluation) throws MasterException { if(hlEvaluation == false && llEvaluation == false) return; MasterMetadata.songES= Executors.newFixedThreadPool(MasterMetadata.nThread); MasterMetadata.songTasks= new ArrayList<SongF...
5a5797c9-3e96-4c50-a93c-69328c433648
3
private void loadDatas() { try { InfoUtils.loadVideoInfo(); InfoUtils.loadNewsInfo(); InfoUtils.loadTemperatureInfo(); InfoUtils.loadLogInfo(); } catch (IOException e) { e.printStackTrace(); } List<News> newsList = NewsDao.instance().getnewsList(); for (News news : newsList) { System.out.pr...
05964ba3-26a0-4d33-a0bc-77dacaa42f31
7
@Test public void testFileReadOnly() throws Exception { final Permissions permissions = new Permissions(); final String fileName = "testFileReadOnly.txt"; permissions.add(new LibUVPermission("libuv.handle")); permissions.add(new FilePermission(fileName, "read")); permissions....
93c8ae10-df82-4ff4-8b0b-53c6acad8dc2
6
@Override public SymbolInfo Execute(RuntimeContext cont) throws Exception { while (true) { SymbolInfo m_cond = cond.Evaluate(cont); if (m_cond == null || m_cond.Type != TypeInfo.TYPE_BOOL) { return null; } if (m_cond.BoolValue != true) { ...
de4fe50d-924a-4257-bb9e-1ce25fb79857
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int n = to.length(); char[] circle = new char[n]; /* * First fill the circle buffer with as many characters as are in the * to string. If we...
d3276c61-2d25-4978-acfe-5ceb291912a6
5
private void waitForCurrentByteBuffer() { if (currentByteBuffer == null || currentBufferPosition > currentByteBuffer.length - 1) { currentByteBuffer = null; while (currentByteBuffer == null && !reachedEndOfStream()) { currentByteBuffer = dataQueue.poll(); ...
2d98c05f-6d52-44db-a5fd-a030dd7011d9
8
public void mouseClicked(MouseEvent arg0, int xMouse, int yMouse) { if(xMouse>33 && xMouse<163 && yMouse>414 && yMouse<454) state = true; else if(xMouse>33 && xMouse<163 && yMouse>472 && yMouse<512) state = true; }
4684ff72-f8ec-4187-af10-377520a2ee99
6
public static Color getColorFromNumber(int num) { switch(num) { case 0: return Color.blue; case 1: return Color.red; case 2: return Color.green; case 3: return Color.cyan; case 4: return Color.yellow; case 5: return Color.orange; default: return Color.black; } }
02e638bf-c77b-4099-b69f-b35cca63829e
3
private void generateOrder(Sorter sorter, StatementPrototype mainStatement) { // add order statements for all non-null values ObjectStack oStack = new ObjectStack(adapter, sorter.getSortClass(), sorter.getSortObject()); this.typeIds.nameStack(oStack); mainStatement.getIdStatementGenerator().addPropertyTablesTo...
759eac2f-321d-4242-8596-240e6514c6e7
8
public int readLine(byte b[], int off, int len) throws IOException { int total = 0; if (len == 0) return 0; int avail = count - pos; if (avail <= 0) { fill(); avail = count - pos; if (avail <= 0) return -1; } int copy = Math.min(len, avail); ...
c9439e2b-5c1b-4499-9e5c-085d2fb2f686
7
public int enableRecorder(final boolean b) { if (!EventQueue.isDispatchThread()) throw new RuntimeException("must be called in the EDT thread."); model.stopImmediately(); if (b) { /* IMPORTANT!!! we should turn the recorder on */ if (!model.hasEmbeddedMovie()) { model.activateEmbeddedMovie(true); ...
ee547411-292f-423f-9de8-489611913358
8
public boolean IsConsecutive() { if(playingCards.size() < 5) return false; Collections.sort(playingCards); int currentIndex = 0; int count = 0; for (PlayingCard playingCard : playingCards) { int thisCardIndex = playingCard.ValueOrder.indexOf(playingCard.Value); ...
cc7f4814-c2b0-4a78-a591-becd86c9d8ef
2
public void testBase64() { System.out.println("** testBase64 **"); CycList request = new CycList(); request.add(CycObjectFactory.makeCycSymbol("list")); request.add(":none"); request.add(CycObjectFactory.makeCycSymbol(":none")); String encodedRequest = null; Object response = null; Base6...
c741dbc2-b8d2-442c-b461-e2ce135e43fe
0
public DoublyLinkedListPerformanceTest() { }
897631c7-90e9-43f4-b5b8-2ed16e2ba490
9
public Coordinate move(Direction dir, Coordinate coor) { switch (dir) { case NORTH: { Coordinate newCoord = new Coordinate(coor.getRow()-1, coor.getCol()); if (validCoordinate(newCoord)) { //System.out.println("Old: " + coor + "New: " + newCoord); return newCoord; } // else { // System.out.pri...
a0530df2-f13e-458b-829a-02cbb069c43a
7
public boolean hittable(GameObject obj) { if (!enemy) { if (obj instanceof Ship || obj instanceof Asteroid || obj instanceof EnergyShield || obj instanceof Saucer) { return true; } return false; } if (obj instanceof Ship || obj instanceof Energ...
9767b48a-5771-4277-b3ab-ca97f2cf52db
8
private Element login(HttpServletRequest request, Element elResult) { HttpSession session = request.getSession(true); Element elResponse = new Element ("response"); String username = request.getParameter("username"); String password = request.getParameter("password"); if (username == null || "".equals(use...
ffc901c3-5e91-4cd9-95ea-86228b30c196
3
protected void setSlope(Point s, Point e) { slope = 0.0f; if ((double) last.x - (double) end.x != 0.0f) { slope = ((double) last.y - (double) end.y) / ((double) last.x - (double) end.x); } else if (last.y > end.y) { slope = 9999999.0f; } else if (last.y < end.y) {...
6258adda-f3a5-4fbf-a46d-3d5a61c2f5b1
7
public static void updatePreMainUpdate(){ GameState state = DDGameLoop.getInstance().getGameState(); ArrayList<DataContainer> dataCon; ArrayList<PlatformEvent> eventQueue; //Process PlatformEvents if(handler.getEventQueueSize()>0){ eventQueue = handler.getPla...
c7bd9ea0-791b-4781-9fe9-73fdd9dc75c2
2
@Test public void testGetCard(){ Pile pile = new Pile(); Card card = new Card(Card.CARD_SUIT.DIAMONDS, Card.FACE_VALUE.ACE); Card card2 = new Card(Card.CARD_SUIT.CLUBS, Card.FACE_VALUE.NINE); pile.addCard(card); pile.addCard(card2); assertEquals("Asserting the right card was retrieved", card2, pile.getCard...
9f82e0cf-b120-4c4c-ae15-26d890c43ba4
9
public ListNode mergeTwoLists(ListNode l1, ListNode l2) { if (l1 != null && l2 == null) return l1; if (l1 == null && l2 != null) return l2; ListNode head = new ListNode(0); ListNode cur = head; while (l1 != null && l2 != null) { if (l1.val < l2.val) { cur.next = l1; l1 = l1.next; } else { cu...
191c83ad-74db-47ef-9f24-861a372be65a
8
public void getMinMaxXY() { if( Settings.national_map) { System.out.println("national"); minx = -127.50; miny = 28.70; maxx = -55.90; maxy = 49.10; System.out.println(""+minx+","+miny); System.out.println(""+maxx+","+maxy); featureCollection.recalcDlonlat(); return; } Vector<VTD> featur...
721f19ba-633f-4f5f-be60-f6b8a1e0887c
8
public static final void writeNumber( Number num, byte encoding, OutputStream os ) throws IOException { switch( encoding ) { case NE_FLOAT16: writeFloat16( num.floatValue() , os ); return; case NE_FLOAT32: writeFloat32( num.floatValue() , os ); return; case NE_FLOAT64: writeFloat64( num.doubleValue(), os ); ret...
251adcd8-f25b-4d36-ba51-aaad1cb7ec89
4
@Override public boolean isSolid(final int pX, final int pY) { if(0 <= pX && pX < mBitsBlock.length && 0 <= pY && pY < mBitsBlock[0].length) return mBitsBlock[pX][pY]; else return false; }
ca28003d-5d5b-42d8-a430-6d17cb738a2b
3
public static void main(String[] args) { try { System.out.println("Server running..."); ServerSocket ss = new ServerSocket(7002); while (true) { Socket s = ss.accept(); // Block until connecting received ObjectInputStream ois = new ObjectInputStream( s.getInputStream()); ObjectOutputStre...
bed8fbcd-b002-491e-8c39-bddd5babdefb
9
private String renderFields(List<SmaliField> fields) { StringBuilder builder = new StringBuilder(); for(SmaliField field : fields) { switch(field.getFlagValue(SmaliEntity.MASK_ACCESSIBILITY)) { case SmaliEntity.PUBLIC: { builder.append("public "); break; } case SmaliEntity.PROT...
841764a0-68dd-4a13-aa0f-7fb3585e5785
2
@EventHandler public void onFoodUpdate(FoodLevelChangeEvent ev) { if(!RushPlugin.isGameRunning() || RushPlugin.isGameFinished()) ev.setCancelled(true); }
acaa1881-3334-4591-849b-177179cfc2c1
8
@Override public boolean doesHaveWeakPrivilegesWith(final MOB mob, final PrivateProperty record) { if((record==null)||(mob==null)) return false; if(record.getOwnerName()==null) return false; if(record.getOwnerName().length()==0) return false; if(record.getOwnerName().equals(mob.Name())) return tru...
7e6f233f-5a09-46d5-b390-8887ae945d47
6
public static final MaplePacket getPlayerStore(final MapleCharacter chr, final boolean firstTime) { final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter(); mplew.writeShort(SendPacketOpcode.PLAYER_INTERACTION); IMaplePlayerShop ips = chr.getPlayerShop(); switch (ips.getShopType()) { ...
1e291531-4b53-445e-b1a0-57947a5cfb0b
1
public static void main(String [] args) throws IOException { File f = new File("D:\\abc.txt"); if (f.exists()) { f.delete(); } f.createNewFile(); }
7d18953f-c38b-4f5f-87d2-257bcb53b478
8
@Override public void mouseClicked(MouseEvent event) { ParametersWindowController parametersWindowController = CentralSystem.getCentralSystem().getWindowParametersController(); MainJP mainJP = parametersWindowController.getWindowParameters().getDivisionJSP().getMainJP(); JTextField source = (JTextField) event.ge...
2ad7b7bc-d1a2-463b-96e8-f41f27310a55
4
public FireBall(TileMap tm, boolean right) { super(tm); facingRight = right; moveSpeed = 3.8; if(right) dx = moveSpeed; else dx = - moveSpeed; width = 30; height = 30; cwidth = 14; cheight = 14; // load sprites try { BufferedImage spritesheet = ImageIO.read(getClass().getResourceAsS...
a889127a-3810-42a4-abae-c28467ffbd0a
6
Vector merge(Vector v1, Vector v2) { if (v1 == null || v1.isEmpty()) return v2; if (v2 == null || v2.isEmpty()) return v1; Vector result = (Vector) v1.clone(); Enumeration enum_ = v2.elements(); while (enum_.hasMoreElements()) { Object elem = enum_.nextElement(); if (!result.contains(elem)) re...
3442fa97-81cc-46ff-9e2c-935e0140214e
0
@Override public void mouseMoved(MouseEvent e) { }
3d563460-2462-4c26-b889-bd137d6f0106
5
public String listarPrestamo() throws SQLException { String Recorrertbl = ""; ResultSet listPrestamo = Pres.consultarPrestamo(); ResultSet listPrestamo1 = Pres.consultarPrestamo1(); try { while (listPrestamo.next()) { Recorrertbl += "<tr>"; Rec...
2a6210a5-50b3-463a-9827-c0e1feceb676
0
@Override public void fly() { System.out.println("Sry. I cannot fly. :-("); }