method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
cf7d9452-e771-4ce2-8ddd-bd27955ae620
6
public void renderPlan(GameContainer container, StateBasedGame game, Graphics g) { g.setColor(Color.yellow); for (Array a : plan) { if (a.east != null) g.drawLine( (int) (a.posX * 11 + AbstractAreaRenderer.originX + 2.5), (int) (a.posY * 11 + AbstractAreaRenderer.originY + 2.5), (int) (a...
4e8eff1d-53e9-4ff4-93a1-5e1be7e90277
1
private String getReverse(String string) { StringBuffer buffer = new StringBuffer(); for (int k = string.length() - 1; k >= 0; k--) { buffer.append(string.charAt(k)); } return buffer.toString(); }
49f24547-8513-4335-9746-fd232798f178
9
private void move(Vector movement, ArrayList<Bacteria> baclist){ //Moves according to the movement vector if(movement.getX() > 0.1){ movement.setX(1); } else if(movement.getX() < - 0.1){ movement.setX(-1); } if(movement.getY() > 0.1){ ...
2ccd7ad8-673b-462c-8bc0-af459ae503c6
7
public static void playAudioStream(AudioInputStream audioInputStream) { // Audio format provides information like sample rate, size, channels. AudioFormat audioFormat = audioInputStream.getFormat(); System.out.println("Play input audio format=" + audioFormat); // Convert compres...
435a8c85-0cb7-4dd3-86b3-e650ae6b0b11
7
private void finishPage(Graphics2D g) { // // Notify the report listeners that we are at the end of the current page // ReportEvent event = new ReportEvent(ReportEvent.PAGE_FINISHED, state); int expCount; ReportExpression exp; if (g != null) { PageSta...
6738e646-403f-41b7-9cf0-89713c385e10
6
public boolean confirmValidity(Vector<int[]> Lines, Vector<int[]> Goals) { boolean goalgood = false; //Richtungsgerade float[] dv = new float[4]; //Pruefen ob der Weg noch zu irgendeinem Tor führt for(int i=0; i<Goals.size(); i++) { if((Way.lastElement()[0] == Goals.elementAt(i)[0]) && (Way.lastEl...
3b6b1fb8-a7d9-44bc-b078-3c4199b11cb0
7
public DbManager(String accessKeyId, String secretAccessKey, int numMap, int numReduce) { List<String> domainNames = null; // to store domain names --d3 Boolean retry = false; // to retry if anything do not follow up --d3 // Initialize simpleDB service service = new AmazonSimpleDBClient(acc...
e41f9869-0445-42cd-9b4f-5955ca0670d9
1
private void parseHeader(Scanner scanner){ String playersArray[] = scanner.nextLine().split("\\s"); String sizeArray[] = scanner.nextLine().split("\\s"); String descriptionArray[] = scanner.nextLine().split("\\s"); int numPlayers = Integer.parseInt(playersArray[1]); assert(numPlayers <= 8); assert(numPlayers ...
af664ddd-f53d-45e3-bc31-ed8f5a6a5e17
1
public void setName(String name) { if (StringUtils.isEmpty(name)) { throw new IllegalArgumentException("Name shouldn't be NULL or empty."); } this.name = name; }
655e9c27-53cd-46bb-a281-ef3a4f876eb2
4
public static void tokenize_query(String query, String punctuation) { StringBuilder token = new StringBuilder(); for (int i = 0; i < query.length(); i++) { char c = query.charAt(i); boolean separator = punctuation.indexOf(c) != -1 || c == ' '; if (separator) { ...
8a09f8dc-f73b-4c36-bb61-f5670d8c4d49
2
public Hero getHero() { if (hero != null && hero.isInCastle(this)) { return hero; } else { return null; } }
e6c8eeb3-7077-4b5f-8db7-0453bf4827b0
1
private void compute_pcm_samples11(Obuffer buffer) { final float[] vp = actual_v; //int inc = v_inc; final float[] tmpOut = _tmpOut; int dvp =0; // fat chance of having this loop unroll for( int i=0; i<32; i++) { final float[] dp = d16[i]; float pcm_sample; pcm_sample = (float)(((vp[11 ...
09b2df15-8103-4d38-855b-36c142029a80
5
private void createOrientationCombo(PrintRequestAttributeSet set) { OrientationRequested[] orientations = (OrientationRequested[]) mService.getSupportedAttributeValues(OrientationRequested.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null); if (orientations != null && orientations.length > 0) { HashSet<Orientat...
cb31a1a4-7609-4313-bd64-b8a47886110e
3
private void gameOver(boolean completed) { boolean beatRecord = score > highScore.get(multipleLives).get(difficulty); if (beatRecord) { highScore.get(multipleLives).put(difficulty, score); } JOptionPane.showMessageDialog(MainFrame.getThis(), "Congratulations!\n" + (!completed ? "You made it ...
0e77d2e2-ee32-46a2-a872-880f49a3673f
5
@Override public String getMessage() { String channel = ""; String key = ""; for (int i = 0; i < this.channels.length - 1; i++) { channel += this.channels[i] + ","; } if (this.channels.length > 0) { channel += this.channels[this.channels.length - 1]; } for (int i = 0; i < this.keys.length ...
0b501a1e-4b7e-4c54-b993-8c85d96de9a9
5
public static void MaxHeapify (List<Integer> array, int i){ int left = (i*2) - 1; int right = (i*2); int largest; /*condition checks if there is a right side and if it's bigger*/ if(right<=array.size() && array.get(left)>array.get(i-1)){ largest = left; } else{ largest = i - 1; } /*conditi...
6f54befa-bdf6-4e85-8175-28238aec03ff
2
private ArrayList<java.awt.geom.Rectangle2D.Float> createVolumeBars( TreeMap<Float, float[]> technicals) { ArrayList<java.awt.geom.Rectangle2D.Float> vol = new ArrayList<java.awt.geom.Rectangle2D.Float>(); ArrayList<Float> tradeVol = new ArrayList<Float>(); for (Entry<Float, float[]> entr : technicals.entrySet...
e54aad29-6292-4e03-9405-a672d52836d0
0
@Override public void fight() throws Throwable { log.debug("Fight!"); throw new SecurityException("不准打架!"); }
ffc3eb72-a84a-46d1-abb4-e27d1eaf8ef4
5
public static Object getConnectingEdge(mxAnalysisGraph aGraph, Object vertexOne, Object vertexTwo) { mxIGraphModel model = aGraph.getGraph().getModel(); Object[] edges = aGraph.getEdges(vertexOne, null, true, true, false, true); for (int i = 0; i < edges.length; i++) { Object currEdge = edges[i]; Object...
5026a925-a943-48ee-9bd4-83f5f4037f8e
9
public static Keyword uValueMeasureSpecialist(ControlFrame frame, Keyword lastmove) { { Proposition proposition = frame.proposition; Stella_Object mainarg = (proposition.arguments.theArray)[0]; Stella_Object mainargvalue = Logic.argumentBoundTo(mainarg); Stella_Object measurearg = (proposition.arg...
504f2d9d-5611-4baa-8fc2-97b09c00bb1b
4
public void parse() { File sourceFile = new File("marketdump.txt"); FileReader fr = null; try { fr = new FileReader(sourceFile); } catch (FileNotFoundException e) { e.printStackTrace(); } BufferedReader br = new BufferedReader(fr); String myline = null; int tmpId; String tmpString; try { ...
e3881112-6795-42c1-82e2-344414447d0d
3
private static void insertAuxInitializer(CodeAttribute codeAttr, Bytecode initializer, int stacksize) throws BadBytecode { CodeIterator it = codeAttr.iterator(); int index = it.skipSuperConstructor(); ...
a72a03b6-176e-4a8c-857f-c75651b7f8db
6
public BlockBusterItem buscarItem(int cod, TipoItem tipo){ for(BlockBusterItem bi : items){ if(tipo == TipoItem.MOVIE && bi instanceof MovieItem || tipo == TipoItem.GAME && bi instanceof VideoGameItem){ if( cod == bi.codigo ) ...
4a3168dd-ae0b-4331-8b4a-70fb5954aec2
5
public double getDiffuseLayerCapacitance(){ if(!this.surfaceAreaSet){ System.out.println("Class: GouyChapmanStern\nMethod: getDiffuseLayerCapacitance\nThe surface area has not bee included"); System.out.println("A value per square metre has been returned"); return this.diffCa...
a716cca9-d438-40d7-a2c3-b92694fe1264
4
private void exit() { String save = ""; while (!(save.equals("y") || save.equals("n"))) { System.out.print(" Save network (y/n) : "); try { save = bufReader.readLine(); save = save.toLowerCase(); } ca...
f3c301a6-bdc9-4706-9bbd-0929111f0943
7
public void draw(GameTimer gameTime, Graphics2D graphics) { // Get the font. Font font = _ScreenManager.getMenuFont(); Font textFont = _ScreenManager.getTextFont(); // The position of the menu and text. Vector2 position = new Vector2(_MenuPosition.x, _MenuPosition.y); Vector2 textPosition = new Vector2(_T...
b1cfec6b-5b66-4201-b529-8675059f81dc
4
@Override public void run() { try { state = "Herunterladen"; for (URL u : urls) fullsize += u.openConnection().getContentLength(); time = System.currentTimeMillis(); for (int i = 0; i < dests.size(); i++) { InputStream in = new BufferedInputStream(urls.get(i).openStream(), 1024); File...
11f94f19-c90b-43c4-978a-2b2d5142d878
8
public String getFormattedReport(boolean hideUninterestingLines) { StringBuffer sb = new StringBuffer(); for (String pageName : pageCount.keySet()) { Map<String, Integer> count = pageCount.get(pageName); SortedSet<Map.Entry<String,Integer>> sortedCount = ProfilerResults.getSortedCountsStatic(hideUninteres...
e6299a1b-0f36-40d0-ba0a-a02adfc87010
9
@Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof Tag)) { return false; } Tag o = (Tag) obj; if (getId() != o.getId()) { return false; } if (name == null && o.name != null || name != null && o.name == null) { ...
1f839b61-b340-4733-9639-2bff22b09a65
5
public static Color getColorForProvinceType(ProvinceType provinceType){ if(provinceType == null) return Color.BLACK; switch(provinceType){ case LAND: return Color.BLACK; case SEA: return Color.BLUE; case LAKE: ...
4335c09e-699d-47f1-a539-f61c5ad13430
9
private void availableInDirections(final Point current) { for (Direction theDirection : theDirections) { final Point newPoint = getNewPoint(current, theDirection); if(newPoint.getX() >= theBoard.length || newPoint.getY() >= theBoard[0].length) { //Skip } else if(newPoint.getX...
31159de0-ccef-40a2-9af5-e0a92e161178
6
@EventHandler public void CaveSpiderWeakness(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getCaveSpiderConfig().getDouble("CaveS...
3d2c5407-c9de-4d5f-b8af-99fdc3500c6b
5
public void run() { synchronized (articles) { if (articles.isReady == false) { try { System.out.println("!!!!!waiting parser!!!!!!"); articles.wait(); } catch (InterruptedException e) { ...
d7ddd684-2e6a-49b7-a5ac-92c6f2b3d163
5
public void mousePressed(MouseEvent e) { if(clickable) { if(e.getX()>x && e.getX()<x+width) { if(e.getY()>y && e.getY()<y+height) { t1 = System.nanoTime(); clicked=true; } } } }
5b24d28f-bdb2-42fc-9b07-80f2d6b67eb0
4
private void ParsePHPFileButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ParsePHPFileButtonActionPerformed PreparedStatement ps = null; ResultSet rs = null; Connection conn = null; int TARGET_PHP_FILES_ID = 0; try { if ((conn = JavaDBAccess.setConn()) != null) { ...
476d441f-06a0-4fd2-bcb8-5e830fdfea80
3
public void rewind() { if (!loading()) { // Make sure there is a sequencer: if (sequencer == null) return; try { // rewind to the beginning: sequencer.setMicrosecondPosition(0); } catch (Exception e) { errorMessage("Exception in method 'rewind'"); printStackTrace(e); SoundSystemEx...
7f37cb0c-cf5d-43ec-af65-0b5b68d6fdcd
2
public boolean[] readBooleanArray() throws IOException { final int size = this.readInt(); final int byteCount = ceilDiv(size, 8); final boolean[] bools = new boolean[size]; final byte[] data = new byte[byteCount]; this.in.read(data); for (int boolIndex = 0, byteIndex = 0, bitIndex = 7; boolIndex < size; ...
7bbfd92e-01fd-4e46-8ec6-ac4acdbb6a83
2
private String getHtmlLink(String baseUrl, String repositoryName) { if (repositoryName == null || repositoryName.equals(WebConstants.ALL_REPO_FEEDS)) { return Utils.checkUrl(baseUrl.replace(WebConstants.REPO_SERVICE_PATH, "#/repos")); } else { return Utils.checkUrl(baseUr...
d4fd5ff5-fd86-49ad-a2be-f3033f69427b
0
public formMain() { initComponents(); }
e1cc9fc9-3db4-4783-baaa-cb9c9f20077f
9
private void loadSettings() { try { settings.read(); } catch (final FileNotFoundException e) { // this is okay } catch (final IOException e) { e.printStackTrace(); } catch (final NullPointerException e) { e.printStackTrace(); System.err.println("Error reading run control file!"); } // assumin...
c911ed8f-2efe-42bc-ae17-85d1b5761ddf
7
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_RIGHT) { if (Jbb.nx < 300) { Jbb.nx += 10; setTitle(); Jbb.repaint(); } else { System.out.println("too far"); } } if (e.getKeyCode() == KeyEvent.VK_LEFT) { // Invisible image background causes funky coord...
fbb17b47-db07-47df-bb88-f3b638a55e48
9
public static boolean compareNode(TreeNode p,TreeNode q){ if(p.val!=q.val) return false; if((null!=p.left&&null==q.left) || (null==p.left&&null!=q.left)) return false; if((null!=p.right&&null==q.right) || (null==p.right&&null!=q.right)) return false; return true; }
76d5b787-9522-4ba7-8b4e-cdf7fd1c0a7a
4
public void changePassword(int id,String pass) { Connection con = null; PreparedStatement pstmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverManager.getConnection(dbCon.getDATABASE_URL(), ...
98e4abc7-727d-4550-9070-aad96bcc3f8a
2
private void getDataFromWordTable() { try { connection = DriverManager.getConnection(Utils.DB_URL); statement = connection.createStatement(); resultSet = statement.executeQuery("SELECT id, motherlang_word, foreignlang_word FROM word WHERE section_id = '" + AddCard.getSelected...
108de7e5-511c-4425-b88b-0594355c98d4
3
public String getParametersTo(int i) { if (parameters == null) initParameters(); StringBuffer params = new StringBuffer(); int max = (i < parameters.length) ? i : parameters.length; for (i = 0; i < max; i++) params.append(parameters[i] +" "); return params.toString(); }
ec420edc-bda3-48d9-8369-0f83b51c7ebb
7
final byte[] method1272(byte[] is, int i) { if (i != 1) method1276(71); anInt2167++; if (anIntArrayArray2163 != null) { int i_13_ = ((int) ((long) anInt2159 * (long) is.length / (long) anInt2164) + 14); int[] is_14_ = new int[i_13_]; int i_15_ = 0; int i_16_ = 0; for (int i_17_ ...
23c8c51a-7d10-4209-943c-14ba56ac9e6f
0
public int getDimension() { return 7; }
ce985842-0c88-49d3-8e0b-2374f50125c0
2
public long longValueIEEEforBfield() // returns Long value from IEEE double { String s = value.trim(); long r = 0; if(s.length()==0 || s.indexOf("*")>=0) {} else { double d = Double.parseDouble(s); r = Double.doubleToLongBits(d); } return r; }
a2f936ec-af32-48bd-b5e9-a1923b20d38c
9
public static double getPunctuationPercent(String text){ int validChars = 0; int extraSpaceChars = 0; char lastChar = ' '; for (int i=0; i<text.length(); i++){ if (Character.isUpperCase(text.charAt(i)) || Character.isLowerCase(text.charAt(i)) || text.charAt(i) == '"' || (text.charAt(i) == ' ' && lastC...
8d2bb288-15d3-4161-9fae-e4840fe6c988
6
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { if (DefaultXmlNames.ELEMENT_PcGts.equals(localName)){ String str = namespaceURI; //Example: http://schema.primaresearch.org/PAGE/gts/pagecontent/2010-03-19 int pos = str...
8900fe06-da32-4bb0-98ae-0c80579f3171
6
@Override public void paint(Graphics g) { super.paint(g); this.setDoubleBuffered(true); this.setBackground(Color.BLACK); if (matrixOn) { for (PowerUp p : particleList) { switch (type) { case 0: p.drawMatrix(g, c...
46f3552b-46a2-4dfa-bbbd-ae1fc1285b2f
8
public static Iterator<Position> get8NeighborhoodIterator(Position center) { ArrayList<Position> list = new ArrayList<Position>(); int row = center.getRow(); int col = center.getColumn(); int r,c; for (int dr = -1; dr <= +1; dr++) { for (int dc = -1; dc <= +1; dc++) { r = row+dr; c = col+d...
8569646b-e47f-4342-9a8d-51b98065ee4c
6
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=utf-8"); String method = Util.nullToString(request.getParameter("method")); if("viewA...
62d5d3df-a3a6-409b-9465-dc2d7d0acfc7
5
public static RosterDB readCSV (String fName) { RosterDB rosterDB = new RosterDB (); LabeledCSVParser lcsvp = null; try { lcsvp = new LabeledCSVParser( new CSVParser( new FileReader( fName ) ) ); try { while(lcsvp.getLine() != null){ /* System.ou...
ce3f6d7f-0e47-4d85-8a6e-6edddc619792
7
private Location findFood(Location location) { List<Location> adjacent = getField().adjacentLocations(location); Iterator<Location> it = adjacent.iterator(); while (it.hasNext()) { Location where = it.next(); Object character = getField().getObjectAt(where); /...
11bbb9a5-f5b8-463c-8c93-10fd2d25a13c
3
public String getMessage() { StringBuffer buf = new StringBuffer("Invalid constant name(s): "); if (getInvalidConstantNames() != null) { for (Iterator iter = invalidConstantNames.iterator(); iter.hasNext(); ) { buf.append("#$").append(iter.next()); if (iter.hasNext()) { buf.appen...
b4fe86f8-d68d-4bb9-b46a-02d14b6d506d
6
private static Graph readInputFile(final String filename) { Graph graph = null; try { graph = new Graph(getNumberOfVertices(filename)); BufferedReader reader = new BufferedReader(new FileReader(filename)); String line = null; while ((line = reader.readLin...
b427c2d0-2b1f-4072-8d59-b8a2df78ad73
0
public void setjTextFieldCoefNot(JTextField jTextFieldCoefNot) { this.jTextFieldCoefNot = jTextFieldCoefNot; }
4d8cf875-2c2e-4fc2-955a-de1f76b6ef21
0
public void voidMethod() { }
f734abb1-c089-4a16-b23e-fc74f35c095c
3
public void updateTime(int t) { this.startTime = t; if(Parent.Agenda.Smartphone.equals(this.agenda)) { System.out.println("--- "+this.name+" noteert "+ this.startTime + " voert het in de "+ this.agenda); } if(Parent.Agenda.Planboard.equals(this.agenda)) { System.out.println("--- "+this.name+" not...
1efbbe1c-035b-4ad4-a62a-83ade6e4bbb7
6
public void update(Stage stage) { if(source != null) { setCenterPosition(source.getX(), source.getY()); } if(input() != null) { if(hasInputNumbers) { if(!this.getText().get(0).getLine().isEmpty()) Events.get().setInputHolder(Integer.parseInt(this.text)); else Events.get().setInputHold...
25a6c1ff-3db9-41b4-8dd6-a7d7fc007687
2
public void postorderPrint( )//NLR { if (left != null) left.postorderPrint( ); if (right != null) right.postorderPrint( ); System.out.println(data); }
175f4870-1468-442f-9981-9957bc381e4e
1
private static File getSocketFile () throws IOException { String explicitFile = System.getProperty("org.newsclub.net.unix.testsocket"); if ( explicitFile != null ) { return new File(explicitFile); } Path f = Files.createTempFile("junixsocket-test", ".sock"); Files.de...
3237e635-eeb7-4e25-9b57-d7b0784ade18
2
public static void main(String[] args) throws Exception { List<Shape> shapes = new ArrayList<Shape>(); for (int i = 0; i < 10; i++) shapes.add(Shape.randomFactory()); for (int i = 0; i < 10; i++) ((Shape)shapes.get(i)).setColor(Shape.GREEN); //Saving state ...
946422c3-dd4c-4919-b604-d09e0275f5a4
4
@EventHandler public void onBlockBreak(BlockBreakEvent event) { Player player = event.getPlayer(); Block block = event.getBlock(); ItemStack item = player.getItemInHand(); if (!BlockChecker.isNaturallyPlaced(block)) { return; } if (ItemChecker.isTool(plugin, item.getType())) { if (ItemChecker....
334bdeed-250f-4ce4-a076-9e83a09463ce
4
public TemperatureDialog() { super(MainFrame.instance(), "编辑温度", true); setLayout(null); setSize(420, 420); setLocationRelativeTo(null); temperatureDialog = this; JLabel jlbName = new JLabel("温度内容(100字):"); JButton ensure = new JButton("确定"); JButton cancel = new JButton("取消"); jTextArea = new JTextA...
0674a877-5c99-4d76-9de3-5dfe9fae5299
6
public Move02(String data){ if(!data.trim().equalsIgnoreCase("")){ String[] player = data.split(";"); for(String p : player){ try{ String[] split = p.split(","); String playerName = split[0]; float x = Float.pars...
d6398952-d6c0-4cb0-a6e6-a28327800cfd
6
public static void toFile() { try { BufferedWriter writer = new BufferedWriter(new FileWriter( Config.out + "." + Config.format)); if (Config.verbose >= 1) { System.out.println("Generating File : " + Config.out + "." + Config.format); } switch (Config.format) { case "do...
4483b1d9-2b42-466b-b9bd-fdf981ed0e60
0
protected int processAppInfo (byte[] appInfo) { // TBD // if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\tPdbReaderWriter:processAppInfo"); } return SUCCESS ; } // end method processAppInfo;
5ed89a49-78cd-43be-b04e-dc70f9288de2
4
private CycAccess getCyc() { if (cycAccess == null) { if (SHOULD_SET_CONNECTION_PARAMS_INTERACTIVELY && !areConnectionParamsSet) { cycAccess = CycAccess.getNewCycAccessInteractively(); hostname = cycAccess.getHostName(); port = cycAccess.getBasePort(); areConnectionParamsSet = ...
fef7afa4-ae38-4d6b-8273-f0906cc7bc58
4
public final boolean subsetOf(final Set<A> s) { if (isEmpty() || s.isEmpty()) return isEmpty(); else { final P3<Set<A>, Option<A>, Set<A>> find = s.split(head()); return find._2().isSome() && l().subsetOf(find._1()) && r().subsetOf(find._3()); } }
d010d822-35cc-4041-a7f8-71968f89b788
1
public static int summ(int[] array) { int sum = 0; for (int i = 0; i < array.length; i++) { sum += array[i]; //sum = sum+array[i] }//System.out.println("Сумма элеметнов массива = "+sum); return sum; }
204d1faa-ba7c-4fe0-94ac-b83751dfe48c
0
public double getArea(){ return area; }
1630244a-b804-4ff4-b4d0-55be53e32824
7
public static MVD internalise( File src ) throws Exception { // use DOM3 to parse DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); LSParser parser = impl.createLSParser( DOMImplementa...
80588894-9a64-4251-b9c3-6f5d1f7f08ab
9
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT) { if (ship != null) leftPressed = true; //sets the boolean to true. } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { if (ship != null) rightPressed = true; //set the boolean to true. } else if(e.get...
782179b7-7759-48ac-97f8-37f0d60f32f1
0
public Node getTargetParent() {return targetParent;}
40fb0929-8ed9-4354-a3ca-e60dba90d8a9
7
public static void writeFileOaks(ArrayList<Oak> list1) { ObjectOutputStream os = null; try { os = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream("fw.txt"))); os.writeObject(list1); // os.close(); } catch (InvalidObjectException e) { System.out.println("Error7"); } catch (In...
22676fe1-951e-44be-b8bf-8d97ff797641
8
@Override protected void update(GameContext g) { if (isDead) return; if (ghostDuration > MAX_GHOST_DURATION) isGhost = false; color = Parameters.DOT_COLOR; Vector newPos = Vector.add(position, velocity); if (newPos.x < 0 || newPos.x > model.getMapDims().width - dims.width) { velocity.x = velocity...
27736815-365c-4718-8740-e9944a0950ee
5
public void eliminar(String numero){ NodoNumeros q = this.inicio; NodoNumeros t = null; boolean band = true; while(q.getInfo() != numero && band){ if(q.getLiga() != null){ t = q; q = q.getLiga(); }else{ band = false; } } if(!band){ System.out.println("No se encuentra numero"); ...
7c1189ec-c712-4397-a22b-0ae1c6b8b744
6
public static void sort(int[] array) { if (array == null) return; int maxDivisor = findMaxDivisor(array); // iterate through one digit per loop, starting from LSD for (int divisor = 1; divisor <= maxDivisor; divisor *= BASE) { // create list of buckets ArrayList<ArrayList<Integer>> list = new Arr...
ffb7adab-2163-441f-97fa-c0cf603154bd
2
public void fine(String... msg) { if (!open) throw new RuntimeException("Cannot log new items: the log has closed!"); if (parent != null) parent.fine(msg); else { Object[] args = new Object[msg.length - 1]; System.arraycopy(msg, 1, args, 0, msg.length - 1); logQueue.offer(new LogItem(Level.FINE, St...
f966006f-dac9-4c46-b00e-c5d018ae4c18
8
public DumbNetworkerRouter(int port) throws Exception { // just do the reading loop in the ctor with foreverblock. // this doesn't do anything while there's no input. it can // forget about peers after the unblocking occurs. ByteBuffer in = ByteBuffer.allocate(65536); ByteBuffer pingOut = ByteBuffer.al...
0f0f28a7-63ba-4f4d-8d6d-c2bfeedac0d8
0
public void setCtrlM(CtrlMenu ctrlM) { this.ctrlM = ctrlM; }
bb652740-46e8-4bf5-afe1-0ab1fdf3a97f
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BasicPredGraph<N, E> other = (BasicPredGraph<N, E>) obj; if (internalNode == null) { ...
b4dbb563-1693-4334-8e28-65ab381bae97
3
public void ok() { if (comboBox.getSelectedIndex() < 2) mcdlien.setCardMin("0"); else mcdlien.setCardMin("1"); if (comboBox.getSelectedIndex() == 0 || comboBox.getSelectedIndex() == 2) mcdlien.setCardMax("1"); else mcdl...
3fb77914-8b43-4f50-8863-f5d87c6a19c5
4
@Override public void update() { for (Dish tmp : dishs) { if (storage.avaiable(tmp)) { if (!availableDishs.contains(tmp)) availableDishs.add(tmp); } else { if (availableDishs.contains(tmp)) availableDishs.remove(tmp); } } }
40e5e3f5-1c22-4bc8-af90-c83babe160be
3
private void solve() { while (true) { // find entering column q int q = bland(); if (q == -1) break; // optimal // find leaving row p int p = minRatioRule(q); if (p == -1) throw new ArithmeticException("Linear program is unbounded"); ...
40b14329-43b0-4186-96ff-1501836f2f09
1
private void writeParaToCfg (File file, String srcSeqPath, String dstSeqPath, String seqName, String frameRate, String frameSkip, String width, String height, String totalFrames, String qp) { try { BufferedWriter writer = new BufferedWriter(new FileWriter(file)); writer.write("InputFile ...
ceaa8994-4d3a-4168-b1c2-03cadba3b9b9
1
private void showBowl(int[] bowl) { String str = "|"; for (int i = 0; i < bowl.length; i++) { str += " " + bowl[i] + " |"; } str += "\n"; System.out.println(str); }
b15f44c7-98c4-40f7-8eb7-c20ddb9d6576
0
@Override public void validerTransaction() throws SQLException { getConnexion().commit(); getConnexion().setAutoCommit(true); }
c89cf857-7055-4680-a1fd-bd76cba57f7d
4
public Object construct () throws InvocationTargetException { try { Object[] parameters = new Object[parameterValues.length]; int i = 0; for (ParameterValue parameter : parameterValues) { if (parameter == null) throw new InvocationTargetException(new YamlException("Missing constructor property: " + ...
f668c65f-961f-4db3-9adf-7e0a008fdd1b
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 fe...
1526eaa0-1d02-49e1-bc78-a699bba95a81
7
public static int svm_check_probability_model(svm_model model) { if (((model.param.svm_type == svm_parameter.C_SVC || model.param.svm_type == svm_parameter.NU_SVC) && model.probA!=null && model.probB!=null) || ((model.param.svm_type == svm_parameter.EPSILON_SVR || model.param.svm_type == svm_parameter.NU_SVR) &&...
dd6cc9bf-0912-4b28-9639-a4f14399ff0b
8
private void addRow(String row) { StringBuilder ss = new StringBuilder(row); String s1 = ss.toString(); int l = 0; String columnType; while (ss.length() > 0) { s1 = StringParser.getFirstSubstring(ss, ";"); for (Column column : columns) { co...
511ed5d8-eb33-4c32-b810-a495d29b8b8e
1
public static void main(String[] args) { // Working with Strings System.out.println("The scruffy dog said, \"WOOF WOOF\""); System.out.println("Transportation types: bike\\car\\airplane"); String surprise = "Boo!"; System.out.println(surprise.toLowerCase()); System.out.println(surprise.toUpperCase()); ...
edd871fa-4e17-478e-a85b-a4275ef21372
5
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed DefaultTableModel model1 = (DefaultTableModel) jTable2.getModel(); int bookcode = 0; int n = 0; String bookname = null; String query; int issuerid; int ...
73da40f5-4934-45fd-a152-71960e844799
0
protected void init() { checkedItems = new boolean[this.getModel().getSize()]; class MyCellRenderer extends JCheckBox implements ListCellRenderer { public MyCellRenderer() { setOpaque(true); } public Component getListCellRendererCompon...
e8b70fca-bbb3-42ac-85d3-8e2a13c490cc
8
int findlengthLongestPalindrome(String s){ if(s==null || s.length() == 0) return 0; else{ char arr[] = s.toCharArray(); int[][] dp = new int[arr.length][arr.length]; for(int i=0;i<arr.length;i++){ for(int j=0;j<arr.length-i;j++){ ...
37b9637b-aa25-48a3-ad11-62b0bb4317e1
3
@Override public void serialize(Buffer buf) { buf.writeInt(fightId); buf.writeByte(fightType); buf.writeUShort(fightTeams.length); for (FightTeamInformations entry : fightTeams) { entry.serialize(buf); } buf.writeUShort(fightTeamsPositions.length); ...
01cb0df9-b2f9-4a2d-a1c1-7e4bc7ac90bd
6
public static void copy(Object src, Object dst) { try { for (Method getter : src.getClass().getDeclaredMethods()) { final String getterName = getter.getName(); if (!getterName.startsWith("get") || getter.getReturnType() == void.class) continue; ...