method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6d5698dc-d975-4515-b71d-ddc499787b3f
3
public List<Bomb> collectBombs() { List<Bomb> bombs = new ArrayList<Bomb>(); for (Tile[] tiles : this.map) { for (int i = 0; i < tiles.length; i++) { Tile tile = tiles[i]; if (tile.getBomb() != null) { bombs.add(tile.getBomb()); ...
ca3af533-2f03-490e-bf86-8d01eb1e80dd
5
public static void loadConstants() { try { //get a connection to the constants file and read it final String fileName = "file:///" + CONSTANTS_FILE_NAME; printIfDebug("Opening constants file: " + fileName); FileConnection commandFileConnection = (FileConnection) C...
5b3d9f31-1c4d-4c2f-a4ff-2e49ae829b43
2
@Test public void testGetLastCheckpoint()throws Exception{ Tracking trackingGet1 = new Tracking("GM605112270084510370"); trackingGet1.setSlug("dhl-global-mail"); Checkpoint newCheckpoint = connection.getLastCheckpoint(trackingGet1); Assert.assertEquals("Should be equals message", "De...
80d3aac3-1081-4983-8429-0ece2dcd1481
7
/* */ public Object getTeleportPacket(Location loc) /* */ { /* 134 */ Class<?> PacketPlayOutEntityTeleport = Util.getCraftClass("PacketPlayOutEntityTeleport"); /* */ /* 136 */ Object packet = null; /* */ try /* */ { /* 139 */ packet = PacketPlayOutEntityTeleport.getConstru...
7a7d7059-394f-4bfd-b9b7-d1a10b94a9c7
5
public void run() { try { Map<String, String> requestHeaders = new HashMap<String, String>(); Map<String, String> formParams = new HashMap<String, String>(); formParams.put(CommunityConstants.BASE64_PUBLIC_KEY, Base64.encode(pair.getPublic().getEncoded())); formParams.put(CommunityConstants.NICKNAME, "t...
9020ff53-52f3-434f-98c0-6451d06d5e62
8
static void prob4() { /* * A palindromic number reads the same both ways. The largest palindrome * made from the product of two 2-digit numbers is 9009 = 91 99. * * Find the largest palindrome made from the product of two 3-digit * numbers. */ long start = System.currentTimeMillis(); int max =...
d6f4b7d5-ce84-47fd-af4d-39aae6c41e81
1
@Override public Integer call() throws Exception { System.out.println("子线程在进行计算"); Thread.sleep(3000); int sum = 0; for(int i=0;i<100;i++) sum += i; return sum; }
4d9a7f7a-c559-4cbf-86d4-202979236a25
6
@SuppressWarnings({ "rawtypes", "unchecked" }) public static int partition(Comparable[] a, int min, int max){ int i = min; int j = max + 1; Comparable element = a[min]; while(true){ while(a[++i].compareTo(element) < 0){ if(i == max) break; } while(element.compareTo(a[--j]) < 0){ if(j == min...
81c98a72-8b66-494d-a10f-8606321ccccb
7
private final int calcHPChange(final MapleCharacter applyfrom, final boolean primary) { int hpchange = 0; if (hp != 0) { if (!skill) { if (primary) { hpchange += alchemistModifyVal(applyfrom, hp, true); } else { hpchange...
0b238f8a-208f-4090-8ff9-3d71fc28400b
4
public static void main (String[] args) { System.out.println("Irule! YEAR BOIIII"); System.out.println("LIKEABOSSSSS"); String name = "Dencho"; int x = 3; x = x *17; System.out.print("x is " + x); while (x > 12) { x = x -1; } while (x > 10) { x = x - 1; System.out.println("subbin...
34aa8e37-abc2-4668-980d-ba202618a899
2
public Production getSimplifiedProduction(Production production) { String lhs = (String) MAP.get(production.getLHS()); String rhs = production.getRHS(); int leftIndex, rightIndex; // Position of left and right parentheses. StringBuffer newRhs = new StringBuffer(); while ((leftIndex = rhs.indexOf('(')) != -1 ...
035751d2-3e7b-4a6b-90ad-35b8e525801d
6
private OrderReport processMarketOrder(Order quote, boolean verbose) { ArrayList<Trade> trades = new ArrayList<Trade>(); String side = quote.getSide(); int qtyRemaining = quote.getQuantity(); if (side =="bid") { this.lastOrderSign = 1; while ((qtyRemaining > 0) && (this.asks.getnOrders() > 0)) { Order...
1165a021-247e-4b25-a5ca-9b24e955d389
9
@SuppressWarnings("unchecked") public CepService(String cep) { try { URL url = new URL("http://cep.republicavirtual.com.br/web_cep.php?cep=" + cep + "&formato=xml"); Document document = getDocumento(url); Element root = document.getRootElement(); for (Iterator<Element> i = root.elementIterat...
c8f47081-1211-401c-9f0f-8dd6a1e61b05
8
protected void read(InputStream in, int maxLength) throws IOException, ParsingException { InputBuffer buffer = new InputBuffer(in, 24, 24); if (!Arrays.equals(magic, buffer.get(0, 4))) { throw new ParsingException("Unknown magic bytes: " + Arrays.toString(buffer.get(0, 4))); } byte[] ascii = buffer.get(4, ...
5a0fba71-d8c2-4dee-a0dd-d80500cfc2b1
1
private void returnStatement() { if (accept(NonTerminal.RETURN_STATEMENT)) { expression0(); expect(Token.Kind.SEMICOLON); } }
25f587dd-45d3-404a-845a-3a07ddc2b7f7
8
@Override public double getProgress() { switch (getState()) { case READY: return 0.0; case EXECUTING: case ROLLBACKING: case PAUSED: return 0.5; case EXECUTION_SUCCEEDED: case EXECUTION_FAILED: case ROLLBACK_SUCCEEDED: case ROLLBACK_FAILED: return 1.0; default: return 0.0;...
b5cd6bd3-b8b8-46ed-8956-bd648641b780
3
public void run() { try { in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = new PrintWriter(socket.getOutputStream()); login = in.readLine(); password = in.readLine(); DbConnect DBC = new DbConnect(); stat...
3f5a6a81-d374-492b-82d9-339dc9c24f34
3
public static boolean addArtist(boolean manually, String prefName, String name, String ... moreNames) { try { check(); int aid = createArtist(prefName, manually); createName(name, aid); if(moreNames != null) { for(int i = 0; i < moreNames.length; i++) { String mn = moreNames[i]; creat...
55b74985-2173-4b4b-8c5c-91eebb72a7b0
7
public CoordVizualizer() { super(new BorderLayout()); mapKit = new JXMapKit(); mapKit.setName("mapKit"); mapKit.setPreferredSize(new Dimension(413, 218)); add(mapKit, BorderLayout.CENTER); mapKit.setDefaultProvider(DefaultProviders.OpenStreetMaps); mapKit.setCen...
20864a99-f6dc-404f-8680-2d88cfd2f4f1
3
public double rollOut() { StateObservation rollerState = state.copy(); int thisDepth = this.m_depth; while (!finishRollout(rollerState,thisDepth)) { int action = m_rnd.nextInt(num_actions); rollerState.advance(actions[action]); thisDepth++; } ...
5764019b-6b82-4833-936f-8257cc0dccd0
5
public <V extends Collection<T>> V fetchContainingIntervals(V target, U queryPoint) { if (target == null) { throw new NullPointerException("target is null"); } if (queryPoint == null) { throw new NullPointerException("queryPoint is nu...
736e1cde-0b1f-494d-b6a8-e1f98a5afa08
1
private boolean jj_2_68(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_68(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(67, xla); } }
cfdaa45f-1bb2-4417-b763-4cd302597df1
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the * to str...
38dd6c79-f0cc-4c27-a2d1-24aa089062eb
8
private void init() { if (Double.compare(getWidth(), 0) <= 0 || Double.compare(getHeight(), 0) <= 0 || Double.compare(getPrefWidth(), 0) <= 0 || Double.compare(getPrefHeight(), 0) <= 0) { setPrefSize(PREFERRED_SIZE, PREFERRED_SIZE); } if (Double.co...
e510693b-f89d-456e-b72a-fd703b2d41b8
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
5e8c4940-3426-410e-8d4e-2d659bade19b
7
public static void populate() { Random rand = Randomizer.getRandom(); field.clear(); for(int row = 0; row < field.getDepth(); row++) { for(int col = 0; col < field.getWidth(); col++) { if(rand.nextDouble() <= FOX_CREATION_PROBABILITY) { Locatio...
94aaaeeb-aac5-4ac7-be3c-ae2a7fe8533d
6
private Rule _NextRule(String nonterm){ HashSet<Rule> prog_rules = m_mapping.get(nonterm); Rule rule = new Rule(); m_possible_lexems = new HashSet<ArrayList<String>>(); for(Rule cur_rule : prog_rules) { ArrayList<String> terminals = new ArrayList<String>(); ...
3e1b01d7-ea38-4119-9755-78a6c69ba783
2
public void addSample(double value) { if(value < min) { min = value; } if(value > max) { max = value; } sum += value; squared_sum += value * value; num_samples++; }
327f3535-01b6-462a-8fcb-135c932a2f7d
9
public void updateNeighbors() throws RemoteException { neighborsTable = new HashMap<String, Double[]>(); double distValue; List<String> listOfOffices = registry.list(); try { Double maxDistance = 0.0; Object removeNodeName = null; Iterator<String> iter = listOfOffices.iterator(); while (iter.ha...
f3a48c1e-531f-409d-8e85-1da6adcc3463
3
private void jButtonFilesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonFilesActionPerformed Logger.getLogger(UserInterface.class.getName()).log(Level.FINE, "FileChooser"); JFileChooser f = new JFileChooser(); f.setMultiSelectionEnabled(true); if (f.showOpenDi...
ecad6dab-17ea-44d8-bc2a-f6313ad542e2
7
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...
ed96c203-c3a0-41b1-b48b-8789dd0f8653
8
public void zip(File source) { try { File[] files = source.listFiles(); if (files != null) { for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { zip(files[i]); } else { FileInputStream fis = new FileInputStream(files[i]); bis ...
d0b7da82-28cd-4f7f-9c56-e9ee448f89f7
6
public void downloadFiles() { recursiveDelete(new File(OS.getFolderFile(), "bin")); File downloadDir = new File(OS.getFolderFile(), "bin"); downloadDir.mkdirs(); File nativesDir = new File(downloadDir, "natives"); nativesDir.mkdirs(); List<DownloadFile> files = new ArrayL...
1e456e9f-1b61-47b7-8d30-39f5f3239c94
4
public void removeTaxis(int taxis) { int i = 0; try { int loops = 0; while (i < taxis) { loops++; if (items.get(loops) instanceof Taxi) { if (!((MovingMapItem) items.get(loops)).dying()) { ((MovingMapItem) items.get(loops)).kill(); i++; } ...
d6690ddd-bd37-40bd-95c7-1d5955d737e4
8
public void keyPressed(KeyEvent e) { switch(e.getKeyCode()) { case KeyEvent.VK_RIGHT: if (gameBoard.isValidMove(Direction.RIGHT)) { gameBoard.moveSide(Direction.RIGHT); repaint(); } break; case KeyEvent.VK_LEFT: if (gameBoard.isValidMove(Direction.LEFT)) { gameBoard.moveSide(D...
fdfc4dd2-5d26-47ae-be70-3ac1f823885f
4
private void radixSort0(int[] a, int i, int low, int high) { if (i < 0) return; for (int j = low; j < high; j++) registers[getDigit(a[j], i)].offer(a[j]); //printInfo(i); int index = low; for (Queue register : registers) { int low2 = index; ...
0fa94120-5e68-4e0a-9549-1c57643b9f8a
7
public void listeningPort(){ BufferedReader entradaCliente; DataOutputStream salidaServer; String peticion = ""; int tamano = 0; try (ServerSocket puertoServidor = new ServerSocket(PUERTO)) { Socket puerto = puertoServidor.accept(); entradaCliente = new Bu...
e50f5845-cdf8-4f5b-84f1-7893472419d3
9
public Model method202(int i) { if (stackIDs != null && i > 1) { int j = -1; for (int k = 0; k < 10; k++) if (i >= stackAmounts[k] && stackAmounts[k] != 0) j = stackIDs[k]; if (j != -1) return forID(j).method202(1); } Model model = Model.method462(modelID); if (model == null) return nul...
22b4d4d9-d718-427e-9d81-355fab5acc6e
7
public static List<Double> changeOfCoords(List<Poi> oldPoiList, List<Poi> newPoiList){ List<Double> changes = new ArrayList<Double>(); HashMap<String, Poi> newPoiMap = new HashMap<String, Poi>(); for (Poi new_poi : newPoiList) { newPoiMap.put(new_poi.getId(), new_poi); } for(Poi old_poi : oldPoiList){ i...
3f6831aa-6ae6-4e85-807c-bddb731c5aec
2
public Main(){ try{ Display.setDisplayMode(new DisplayMode(800, 500)); Display.setResizable(false); Display.setTitle("Hexagon Mapping"); PixelFormat pf = new PixelFormat().withSamples(4).withDepthBits(24); Display.create(pf); width = 800; height = 500; AL.create(); }catch(LWJGLEx...
b11bdd55-f81b-4995-99fe-a2e3fcbfcedd
5
public Response serve(IHTTPSession session) { Map<String, String> header = session.getHeaders(); Map<String, String> parms = session.getParms(); String uri = session.getUri(); if (!quiet) { System.out.println(session.getMethod() + " '" + uri + "' "); Iterator<St...
cba5ca9c-9977-4ef1-a178-e5fd73bac30e
1
public void playFanFare() throws InterruptedException{ try { in = new FileInputStream(fanFare); as = new AudioStream(in); ap.player.start(as); } catch(Exception e) { System.out.println("Got an IOException: " + e.getMessage()); e.printStackTrace(); ...
dd0cadf1-daed-4762-9bfd-3dc134e4795f
1
public World getWorld(){ if(server != null)return server.getWorld(); return null; }
286ca07b-0d29-4e91-807c-5426a1ac935d
4
@Override public boolean equals(Object obj) { if(obj == null) { return false; } if(getClass() != obj.getClass()) { return false; } final TerminalPosition other = (TerminalPosition) obj; if(this.row != other.row) { return false; ...
447643d3-9dd9-4864-a4e3-f4274a484fe0
0
public void setCount(int value) { this._count = value; }
8368b1df-6a36-48a6-88aa-3b132c3022b4
5
public static BigInteger check() { for (BigInteger a : primes) { for (BigInteger b : primes) { for (int i = 0; i < 80; i++) { int sum = i * i + a.intValue() * i + b.intValue(); BigInteger test = new BigInteger(String.valueOf(sum)); ...
4b9ef6f0-b225-4a98-9ddf-efb171b80d39
3
public static Stack<Integer> sortStack(Stack<Integer> s){ Stack<Integer> r = new Stack<Integer>(); while(!s.isEmpty()){ Integer e = s.pop(); while(!r.isEmpty() && r.peek() > e){ s.push(r.pop()); } r.push(e); } return r; }
b6f92951-700d-46d3-8871-4a7a319cd8f7
1
public static final int GetLenToPosState(int len) { len -= 2; if (len < 4) return len; return 3; }
3ef6623c-1c65-482d-a49f-35c67535dcef
5
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
184cc62a-0ccd-406a-8d77-e40df74752ac
4
@SuppressWarnings("static-access") @EventHandler(priority = EventPriority.HIGH) public void onMobDeath (EntityDeathEvent event) { Random rand = new Random(); int dropAmount = rand.nextInt(3); Entity entity = event.getEntity(); World world = event.getEntity().getWorld(); i...
d8f7d6f4-fcbf-4557-a8a0-32dcca23b77b
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...
7598de40-a9fb-48da-9a7d-527710cd421a
1
public void update() { bgX += speedX; if (bgX <= -2160) { bgX += 4320; } }
6ceed340-8c28-4965-9166-c0c4ebe2ddbb
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SpecificationSubModel other = (SpecificationSubModel) obj; if (featureSpecSet == null) { if (other.featureSpecSet != null) return false; ...
2d4c3e6b-0824-4cd5-833a-5b595b955e45
0
public void setContent(String content) { this.content = content; }
ab773ce4-1939-4790-a3e1-5f4cfee38af0
3
private void getDataFromEvent(Sim_event ev) { IO_data io = (IO_data) ev.get_data(); // if the sender is not part of the overall network topology // whereas this entity is, then need to return back the data, // since it is not compatible. if (link_ != null) { ...
a308233a-cda4-4a0f-82d8-90640729317d
4
public static void renderNormalBlock(float x, float y, float z, boolean clear, int id, int rendermode) { // GL11.glTranslatef(x, y, z); if (clear) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glLoadIdentity(); }// GL20.glUseProgram(0); if (id == 1) { // GL11.glColor3f(0...
356ce56b-a466-4854-9f19-8c6e1fb0e4a3
0
public void setEventName(String eventName) { this.eventName = eventName; }
340fe41c-15a6-461e-bf90-e6e17c0def90
0
public void addAdj(TrieNode node){ adj[getIndex(node.ch)]=node; }
49b5b385-c4e8-4751-bd68-11c688409391
6
@Test public void testNull() { RedBlackTree<Integer> tree = new RedBlackTree<Integer>(); try { tree.insert(null); Assert.fail(); } catch (NullPointerException e) { } try { tree.getPredecessor(null); Assert.fail(); } catch (NullPointerException e) { } try { ...
1db79bc6-2660-4334-a6ae-341f738606cc
2
public void replaceCards(Card oldCard, Card newCard){ // We need to find the index of the old card for(int i = 0; i < this.cards.size(); i++) { if(this.cards.get(i).equals(oldCard)) { // Set the new object this.cards.set(i, newCard); } } }
f4ade8f7-4103-4c67-845b-b142e20c792c
4
public static void main(String[] args) throws InterruptedException { Thread.currentThread().setName("Startup"); try { LOG.info("The \"Java GWCAConstants\" (version {}) is starting", Version.getVersion()); addShutdownHook(); // Fill in the PID here gwcaCon...
6b888bda-ec47-4c44-a0da-887feb854ffe
3
@Override public Set<Election> getNominationsForUser(User user) { Set<Election> electionsNominated = new HashSet<Election>(); Collection<Election> col = electionMap.values(); Iterator<Election> it = col.iterator(); while (it.hasNext()) { DnDElection el = (DnDElection) it.next(); if (el.getElectionState(...
6e74a75f-dbe2-4b3a-a929-8d51c0f6bc95
0
public double[] getBbox() { return bbox; }
f4a8bcd7-a77f-4ae4-ac08-b4c223da9f70
1
private boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; } }
59b8493a-74ce-42c2-9bb3-a9f04ba65f77
3
public static int hashCode(final Node node) { class Int { int value = 0; } ; final Int hash = new Int(); node.visit(new TreeVisitor() { public void visitExprStmt(final ExprStmt stmt) { hash.value = 1; } public void visitIfCmpStmt(final IfCmpStmt stmt) { hash.value = stmt.comparison() + ...
ddb28d7a-f804-4cf6-806d-bb0f09a42398
0
public String toString(String input) { return name + calc(input); }
6addc850-e5c9-46c8-9789-1d0663ddd63d
7
public static boolean handle(SyncSettings settings) throws UnknownHostException, IOException { HttpRequestor rq = settings.getRequestorFor(SyncPage.NEW); Request r = rq.getRequest(); buildRequest(settings, r); // only actually request if necessary int minSize = settings.isUsingPassword() ? 1 : 0; if (r.g...
c827578b-6ea2-4709-b929-a240b5f4137c
2
public void uglyjoglhack() throws InterruptedException { try { rdr = true; display(); } catch (GLException e) { if (e.getCause() instanceof InterruptedException) { throw ((InterruptedException) e.getCause()); } else { e.printStackTrace(); throw (e); } } finally { rdr = false; } }
cb10aa0f-56d8-4afb-b639-bf962702e49b
1
private static void postOrderTraversal(Node root) { if (root == null) return; postOrderTraversal(root.left); postOrderTraversal(root.right); System.out.println(root.v); }
d63364fe-28e6-484c-b88c-421bffded83d
8
private boolean edge_adj(Edge e1,Edge e2) { if(e1.source.getId()==e2.source.getId() && e1.target.getId()==e2.target.getId()) return false; else if(e1.target.getId()==e2.source.getId() && e1.source.getId()==e2.target.getId()) return false; else if(e1.source.getId(...
2d23b1a1-c7aa-4cbb-bea5-f84057c0e725
2
private boolean validCommand(String command) { String[][] items = this.menuItems; for (String[] item : this.menuItems) { if (item[0].equals(command)) { return true; } } return false; }
1facfe9e-f63b-4656-a84d-fea1dbe538c5
3
public boolean hasTransitionsInCorrectForm(Automaton automaton) { Transition[] transitions = automaton.getTransitions(); for (int k = 0; k < transitions.length; k++) { if (!isPushLambdaTransition(transitions[k]) && !isPushTwoTransition(transitions[k])) { return false; } } return true; }
4de39a46-7b41-4128-a716-48adbd7a49d9
5
public void write(){ try { log.info("Writing to "+ to +" file"); DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("highscores")...
cc1111fd-cc36-4505-a607-52fdedc4aa2b
9
protected boolean fireAndHandleEvent(WordTokenizer tokenizer, SpellCheckEvent event) { fireSpellCheckEvent(event); String word = event.getInvalidWord(); //Work out what to do in response to the event. switch (event.getAction()) { case SpellCheckEvent.INITIAL: break; case SpellCheckEv...
e0b5ba3f-f75f-4d46-9e92-8345532fee4c
9
private void postPlugin(final boolean isPing) throws IOException { // The plugin's description file containg all of the plugin data such as name, version, author, etc final PluginDescriptionFile description = plugin.getDescription(); // Construct the post data final StringBuilder data =...
1e62ae26-99fd-4a74-bc89-68af497241af
7
public byte[] extractFile(FAT32DIRElement f32DIRElement) { int countFileClusters = 0; if (f32DIRElement.getDIR_FileSize() < BPB_BytsPerSec) { countFileClusters = 1; } else { countFileClusters = f32DIRElement.getDIR_FileSize() / BPB_BytsPerSec + 1; } //счет...
6f2cd92c-6e08-462c-b886-4c769120fcfa
2
public int getDividerMaximum() { if (isFull()) { return Math.max((mHorizontal ? mWidth : mHeight) - Dock.DIVIDER_SIZE, 0); } return 0; }
e7e5012a-9fe2-439c-90b7-7d505b0ad1bc
4
public void ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis) { if (semiMajorAxis < 0) throw new RuntimeException("ellipse semimajor axis can't be negative"); if (semiMinorAxis < 0) throw new RuntimeException("ellipse semiminor axis can't be negative"); double xs = scaleX(x...
e4114db0-0297-4bb4-80ba-4e15be785265
4
public void closePromoteConnection(){ try { //Rollback any outstanding transactions - there shouldn't be any, so this is probably an internal mistake //If this rollback isn't performed, closing the connection issues a commit which is potentially dangerous if(isTransactionActive(mPromoteConne...
1d10cda0-0e07-4814-9c85-7c916a38da7d
0
public ArrayList<Account> pay(Account seller, String amount, Account buyer) { buyer.pay(amount); seller.receive(amount); ArrayList<Account> accounts = new ArrayList<Account>(); accounts.add(buyer); accounts.add(seller); return accounts; }
b96ad5ad-074b-4bff-a0ef-d427e3a9491e
9
public void addYoungerLab(){ TD tD1 = new TD(1); TD tD2 = new TD(2); TD tD3 = new TD(3); if(!this.getListofLabs().containsKey(1) && this.getListoflessons().containsKey(1)){ this.getListofLabs().put(1, tD1); System.out.println("You attended the first lab."); }else if(!this.getListofLabs().contains...
938f7197-824a-4281-8854-283908e9adc3
3
public void moveLeft() { if (units1.size() == 6) { QMessageBox.warning(this, "Nie można przenieść jednostek", "Bohater może mieć maksymalnie 6 jednostek"); } else if (units2.size() == 0) { QMessageBox.warning(this, "Nie można przenieść jednostek", "Bohater nie ma żadnych jednostek"); } else if (list2.curre...
bc7edf77-85db-4d6e-9149-3d525ad6a4b7
8
@Override public void startBehavior(PhysicalAgent forMe) { if((forMe!=null)&&(forMe instanceof MOB)) { if(stomachR==null) stomachR = CMClass.getLocale("StdRoom"); lastKnownEaterM=(MOB)forMe; lastKnownLocationR=((MOB)forMe).location(); if(lastKnownLocationR!=null) stomachR.setArea(lastKnownLoca...
081fc9ab-3383-490e-80ca-3553881dc26d
7
public static final boolean checkTrashOkazari(Body b) { if(b.hasOkazari()) return false; if(b.isVerySad()) return false; Obj found = null; int minDistance = b.getEyesight(); int wallMode = b.getAgeState().ordinal(); // 飛行可能なら壁以外は通過可能 if(b.canflyCheck()) { wallMode = AgeState.ADULT.ordinal(); } ...
807e0008-9b1c-4a54-b58c-7e76d594ca75
2
public static Vector<Place> getPlacesDisponibles (String numS, String date) throws BDException { Vector<Place> res = new Vector<Place>(); String requete = "select norang, noplace, numz from lesplaces MINUS select lestickets.norang, lestickets.noplace, numz from LesTickets, lesplaces where lestickets.noplace = lespl...
b02b2209-2f9b-4b08-9f39-d813834c05f4
7
public void viewAccepted(View view) { if(bridge_view != null && bridge_view.getViewId().equals(view.getViewId())) return; int prev_members=bridge_view != null? bridge_view.size() : 0; bridge_view=view; switch(view.size()) { case 1: ...
b7376c69-0995-40a3-80f5-9fa9a7f4a72d
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...
b42b802f-0fe8-4764-ad6c-fe52df23fcdc
0
@Override public int attack(double agility, double luck) { System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn..."); return 0; }
ba06c355-fdc2-4669-9f24-2c9cd367cbcf
3
protected void loadPrestigeList(){ //print all prestige buttons prestigeContainer.clear(); for(int classId : DDOCharacter.getTakenClasses()){//loop over all possible prestige classes if(DDOCharacter.prestigeToClassMap.containsValue(classId)){ //check to see if there is any valid Set<String> prestigeSet ...
39373843-0ba5-4e80-bd09-dbe7ced98022
2
public boolean vaincu(){ int actifs = 0; for (int i=0; i<recensement(); i++) if (!soldats[i].estMort()) return(false); return(true); }
7f60bd76-459a-4499-8751-1726e736b9ae
9
public void update() throws SteamCondenserException, TimeoutException { SourceServer ss = new SourceServer(sock.getAddress(), sock.getPort()); Map<String, Object> info = ss.getServerInfo(); Map<String, String> rules = ss.getRules(); Map<String, SteamPlayer> players = ss.getPlayers(); ...
eeb150a2-edfd-4777-a5a0-b2d2d4425ce0
8
private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expe...
ebae89bd-2f72-4535-b5f3-2014821a6065
5
public void draw() { timer--; if (timer == 0) { //if a player died reset all players and detonate all bombs if (BombermanGame.players.stream().anyMatch(player -> !player.living)) { BombermanGame.players.forEach(Player::resetPosition); for (Bomb b :...
51d87f80-231c-4a19-8ebd-a1ca28ca31f2
0
@Before public void init(){ MockitoAnnotations.initMocks(this); }
f57cd709-6c32-4b4b-9088-5fe6b221ed18
8
private boolean handlePlaceAllowed(Player player, Block block, Material type) { if (WorldRegionsPlugin.getInstanceConfig().ENABLE_ALLOWED_PLACE && WGCommon.willFlagApply(player, WorldRegionsFlags.ALLOWED_PLACE)) { // Disabled? if (WGCommon.areRegionsDisabled(player.getWorld())) return true; // Bypass? ...
b306b685-a219-4532-9099-b2c4cb604c15
6
public void refresh() { GlobalLogger.getLogger().logp(Level.INFO, "CalendarPanel", "refresh", "Refresh called."); // We need to go through the task list and update all items that match // the current date // Clear it out first itemsToPaint.clear(); for (Scheduleable t : Timeflecks.getSharedApplicati...
97a0c155-7f26-40eb-b8fe-a1b481000f4d
5
public Difficulty difficulty(String functionString){ Difficulty difficulty; if (functionString != null){ if (functionString.toLowerCase().equals("easy")){ difficulty = Difficulty.EASY; }else if (functionString.toLowerCase().equals("hard")){ difficulty = Difficulty.HARD; }else if (functionString.toL...
af6ca0ca-e522-4e68-86cd-18da230526f1
2
public static void copyFolder(String srcFileDir, String destFileDir, String includePattern, String excludePattern) { File srcFile = new File(srcFileDir); File destFile = new File(destFileDir); Project project = new Project(); Copy copy = new Copy(); copy.setProject(project); ...
bdd68f52-093e-43da-8935-551295672091
6
public boolean match(Sim_event ev) { // checks for errors first if (ev == null || lfn_ == null) { return false; } boolean result = false; try { // find an event with a matching tag first if (ev.get_tag() == tag_) { Object obj ...
22d1ef86-3b69-45f9-a97c-0cae32155b48
2
public void addChildren(int x) { if(x >= 3) { propChildren[x] = new PropQuad(this, new Rectangle2D.Double(container.getX() + (container.getWidth()/2), container.getY() + (container.getHeight()/2), container.getWidth()/2, container.getHeight()/2), props, rects, flatRects); } else { if(x < 2) { propChi...