method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
bfff3b03-724d-40f1-9286-7946a2556706
7
protected static String combineActualExpected(String actual, String expected) { // pad the space between actual and expected with spaces or dots String space = " "; String fill = ".................................................."; // the resulting String Str...
f7d052fa-69ca-46c7-ac85-5413dbeba736
8
@Override public boolean drawEdge(int row, int col, Edge edge) { Box selectedBox = this.getSelectedBox(row, col); //find the adjacent box and draw the edge on opposite side Box adjBox =this.getAdjBox(row, col, edge); boolean isEdgeDrawn = false; boolean...
52a59002-dc15-46c1-a48d-6e4088268253
2
public void render(Graphics g) { for (HitCircle c : circles) { c.render(g); } g.setFont(font); g.setColor(Color.white); g.drawString("Hit: " + hitCount + " / " + maxHit, 5, 20); g.drawString(formatter.format(time / 1000.) + " s", 5, 45); button_restart.render(g); if (hitCount >= maxHit) { g.setF...
9ac0b3dc-ef41-4c2d-ab22-c7e3a3845c90
6
public boolean containsAll(Itemset itemset2){ // we will use this variable to remember where we are in this itemset int i = 0; // for each item in itemset2, we will try to find it in this itemset for(Integer item : itemset2.getItems()){ boolean found = false; // flag to remember if we have find the item ...
a9d2e9df-fc68-4282-9ffd-aa316c7ca3ea
8
private double distance(Instance first, Instance second) { double distance = 0; int firstI, secondI; for (int p1 = 0, p2 = 0; p1 < first.numValues() || p2 < second.numValues();) { if (p1 >= first.numValues()) { firstI = m_trainInstances.numAttributes(); } else { fir...
e780e668-fe85-47af-8cc6-2f8727b18b3a
9
public ListNode detectCycle(ListNode head) { if(head == null || head.next == null) return null; ListNode fast = head; ListNode slow = head; while(fast != null && fast.next != null){ slow = slow.next; fast = fast.next.next; if(slow.equals(fast)) break; } if(!slow.equal...
3dc51bb6-9e64-46f9-b651-d988bbcdfcdf
7
private void testForCollision(Ship ship, Shot shot) { if (!shot.isDying() && !ship.isExploding()) { if (Calculator.getDistance(ship.getLocation(), shot.getLocation()) < 500) { if (ship.returnHitbox().collides(shot.returnHitbox())) { ...
b1f1fcee-6078-43a6-b833-ac4d24984766
1
public void updateSubTypes() { subExpressions[0].setType(type != Type.tVoid ? type : Type.tInt); }
c7d472e5-d725-44cf-9a81-1cb5118873a9
7
private PassWindow(String option){ super(); //setResizable(false); this.setTitle("Personnel Records"); cnt = this.getContentPane(); JLabel background = Background.getLabel(); cnt.add(background, BorderLayout.CENTER); background.setLayout(new GridLayout(3,3)); // cnt.setBackground(defaultColor); setBoun...
d6c8c976-be22-45f8-b25d-bb2c90dd3279
1
public long getLong(){ try{ return Long.parseLong( value ); } catch( NumberFormatException ex ){ throw new XException( ex ); } }
ae7b6687-858d-4d3c-a86c-cb5360d71f2f
6
public static void equateCollections(Proposition prop, Collection col1, Collection col2) { if (col1.orderedP() && col2.orderedP()) { { Stella_Object i1 = null; Iterator iter000 = ((Iterator)(col1.allocateIterator())); Stella_Object i2 = null; Iterator iter001 = ((Iterator)(col2...
1cda4370-642a-48b1-b749-4e674e6d111f
2
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; int width = this.getWidth(); int height = this.getHeight(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_INTE...
bcc6bdc1-49cf-4e0d-ad18-1746a0566a34
8
public static double[][] benchmarkJLargeArraysByteSequentual_safe(long[] sizes, int[] nthreads, int iters, String file) { double[][] results = new double[nthreads.length][sizes.length]; long k; System.out.println("Benchmarking JLargeArrays (bytes, sequentual, with bounds checking)"); ...
d8aa91ee-3248-4c68-969c-83501db45ef4
1
private void open() { if (DEBUG) System.out.println("open using draft: " + draft.getClass().getSimpleName()); handshakeComplete = true; }
c84ab662-9d28-4eeb-8cd5-73464cd4f145
1
public String toString() { StringBuilder sb = new StringBuilder("["); String sep = ""; Node[] nodes = _queue.toArray(new Node[0]); java.util.Arrays.sort(nodes); for (Node node : nodes) { sb.append(sep).append("(").append(node.waketime).append(",") .append(node.agent).append(")"); ...
e7b5df85-50cb-4454-a76e-96314643b9cf
7
public int getScoreEndGame(BufferedImage screenshot) { // crop score image BufferedImage scoreImage = screenshot.getSubimage(370, 265, 100, 32); // transform template images into black-white format BufferedImage[] endGameNumberTemplates = { extractNumber(_endGame0), extractNumber(_endGame1), ext...
26b7f904-dd81-4d4b-8db8-180ca90d12fc
7
public static void main(String[] args) { int matriceA[][] = {{1, 1, 1, 1}, {2, 2, 2, 2}, {3, 3, 3, 3}}; int matriceB[][] = {{1, 2, 3}, {1, 2, 3}, {1, 2, 3}, {1, 2, ...
6419e292-d67e-4d3e-800d-51df29856821
3
@Override public Object getValueAt(int row, int col) { if (data == null) { return null; } if (row == -1 || col == -1) { return null; } return data[row][col]; }
d733f68e-e702-4399-b3af-052fae5d2b9d
3
public void UpdateLayout() { // kann nicht mehr gesetzt werden if (field.getBattleState() != null) { setBattleState(); return; } // Gegner grid kann nur anzeigen if (mode == eBattleFieldMode.Displaying) { setEnabled(false); ...
cbb33486-8109-4029-a8a4-ac5415a769cf
0
public String getApkFileLocation() { return apkFileLocation; }
c362a63e-961e-4a79-a7be-24a992eb68a3
6
private void processVersionMsg() { vlog.debug("reading protocol version"); if (!cp.readVersion(is)) { state_ = RFBSTATE_INVALID; throw new ErrorException("Reading version failed: not an RFB server?"); } if (!cp.done) return; vlog.info("Server supports RFB protocol version " + ...
b94b94e9-fa03-4c0d-bc6d-0417415a1d60
6
public void pintarTableroReal() { int aleatorio; Random pitopitogorgorito=new Random(); for (int i = matrizReal.length-1; i >= 0; i--) { System.out.println(" _______________________________________"); System.out.print(i + " |"); for (int j = 0; j < matrizReal[0].length; j++) { if (matrizReal[j][i] ...
98f85116-23df-49bf-8b6a-32416b2cc0f9
9
public static void main(String[] args) throws Exception { frame = new GUI(7); frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE); frame.pack(); frame.setResizable(true); frame.setLocationRelativeTo(null); frame.setVisible(true); //While loop secures that the application will never terminate (all by //its...
a984701a-34bc-4238-b297-74d3b4dc4ab1
6
@Override public void visitOperator(XTreeOperator operator) { super.visitOperator(operator); XTree t = operator.exprs.get(0); if(!(t instanceof XTreeConstant)) return; XTreeConstant left = (XTreeConstant)t; while(!operator.operators.isEmpty()){ XOperator o = operator.operators.get(0); t = operator.e...
5d675a20-8212-42cd-8c56-9374c4850bb5
1
public boolean CloseDatabase() { try { Conn.close(); } catch (SQLException e) { plugin.Warn("Close database failed!"); e.printStackTrace(); } return true; }
bb77294c-32f3-4aab-990a-5ec0e4383dbe
8
public LabelsPanel(LangEditor langEditor) { setOpaque(false); setBorder(new TitledBorder(null, "Labels", TitledBorder.LEADING, TitledBorder.ABOVE_TOP, null, null)); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[]{0, 0, 0, 0}; gridBagLayout.rowHeights = new int[]{0...
a0ccb4c6-88ba-44b3-9da6-77d153aa2079
2
private static String encodeParameters(UrlParameter... parameters) throws UnsupportedEncodingException { StringBuilder encodedParameters= new StringBuilder(); for(UrlParameter parameter : parameters) { if(encodedParameters.length() > 0) encodedParameters.append("&"); ...
b532fde9-775d-49c5-bff9-3fef80955cf2
8
public static long countSplitInversionsAndMerge(int start, int end, int leftStart, int leftEnd, int rightStart, int rightEnd) { int subArray1[] = new int[leftEnd - leftStart + 1]; int subArray2[] = new int[rightEnd - rightStart + 1]; int count = 0; for (int i = leftStart; i <= leftEnd; i++) { subArray1[coun...
6d157f33-b86b-4f76-8d8c-d0e44b468d57
0
public void setLogin(String login) { this.login = login; }
4c68c2ac-7a92-4386-a2af-524f5640fa3b
9
public final long uploadNextChunk(long numBytesToUpload) { if(currentUploadFile == null) { err = "no upload is in progress"; return -1; } long max = sz - offset; long maxBytesWeCanUpload = Math.min(max, numBytesToUpload); int actualBytes = 0; if(...
352d37ff-3a4e-469e-9d32-a6b258b91e37
1
public Home() { initComponents(); if (Manager.getInstance().getCurrentProfile() != null) { updateProfile(); } }
db9a0c1a-d116-4982-8b87-7f8bba76dd28
3
public AxisAlignedBB func_31035_a(World var1, int var2, int var3, int var4, int var5, float var6, int var7) { if(var5 != 0 && var5 != this.blockID) { AxisAlignedBB var8 = Block.blocksList[var5].getCollisionBoundingBoxFromPool(var1, var2, var3, var4); if(var8 == null) { return null; ...
65d0fa25-4cc7-48e2-906f-5e946d2ad0ec
2
public void code() { System.out.println("Enter the pattern" ); String x=in.next(); System.out.println("Enter the no.of rows"); int r=in.nextInt(); for(int i = 1;i <= r ;i++) { for(int j = 1 ; j<=i;j++) { System.out.print(" " + x); } System.out.println(" "); } }
022a02fb-7dc4-468c-a376-27108b2d719a
3
public UsuarioBean load(UsuarioBean oUsuario) throws NumberFormatException { try { if ((request.getParameter("login") != null)) { oUsuario.setLogin(request.getParameter("login")); } if ((request.getParameter("password") != null)) { oUsuario.set...
44e57d13-81ed-4837-9099-c0551dd72f4f
4
@Override public Map<String, Double> getTagsWithLikelihood(String user, String resource, List<String> topics, Integer count) { if (topics != null && topics.size() > 0 && this.threelEngine != null) { return this.threelEngine.getTagsWithLikelihood(user, resource, topics, count); } else if (this.bllEngine != null)...
d059d505-20cf-4334-b30a-38867eacd524
1
public boolean isGravityDebugStatus() { if(frame == null) buildGUI(); return gravityDebugStatus.isSelected(); }
76bb4d2b-65ea-4022-8f7c-0d31666ea6db
3
@Override public ItemStack getIcon(Player viewer) { String finalName = this.getName(); if (willChangeNameColours()) { finalName = ((this.permission == null ? true : viewer.hasPermission(this.permission)) ? ChatColor.GREEN : ChatColor.RED) + ChatColor.stripColor(this.getName()); }...
256545d9-b2f3-4ca8-bacf-bcbefb428db7
2
private String optimizeOneTime(String in) { this.buffer = in.split("\n"); this.nextLine = 0; String threeCode, output = ""; while((threeCode = this.getNextCodeBlock()) != null){ for(Optimizer optimizer : optimizersOneTimer){ threeCode = optimizer.optimize(threeCode); } output += threeCode; } ...
b4ce025b-1cd1-404e-8e9b-12376f37ec2c
4
public void caretUpdate(CaretEvent event) { String text = getText().trim(); String emptyMask = maskPattern.replace('#', placeholder); if (text.length() == 0 || text.equals(emptyMask)) { setForeground(Color.BLACK); return; } try { Date date = ...
89f2bfb7-170d-4762-8432-85a73dfef285
2
public Models.DatabaseModel.Bill findBill(int billId) { String query = "SELECT `bill`.`billId`, " + " `bill`.`patientId`, " + " `bill`.`dateCreated`, " + " `bill`.`datePaid`, " + " `bill`.`consultationCost` " + " FRO...
72068526-5d8f-4fdc-bdcd-f0e0c18ab788
6
@Override public void validate() { if (sitename == null) { addActionError("Please Enter Site Name"); } if (siteurl == null && siteurl.equals("http://")) { addActionError("Please Enter Web Site Url"); } if (txtcolor ==...
f909e7f5-96fd-4b41-afe3-3ffd555d9956
8
@Override public void run() { while(!finishedRegistration()) { try { //Preferred courses first and the other courses second if(!triedRegisteringForPreferred) { for(int i = 0; i < NUMPREFERREDCOURSES; i++) { register(getP...
9374c6d3-befe-4c2f-a3f6-c59d18e6c111
4
public void setEndian(int endian) { if(this.endian==BIG_ENDIAN && endian==LITTLE_ENDIAN) { bitIndex=0; byteIndex++; } else if(this.endian==LITTLE_ENDIAN && endian==BIG_ENDIAN) { bitIndex=7; byteIndex++; } this.endian=endian; }
c9f3f838-6f6b-4350-94a7-4ceb42715662
6
public static MonthMap fromAllLocales() { MonthMap newMonthMap = new MonthMap(); Locale[] locales = DateFormatSymbols.getAvailableLocales(); for (Locale locale : locales) { DateFormatSymbols dfs = DateFormatSymbols.getInstance(locale); String[] longMonths = dfs.getMonths(...
49306004-35ab-48fd-9f28-e52dc984ff8b
5
public void payFine() { // User inputs: bid, fid, amount to pay JTextField bidField = new JTextField(15); JTextField fineField = new JTextField(15); JTextField amountField = new JTextField(15); JComponent[] inputs = new JComponent[] { new JLabel("Borrowing ID:"), bidField, new JLabel(...
2177e11c-7d18-4a47-aa03-a15baa2350f2
7
private Map<Date, Double> flexi(Date registrationDate, String plan, int textCount, String options, String payAsYouGoLevel, int callTime) { final Properties prop = loadProperties(); double amount = 0; double rate = 0; double fee = 0; int builtInTime = 0; // mn if (FLEXI_S.equals(plan)) { rate = Double...
5692b49f-feda-459d-8158-e146c169ce66
1
@Override public float isContextMenuEnabledAt( int x, int y ) { if( listeners.isEmpty() ){ return 0.f; } return item.isContextMenuEnabledAt( x, y ); }
371abc5b-358b-433a-bfab-255bc31a60ab
6
public List<Curve> parsePlotInCsv() throws IOException { CustomReader csvReader = new CustomReader(this.reader, separator); String[] header = csvReader.readRaw(); Map<String, Curve> curveMap = new HashMap<String, Curve>(); // for all curve's column for (int i = 1; i < header....
2df53c91-4cbc-47eb-8d90-2bb1f18a650d
7
@Override public void explore(ProcessConfiguration config, ExploringThread thread, Explorable parent) throws ExplorationException { if (parent instanceof Root) { try { thread.enqueue( parent, "Folder", new File(config.getOption(OPTION_ROOT).getStringValue()) ); } catch (Interrupted...
ac17c28d-80dc-48a9-93d4-c026218967b8
9
private short readShort() { switch ( type ) { case MatDataTypes.miUINT8: return (short)( buf.get() & 0xFF); case MatDataTypes.miINT8: return (short) buf.get(); case MatDataTypes.miUINT16: return (short)( buf.getShort...
2bba87e6-35f5-4b9c-ba8a-e35c21f3fdfe
8
public static int getFirstOrderClassification(List<GraphPoint> neighbours) { int votes[] = new int[Point.classes.length]; // Count the classes of all the neighbours Iterator<GraphPoint> neighbourIterator = neighbours.iterator(); while(neighbourIterator.hasNext()) { int classIndex = Point.getClassIndex(...
8da3b927-62eb-4c26-b934-1acf29c5a7b2
2
private boolean pluginFile(String name) { for (final File file : new File("plugins").listFiles()) { if (file.getName().equals(name)) { return true; } } return false; }
bba64a20-5881-40ee-8d88-7dd232c21b2e
2
public OximataList() { /* * parathiro me thn lista twn oximatwn */ con = new Mysql(); setTitle("Lista Oximatwn"); /* vgazei to para8uro sto kedro tis othonis me diastaseis 350x400 */ Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); this.setBounds(dim.width/2-175, dim.height/2-200, 350, 400...
96a84360-c996-4402-8b83-39c651f27a63
2
WebSearchResponse(JSONObject jsonObject) { super(jsonObject); if (this.Count > 0) { JSONArray results = (JSONArray) jsonObject.get("results"); @SuppressWarnings("unchecked") Iterator<JSONObject> iterator = results.iterator(); while (iterator.hasNext()) { Results.add(new WebResult(iterator.next())); ...
a5c6970d-9802-46cc-bf1a-9762f07dc7d9
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 NewEntity)) { return false; } NewEntity other = (NewEntity) object; if ((this.id == null && other.id != null) |...
b420f83f-e50e-493b-83ba-6ce98ec6d5b6
7
public void calcRandIndex() { final Map<Integer, Integer> docIndexToGoldCluster = new HashMap<Integer, Integer>(); final Map<Integer, Integer> docIndexToRegularCluster = new HashMap<Integer, Integer>(); for (int i = 0; i < this.docs.size(); i++) { final int goldStadartClusterNum = this.docs.get(i).getDocGoldSt...
49e5fb95-48db-4544-980f-7fa7d6aab0d2
7
private void move() { xa = 0; ya = 0; int px = (int) level.getPlayerAt(0).getX(); int py = (int) level.getPlayerAt(0).getY(); Vector2i start = new Vector2i((int) getX() >> 4, (int) getY() >> 4); Vector2i destination = new Vector2i(px >> 4, py >> 4); if (time % 3 == 0) path = level.findPath(start, destina...
cc2da932-abe0-46a2-87ab-c51e425e54ab
7
PatientsPanel(ResultsDisplay x){ rd = x; setLayout(null); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBounds(214, 5, 21, 21); add(tabbedPane); JButton btnQuery = new JButton("Green ID#"); btnQuery.setBounds(22, 52, 117, 29); add(btnQuery); btnQuery.add...
79080739-11e9-40f9-9d9f-bc6226d65912
7
private final static void startArtistAnalysis(List<File> foundFiles) throws MasterException { int cnt= 0; try { Iterator<File> iter= foundFiles.iterator(); while(iter.hasNext()) { //create the list of tasks to do. MasterMetadata.artistTasks.add(new ArtistFeature(iter.next())); if(++cnt...
78cd111b-be32-4148-b626-ad9be476ef34
0
public int GetPacketsRemaining() { return packetCreated.size(); }
17bac2c9-4ce7-4afd-9e0f-ed7f32b592d1
2
@Override public String toString() { if (address == null) { return null; } if (address.getAddress() instanceof Inet6Address) { return "tcp://[" + address.getAddress().getHostAddress() + "]:" + address.getPort(); } else { return "tcp://" + ...
5beac27b-530d-485c-9b84-8b955065f2b7
7
int getSteeringForceScale() { int s = 0; for (int i = 0; i < nAtom; i++) { if (atom[i].getUserField() != null) { s = (int) (atom[i].getUserField().getGear() * 4.0); break; } } RectangularObstacle obs = null; if (s == 0 && obstacles != null && !obstacles.isEmpty()) { synchronized (obstacles.ge...
f19c589b-7b5b-491a-aded-cd9693d940e7
1
@Override public void deleteStack() { for (int i = 0; i < amount; i++) { stack[i] = 0; } amount = 0; }
9d81d579-ded4-47bb-bd74-7e36ad7d0483
8
public void paint(Graphics g) { debug("paint("+g+")"); debug("cursor="+he.cursor+" buff.length="+he.buff.length); Dimension d=getMinimumSize(); g.setColor(Color.white); g.fillRect(0,0,d.width,d.height); g.setColor(Color.black); g.setFont(he.font); //...
b1c450e5-f9c0-40c7-a41c-5504308296c8
3
public String toString() { StringBuilder sb = new StringBuilder(1024); while (!stack.isEmpty()) { Story curr = stack.pop().getStory(); if (curr != null) { boolean showAuthors = true; sb.append(curr.getText(false, showAuthors, showTitles, showSeries...
283f6a81-25ae-42d3-b929-b57e93a32d60
9
private static Dataset gen(int rows, int cols, int numClasses) { Random rand = new Random(1); float[][] data = new float[rows][cols]; int[][] labels = new int[numClasses][rows]; int pos = rows/2; int negs = rows - pos; for(int i = 0; i < labels.length; ++i) { for(int j =0; j < labels[i].length; ++j) { labe...
17894f54-a830-45f2-81d0-9c66b96b0723
1
@Override protected void compute() { // Better use Runtime.getRuntime().availableProcessors() if (end-start < 10) awardBonus(); else { invokeAll(new AwardBonus(accounts,start,(start+end)/2), ...
51b4f671-1d47-4c0d-894e-d1570142104d
3
public void sql_remove_appointment() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver").newInstance(); Statement s = GUI.con.createStatement(); //CHANGE FUNCTIONS BASED ON HIERARCHY if(GUI.Level == 1) { s.executeUpdate ("DEL...
19ff7c61-7221-4499-beab-85315f2b9727
2
private void showPopup(MouseEvent e) { if ( !e.isPopupTrigger() ) return; String nickname = getNicknameWhereClicked(e); if (nickname == null) return; selectedPopupUser = nickname; popup.show( e.getComponent() , e.getX() , e.ge...
24ba6038-35d8-4d15-928a-771b775f481c
7
public void connect(String address, int port) throws CouldNotConnectException { logger.fine("Connecting to " + address + ":" + port + "..."); boolean disconnected = false; try { synchronized(CONNECTION_LOCK) { if(isConnected) { logger.fine("Disconnecting from " + serverAddress + ":" + serverPort + " s...
98bdd7fc-1981-4ecb-b784-ef0a8776c7f7
7
public Capabilities(CapabilitiesHandler owner) { super(); setOwner(owner); m_Capabilities = new HashSet(); m_Dependencies = new HashSet(); // load properties if (PROPERTIES == null) { try { PROPERTIES = Utils.readProperties(PROPERTIES_FILE); } catch (Exception e) { e...
6c48305c-bb9b-4a9b-aa4a-fd3dc75286b2
2
final void checkDataSize() { if (data == null || ((int[])data).length < dataLen()) data = new int[dataLen()]; }
ebe28c15-8f6b-4e60-996a-5bc3de027cec
7
public static Cons allSubrelations(NamedDescription relation, boolean removeequivalentsP) { { MemoizationTable memoTable000 = null; Cons memoizedEntry000 = null; Stella_Object memoizedValue000 = null; if (Stella.$MEMOIZATION_ENABLEDp$) { memoTable000 = ((MemoizationTable)(Logic.SGT_LOGIC_...
ee058cfe-e3d3-43fc-b640-22b8ea5e68f8
0
public long getId() { return Id; }
9a3e579f-3593-4589-afbc-72376100f2f3
0
@Override public int getColumnCount() { return columnNames.size(); }
c9006ed8-c1ff-4987-b021-18573eae6c8c
1
public void checkFlyweight() { int i = 0; System.out.println(this + ".checkFlyweight()"); Iterator<Map.Entry<String, Flyweight>> iterator = flies.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, Flyweight> e = iterator.next(); System.out.println("item " + (++i) + " : " + e.getKey()); ...
f8156423-5905-47fe-ba95-83ef8497a40e
9
public ExplorationStep next() { if (this.candidates == null) { return null; } while (true) { int candidate = this.candidates.next(); if (candidate < 0) { return null; } try { if (this.selectChain == null || this.selectChain.select(candidate, this)) { TransactionsIterable support = t...
250973b3-1c24-48e6-9f6c-36c332f1c706
9
public void Animate() { if (carriedBy != null) { int maxPull = 4 * 28; Dimension d = GetXY(); int tempX = d.width; int tempY = d.height; if (tempY != startY) { carriedBy.moveDown(startY - tempY); } if (tempX < st...
1032cbf2-07ac-48d9-97a1-67aa4dfc4d4a
9
public ParticleSystemOptionDialog(String title) throws LWJGLException { super(title); GroupLayout groupLayout = new GroupLayout(getContentPane()); getContentPane().setLayout(groupLayout); groupLayout.setAutoCreateGaps(true); groupLayout.setAutoCreateContainerGaps(true); DisplayMode[] displayModes = Display.get...
69234fac-d6ab-4a4b-9cb8-4177c7acf3cd
2
private void initializeElements() { int number = ElementType.values().length * 10 + (GameModel.UNIT * 10); for(ElementType type:ElementType.values()) { for(int i = 0; i < number; i++) { model.addElement(new Element(type, getRandomLocationOnGrid(GameModel.GROUND_LEVEL + 25))); } number -= 10; } ...
2b297b99-1c3f-4d78-ba55-bed6fddc4aa0
9
public final ChannelBuffer getArchivePacketData(int indexId, int archiveId, boolean priority) { byte[] archive = indexId == 255 ? Cache.STORE.getIndex255() .getArchiveData(archiveId) : Cache.STORE.getIndexes()[indexId] .getMainFile().getArchiveData(archiveId); if (archive == null || !priority) return...
fd09665c-1bf4-4c09-9cc8-45f01c127dc3
3
public List<LoginEntry> readNewestPlayers() { List<LoginEntry> retList = new ArrayList<LoginEntry>(); try { ResultSet rs = _sqLite.query("SELECT p.playername AS name, j.newest as newest, j.time_online as online FROM player AS p JOIN " + " (SELECT id, id_player, max(time_login) AS newest, time_online ...
e277fc67-2311-45dd-b428-cdfc59fc5590
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Report other = (Report) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; r...
bb33c0fe-4342-47d6-9c5b-112dcc68d37b
6
public static int safelyComputeTreeSize(Cons tree, int depthcount, int cutoff) { { int count = 1; Stella_Object value = null; if (depthcount > Stella.$DEPTHCUTOFF$) { Native.setBooleanSpecial(Stella.$DEPTHEXCEEDEDp$, true); return (1); } for (;;) { value = tree.value...
e7545743-d666-478c-8bef-68f16f81df71
3
public static String json2xml(String json) { StringReader input = new StringReader(json); StringWriter output = new StringWriter(); JsonXMLConfig config = new JsonXMLConfigBuilder().multiplePI(false) .repairingNamespaces(false).build(); try { XMLEventReader reader = new JsonXMLInputFactory(config) ....
c48d80be-0bf7-4d73-aba9-1d7e53a01d47
4
private boolean isFull() { return full?true:(full=o0!=null&&o0.isFull()&&o1!=null&&o1.isFull()); }
7f7336c5-ebe3-4772-b837-a630ac3700e7
5
public static boolean login (Connection conn, String login, String password) { ResultSet resultSet = null; Statement statement = null; String dbLogin; String dbPassword; boolean authentication = false; try { statement = conn.createStatement(); resultSet = statement .executeQuery("s...
d98ed436-938d-4baf-8882-614a4002e02d
4
/* @ pure */ public String getSide(Coordinate coord) { String side = null; if (coord.getX() == 0) { side = "top"; } else if (coord.getX() == DIM - 1) { side = "bottom"; } else if (coord.getY() == 0) { side = "left"; } else if (coord.getY() == DIM - 1) { side = "right"; } return side; }
275f4b9a-8ae4-49bb-b92a-35895ad9cde8
9
@Override public int hashCode() { int result = employeeId != null ? employeeId.hashCode() : 0; result = 31 * result + (cpr != null ? cpr.hashCode() : 0); result = 31 * result + (birthday != null ? birthday.hashCode() : 0); result = 31 * result + (fullName != null ? fullName.hashCode(...
f00069b9-0dfa-4385-8369-1e3c7d8b9d58
3
public Object getValueAt(int row, int col) { try { switch (col) { case 0 : return SBStringUtils.dateFormatShort.format(myRecipe.getNoteDate(row)); case 1 : return myRecipe.getNoteType(row); } } catch (Exception e) { }; return ""; }
2424baa8-50b2-41ef-a7e2-a7c885b702da
6
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { config = plugin.getConfig(); if (args.length == 1 ){ if (sender instanceof Player) { if (sender.hasPermission("darkcommand.hug")){ if (commandLabel.equalsIgnoreCase("hug")){ Player player = (Player) s...
51835b3d-1254-416a-b511-d7ad49dcfad4
4
public void actions() { Scanner in = new Scanner(System.in); List<String> user_input = new ArrayList<>(); String new_input = new String(); boolean check; System.out.println("Input instructions followed by " + "enter (Use 0 to run ...
5cf42585-9411-4ef7-bcdf-e4372a2e7fb8
6
public double similarity(CharSequence source, CharSequence pattern) { int m; int n; char s, p, s1, p1; m = pattern.length() + 1; n = source.length() + 1; for (int x = 0; x < n; x++) { e[0][x] = x; } // for p = 0; ...
710e921b-8672-4c5c-b0c5-4d09d0f753ec
6
public static void main(String[] args) { File f = new File("files/numeros.txt"); BufferedReader Buffer = null; String Linea = null; try { Buffer = new BufferedReader(new InputStreamReader( new FileInputStream(f))); while ((Linea = Buffer.readLine()) != null) { System.out.println(Linea); try {...
67a00c92-4d28-4622-84e3-831aae0faeb2
0
public Collection<File> getDbFile(){ return dbFile; }
05a31631-b818-469b-ba74-c2b5f2977fb2
6
public boolean canJump1(int[] A) {// O(n^2) and O(n) space if (A.length <= 1) return true; boolean[] canReach = new boolean[A.length]; for (int i = A.length - 2, dist = 1; i >= 0; --i, ++dist) { if (A[i] >= dist) { canReach[i] = true; } else { int j = 1; while (j <= A[i] && !canReach[i + j]) ...
6e2231c0-9532-4b33-ba99-1ef82c8a06ac
3
private void initialize(Header header) throws DecoderException { // REVIEW: allow customizable scale factor float scalefactor = 32700.0f; int mode = header.mode(); int layer = header.layer(); int channels = mode==Header.SINGLE_CHANNEL ? 1 : 2; // set up output buffer if not set up by client....
e68c9cba-6f90-4c79-b017-3976307acbe2
5
public boolean mousedown(Coord c, int button) { for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) { if (!wdg.visible) continue; Coord cc = xlate(wdg.c, true); if (c.isect(cc, (wdg.hsz == null) ? wdg.sz : wdg.hsz)) { if (wdg.mousedown(c.add...
aaca61bd-24c8-4172-9346-b938400b1ffd
1
public void connectDb() { startSQL(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection(url, user, password); st = con.createStatement(); } catch (Exception e) { e.printStackTrace(); ...
4072054a-dfc5-4648-9ec5-32e68144e7c6
7
private void treadBufferingLogic() { Thread bufferingThread = new Thread(new Runnable() { @Override public void run() { final int BUFFER_IMAGE_STEP = 5; for(int i = 0; !endOfFrames; i+=5){ try { addFramesToQuese(i, i + BUFFER_IMAGE_STEP); } catch (JCodecException e) { ...