method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
217d8c78-cffb-401c-b086-9607e9aa3206
7
private void declaration(Declarations ds, Functions functions) { // grab the Type Type type = type(); while(currentToken.type() != Token.Type.Eof){ // grab variable name from current token Variable v = new Variable(currentToken.value()); // skip identifier match(Token.Type.Identifier); if(cu...
25949335-f1a2-4ca7-a6d0-037d2f5ce4fb
4
public void tick(GameMaster game) { // update the collision box to move with the player collisionBox.setBounds(x, y, width, height); // Moving the player up if(moveUp == true && y > 0) { y -= speed; } // Moving the player down if(moveDown == true && y + height <= game.getHeight()) { y += speed; ...
e23c9d43-acab-46b4-96e1-9c0e2c5a1b34
5
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.setContentType("text/html"); PrintWriter out = response.getWriter(); HttpSession session = request.getSession(); if (session == null || session.get...
a28be8e5-d0a5-44d3-96e5-3c41e3d32127
3
public void mousePressed(MouseEvent arg0) { switch( choixBouton ){ case 0: Partie.getInstance().cliqueFinTour(); break; case 1: Partie.getInstance().cliqueFinRedeploiement(); break; case 2: Partie.getInstance().cliqueDeclin(); break; } }
1a37b81f-5fe6-4082-b300-840de8726c18
2
@PostConstruct public void init() { LOG.info("Startup ..."); if (createDemoData) { LOG.info("creat demodata..."); Viewport vp = vr.findOrCreateMainViewport(); vr.initViewport(); for (int c = 0; c < 5...
d82809dd-2c26-4778-90f7-8b354a2dc1b0
2
public int donnerStock (int dons){ if(dons > 0) this.compteur = 0; if(this.stock + dons > MAX_STOCK){ int r = MAX_STOCK - this.stock; this.stock = MAX_STOCK; return r; } else{ this.stock += dons; return 0; } }
0ceeeb9c-26a2-430f-b789-00a93f3084e7
5
@Override public void run() { DatagramSocket ssdp = null; try { // Create socket bound to specified local address ssdp = new DatagramSocket(new InetSocketAddress(ip, 0)); byte[] searchMessageBytes = searchMessage.getBytes(); ...
8705b941-9655-4895-b80e-8baa7f8f8f58
8
public void processFrames(String path) { GSR gsr = new GSR(); BufferedWrapper bWrap; BufferedImage currentImage; int cropStartX, cropStartY, cropWidth, cropHeight; JFrame statusFrame = new JFrame(); statusFrame.setPreferredSize(new Dimension(500, 100)); JPanel content = new JPanel(); ...
f8833ede-a148-4705-b342-28ad48b0d50d
9
static void withModeKeyGamesAndServer(final String mode, final String key, final int numberOfTurns, final URL serverUrl) { System.out.println("\nConnecting to Vindinium server at " + serverUrl); State state = null; final HashMap<String,String> initParams = new HashMap<String,String>(1); ...
6b417480-98f4-4077-8d92-bce8dd9e6dce
1
public void gameLoop() { long startTime = System.currentTimeMillis(); long currTime = startTime; while (isRunning) { long elapsedTime = System.currentTimeMillis() - currTime; currTime += elapsedTime; // update update(elapsedTime);...
f9f24c73-4548-4a0d-a61b-c3c2da38f06a
7
public Message(String message) throws InvalidMessage { int prefix_end = -1; int trailing_start; String[] tmp; String trailing = null; if (message == null || message.length() < 1) { throw new InvalidMessage("<<empty message>>"); } // grab the prefix if (message.charAt(0) == ':') { prefi...
eb37bffc-59a9-46d1-a316-cabc1cd269bc
2
public void updateCombinedImage() { //draw layers on top of one another combinedImage = new BufferedImage(JIP.iWidth, JIP.iHeight, BufferedImage.TYPE_INT_ARGB); Graphics g = combinedImage.getGraphics(); for (BufferedImage i : layers) { g.drawImage(i, 0, 0, null); } //draw graphics layer on top of ever...
e74d45c5-6a96-4562-9b9e-8e1f5902fe5b
1
public BenchControls() { setTitle("Crosslink - Java"); getContentPane().setLayout(null); setSize(1030, 514); JLabel lblIp = new JLabel("IP :"); lblIp.setBounds(10, 54, 46, 14); getContentPane().add(lblIp); ipAddr = new JTextField(); ipAddr.setEnabled(false); ipAddr.setBounds(33, 51, 86, 20); g...
12e7f7b7-a7e2-4baa-be07-222aaa3fdbe4
4
static protected void AdjustBuffSize() { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = 0; available = tokenBegin; } else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ...
38e0b527-0114-4552-8381-daea08d078ab
3
public List<DataRow> select(DataRow parameters) { synchronize(); List<DataRow> result = local.select(parameters); for(DataRow row : result) { if(row.containsAttribute("date")) { row.removeAttribute("date"); } if(row.cont...
0862ec95-4029-44b9-88fb-e351ff81867d
2
public static BmTestManager getInstance() { if (instance == null) synchronized (lock) { if (instance == null) instance = new BmTestManager(); } return instance; }
e0fa1ba2-6c13-4e76-807a-d85b3a7b9460
9
public static boolean copyFolderContents(String src, String dst, boolean recursive){ File srcDirectory = new File(src); File dstDirectory = new File(dst); if(srcDirectory.exists() && srcDirectory.isDirectory()){ if(!dstDirectory.exists()){ MessageGenerator.briefError("ERROR: Could find destination director...
c6cffea6-b546-4ef6-a7aa-5db3e884362c
7
public String getQueryString() { if (options == null) return ""; String s = name + "="; int n = 0; int count = options.size(); HtmlOption o = null; if (model instanceof DefaultComboBoxModel) { DefaultComboBoxModel cbm = (DefaultComboBoxModel) model; for (int i = 0; i < count; i++) { if (cbm.get...
895484da-b03e-4914-89f0-b21efc5fae9d
7
void write(JDefinedClass c) { // first collect all the types and identifiers mode = Mode.COLLECTING; d(c); javaLang = c.owner()._package("java.lang"); // collate type names and identifiers to determine which types can be imported for( ReferenceList tl : collectedReferen...
29286557-c5cd-4faf-b621-ce3e55817191
7
public boolean step() { if (!assembler.execute(pc)) { if (NOPcount == 0) { done = true; NOPcount++; } else if (NOPcount == 6) { return false; } else { NOPcount++; } } registerFile.execute(); controller.execute(); alu.execute(); dataMemory.execute(); assembler.write(); regis...
94088dc9-b7d6-40f7-b5b1-21000f38297e
6
public void onTick(Instrument instrument, ITick tick) throws JFException { if (ma1[instrument.ordinal()] == -1) { ma1[instrument.ordinal()] = indicators.ema(instrument, Period.TEN_SECS, OfferSide.BID, IIndicators.AppliedPrice.MEDIAN_PRICE, 14, 1); } double ma0 = indicators.ema(instru...
2359d0cc-937b-4e5f-b17d-8b1208ad5d0b
0
public void setV(int a){ velocity = a; }
a90d86da-345d-4a1b-b10f-63875cf48a6c
8
public void rememberFile(String fileName, final JMenu recentFilesMenu) { if (historyMap == null) return; if (fileName == null) return; int max = RECENT_FILES.length; if (recentFiles.contains(fileName)) { recentFiles.remove(fileName); } else { if (recentFiles.size() >= max) recentFiles.remove...
b942c675-946b-46c3-bb55-594ae04df202
5
public void cargarEstadisticas(JTextField idProd, JTextField dia, java.util.Date desde, java.util.Date hasta) { if (desde != null && hasta != null) { abrirBase(); tablaEstadisticas.setRowCount(0); if (idProd.getText().trim().length() == 0) { listaProd = Produc...
71ce74ae-c3f0-4f0a-acc4-9041a3aa873c
2
public double getPhaseConstant(){ if(this.distributedResistance==0.0D && this.distributedConductance==0.0D){ this.generalPhaseConstant = this.omega * Math.sqrt(this.distributedInductance * this.distributedCapacitance); } else{ this.generalPhaseConstant = Complex.sqrt(this...
19bb1fbf-e827-4d8e-99cf-0bb59606dbb1
2
public String toString() { StringBuffer b = new StringBuffer(); for (int i = 0; i < getLocals(); ++i) { b.append(getLocal(i)); } b.append(' '); for (int i = 0; i < getStackSize(); ++i) { b.append(getStack(i).toString()); } return b.toString...
89eace47-610b-4fd9-8425-91e7428534de
4
private void drawCoordinates(Graphics g) { // Numbers g.drawString("1", scale.getOriginX()+scale.getScale()-3, scale.getOriginY()+scale.getScale()+5); g.drawString("1", scale.getOriginX()-20, scale.getOriginY()+scale.getScale()+scale.getScale()*(-2)+5); // Right side for(int i=sc...
a7eb3e23-1653-4d67-8a2b-e9874d84e3ac
5
private SocketProvider initDataSocket(Command command, Reply commandReply) throws IOException, FtpIOException, FtpWorkflowException { setConnectionStatusLock(CSL_INDIRECT_CALL); setConnectionStatus(FTPConnection.BUSY); if(isPretSupport()) { Command pretComma...
d0d6b2b8-655e-4268-81a4-52d847373d36
6
public void download() { try { int i = 1; File file = new File("xkcdImages.txt"); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String link = ""; while((link = reader.readLine()) != null) { if(i == 100 || i == 1037 || i == 404) { System.out.p...
4cfe13b9-1923-4e31-ac27-72dae30226b7
6
@Override public void loop() { switch (step) { case 0: if(Motors.movement.isMoving()){ if(System.currentTimeMillis()>time){ Motors.movement.stop(); reset(); step++; } } else{ Motors.movement.forward(); } break; case 1: if (delta()>500){ Motors.movement.stop(); ...
8b687b8b-d4e9-4cbe-a1f3-84282e7e34fc
8
public void drawAlphaTextWithShadow(String text, int x, int y, int currentColour, int seed) { if (text == null) return; /* * Set the seet for the RNG. */ random.setSeed(seed); /* * Generate a random alpha value that is more * opaque than the shadow (192 is the alpha value * for the sh...
996decf1-4dea-44a8-89b3-a89cd4d6bdd5
6
public String toString() { if (x != 0 && y > 0) { return x + " + " + y + "i"; } if (x != 0 && y < 0) { return x + " - " + (-y) + "i"; } if (y == 0) { return String.valueOf(x); } if (x == 0) { return y + "i"; } // shouldn't get here (unless Inf or NaN) return x + " + i*" + y; }
9d3bb1f9-5767-4983-a837-995fb4f149ad
7
public int Run(RenderWindow App) { boolean Running = true; Text VictoryText = new Text(); Font Font = new Font(); try { Font.loadFromFile(Paths.get("rsc/font/Frank Knows.ttf")); } catch (IOException e) { e.printStackTrace(); return (-1); ...
0407f8bb-e629-48fc-ab3c-2c350f648ae9
8
public void install(JTextComponent tc) { boolean replaceTabs = false; if (tc instanceof RSyntaxTextArea) { RSyntaxTextArea textArea = (RSyntaxTextArea)tc; markOccurrencesEnabled = textArea.getMarkOccurrences(); textArea.setMarkOccurrences(false); replaceTabs = textArea.getTabsEmulated(); } ...
3dd280b6-334c-4c11-b339-4973083d250f
9
@Override public Command planNextMove(Info info) { try{ this.enemies = info.getEnemies(); this.bullets = info.getGrenades(); this.position.x = info.getX(); this.position.y = info.getY(); this.direction_vector = this.getVectorFromAngle(info.getDire...
68916049-febb-47ec-b733-3d29f59f8213
3
public void showGame() { image.setVisible(true); for (Base b : Game.getInstance().getBaseManager().getBases()) { b.setVisible(true); } for(GroupAgent a : Game.getInstance().getAgentManager().getAgents()){ a.setVisible(true); } for(Tower t : Game.getInstance().getTowerManager().getTowers()) { t.setV...
d100f40d-ffdc-4794-99e1-4926366cbcfb
4
public static String descriptionFor(Trait trait, float level) { String bestDesc = null ; float minDiff = Float.POSITIVE_INFINITY ; int i = 0 ; for (String s : trait.descriptors) { float value = trait.descValues[i] ; if (value > 0) value -= (trait.maxVal - level) / (trait.maxVal - 1) ; if (...
8e7dfb8a-1211-4888-b448-56037bad1c03
4
public static int associated(int from, int end) { Queue<Point> q = new LinkedList<Point>(); BitSet vis = new BitSet(nNodes + 1); Point node = new Point(from, -1); int next = 0; q.add(node); vis.set(from, true); while (!q.isEmpty()) { node = q.poll(); for (int i = 0; i < ady[node.x].size(); i++) { ...
648b985e-dbeb-46ee-807f-c78d88a04b84
7
@Override public JView load() { if (loaded) return this; String body = null; try { body = JHttpClientUtil.postText( context.getUrl() + JHttpClientUtil.Views.URL, JHttpClientUtil.Views.GetView .replace("{listName...
af330765-49d3-49b0-a413-b70c9e520aaa
3
void scrollPalette(ScrollBar scrollBar) { if (image == null) return; Rectangle canvasBounds = paletteCanvas.getClientArea(); int paletteHeight = imageData.palette.getRGBs().length * 10 + 20; if (paletteHeight > canvasBounds.height) { // Only scroll if the palette is bigger than the canvas. int y = -scroll...
502ccbc4-39f1-43cd-97b0-e3485ce8869d
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final MainMenu other = (MainMenu) obj; if (this.enabled != other.enabled) { return false; }...
c9b0ef28-3a3a-4a00-86eb-9cd2b4dba495
0
public Moover(int b) { super(b); }
7b7a1b54-b487-4dfb-b91a-e7f3ffae13cb
2
public Object get(String key) throws JSONException { if (key == null) { throw new JSONException("Null key."); } Object object = this.opt(key); if (object == null) { throw new JSONException("JSONObject[" + quote(key) + "] not found."); } return obje...
d4584ec4-db61-451c-a80f-a77b42126927
7
public void setMission(Mission mission) { final Mission oldMission = this.mission; if (mission == oldMission) { return; } else if (oldMission == null) { if (!mission.isOneTime()) { logger.fine("Replacing null mission with " + mission); } ...
10cb4c04-1841-4fd1-a1f5-1841dc9c236c
6
static public void main(String args[]) { double x, y; String prefix = null; OSNI osni = new OSNI(); if (args.length < 2) { /* * Slieve Donard */ x = 335788.01; y = 327685.85; } else { if (args.length == 2) { Double d; d = new Double(args[0]); x = d.doubleValue(); d = new ...
4ea7f6eb-9031-4dc6-b5c1-ebb9e371fbda
6
public void login() throws Exception{ Member loginmem = new Member(); String id; int loginputcomplete =1; do{ System.out.println("[̵ Է]"); scan.nextLine(); id = scan.next(); //缭 缭 ̵ 123 if((id.equals("0000123")) == TRUE){ //Է id 0000123(缭 ID) ġʴ´ٸ if(membercollect.getequal(id)==-1){ //i...
614dcf0a-05ee-436e-90b0-9b87fb462572
5
private void t5CaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_t5CaretUpdate jScrollPane1.setVisible(false); jScrollPane2.setVisible(true); DefaultTableModel model1 = (DefaultTableModel) jTable2.getModel(); int bookcode = 0; int n = 0; String query; ...
09015f22-b9c0-45e2-92cc-5fda037dc552
0
@Test public void itShouldSerializeAPoint() throws Exception { Point point = new Point(100, 0); assertEquals("{\"coordinates\":[100.0,0.0],\"type\":\"Point\"}", mapper.toJson(point)); }
e99e8486-8553-441e-bfd0-43895f590c1a
1
@Override protected void paintComponent(Graphics gc) { super.paintComponent(GraphicsUtilities.prepare(gc)); Rectangle bounds = getBounds(); bounds.x = 0; bounds.y = 0; int step = getStep(); int count = getComponentCount(); for (int i = 0; i < count; i += step) { Rectangle compBounds = getComponent(i)....
b5ce2cca-f951-4282-a214-221f8ea57fc7
5
@Test public void testRollbackingState() throws ProcessExecutionException, ProcessRollbackException { IProcessComponent<?> comp = TestUtil.executionSuccessComponent(true); // use reflection to set internal process state TestUtil.setState(comp, ProcessState.ROLLBACKING); assertTrue(comp.getState() == ProcessS...
bd407a37-11e5-4d1d-9a38-8df07b69e24c
3
public void open() { Display display = Display.getDefault(); int result = createContents(); if (result == 1) return; shlFnirsDataProcessing.open(); shlFnirsDataProcessing.layout(); while (!shlFnirsDataProcessing.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
ad41ab62-4222-412b-b9c0-f4ae99a9286b
6
public Parser(List<File> inputFiles, File outputFile, char[] wordCharacters, Locale locale, char[] additionalInnerWordCharacters, int maxListSize) throws IOException { if (inputFiles.size() == 0) throw new IllegalArgumentException("Files list should be at least 1 size."); for (File inputFile...
cf7ce145-ef17-41cd-8d3d-275fd4b01f1f
5
public void run() { try { PrintWriter pw = null; if (os != null) pw = new PrintWriter(os); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = null; while ((line = br.readLine()) != null) { ...
6f828e22-1c8a-4a71-bac3-4effb67c18a5
9
@WebMethod(operationName = "RegistrarCierre") public String RegistrarCierre(@WebParam(name = "validador") String validador, @WebParam(name = "rad_Numero") String rad_Numero, @WebParam(name = "rad_Comentarios") String rad_Comentarios) { consultas con = new consultas(); utilidades ut = new utilidades(...
2460f439-b950-4e92-96e4-b9b1a090ce5b
6
public List<TransactionRecord> query(final Date startDate, final Date endDate, final int startRow, final int endRow, Criteria[] searchCriteria) throws BeanstreamApiException { if (endDate == null || startDate == null) throw new IllegalArgumentException("Start Date and End Date cannot be null!");...
0deb529a-fa99-4f44-8c63-afd38bca3336
6
public void findClosestCities() { System.out.println("Enter the number of closest cities to the current city you would like."); input.nextLine(); int n= input.nextInt(); while(n<1||n>map.getSize()-1) { System.out.println("Sorry I think your input was invalid, please try again."); System.out.println("En...
94c2f51f-b9d7-4b24-a0a9-f64ffc9ec537
7
*/ public void selectDestination(Unit unit) { Location destination = gui.showSelectDestinationDialog(unit); if (destination == null) return; // user aborted if (setDestination(unit, destination) && freeColClient.currentPlayerIsMyPlayer()) { if (destination instanceof...
ce1c828b-8e51-4e81-8cc8-5a39e6cfcf7e
9
private void createContentPane() { if (contentPane != null) return; contentPane = new JPanel(new BorderLayout()); ActionListener okListener = new ActionListener() { public void actionPerformed(ActionEvent e) { cancel = !confirm(); dialog.dispose(); } }; JPanel p = new JPanel(new FlowLayou...
4a6149df-c303-443d-9f59-cb2c823cdd72
7
private boolean r_Step_1c() { int v_1; int v_2; // (, line 93 // [, line 94 ket = cursor; // or, line 94 lab0: do { v_1 = limit - cursor; lab1: do {...
7faaff19-6e7a-4484-bb0e-ce24d73b1940
2
public Deal RechercheParId(int idDeal) { PrestataireDeServiceDAO psdao = new PrestataireDeServiceDAO(); try { String sql = "SELECT * FROM deal WHERE idDeal='" + idDeal + "'"; ResultSet rs = crud.exeRead(sql); Deal d = new Deal(); while (rs.next()) { ...
0600b2f3-fe35-4a5d-aae5-3ec6db7fcdf9
5
@SuppressWarnings("unchecked") boolean getBooleanValue(Object obj, int k) { if ((obj instanceof ArgHolder<?>) && ((ArgHolder<?>) obj).getType().equals(Boolean.class)) { return ((ArgHolder<Boolean>) obj).getValue(); } else if (obj instanceof boolean[]) { return ((boolean[]) obj)[k]; } e...
e2e61ad4-fbd3-4209-9130-a787c24b0854
2
private boolean validate(String userID) { // TODO Auto-generated method stub if(userID.equals(user)){ if(occurance<3) return true; else return false; } else{ occurance=0; return true; } }
6027ce71-0ab7-40cf-9c5e-e873574c832c
1
private int getNumberOfPages(int listSize) { int numOfPages = listSize / RECORDS_PER_PAGE; if (listSize % RECORDS_PER_PAGE > 0) { numOfPages++; } return numOfPages; }
7ecb38a0-d35e-4648-b701-114f55133eeb
3
@Override public void run() { long diff; while (monitor.isAlive()) { while ((diff = waitTime - System.currentTimeMillis()) > 0) { try { Thread.sleep(diff); } catch (InterruptedException e) { throw new RTInterrupted(...
de37a227-da4c-464b-893a-f29705ab9291
8
public boolean achievements(MOB mob, List<String> commands) { final boolean accountSys = CMProps.isUsingAccountSystem(); if(commands.size()<((accountSys)?4:3)) { if(accountSys) mob.tell(L("You have failed to specify the proper fields.\n\rThe format is MODIFY ACHIEVEMENT (PLAYER/ACCOUNT/ALL) [TATTOO]\n\r")...
e234aade-e959-4b3c-aa8c-5aa496e25463
5
@Override public void drop(DropTargetDropEvent dtde) { if (mDragWasAcceptable) { dtde.acceptDrop(dtde.getDropAction()); if (mModel.getDragColumn() != null) { dropColumn(dtde); } else { Row[] rows = mModel.getDragRows(); if (rows != null && rows.length > 0) { dropRow(dtde); } } dt...
edc0a1aa-3c19-4f5e-ad11-015604b58bd3
8
protected JPanel createDaysGUI() { JPanel dayPanel = new JPanel(true); dayPanel.setLayout(new GridLayout(0, dayNames.length)); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MONTH, month); calendar.set(Calendar.YEAR, year); ...
a648d981-03b8-4412-9d0f-770bd6acaa62
4
public void addNode(Node newNode) { int comp = newNode.data.compareTo(data); if (comp < 0) { if (left == null) { left = newNode; left.parent = this; } ...
e87f55b2-6d02-42f7-889b-fc80e13efbf6
9
public String convertHarga(int harga){ // jadi tar kalo 50000 jadi 50.000 dst... // harga = 444; int ribuan[] = new int[10]; int counter=0; String temphasil=""; while(harga/1000!=0){ ribuan[counter] = harga%1000; counter++; //temphasil = temphasil + ribuan+"."; ...
0cc301cb-9e2c-46d1-9c81-71a844b4fabb
3
public Object open(boolean _restoreBackup) { restoreBackup=_restoreBackup; createContents(); shell.open(); shell.layout(); mySelf = this; if( _restoreBackup ) { setText(Messages.Backup_0); } else { setText(Messages.Backup_1); } Display display = getParent().getDisplay(); while (!shell.isDi...
d2cd08d3-09cb-4a1a-80c3-4ff5d3e34b8d
3
public void sendString(String msg, MultipleTalkServer server, String str) { try { for (int i=0; i < server.socket.size()-1; i++){ if(str.equals(server.socket.get(i).getName())){ OutputStream ostream = server.socket.get(i).getSocket().getOutputStream(); ...
4f86a18c-1dd4-4650-b053-f923c4b33f06
0
public int getID(){ return id; }
59b473e4-bd3e-4358-afe9-7c08b1af1ef2
4
public void initComponents() { UIManager.put("TextArea.margin", new Insets(10, 10, 10, 10)); jPanel = new JPanel(); jScrollPane1 = new JScrollPane(); output = new JTextArea(); jScrollPane2 = new JScrollPane(); input = new JTextArea(); font = new Font(Font.SANS_SERIF, Font.PLAIN, 20); undo = new UndoMan...
480de3b4-3325-474b-9bbe-d25a1328d5f0
7
public static void startupGenerate() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, ((Mod...
b0a81b99-95a4-4aba-be28-601acbc79f70
1
private void gameSetup() { playerGrid = new BattleFieldGrid(game, true); JButton buttonApplyShips = new JButton("Apply ship settings"); buttonApplyShips.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ...
2ea7d5e7-c03e-43fe-bb9c-55f6cfd49a73
5
private boolean backupEFS() { new Thread() { @Override public void run() { BufferedReader reader = null; List<String> args = null; ProcessBuilder process = null; Process pr = null; String line = null; ...
1e4c6fa1-b24f-4994-87ec-0cf5596dfb89
5
@Override public String getText() { BufferedReader br = null; String everything = ""; try { br = new BufferedReader(new FileReader(file)); StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != nul...
7022ba0c-d7e5-41ea-934f-b03b95a32489
5
public ArrayList<ArrayList<Integer>> levelOrder(TreeNode root) { ArrayList<ArrayList<Integer>> order = new ArrayList<ArrayList<Integer>>(); if (root == null) return order; Queue<TreeNode> queue = new LinkedList<TreeNode>(); queue.offer(root); int currentLevelCount = 0; int next...
69179e02-103a-4280-b9bf-167141beac66
6
private void draw(LineSegment lineSeg, long initialTime, long endTime) { long drawTime = endTime - initialTime; double initX = originX + lineSeg.start.x; double initY = originY - lineSeg.start.y; double finalX = originX + lineSeg.end.x; double finalY = origi...
c630d32b-b22f-48f1-9480-e47318c33efd
2
public StdImage getImage() { StdImage offscreen = null; synchronized (getTreeLock()) { Graphics2D gc = null; try { Rectangle bounds = getVisibleRect(); offscreen = StdImage.createTransparent(getGraphicsConfiguration(), bounds.width, bounds.height); gc = offscreen.getGraphics(); Color saved = g...
fa2374a9-dae2-4b76-b4d2-964dde1a1654
4
private static int _getScore(Proxy proxy) { byte[] imageBytes = proxy.send(new ProxyScreenshotMessage()); int score = -1; BufferedImage image = null; try { image = ImageIO.read(new ByteArrayInputStream(imageBytes)); } catch (IOException e) { e.printStackTrace();...
70c6561f-4836-4da8-87fb-9bc24927afe9
6
public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { String s = remapper.mapMethodName(className, name, desc); if ("-".equals(s)) { return null; } if ((access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED)) == 0) { ...
6755c336-5894-4163-885c-7e36193f11a9
7
public static int updateHeadFile(int tid, File fileName) { int result = 0; Connection con = DBUtil.getConnection(); PreparedStatement pstmt = null; FileInputStream fis = null; try { fis = new FileInputStream(fileName); pstmt = con.prepareStatement("update mstx_head set tdata=? where tid=?"); pstmt.se...
b3fd96a9-6262-498a-9c84-60c7e3bc4e3f
0
public PlotBuilder() { }
9599be26-1d74-497f-a3da-251af019fdfb
7
private void clickPixel(int x, int y) { int pixel_x = x / this.pixelSize; int pixel_y = y / this.pixelSize; // int tmp_s = 0; while (pixel_x < 1) pixel_x++; while (pixel_x >= this.tabSizeX - 1) pixel_x--; while (pixel_y < 1) pixel_y++; while (pixel_y >= this.tabSizeY - 1) pixel_y--; if (pi...
e6567b02-33b9-4284-ad3f-338c60d5cfc0
4
public static String toString(JSONObject o) throws JSONException { StringBuffer sb = new StringBuffer(); sb.append(escape(o.getString("name"))); sb.append("="); sb.append(escape(o.getString("value"))); if (o.has("expires")) { sb.append(";expires="); sb.ap...
6a4cb268-5c9f-4a93-9cf5-50172f2e3f51
0
public void download() { this.share(0); }
cb958b89-926e-402c-87c7-b85b931a285c
2
private InputStream getInputStream(String url) { // TODO: Sanitize strings InputStream is = null; HttpGet lyricsGet = new HttpGet(url); try { HttpResponse response = this.httpClient.execute(lyricsGet); is = response.getEntity().getContent(); } catch (ClientProtocolException e) { // TODO Auto-genera...
19a3404c-5e05-4e48-80fd-f911e6d637d2
0
public void setFirstpoint(Point firstpoint) { this.firstpoint = firstpoint; }
f14663d4-332e-4f5d-9e7a-3ee60a9f731b
3
private static void LogicalOperators() { System.out.println("Start of LogicalOperators"); boolean b1 = false; boolean b2 = true; boolean b3; System.out.println("Value of b1: " + b1 + " Value of b2: " + b2); b3 = b1 && b2; System.out.println("Value of b1 && b2: " + b3); System.out.println("\n"); ...
14255830-523f-4ea6-ac67-c6f2933d1fc5
9
private static boolean isREWhiteSpace(int c) { return (c == '\u0020' || c == '\u0009' || c == '\n' || c == '\r' || c == 0x2028 || c == 0x2029 || c == '\u000C' || c == '\u000B' || c == '\u00A0' || Character.getType((char)c) == Ch...
cbdcd56c-a9ba-4525-b99c-14e352fdbd5e
8
protected void doStop() throws Exception { MultiException mex=new MultiException(); Thread thread= Thread.currentThread(); ClassLoader lastContextLoader= thread.getContextClassLoader(); try { // Context listeners if (_context...
042f3599-1083-4b64-a585-e54819fd09eb
2
public void zoomOut() { if (tileSize - TILE_SIZE_STEP < TILE_MIN_SIZE) return; int oldSize = tileSize; Container c = GraphicPanel.this.getParent(); int newX, newY; tileSize -= TILE_SIZE_STEP; revalidateScroll(); if (c instanceof JViewport) { JViewport jv = (JViewport) c; Point pos = j...
6907c374-7e36-4f64-9546-daf7a3353089
8
protected void drawVertical(Graphics2D g2, Rectangle2D area) { Rectangle2D titleArea = (Rectangle2D) area.clone(); g2.setFont(this.font); g2.setPaint(this.paint); TextBlockAnchor anchor = null; float y = 0.0f; VerticalAlignment verticalAlignment = getVerticalAlignment(); ...
60f38097-013d-482d-9817-13210fbf916b
5
public float mineralsAt(Tile t, byte type) { byte m = minerals[t.x][t.y] ; if (m == 0) return 0 ; if (m / NUM_TYPES != type) return 0 ; switch (m % NUM_TYPES) { case (DEGREE_TRACE) : return AMOUNT_TRACE ; case (DEGREE_COMMON) : return AMOUNT_COMMON ; case (DEGREE_HEAVY ) : return AMO...
8bc42992-71e1-4cdd-aca6-3d85008fc487
5
public static Tile getRandomTile(Map map, int x, int y) { //gets random tile Tile tile; if (Math.random() < 0.92) { tile = new Grass(map, x, y); } else if (Math.random() < 0.25){ tile = new Flowers(map, x, y); } else if (Math.random() < 0.25) { tile = new Tree(map, x, y); } else if (Math.rando...
3792975c-6a6a-4818-bd2d-3819791bd46f
9
private void collectTweets(int tokenIdx, int tokenOffset, int tweetFileIdx, long skip, String filePrefix, String endId) throws Exception { BufferedReader userIdReader = new BufferedReader(new FileReader( Constants.USER_ID_FILE_PATH)); userIdReader.skip(skip); // set the writer's buffer to 2MB to improve pe...
35134df2-42c2-4b48-83aa-e82c112f3cf0
8
private CompWrap(ComponentWrapper c, CC cc, int eHideMode, UnitValue[] pos, BoundSize[] callbackSz) { this.comp = c; this.cc = cc; this.pos = pos; if (eHideMode <= 0) { BoundSize hBS = (callbackSz != null && callbac...
ab300d2d-9fed-43bb-bfb4-b39693f0e782
3
public void tick() { tickTime++; if (level.getTile(x >> 4, y >> 4) == Tile.lava) { hurt(this, 4, dir ^ 1); } if (health <= 0) { die(); } if (hurtTime > 0) hurtTime--; }
9686cef1-595d-4207-962f-66e7a6e4e8fa
5
private int lookForNearbyHero(int uid, int dist) { /* Buscamos el mas cercano */ ConcurrentHashMap<Integer,Actor> a = scenario.actores; Actor me = a.get(uid); for(Map.Entry m : a.entrySet()){ if (((Actor)m.getValue()).health >0 && !((int)m.getKey()== uid) && ((Actor)m.getValu...