method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e840b346-619f-4203-8f5e-38da8dac619b
1
@Override public void remove(int i) { for(int j = i; j<this.size-1;j++){ this.keys[j] = this.keys[j+1]; this.values[j] = this.values[j+1]; } this.size--; }
da8d16ef-7015-47be-b0f2-a7cf006bd1d6
7
void postRiderEvent(int event, int floor, int elevator) { int direction = dirNeither; if (elevator != -1) { Lib.assertTrue(elevator >= 0 && elevator < numElevators); direction = elevators[elevator].direction; } RiderEvent e = new RiderEvent(event, floor, elevator, direction); for (int i=0; i<numRiders; ...
8511970d-cf16-4cc9-8286-44b097ed873b
1
public static synchronized void playSound(final String url) { try { Clip sound = (Clip) AudioSystem.getLine(new Line.Info(Clip.class)); sound.open(AudioSystem.getAudioInputStream(new File(Constants.ASSETS+ File.separatorChar +url))); sound.start(); } catch(Exception e){ } }
648f75dd-8dc3-4ef9-9474-1db5d991ec87
2
public void fillWithColorNoise(CPRect r) { CPRect rect = new CPRect(0, 0, width, height); rect.clip(r); Random rnd = new Random(); for (int j = rect.top; j < rect.bottom; j++) { for (int i = rect.left; i < rect.right; i++) { data[i + j * width] = rnd.nextInt() | 0xff000000; } } }
34ad15a1-727c-484c-bda1-f17fa8d85a28
0
public int getAvailableCredit() { return this.creditLimit - this.balance; }
82972e82-8f0d-4bb3-bacc-2c02015cba61
0
private JToolBar getToolBar() { JToolBar toReturn = new JToolBar(); toReturn.setFloatable(false); myBackButton = makeButton("Back", "left.gif", new BackAction(), null); myForwardButton = makeButton("Forward", "right.gif", new ForwardAction(), null); myStartButton = makeButton("Main Index", "start.gif", ne...
58911110-c761-4d4f-99d4-cdf982c38ee4
0
public DebugCommand(TotalPermissions p) { plugin = p; }
862601b0-9d21-4245-b5d7-b95f68bf7798
1
public void previousPage() { if (isHasPreviousPage()) { page--; } }
8a0db557-847a-4347-815a-03e4baf8e970
2
public int getAttributeSize() { int size = 2; /* attribute count */ if (unknownAttributes != null) { Iterator i = unknownAttributes.values().iterator(); while (i.hasNext()) size += 2 + 4 + ((byte[]) i.next()).length; } return size; }
70ac383e-67e5-47c9-8919-91ea1507da77
3
public void mergeSort1(int[] inputArray) { int size = inputArray.length; if (size < 2) return; int mid = size / 2; int leftSize = mid; int rightSize = size - mid; int[] left = new int[leftSize]; int[] right = new int[rightSize]; for (i...
e51e8457-b236-4ffe-9920-a3b06699bb33
8
public static Length getTypeOfLength(String type) { if (type.equalsIgnoreCase("inch") || type.equalsIgnoreCase("inches")) { return new Inch(0.0); } if (type.equalsIgnoreCase("meter") || type.equalsIgnoreCase("meters")) { return new Meter(0.0); } if (type.equalsIgnoreCase("foot") || type.equalsIgno...
7ae6b285-2d74-48d8-a44b-a189a4654ea5
8
public void init() { this.mcCanvas = new CanvasMinecraftApplet(this); boolean var1 = false; if (this.getParameter("fullscreen") != null) { var1 = this.getParameter("fullscreen").equalsIgnoreCase("true"); } this.mc = new MinecraftAppletImpl(this, this, th...
8f116375-ee6f-4a72-9b10-bbd869dda3af
7
@Override public TLValue evaluate() { TLValue value = expression.evaluate(); List<TLValue> indexValues = new ArrayList<TLValue>(); for (TLNode indexNode : indexes) { indexValues.add(indexNode.evaluate()); } for(TLValue index : indexValues) { if(!index.isNumber() || !(value.isList(...
9a5da41c-e9e1-4be9-9347-0485875dd281
5
@Override public void paintComponent(Graphics graphics) { graphics.setColor(Color.BLACK); graphics.fillRect(0, 0, getWidth(), getHeight()); graphics.setFont(descent.getTitleFont().deriveFont(48.0F)); graphics.setColor(Color.WHITE); graphics.drawString(title, (getWidth() - gra...
0d3cbbdc-30a9-45d9-b5b9-11231a4eac5d
6
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); switch (key) { case KeyEvent.VK_UP: action.thrust = 1; break; case KeyEvent.VK_DOWN: action.thrust = -1; break; case KeyEvent.VK_LEFT: action.turn = -1; break; case KeyEvent.VK_RIGHT: ...
5e2e51a9-58fa-4540-bb67-80159d52f501
9
public HandEvaluator(Hand hand) { cards = hand.getCards(); // Find patterns. calculateDistributions(); findStraight(); findFlush(); findDuplicates(); // Find special values. boolean isSpecialValue = (isStraightFlush() || ...
f91aa87c-04ff-4a86-b1b5-0c246d56ed6d
2
private void assertValidTypeOfDatabase(String typeOfDatabase) { if(typeOfDatabase.isEmpty() || typeOfDatabase.equals("DB2")) { fail("not a valid type of database"); } }
05c59e52-5d1e-4670-a23f-a84c5ccf6c9b
2
private ImmutableSet<Long> nextPages(SiteConfig siteConfig) { ImmutableSet.Builder<Long> pages = ImmutableSet.builder(); for (Map.Entry<String, PageConfig> entry : siteConfig.getPages().entrySet()) { PageConfig pageConfig = entry.getValue(); double r = random.nextDouble(); if (r < pageConfig.g...
b8b22123-b270-4893-a323-1f4c9f243f09
3
public void render() { GameObject[][] SubArea = getVisibleMap(Screen.getPlayer()); for (int x = 0; x < SubArea.length; x++) { for (int y = 0; y < SubArea[0].length; y++) { if (!(SubArea[x][y] == null)) renderObject(x, y, SubArea[x][y]); } } }
403cb01c-2b25-46eb-a70e-abaa5b591e17
1
public void write(String file_path) { try { ConfigurationManager.logger.log("Writing the pathname to a cache file at: " + file_name, 1); PrintWriter writer = new PrintWriter(file_name); writer.println(file_path); writer.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } }
b62eb27a-b5a2-4e9e-9e58-e86caec85301
6
public static String getSetting(String name) { if (hasVariableWithName(name)) { PrioritizedVariable var = getVariableByName(name); if (var.PrioritizationExpression == null) { //Get newest TaggedValue newestValue = var.Values.get(var.Values.size() - 1); ...
7d8b048f-c29f-413e-a987-e30941b03f5e
8
protected boolean isApndblWithSpacingError(MCandidate prevMC, MCandidate mc) { if( // 복합 명사인 경우 prevMC.isLastTagOf(POSTag.NN) && mc.isFirstTagOf(POSTag.NN) // 연결 어미 + 보조 동사 || prevMC.isLastTagOf(POSTag.EC) && mc.isFirstTagOf(POSTag.VX) // 관형형 전성어미 + 의존 명사 || prevMC.isLastTagOf(POSTag.ETM) && mc.isFirstTa...
6de7b24b-e98f-4f4a-be98-0bd2b120d4ae
3
protected void parseFont(byte[] font, int start, int len) { name2width = new HashMap<String,FlPoint>(); byte data[] = null; if (isASCII(font, start)) { byte[] bData = readASCII(font, start, start + len); data = decrypt(bData, 0, bData.length, 55665, 4); } else {...
9e3efc6e-1cb7-44c2-a3cd-382c5471afa2
4
public static DyeColor regrowthColor(DyeColor color) { switch ( color ) { case WHITE: case BLACK: case GRAY: case SILVER: return color; default: return DyeColor.WHITE; } }
959cc487-7b2e-40ba-b5ac-36a0d5d8b592
4
List<A> merge(List<A> xs, List<A> ys, final Ord<A> o) { final Buffer<A> buf = empty(); while (true) { if (xs.isEmpty()) { buf.append(ys); break; } if (ys.isEmpty()) { buf.append(xs); break; } ...
bd33a964-5824-414b-953f-48a9cf1e4d91
8
public static ItemStack result(int i){ ItemStack st = null; switch (i) { case Sticks: st = new ItemStack(Items.stick, 2); break; case CraftTable: st = new ItemStack(Items.craftTable, 1); break; case Pickaxe: st = new ItemStack(Items.pickaxe, 1); break; case CampFire: st = new ItemSt...
6b6d2acb-9adc-4aef-bafa-fdb960ad5215
5
public CheckResultMessage checkG11(int day) { int r1 = get(23, 5); int c1 = get(24, 5); int r2 = get(47, 5); int c2 = get(48, 5); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); if (0 != getValue(r1 + 11, c1 + day, 5).compareTo( ...
7bcb6483-31c7-4baa-afdf-01987c50d20d
6
@Override public List<Combo> call() throws Exception { String compname = comp.getClass().getSimpleName(); switch (compname) { case "AtkComparator": return callAtk(); case "DefComparator": return callDef(); case "MatkComparator": return callMatk(); case "StaDComparator": case "StaAComparator": ...
a830cc51-2e46-451f-8209-5b8c990e7030
1
private void doInsert(String typeCoffee, int price) { System.out.print("\n[Performing INSERT] ... "); try { Statement st = conn.createStatement(); st.executeUpdate("INSERT INTO COFFEES " + "VALUES ('" + typeCoffee + "', " + price + " )"); } catch (SQLE...
0682dbea-8631-40f8-81e9-06486cc2f61a
9
public ResourceDMBean(Object instance) { if(instance == null) throw new NullPointerException("Cannot make an MBean wrapper for null instance"); this.obj=instance; Class<? extends Object> c=obj.getClass(); expose_all=c.isAnnotationPresent(MBean.class) && c.getAnnotation(MBean....
8fca189f-c201-4c11-bf76-ef4089cedcfa
0
public void laitetaasPariEstetta() { t = new Taso(); pe = new Pelaaja(); pe.setTaso(t); pe.siirra(5, 95); t.lisaaEste(new Este(-50, 0, 0, 200)); t.lisaaEste(new Este(-100, 100, 200, 150)); }
cb369cb4-9683-44d0-900f-505965b4ac2a
8
private Rectangle2D createShadow(RectangularShape bar, double xOffset, double yOffset, RectangleEdge base, boolean pegShadow) { double x0 = bar.getMinX(); double x1 = bar.getMaxX(); double y0 = bar.getMinY(); double y1 = bar.getMaxY(); if (base == RectangleEdge.TOP) {...
ac5af9c4-2c13-45c6-b792-6f5a68263340
9
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxN...
394b5710-0820-45b8-8e02-19b14831fe4c
9
public int rank(int[] num, int l, int r, int k) { if (l > r) return -1; int rand = l + new Random().nextInt(r - l + 1); swap(num, l, rand); int begin = l + 1, end = r; while (begin <= end) { while (begin <= end && num[begin] <= num[l]) { begin++; } while (begin <= end && num[l] < num[end]) { ...
6e674e18-ba4e-483b-824b-d42b2823e94c
7
public static void main(String[] args) { Scanner sysin = new Scanner(System.in); try { // reads the create command String command = sysin.next(); if (!command.equals("create")) throw new IllegalArgumentException("UNKNOWN COMMAND"); image...
8dbb2a66-558b-4595-a375-ea40475e3987
6
private String s(Sign s, boolean firstCap) { switch (s) { case ROCK: return (firstCap ? "R" : "r") + "ock"; case PAPER: return (firstCap ? "P" : "p") + "aper"; case SCISSORS: return (firstCap ? "S" : "s") + "cissors"; } return ""; }
6e9e351e-01e2-4a74-a3e1-c8afd7f26011
6
@Override public void sort(IComparable[] ArrayToSort) { boolean swapped = true; boolean leftToRight = true; // int left = 0; int right = ArrayToSort.length - 1; while (swapped) { swapped = false; // if ShakerSort has nothing to to, swapped == false --> return. if (leftToRight) { // bubble from...
10a12ab8-7d5e-43fd-a165-ead78e824dc9
6
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(false); String userPath = request.getServletPath(); // ist der Nutzer nicht angemeldet, schicke ihn zur Login-Seite ...
4233c8c7-146a-4078-b4fe-b228b7e8e023
7
private void pickNextState(String fileContents) throws IOException { List<NusmvState> states = new ArrayList<NusmvState>(); NusmvState currentState = (NusmvState) this.currentNode.getState(); try { states = NuSMVOutputHandler.addTransitionsFromState( fileContents, currentState, sts); } catch (...
721b81e2-4d4a-4c4a-b11e-ccf290807280
6
public void close() throws IOException { if (out != null) { if (!finished) { try { writeEndMarker(); } catch (IOException e) {} } try { out.close(); } catch (IOException e) { if (...
e3f54568-64a8-4275-91e3-9f02f61772f7
9
private boolean matchesStepTwo() { RubiksCube rc = this.initialRcConfig; if (! matchesStepOneTopCross()) return false; // Get top face center cubie Cubie topFaceCenterCubie = rc.getCubie(2, 3, 2); // Check the edges Cubie frontFaceEdgeCubie = rc.getCubie(2, 3, 3); Cubie frontFaceUpperR...
8c121ab8-60c8-41ab-9273-1817773412b5
1
private ArrayList<Point> clone(ArrayList<Point> al) { ArrayList<Point> cloned = new ArrayList<Point>(); for (Point p : al) cloned.add(new Point(p.x, p.y)); return cloned; }
13d5c7ba-6ae2-41b1-bb7e-d61d34b1063a
7
public boolean isMatch(String s, String p) { if(p.isEmpty()){ return s.isEmpty(); } if(s.length() >= 1 && (s.charAt(0) == p.charAt(0) || p.charAt(0) == '.')){ if(p.startsWith(p.charAt(0) + "*")){ return isMatch(s.substring(1), p) || isMatch(s, p.substring...
5aecc8ea-358c-48a3-868c-4aba1f6be66f
6
@Override public void stateChanged(ChangeEvent arg0) { if (this.chckbxAutoApply.isSelected()) { if (!this.stopAutoApply) this.applyChanges(); } else { if ((arg0.getSource() == this.spnrResultOffsetX) || (arg0.getSource() == this.spnrResultOffsetY) || (arg0.getSource() == this.spnrHeight) || ...
c290e84e-4693-43d9-89de-d22aa3db959e
0
public BusinessObject(String id) { this.id = id; }//constructor
8ef8715b-7332-4133-aa3d-c1178c7d2108
1
protected void changedIP(){ for(ModelChangeListener mcl : listeners){ mcl.changedClientIP(client_ip); } }
11042f4e-7b01-4df3-ad7b-cff10e5072e0
4
private BinarySearchTreeNode<T> performBinarySearch(T targetValue, BinarySearchTreeNode<T> currentRootNode) { // BASE CASE if (currentRootNode == null) { return null; } // RECURSIVE CASE if (currentRootNode.getValue().compareTo(targetValue...
49ee2175-9b11-473a-82fb-6b587edf938e
5
public HashMap<Integer, Integer> selectPertinenceS(ArrayList<Integer> lint) { HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>(); if (lint.size() != 0) { Map<Integer, Integer> res = new HashMap<Integer, Integer>(); String listint = new String(); listint = ...
eb0fe726-70ed-4f65-9bbc-5bf4790877b6
7
private int generateUpdate(BufferedWriter out, Object fileToModify, int fileSize) throws IOException { ModificationPart modificationPart = this.getModificationPart(); int bs1, bs2, bs3, dataModified = 0; switch (modificationPart) { case B: case E: case M: bs1 = this.getRealisticByteModification(fileSi...
2e117691-4996-40f7-8ddd-561f7be72753
3
public void goTo(int x2, int y2) { if (draw){ Graphics2D g = (Graphics2D)image.getGraphics(); g.setColor(color); g.draw(new Line2D.Double(x, y, x2, y2)); } if (currentPath != null){ if (draw){ currentPath.lineTo(x2, y2); } else { currentPath.moveTo(x2, y2); } } x = x2; y = y2...
8f31697a-76c3-4885-9036-5400d49e63ab
1
@Override public Dimension getPreferredSize() { if(this.image == null) return new Dimension(600, 300); return new Dimension(this.image.getWidth() + 2*border, this.image.getHeight() + 2*border); }
fcca269f-b897-4ae1-a273-a77044ff713c
3
public static String toString(JSONObject jo) throws JSONException { boolean b = false; Iterator keys = jo.keys(); String string; StringBuffer sb = new StringBuffer(); while (keys.hasNext()) { string = keys.next().toString(); if (!jo.isNull(s...
e57c36b9-4f0d-4ea3-9703-7dc6f392c8e3
0
protected int getAge() { return age; }
9951f8f6-ce82-4a01-a8c8-3e854e2e0443
8
public LoggingInWindow() { setUndecorated(true); getContentPane().setLayout(null); JProgressBar progressBar = new JProgressBar(); final JLabel label = new JLabel(""); progressBar.setBounds(0, 326, 492, 14); label.setBounds(0, 0, 492, 340); progressBar.setIndeterminate(true); getContentPane()...
8a843529-3b87-4c95-9c85-e240f3bcd3bf
3
public int map_pf_interact(int id) { if (path != null) { path.clear(); path_moving = false; path_step = 0; path_interact_object = null; } Gob pgob; synchronized (glob.oc) { pgob = glob.oc.getgob(id); } if (pgob == null) return -1; path_interact_object = pgob; path = APXUtils._pf_find_p...
cf0696f2-5fce-4b5a-ad5a-65770b913050
7
private void criaEventoTextField() { textFieldAgencia.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (textFieldAgencia.getText() != null) { Integer agenciaSelecionada = new Integer(textFieldAgencia .getText()); agenciaSelecionada--; ...
53185866-2244-48ea-827b-f271967b676e
2
@Override public void atualizar(Cliente cliente, Secao secao, Evento evento){ try { conn = ConnectionFactory.getConnection(); String sql = "UPDATE ingresso SET idcompra = (SELECT compra.id " + "FROM compra JOIN cliente ON compr...
e6bbd73a-9be0-4b91-af27-323c069b50b2
3
public boolean isRightHeld(){ if(isXboxControllerAttached()){ if(xboxController.getLeftStickXAxis()>0.5){ return true; } } if(right.isHeld()){ return true; } return false; }
59fa8a53-603c-4b92-bc81-bf6a38d91297
6
private void createToolBar(Composite parent) { ToolBar toolbar = new ToolBar (parent, SWT.NONE); String group = null; for (int i = 0; i < tools.length; i++) { Tool tool = tools[i]; if (group != null && !tool.group.equals(group)) { new ToolItem (toolbar, SWT.SEPARATOR); } group = tool.group; Too...
f8aee11e-6bf3-4e39-a8f0-833deac83c8f
2
public ChecksumUtils(AlgoChecksumType type) { if ((type != AlgoChecksumType.ADLER32) && (type != AlgoChecksumType.CRC32)) { throw new IllegalArgumentException("Invalid type of algorithm."); } this.type = type; }
abfd855a-06f3-4fde-b2c9-31a5a585b741
9
public void triggerCheck() { boolean showTrigger=false; // Find the number of Triggers List<Trigger> tList=theApp.getListTriggers(); // If no triggers return if (tList==null) return; int a; for (a=0;a<tList.size();a++) { // Get each trigger in turn Trigger trigger=tList.get(a); // Do we have a ma...
8bb4b20c-345e-4d64-ac31-01f658563484
6
public boolean addMobType(ArrayList<Object> toRemove, String type) { if (type.equalsIgnoreCase("monster")) { toRemove.add(MobType.MONSTER); } else if (type.equalsIgnoreCase("animal")) { toRemove.add(MobType.ANIMAL); } else if (type.equalsIgnoreCase("wateranimal")) { toRemove.add(MobType.WATER_...
1fc48ec9-c82d-4893-8035-5c13d75c79e7
2
private void generate(){ for (int y = 0; y < map.length; y++){ for (int x = 0; x < map[0].length; x++){ map [y][x] = new Tile(x, y, this); addObject (map[y][x], x*20+10 + leftSpace, y*20+10 + topSpace); } } map[endYf][endXf].setMove...
a7fc086d-80cd-495c-bcaa-6cd273c9bfc8
7
private void accionDesplazar(JButton boton){ if(boton.getText().equals("<<")){ boton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { verTexto(banderaBoton.PRIMERO); } catch (Exception e2) { // TODO: handle exception } } }); } ...
4841535c-0bdf-4c80-9c07-a9849b4bf60e
6
@Override public UnitItemStack[] pass(DataInputStream in, DataOutputStream out, PassthroughConnection ptc, KillableThread thread, boolean serverToClient, byte[] buffer, DownlinkState linkState) { length = lengthUnit.read(in, ptc, thread, serverToClient, linkState); if(length == null) { return null; } ...
1ee49ee8-7b13-4c5d-96df-f55373af6173
2
public void update(){ for (int x = 0; x < Standards.MAP_SIZE; x++){ for (int y = 0; y < Standards.MAP_SIZE; y++){ world[x][y].update(); } } }
9d7b5492-5a5a-4ca1-bd03-a1004234a0e2
0
public void setTitle(String title) { this.title = title; }
98af86ac-c403-42ba-a75f-1e84c6b0f63e
8
public AxisSpace reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, RectangleEdge edge, AxisSpace space) { // create a new space object if one wasn't supplied... if (space == null) { space = new AxisSpace(); ...
b95d70e4-9038-45fd-90af-fc45e2b975d5
9
private static String formatConfiguration(Configuration configuration) { StringBuilder result = new StringBuilder(16); if (configuration.language != null) { result.append('-'); result.append(configuration.language); } if (configuration.country != null) { result.append('-'); result.append('r'); re...
21557f81-bd98-466d-8ada-640703ecb411
7
public void reader(int m) throws FileNotFoundException { Scanner s = new Scanner(new File(getClass().getResource("mazes/").getPath()+"level0.txt")); try { back = ImageIO.read(getClass().getResource("images/levels/level0.png")); } catch (IOException ex) { } int r = 0;...
bdfa8d70-d95e-4e6b-a198-eda41cffb5e8
0
@Basic @Column(name = "FUN_ENDEUDAMIENTO") public Integer getFunEndeudamiento() { return funEndeudamiento; }
10035af1-02b1-47db-a206-3a7969b73415
8
ArrayList<seed> hexPack(double distToWall, double width, double length, ArrayList<Pair> treeLst) { ArrayList<seed> seedLst = new ArrayList<seed>(); boolean canFitMore = true; boolean treeCollision = false; double xIter = distToWall; int isEven = 1; double yIter = distToWall; while( canFitMore ) { ...
b56c4dfd-0c01-4e45-b2fa-62cfcbcb91df
0
public List<T> getCoordinates() { return coordinates; }
797c2b03-ee81-46f5-8f60-0b0f73361faf
9
public void processEvents() { for (;;) { // wait for key to be signalled WatchKey key; try { key = watcher.take(); } catch (InterruptedException x) { return; } Path dir = keys.get(key); if (dir == null) { log.error("WatchKey not recognized!!"); continue; } for (WatchEven...
5bb1017c-fc5e-4e61-b7c9-4e5f6af19df1
8
private static void mapObject(PreparedStatement pstm, int index ,Object arg) throws SQLException { Class<?> argClass = arg.getClass(); if (argClass == String.class) pstm.setString(index, (String) arg); else if (argClass == Integer.class) pstm.setInt(index, (Integer) arg); el...
a6c6ae43-12e8-4cdd-bd93-22fc7d199bed
3
public boolean isOver(){ for(int i=0; i<boardSize; i++){ for(int j=0; j<boardSize; j++){ Cell c = this.board.get(i).get(j); if(c.color == COLOR.WHITE) return false; } } return true; }
9227f767-86ca-41c0-82bb-500ccf7578f0
2
private void jButton5ActionPerformed() { String identityOfStreamer = JOptionPane.showInputDialog(null, "Enter the streamer's ID.\n" + "Riot games url is: http://beta.azubu.tv/riotgames\n" + "Riot games ID is: riotgames"); String nameOfStreamer = JOptionPane.showInputDial...
d7e51889-2ee9-4bc0-bf3d-3664b6ba8616
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Shedule shedule = (Shedule) o; if (idshedule != shedule.idshedule) return false; if (adress != null ? !adress.equals(shedule.adress) : shedule....
72f4ef84-df6e-4ba2-813a-97a327d5573f
5
public void genEnergyType(){ rand = new Random(); int energyRoll = (rand.nextInt(5)+1); if(energyRoll == 1){ energyType = "Acid"; } else if(energyRoll == 2){ energyType = "Cold"; } else if(energyRoll == 3){ energyType = "Fire"; } else if(energyRoll == 4){ energyType = "Electricity"; } else ...
0399718f-8314-43d2-8ce6-1da11e552d0e
4
public int solution(int[] array) { int count = 0; for (int p = 0; p < array.length; p++) { for (int q = p + 1; q < array.length; q++) { if (array[q] < array[p]) { count++; if (count > ONE_BILLION) { return -1; } } } } return count; }
1d8c9efe-5714-4741-9778-54bf79b9eaf8
9
public static String getWinner(String player1Choice, String player2Choice) { String result = ""; if (!elements.contains(player1Choice) || !elements.contains(player2Choice)) { throw new RuntimeException("Invalid value"); } if (player1Choice.equals(player2Choice)) { result = "It is a tie!"; ...
a37ad08d-50c2-4dc5-8709-4e9b4bbb5280
6
@Override public ArrayList<User> findAll() { ArrayList userList = new ArrayList(); try { connection = getConnection(); ptmt = connection.prepareStatement(QUERY_SELECT + ";"); resultSet = ptmt.executeQuery(); while (resultSet.next()) { ...
89afa5c2-a8d2-4e19-ac0e-1bcf8d0b38a7
4
public String readUntil(String pattern) { try { char lastChar = pattern.charAt(pattern.length() - 1); StringBuffer sb = new StringBuffer(); boolean found = false; char ch = (char) in.read(); while (true) { System.out.print(ch); sb.append(ch); if (ch == lastChar) { if (sb.toString().end...
a584d520-a9aa-4659-82aa-827200b15d4a
2
@Override public void keyPressed(KeyBindingEvent keyBindingEvent) { SpoutPlayer player = keyBindingEvent.getPlayer(); if (player.getOpenInventory().getType().equals(InventoryType.ENCHANTING)) { player.closeInventory(); return; } if (!keyBindingEvent.getScreenType().equals(ScreenType.GAME_SCREEN)) { ...
1d1a3906-b490-4965-8315-c8c031c7a00b
3
public K findKey (int value) { K[] keyTable = this.keyTable; int[] valueTable = this.valueTable; for (int i = capacity + stashSize; i-- > 0;) if (keyTable[i] != null && valueTable[i] == value) return keyTable[i]; return null; }
e61bddd0-3d8f-44d4-bd3b-ba5d7ec5e4e0
5
@Override public String onSkillSee(L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet) { if (skill.getSkillType() == L2SkillType.AGGDAMAGE && targets.length != 0) { for (L2Object obj : targets) { if (obj.equals(npc)) { npc.broadcastNpcSay(((caster.getAppearance().g...
e6a7924a-dca5-4393-9e04-63e8dd845869
9
@Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { // 获取登录之前的访问地址 SavedRequest savedRequest = requestCache.getRequest(request, response); if (savedRequest == null) { Sys...
3c905c82-d9de-4120-af2e-818e59e60b2a
6
private BufferedImage readJPGFile(File srcFile) throws IOException { // Find a JPEG reader which supports reading Rasters. Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("JPEG"); ImageReader reader = null; while (readers.hasNext()) { reader = ...
9d7c1dee-795f-45e3-8f3c-8b4f51d455a8
1
public String toString() { String s = null; for (int i = front, count = 0; count != size(); i = (i + 1) % N) s = q[i] + " "; return s; }
2304a854-db9d-4e4a-8710-94ffbe7057d4
0
@AfterMethod public void tearDownMethod() throws Exception { }
1474bba8-64c0-4de9-a695-1cad3e96bce0
6
@Override public int getValues(Sprite target, int tweenType, float[] returnValues) { switch (tweenType) { case POS_XY: returnValues[0] = target.getX(); returnValues[1] = target.getY(); return 2; case CPOS_XY: returnValu...
8a27549d-850f-46fe-b316-c770ebd9b5f0
8
public static byte[] decodeBase32(final String base32) { final String baseInUpper = base32.toUpperCase(); int i, index, lookup, offset, digit; byte[] bytes = new byte[baseInUpper.length() * 5 / 8]; for (i = 0, index = 0, offset = 0; i < baseInUpper.length(); i++) { lookup = ...
9bd2e21c-6281-4030-abe3-5428914e4328
4
@Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o == null ) { return false; } if ( !(o instanceof Course) ) { return false; } final Course other = (Course) ...
28f7a35e-2726-4c8d-be31-25f563aa1ae1
8
public synchronized Position virtualMove() { float curX, curY; curX = getX(); curY = getY(); if (getDirection().equals("left") && !isAsleep()){ curX -= GameBoard.tileLength/4; } else if (getDirection().equals("right") && !isAsleep()){ curX += GameBoard.tileLength/4; } else i...
81ceda73-ba94-4077-8dc8-875436930d47
6
@Override public void update(){ //invalid moves are reversed, so an invalid position at this point is an extreme condition if(!isPositionValid()) escape(); double dx = velocity.x * speed; double dy = velocity.y * speed; projectedCenter.setLocation(center.x + dx, center.y + dy); //check other ball collis...
93dc2b45-2cae-42c2-bf02-1459359514be
3
public void print() { if (isHeaderOK) { if (isBigWig()) System.out.println("BigWig file " + path + ", file header at location " + fileHeaderOffset); else if (isBigBed()) System.out.println("BigBed file " + path + ", file header at location " + fileHeaderO...
15de2787-2c68-47e1-bece-82445f595d20
1
public int getBreakPenalty() { if (subExpressions[0] instanceof Operator) return ((Operator) subExpressions[0]).getBreakPenalty(); return 0; }
3eb34800-c3f3-476b-9b89-de267a1a444f
3
public static final Type tArray(Type type) { if (type == tError) return type; int hash = type.hashCode(); Iterator iter = arrayHash.iterateHashCode(hash); while (iter.hasNext()) { ArrayType arrType = (ArrayType) iter.next(); if (arrType.getElementType().equals(type)) return arrType; } ArrayTyp...
9986218e-0674-480c-bae1-608a11f192b7
3
public int getFieldIndex(String fieldName, Type fieldType) { for (int i = 0; i < fields.length; i++) { if (fields[i].getName().equals(fieldName) && fields[i].getType().equals(fieldType)) return i; } return -1; }
9ad06fc3-25f5-40f2-bf53-47c98a0aefb2
9
private void calculateLocations() { textLocation = new Point(); iconLocation = new Point(); calculatePlacement(); calculateAlignment(); Dimension offset = getSize().getShrinked(getPreferredSize()); offset.width += getTextSize().width - getSubStringTextSize().width; switch (labelAlignment) { case CENTER...