method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
2512fb71-3d3e-49b0-b5d4-42c0bd785efb
2
@Override public void update(GameContainer gc, int delta) { if (gc.getInput().isMousePressed(Input.MOUSE_LEFT_BUTTON)) { if (playItem.isSelected(gc)) { parent.changeScreen(parent.getPlayScreen()); } } }
0868b928-7b4c-4324-8ddc-afa26cfef873
4
@Override protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException { Filter filter = query.getFilter(); // handle query filter if (filter instanceof IncludeFilter) { // don't care about this filter, ignore it } else if (filter instanceof BBO...
87d9d5f5-0a0d-4b77-a4b3-c63cd14055c5
4
public boolean poll() { boolean result = target.poll(); Event event = new Event(); EventQueue queue = target.getEventQueue(); while (queue.getNextEvent(event)) { // handle button event if (buttons.contains(event.getComponent())) { Component button = event.getComponent(); int buttonIndex = button...
1bcf00f1-84e2-4ece-8b8e-9259fe1aaf26
5
public static int isPan( String s ) { boolean[] digits = new boolean[9]; for(char c : s.toCharArray()) { if( c == '0' || digits[c-'0'-1] ) return -1; digits[c-'0'-1] = true; } for(boolean b : digits) if(!b) return 0; return 1; }
5d30d69a-97c9-4f66-b561-6ec5e36e4ca1
2
private void refresh() { if (currState == State.step1) { //Enable step 1 components editorBN.setBackground(Color.white); editorBN.setEnabled(true); optionsBN.setEnabled(true); optionsDicts.setEnabled(true); lockButton.setEnabled(true); //Disable step 2 components ...
63af161a-2f40-4a12-9270-50b79a85e48b
9
private boolean doesTouchInternal(Polyline other) { for (int i = 0; i < nbSegments(); i++) { final LineSegmentInt seg1 = segments().get(i); for (int j = 0; j < other.nbSegments(); j++) { final LineSegmentInt seg2 = other.segments().get(j); final boolean ignoreExtremities = i == 0 || i == nbSegments() - ...
cfa34066-f0fd-40a2-907d-c4490945c2d1
1
public InterfaceSelector(InterfaceSelectorReceiver callbackHandler) throws SocketException { setDefaultCloseOperation(EXIT_ON_CLOSE); this.callbackHandler = callbackHandler; ButtonGroup buttons = new ButtonGroup(); setLayout(new GridLayout(0,1)); setSize(100, 500); Enumeration<NetworkInterface> inter...
ba1c595b-cdeb-43db-af49-a87ff643489b
4
public ByteOrderMark(String charsetName, int... bytes) { if (charsetName == null || charsetName.length() == 0) { throw new IllegalArgumentException("No charsetName specified"); } if (bytes == null || bytes.length == 0) { throw new IllegalArgumentException("No bytes specif...
7c6d69d4-358a-4c7f-b9c5-42a2d6c56b3c
5
public void run () { try { String inputLine; socketOutput = new PrintWriter(clientSocket.getOutputStream(), true); socketInput = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); Scanner netScanner; String instType; System.out.print ("[SERVER]...
ed3d1815-81d4-464e-9d72-fa0abf869aba
9
public static void printContext(Context self, PrintableStringWriter stream) { { String typestring = null; String name = null; int number = self.contextNumber; if (!Stella.$CLASS_HIERARCHY_BOOTEDp$) { stream.print("|MDL|" + ((Module)(self)).moduleName); return; } { Surr...
5670847f-61ab-48f1-8e36-1c78936f2eb2
8
public void excecuteCommand(String channel, String sender, String message) throws Exception { if(message.startsWith("!etip")) { sendMessage(channel, "Such " + sender + " tipped much Ɖ" + message.split(" ")[2] + " to " + message.split(" ")[1] + "! (to claim /msg Doger help)"); sendMessage("Doger", "!tip " + mes...
f7e910f8-d76c-47af-a884-a616adbdcebb
6
private ChartEntry readEntry(ScanfReader scanReader, TablePane pane) throws IOException { String entryName = scanReader.scanString("%S"); ChartEntry entry = new ChartEntry(entryName); String attributeName; while (!(attributeName = scanReader.scanString()).equals("end")) { ...
5f05fba6-2500-447b-99bd-725421fd25bc
2
protected void updateTimeFields() { long timeAsSeconds = getTimeAsSeconds(); // Store the starting seconds minutes and hours so that we can compare // this to the new minutes seconds and hours to set the hasChanged // variable long startS = seconds, startM = minutes, startH = hours; seconds = timeAsSeconds...
e2c617ae-40bf-45cc-b008-d0bfd6f3b0dd
3
public boolean validate(String str) throws Exception { str = str.toLowerCase(); if (isNameExists(str)) { return searchingFile(str).equals("true"); } else { String pattern = "^[a-z][a-z0-9\\.,\\-_]{5,31}$"; // Create a Pattern object Pattern r = Pat...
13392422-7753-43f9-8ea3-95921d5bba84
9
private void discoverDevices() { tvDiscoveryService = TvDiscoveryService.getInstance(swingPlatform); // discovering devices can take time, so do it in a thread new Thread(new Runnable() { public void run() { showProgressDialog(resourceBundle.getString("progress.discoveringDevices"))...
61f2150d-f7bb-4eb4-af15-15aeb3b41b7a
0
protected void buildAttributes(Node node, StringBuffer buf) { // Iterator it = node.getAttributeKeys(); // if (it != null) { // while (it.hasNext()) { // String key = (String) it.next(); // Object value = node.getAttribute(key); // buf.append(" ").append(key).append("=\"").append(escapeXMLAttribute(value.t...
de9bdea7-5964-4615-8d0b-d9db57bfd83d
4
public Recipe openFile(File f) { fileType = checkFileType(f); Debug.print("File type: " + fileType); if (fileType.equals("promash")) { PromashImport imp = new PromashImport(); myRecipe = imp.readRecipe(f); } else if (fileType.equals("sb") || fileType.equals("qbrew")) { ImportXml imp = new ImportXml(f...
7e3f2c34-cbde-4b72-a403-6e697a6f6959
5
@Override public void initResources() { playfield = new PlayField(); // Создание спрайт групп firstBallGroup = new SpriteGroup("firstBalls"); secondBallGroup = new SpriteGroup("secondBalls"); thirdBallGroup = new SpriteGroup("thirdBalls"); playfield.addGroup(...
f389fa92-0013-44fb-b9e1-3a136b142150
7
public List<Chromosome> select(List<Chromosome> population) { List<Double> absoluteFitnesses = new LinkedList<Double>(); List<Double> proportionalFitnesses = new LinkedList<Double>(); double totalFitness = 0; for (Chromosome i : population) { double fitness = Ma...
02876af8-4c56-4caa-913a-09ade7008e62
3
void resetColorsAndFonts () { super.resetColorsAndFonts (); Color oldColor = selectionForegroundColor; selectionForegroundColor = null; setSelectionForeground (); if (oldColor != null) oldColor.dispose(); oldColor = selectionBackgroundColor; selectionBackgroundColor = null; setSelectionBackground (); ...
30ad7422-b51d-44e9-8589-150abe1f47dc
3
public boolean appliesToCurrentEnvironment() { if (this.rules == null) return true; Rule.Action lastAction = Rule.Action.DISALLOW; for (Rule rule : this.rules) { Rule.Action action = rule.getAppliedAction(); if (action != null) lastAction = action; } return lastAction == Rule.Action.AL...
9f3787f8-cebb-4f9a-b820-4f784d1a4cb9
5
public static void generateGradeCSV(String courseID, String actName, String path, String name) { ResultSet res = GradeAccess.accessGrades(courseID, actName); String s = ""; int x = 0; try { while(res.next()) { if(x == res.getInt(1)) { s += "," + res.getFloat(2); } els...
6e04406c-4d20-476f-91b6-d10f947d4504
0
public HumanFirstPane(PumpingLemma l, String title) { super(l, title); l.setFirstPlayer(PumpingLemma.HUMAN); }
a19a3056-5ed1-4396-9964-6466b9448602
5
public void setTextFieldValues() { List<User> theUsers = users.getUsers(); tasks = new AccessTasks(); tasks.getTasks(); theTask = null; if(tasks != null && item != null) { theTask = tasks.getTask(Integer.parseInt(item.getText())); } if(theTask != null) { StaticWindowMethods.populateAss...
da1ba30a-e39b-462b-b0bd-7e0b03816840
4
@SuppressWarnings("unchecked") public E[] toArray() { if (root == null) return null; E[] array = (E[]) Array.newInstance(root.data.getClass(), size); Stack<Node> stack = new Stack<Node>(); Node node = root; int index = 0; while (true) { if (node != null) { stack.push(node); node = node...
89ebc29b-81be-4538-982e-813f6a08f9da
3
private void stopIfDone() { if(isDone() && !(preStop || preStart)) { mm.stopMinigame(this); } }
cce5293e-08c7-4f74-a6ee-a72359348eeb
0
public UndoController() { undoStack = new SizedStack<>(25); redoStack = new SizedStack<>(25); }
1a27696b-7a35-44c2-9006-feb62d3bb9ee
4
public void upgradeTables() { // Add blocks_built into LOGIN if (_sqLite.isTable("login")) { try { _sqLite.query("ALTER TABLE login ADD COLUMN blocks_placed INT;"); _log.info("[Statistics] Table LOGIN upgraded - column blocks_placed added"); } catch (SQLException e) { } } // Add bloc...
217a5154-996d-465d-ad8f-339ced0661c5
8
public static void main(String[] args) { int op=0; do{ System.out.println("1- Agregar Doctor"); System.out.println("2- Agregar Paciente"); System.out.println("3- Mantenimiento de Citas"); System.out.println("4- Reportes"); System.out.p...
4db6c14f-01af-4eb5-9f1e-9cb9265f8a3d
0
@Override public Employee getById(Integer id) { return map.get(id); }
531b0785-2f07-43ea-b5ea-432972c1ae62
9
public void input(){ if(Mouse.isGrabbed()){ pos.addXRot(-Mouse.getDY()*mouseSensivity); pos.addYRot(Mouse.getDX()*mouseSensivity); } if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)){ speed = 0.25f; } if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)){ speed =...
d5c34e13-5cc0-4f1e-9a08-902e5198b84d
9
boolean isCursorOnTopOf(int xCursor, int yCursor, int minRadius, Atom competitor) { // XIE: the following should be used to prevent dx2 or dy2 > Integer.MAX_VALUE if (screenX < 0 || screenX > SCREEN_SIZE.width || screenY < 0 || screenY > SCREEN_SIZE.height) return false; int r = screenDiameter / 2; if (r < m...
3f567606-4c9d-4c34-a7ba-5657309dad5d
7
public static void main(String[] args) { String encoding = "UTF-8"; int maxlines = 100; BufferedReader reader = null; BufferedWriter writer = null; try { reader = new BufferedReader(new InputStreamReader(new FileInputStream("/bigfile.txt"), encoding)); in...
07cc8393-fa1a-4f5c-bcc7-8b77520c4b70
1
public boolean step() { // controller.step(); boolean worked = false; if (treePanel.next()){ stepAction.setEnabled(false); worked = true; } treePanel.repaint(); return worked; }
cde4990a-d6c1-40b4-8e3f-08be2e1cffa8
9
public void setEndPoints(int x1, int x2, int y1, int y2) { colourize(); switch (type) { case LINE: setStartingPoint(new Point(x1,y1)); setEndPoint(new Point(x2,y2)); break; case CIRCLE: case SQUARE: if (x2>=x1 && y2>=y1) { setStartingPoint(new Point(x1, y1)); int side = Math.min(x2-x1, y2-...
a105b0a8-a03c-4218-981f-da5821a9fe4a
8
protected Item getPoison(MOB mob) { if(mob==null) return null; if(mob.location()==null) return null; for(int i=0;i<mob.location().numItems();i++) { final Item I=mob.location().getItem(i); if((I!=null) &&(I instanceof Scroll) &&(((SpellHolder)I).getSpells()!=null) &&(((SpellHolder)I).getSpe...
6bd0c9bb-7e09-482f-93a9-6223ac313819
8
void classification() { int pixels[][] = this.pixels; int width = pixels.length; int height = pixels[0].length; // convert to indexed color for (int x = width; x-- > 0;) { for (int y = height; y-- > 0;) { int pixel = pixel...
e39986e3-d57e-428f-be01-a1fb87ce6864
3
public static Font openFont(String name) { if(fonts.containsKey(name)) return (Font) fonts.get(name); Font font = null; InputStream is = ClassLoader.getSystemResourceAsStream("org/analyse/core/gui/fonts/" + name); if (is == null) { System.err.println("Utilisation de la Fonte impossible : " + name...
472bdaa6-3f69-4298-890c-7532b19a9419
0
public void setRoom(int room) { this.room = room; }
384bb5b6-bb5b-430f-b6a6-30c827fe8d37
4
private void currentCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_currentCheckActionPerformed serverTable.clearSelection(); if(currentCheck.isSelected()){ try { ServicioTablespace st = new ServicioTablespace(conexion.user,conexion.pass,conexion.ip...
0b292ff5-3a70-40bb-9782-4ae6225e85cf
8
public static String readLine(ByteBuffer buf) { boolean completed = false; buf.mark(); while (buf.hasRemaining() && !completed) { byte b = buf.get(); if (b == '\r') { if(buf.hasRemaining() && buf.get() == '\n'){ completed = true; } } } if(!completed){ return null; } int limit = ...
adcfe577-5a9f-4c23-a0b1-87fdf68e77f4
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ThreadTimingBean other = (ThreadTimingBean) obj; if (atomicId != other.atomicId) return false; if (end != other.end) return false; if (...
abadc542-ce04-4269-a87f-a04b3239094b
4
private static boolean canProcess(String line){ boolean processBit = true; boolean foundAnnotationBit = false; if (line.contains("None")) processBit = true; else{ for(String lines: ARGS){ if(line.contains(lines)) foundAnnotationBit = true; } if(foundAnnotationBit){ processBit = true; ...
b545a0a8-2c1f-4455-aedc-4107c7975935
8
public static String[] getPercents() { int a = 0; String[] s1 = new String[100]; int i = Casino.conf.getInt("settings.SevenChance"); while(i>0) { s1[a] = "➐"; i--; a++; } i = Casino.conf.getInt("settings.HeartChance"); while(i>0) { s1[a] = "❤"; i--; a++; } i = Casino.conf.getInt("set...
45427024-33ae-4631-bca5-2ebd5e2ffcac
6
@Override public void validate() { if (dailybdgt == null) { addActionError("Please Enter Daily Budget"); } if (deliverytype == null) { addActionError("Please Select Delivery Type"); } if (campaignname == null) { addActionError("Please...
db1809fb-11a4-447d-a297-c92e41276241
5
public static <TT> TypeAdapterFactory newFactoryForMultipleTypes(final Class<TT> base, final Class<? extends TT> sub, final TypeAdapter<? super TT> typeAdapter) { return new TypeAdapterFactory() { @SuppressWarnings("unchecked") // we use a runtime check to make sure the 'T's equal public <T> TypeA...
826c95a4-bff3-4ec8-9592-529e50e5c9ee
8
private void BackspaceButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BackspaceButtonActionPerformed if (FocusOwnerIndex == 1) { if (NumberField1.getCaretPosition() != 0) { // only do something if the caret is not the at the beginning int tmpcaretpos = Number...
6c3e5fb8-95f3-451d-bb3b-a4bcdfe59621
4
private boolean checkIfOutOfRange(int x, int y) { return x < -1000000 || y < -1000000 || x > 1000000 || y > 1000000 ? true : false; }
cdb15ef5-5f9e-426b-8769-cf53b67449db
0
public static void unlockDoor(int roomId) { keyRequired[roomId-1] = 0; }
130a84c7-e985-420e-bdb2-f85c61a8387e
0
public MoveHandler(boolean pendown, boolean forward) { this.pendown = pendown; this.forward = forward; }
a080e50b-f7c1-4238-8cfd-341a452d6c38
6
@Override public boolean halt(Event lastEvent, OurSim ourSim) { boolean halt = true; List<Job> finishedJobsList = new LinkedList<Job>(); for (ActiveEntity entity : ourSim.getGrid().getAllObjects()) { if (entity instanceof Broker) { Broker broker = (Broker) entity; List<Jo...
f7c05a34-ea18-4aad-8ab6-403b8aed0326
1
public static void main(String[] args) { try { Files.createDirectories(Paths.get("/home/xander/test")); Path file = Paths.get("/home/xander/test/test.txt"); // no need to check prior to deletion Files.deleteIfExists(file); Files.createFile(file); ...
76dc481a-1aab-4738-98c2-a40152c96a9c
1
public final Image image(JPanel panel) { Image image = panel.getToolkit().createImage(ClassLoader.getSystemResource(url)); MediaTracker tracker = new MediaTracker(panel); tracker.addImage(image, 1, width, height); try { tracker.waitForAll(); } catch (InterruptedException e) { throw new RuntimeException(...
bcf2495f-176b-4ad2-9f53-9879076dd9ad
3
private void checkForPeakX(double x) { if (isUpPeakX) { if (x < lastX) { peakX = lastX; isUpPeakX = false; } } else { if (x > lastX) { peakX = lastX; isUpPeakX = true; } } lastX = x; }
92b56c59-a12d-48f8-bef1-963ba8fb3851
8
private Map<String, BoundField> getBoundFields(Gson context, TypeToken<?> type, Class<?> raw) { Map<String, BoundField> result = new LinkedHashMap<String, BoundField>(); if (raw.isInterface()) { return result; } Type declaredType = type.getType(); while (raw != Object.class) { Field[] f...
d51750d2-f939-481f-b52e-ace83596a34f
8
private static Image enhance(Image image, int[]histogram) { ImageData imageData = image.getImageData(); // Calculate cumulative histogram int[] cumulativeHistogram = new int[256]; for (int i = 0; i < cumulativeHistogram.length; i++) {// height if (i == 0) cumulativeHistogram[i] = histogram[0]; else ...
d2411091-01e3-4f8c-8e0a-04b23fe52f8a
5
private void processDeleteMaster(Sim_event ev) { if (ev == null) { return; } Object[] obj = (Object[]) ev.get_data(); if (obj == null) { System.out.println(super.get_name() + ".processDeleteMaster(): master file name is null"); ...
406bf802-e52e-4098-a2fd-26cd676b5a3f
9
@SuppressWarnings("unchecked") public static EventWriter createEventWriter(EventEntry eventEntry){ Properties unisensProperties = UnisensProperties.getInstance().getProperties(); String readerClassName = unisensProperties.getProperty(Constants.EVENT_WRITER.replaceAll("format", eventEntry.getFileFormat().getFileFor...
73545240-416f-42f5-9979-1dd82d54579e
5
@Override public void paintComponent(Graphics g) { int i = 0; Home home; super.paintComponent(g); { g.drawImage(this.image, 0, 110, getWidth(), getHeight(), null); this.sliderPiece.paintComponent(g); this.sliderValue.paintComponent(g); ...
15eba24c-286f-4cf3-a168-01f5f7de0ba9
4
@Test public void test_insertions() { int m = 3; int n = 5; Matrix m1 = new MatrixArray(m,n); for(int i = 1; i <= m; i++){ for(int j = 1; j <= n; j++) m1.insert(i, j, (double)(i*j)); } for(int i = 1; i <= m; i++){ for(int j = 1; j <= n; j++) assertEquals(m1.get(i,j),(double)(i*j), 0.01)...
c455d09b-245f-4289-bb49-e44359ff4dfa
4
public Grid(int width, int length) { frame.setLayout(new GridLayout(width, length)); grid = new JButton[width][length]; //initialise jbutton grid array for (int y = 0; y < length; y++) { for (int x = 0; x < width; x++) { grid[x][y] = new JButton("(" + x + "," + y + "...
6ec17658-fdc8-416c-9980-f41b86ae5bea
0
@Override public String notation() { return this.from.toString() + "x" + this.to.toString(); }
08934e92-36c0-4af3-bf8d-6843e86f4752
1
public void discard() { dealer.discard(pile); player.discard(pile); info.update(deck); discardButton.setEnabled(false); hitButton.setEnabled(false); standButton.setEnabled(false); resetButton.setEnabled(true); if (player.getMoney() > 0) { betButton.setEnabled(true); } doubleButton.setEnabled(fals...
d45377ef-f845-41b6-9d6d-5eede63ebb18
1
protected DataAccessLayer(){ //ensure that the JDBC connector exists. try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { System.out.println("Could not locate JDBC driver"); } //attempt database connection dBConnect(); }
0be366e3-94c9-4c0d-a4f1-2735a8ed0bee
7
public byte[] engineGenerateSeed(int numBytes) { if (DEBUG && debuglevel > 8) debug(">>> engineGenerateSeed()"); if (numBytes < 1) { if (DEBUG && debuglevel > 8) debug("<<< engineGenerateSeed()"); return new byte[0]; } byte[] result = new byte[numBytes]; this.engineNextBy...
0ec56381-aef1-4fca-b3c2-26b1fe39c5fd
4
private static int leapDays(Tm tm) { if (tm.getMonth() < 3) { return 0; } int year = tm.getYear(); return year % 4 == 0 && (year % 400 == 0 || year % 100 != 0) ? 1 : 0; }
7331fa5b-da1f-404a-ad31-4f7db8858b60
5
public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() >= 2) { zoomInAnimated(new Point(mouseCoords.x, mouseCoords.y)); } else if (e.getButton() == MouseEvent.BUTTON3 && e.getClickCount() >= 2) { zoomOutAnimated(new P...
79b4f983-f116-40ce-92fa-ef29fa3e18ee
0
@Test public void testTruncate_quotation() { String s = "It's ok to include \"quotation marks\" along with words."; Assert.assertEquals( "It's ok to include \"quotation marks\"…", _helper.truncate(s, 40) ); }
d9e97122-6daa-4ca2-a266-72a2ab328773
6
private void convertYCBCRtoRGB(double Y, double Cb, double Cr) { R = round(Y + (Cr - 128) * 1.402); G = round(Y - (Cb - 128) * 0.34414 - (Cr - 128) * 0.71414); B = round(Y + 1.772 * (Cb - 128)); R = R > 255 ? 255 : (R < 0 ? 0 : R); G = G > 255 ? 255 : (G < 0 ? 0 : G); B =...
3142a554-1bbc-426a-bbdd-2650c01d2f23
9
public static Keyword computeVarianceOrStandardDeviation(ControlFrame frame, Keyword lastmove, boolean standardDeviationP) { { Proposition proposition = frame.proposition; Stella_Object listarg = (proposition.arguments.theArray)[0]; Stella_Object listskolem = Logic.argumentBoundTo(listarg); Stella...
d9b66976-2cc6-4be6-a441-6b8941be21da
3
public void getChar() { try { if (position >= line.length()){ line = input.nextLine(); line = line + "\n"; position = 0; lineNumber++; // only a period on a line means eof if (".\n".equals(line)) eof = true; } current = line.charAt(position); position++; } catch (NoSuchEle...
fd07611c-1b7f-41d9-9ed4-acc69fb1dfc0
9
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { log.info("WANcostResummingServlet12h Got a GET..."); caches.reload(); link[][] linkArr = new link[caches.lSources.size()][caches.lDestinations.size()]; for (int i = 0; i < caches.lSources.size(); i++) for (int j =...
8e07b24a-82ac-4b9b-95e5-8770ceddbd92
2
boolean isSalesTaxApplicable(String sItem) { for(String sExmpItem : exemptedItems) if(sItem.contains(sExmpItem)) { return false; } return true; }
2c777826-d079-436e-86c6-b18c7f05a718
0
public ENCODE getEncode() { return encode; }
f79a3600-6126-498d-b6fc-89ddae7d5978
0
public int getCount() { return count; }
37a857f7-f21c-4fe9-bdee-e0b6c6187574
7
private static String getBrowserMessage() { if (UserAgentPermutation.isGecko()) { return "feels like a lizard"; } else if (UserAgentPermutation.isSafari()) { return "is out on the savannah"; } else if (UserAgentPermutation.isOpera()) { return "hits all the hig...
301497f5-dce3-4a17-930e-28ba64e421ab
9
public static boolean warnAboutFunctionShadowingSlotsP(MethodSlot function) { { Symbol name = function.slotName; if (name.symbolSlotOffset != Stella.NULL_INTEGER) { { Cons slots = Stella.NIL; { Module module = null; Iterator iter000 = Stella.allModules(); while (it...
eb8a5789-e808-434a-b813-7d326be6baf1
7
public Object nextContent() throws JSONException { char c; StringBuffer sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new Str...
8e88f1f4-5957-49e9-aa35-f4a84872cf5e
4
public LinkedList<Bullet> applyAllUpgrades(String[] sprites) { LinkedList<Bullet> bullets = new LinkedList<Bullet>(); LinkedList<Bullet> newBullets = new LinkedList<Bullet>(); Bullet firstBullet = new Bullet(sprites, baseAim, 10); double centerx = rect.x + rect.width / 2 - firstBullet.ge...
cec0d1dc-af1b-4f5c-9047-28959fe61c81
2
public FileTransfer(String fileName, Long fileSizeLeft){ this.fileName = fileName; this.fileSizeLeft = fileSizeLeft; this.file = new File(this.fileName,""); try{ if(!this.file.exists()){ this.file.createNewFile(); } this.fileOutputStream = new FileOutputStream(file,true);// 追加模式写文件 this.fileCha...
2f2f55c9-7dd5-4967-a3b3-e1795b9c8fc3
2
@Override public void update(Observable o, Object arg) { switch (arg.toString()) { case "parties": this.popupParties.setLocationRelativeTo(null); this.popupParties.setVisible(true); this.afficherPopupParties(this._jeu.getProfilC...
87e174ac-6afc-4cba-aa36-9593d1d05dcf
0
public static int[] getRegion(int x,int z){ int[] chunkCoords = getChuk(x, z); return getChunkRegion(chunkCoords[0], chunkCoords[1]); }
bdd31ece-f310-47fa-a63b-74730c8e6d60
2
public void move() { PhysicsComponent ownPC = (PhysicsComponent)getOwningActor().getComponent("PhysicsComponent"); if(ownPC.getAngleRad() < ownPC.getTargetAngle() + 0.1 && ownPC.getAngleRad() > ownPC.getTargetAngle() - 0.1) { ownPC.applyAcceleration(1.0f); } }
e26e5f46-49b8-4bf8-b453-99a8e694c87d
2
public void analyze() { if (GlobalOptions.verboseLevel > 0) GlobalOptions.err.println("Reachable: " + this); ClassInfo[] ifaces = info.getInterfaces(); for (int i = 0; i < ifaces.length; i++) analyzeSuperClasses(ifaces[i]); analyzeSuperClasses(info.getSuperclass()); }
d50a05cd-36dc-4905-b6cf-75fc4fe9ee57
0
public DocumentStatistics() { super(true, true, true, INITIAL_WIDTH, INITIAL_HEIGHT, MINIMUM_WIDTH, MINIMUM_HEIGHT); Outliner.statistics = this; }
adc5abe2-a6c1-4948-887b-653ae9a9dc40
1
public String toString() { StringBuffer display = new StringBuffer(); display.append("---- " + name + " ----\n"); display.append(dough + "\n"); display.append(sauce + "\n"); for (int i = 0; i < toppings.size(); i++) { display.append((String )toppings.get(i) + "\n"); } return display.toString(); }
1a627fc8-5ef0-4014-a55d-6273f44c2a5c
6
private int handleZ(String value, DoubleMetaphoneResult result, int index, boolean slavoGermanic) { if (charAt(value, index + 1) == 'H') { //-- Chinese pinyin e.g. "zhao" or Angelina "Zhang" --// result.append('J'); index += 2; } else { ...
e05ea0c4-f92b-4df0-95c1-76c0ab6eb102
0
@Override public VueVisiteur getVue() { return (VueVisiteur) vue; }
7115b8c0-fc9f-4d9c-b7e5-86d77501b206
4
public void checkPlayerCollision(Player player, boolean canKill) { if (!player.isAlive()) { return; } // check for player collision with other sprites Sprite collisionSprite = getSpriteCollision(player); if (collisionSprite instanceof PowerUp) { ...
2a0c68f9-3edd-4e54-bdc0-4feda73fdef1
9
public static boolean nonNumeric( String k ){ for( int i = 0; i < k.length(); i++ ){ if( ( k.charAt(i) > '9' || k.charAt(i) < '0' ) && k.charAt(i) != ',' && k.charAt(i) != '+' && k.charAt(i) != '*' && k.charAt(i) != '/' && k.charAt(i) != '-' && k.charAt(i) != '%'){ return true; } } return fal...
0ae17142-fac5-4ac2-8c84-ade7608db9d0
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...
ff9ac4d1-ca9d-447f-ab1e-23ed36b49d3e
2
private boolean containsElement(List<ElementInfo> elements, PlayerInfo element) { for(ElementInfo e : elements) if (e.equals(element)) return true; return false; }
bb2889db-8470-418c-b11c-a45514221818
2
public static void main(String[] args) { Scanner input = new Scanner(System.in); int cases = 1; while (true) { int n = input.nextInt(); if (n < 3) return; double A = input.nextDouble(); double angle = Math.PI * (n - 2) / (2 * n); double s = Math.sqrt(4 * A / (n * Math.tan(angle))); d...
a72a12c1-513c-45c4-9159-57cf934e1d0e
1
public Set<BankAccount> getReplacingAccounts(BiFunction<BigInteger,BigInteger,BankAccount> generator) { Set<BankAccount> result = new HashSet<>(); for (BankAccount account: accounts) result.add(generator.apply(account.getBalance().add(BigInteger.TEN),account.getCreditLimit())); retur...
65dfdfe4-5890-47b0-a51a-a9a3ff5f6e9d
9
public void actionPerformed(ActionEvent event) { Object source = event.getSource(); if (source == addButton) { String value = tfValue.getText(); if (value.length() == 0) return; int typeIndex = typeCombo.getSelectedIndex(); if (typeIndex == -1) return; int type = EXTHRecord.knownTypes[t...
32c33c05-b276-467c-a29f-40407f4693d3
3
@Override public void onEnable() { instance = this; FileConfiguration config = this.getConfig(); config.addDefault("PromptTitle", "Player Plus Accessories"); config.addDefault("TitleX", 190); config.addDefault("Hot_Key", "KEY_U"); config.addDefault("GUITexture", "http://www.pixentral.com/pics/1duZT49LzMno...
730f580d-adee-407c-a59d-83278184a30b
5
private void validateParameters() throws DriverJobParametersException { if (!this.dgenInstallDir.isDirectory()) { throw new DriverJobParametersException("Data generator install dir `" + this.dgenInstallDir + "` does not exist."); } if (!this.dgenNodePropertiesPath.isFile()) { throw new DriverJobParamete...
69a372de-549f-4137-8f5d-42e98917a9b3
4
public int compare(Card other){ if(this == other){ return 0; } if(this.getCardNum() < other.getCardNum()){ return -1; } if(this.getCardNum() > other.getCardNum()){ return 1; } if(this.getCardNum() == other.getCardNum()){ return 0; } return 1; }
d3b26c91-ef8e-4619-8679-ba2914a821aa
1
public LowLevelFeatureCommand(CommandParameter par) { if(par == null) throw new NullPointerException("LowLevelFeatureCommand has a null CommandParameter"); this.par= par; }
f111d221-b879-4d12-b086-c2a70a9bd477
5
public void setValue(String name, String value) { int i = indexOfName(name); if (i == -1) { if ((value != null) && (!value.equals(""))) { add(name + ": " + value); } } else { if ((value != null) && (!value.equals(""))) { set(i, name + ": " + value); } else { delete(i); } } }