method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ef7b9a8c-edbd-4738-8724-d5a811ab9bc8
3
public void reCalcStats() { if (leadership > 92) { // For high Leadership commanders damage = Math.round(leadership + intelligence * 2 / 10); defence = Math.round(leadership * 8 / 10 + intelligence * 2 / 10); } else if (combatPower > 92) { // For high com...
08b68ba8-95e4-43b4-813a-da45dbfa7aff
8
public boolean checkBrackets(String brackets) { char[] bracketsArray = brackets.toCharArray(); Stack<Character> result = new Stack<Character>(); int opening = 0; for (int i = 0; i < bracketsArray.length; i++) { if (result.empty()) { if (bracketsArray[i] == ')') { return false; } else { r...
50a1aca7-3c58-45e6-bc5d-cfa7b2d67ce7
5
public int posWalkForwards(int begin_pos, int end_pos, double tmr, int end_time,int standstill_pos,int standstill_time,int standstill_count){ if (tmr < standstill_time) { double step = (standstill_pos - begin_pos)/(double)standstill_time; return begin_pos + (int)(tmr*step); } else if (tmr>=standstill_time&&t...
b5554539-efa7-4eb9-bc68-758078efd568
4
private void refreshView() { boolean currentAliveStateMPS1, currentAliveStateMPS2; long now = System.currentTimeMillis(); currentAliveStateMPS1 = isMPS1alive(); currentAliveStateMPS2 = isMPS2alive(); if (currentAliveStateMPS1 != lastAliveStateMPS1) lastAliveStateC...
0df3baae-815c-4612-8901-3f4d23771a70
0
public static void main(String[] args) { //sorting custom object array Employee[] empArr = new Employee[4]; empArr[0] = new Employee(10, "Mikey", 25, 10000); empArr[1] = new Employee(20, "Arun", 29, 20000); empArr[2] = new Employee(5, "Lis...
fcd679f9-6384-43e7-85fa-292c9265025e
9
void format(){ boolean isNotFormatted = true; while(isNotFormatted){ if(times[SECOND] >= 60){ times[SECOND] -= 60; times[MINUTE] += 1; } if(times[MINUTE] >= 60){ times[MINUTE] -= 60; times[HOUR] += 1; } if(times[SECOND] < 0 && Math.abs(times[SECOND]) >= 60){ times[SECOND] += 60; ...
8d4758e4-01ab-4762-9724-0d483663e201
6
@EventHandler public void CaveSpiderInvisibility(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getCaveSpiderConfig().getDouble("C...
5e645bb1-ef91-4874-9185-cde3b62cd230
3
private double calculateOrderPrice(String[] selectedDishes, List<AvailableDish> availableDishs) { double price = 0; for (String selectedDish : selectedDishes) { for (AvailableDish availableDish : availableDishs) { if (selectedDish.equals(availableDish.getDishName())) { ...
8732a370-58e5-450e-aa74-4a08ac0cae57
9
public void updateVectorField_internal() { double theta = Math.toRadians(m_flowRotate.getValue()); PdMatrix rotation = m_flowReflect.getState() ? Utils.reflectionMatrix(theta / 2) : Utils.rotationMatrix(theta / 2); m_field.setRotation(rotation); m_interpolatedField = new InterpolatedTensorField(m_domai...
4862d9c0-d012-42e2-8e63-3230c20890ba
3
public void addRight() { int rows[] = types.getSelectedIndices(); if (rows.length != 0) { for (int i : rows) { AccountType type = allTypes.get(i); if (!creditTypes.contains(type)) { creditTypes.add(type); creditModel.addElement(type); } } } }
c672ab36-4ec1-4bbb-b16e-dc003e247111
5
private static int getData(BaseBlock b, Corner c) { if (b.getType() == BlockID.LADDER) { return (c == Corner.NE || c == Corner.SE) ? 3 : 2; } else { return (c == Corner.NE || c == Corner.SE) ? 4 : 1; } }
029aceb1-12c3-4e65-94d4-493071d3b555
5
public void exec() { PrintStream out = System.out; String stadt_name = askUserForCity(); CityInfo cityInfo = null; try { cityInfo = lookUpCity(stadt_name); if( cityInfo == null) { out.println("city not found!"); return; } } catch(SQLException e) { out.println("ERROR: looking up c...
cf7fa2f3-b2c4-4c10-b631-b76460eecc42
0
public ObjectFactory() { }
40a2fc2b-18cb-4925-99af-f93a3277cf09
1
public Locale pop() throws Exception { Locale retVal = null; // Check for stack underflow. if (topPtr < CAPACITY) { retVal = arr[topPtr]; topPtr = topPtr + 1; } else { // In case of underflow, return -1. // TODO: Throw an underflow exception. throw new Exception(); } return retVal; }
8f0d94c0-5fa5-441d-9642-3b25dee69bd4
7
public boolean equals(Object obj) { if (!(obj instanceof LabelBlock)) { return false; } LabelBlock that = (LabelBlock) obj; if (!this.text.equals(that.text)) { return false; } if (!this.font.equals(that.font)) { return false; } ...
22d69323-2071-41c6-8566-844ea8265427
0
@Override public void selectionChanged(TreeSelectionEvent e) { calculateEnabledState(e.getTree()); }
cde046dd-e49c-45c5-9870-0b80b51005ec
5
@Test public void shouldDecomposeInto3Colours() { DecomposedPixelArray pixels = editor.decomposeRGB(); assertTrue(pixels.red[0] == 255 || pixels.red[10] == 255 || pixels.green[0] == 255 || pixels.green[10] == 255 || pixe...
b973ea9d-304f-4f88-ab24-2bb04b58e637
9
@Override public void enterStatementExpression( Java7Parser.StatementExpressionContext ctx) { // System.out.println(ctx.getChild(0).getChild(2).getChild(0).getText()); if (2 == 2) return; String ans = "-1"; System.out.println(ctx.getText()); if (ctx.getText().equals("s=newTreeSet<>()")) { //Syste...
0b147fbe-fbdf-41a6-b68f-3c5cbfd98e17
2
private void addTrees(double x, double y) { for(int i = 0; i < 500; i++) { double tx = x + random.nextGaussian() * 20; double ty = y + random.nextGaussian() * 20; Tree t = new Tree(tx,ty); if(isEmpty(t)) { entities.add(t); } else { t = null; } } }
646680b4-4f4d-468f-8576-5e6bdcdc53ec
3
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, IOException { //Initialize LookAndFeel for(UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if(info.getName().equals("Nimbus")) { UIMa...
27e8f84e-786a-4db4-8350-260495690aa9
2
private void write(String chunk_uuid, String chunk) { // TODO Auto-generated method stub FileOutputStream fos = null; try { fos = new FileOutputStream(path+chunk_uuid); } catch (FileNotFoundException e) { // TODO Auto-generated catch block System.out.println("The file in HDFS is broken."); } try {...
d5a69c6d-02bd-407f-ac30-305ae03a1ff1
6
@EventHandler public void sClick(PlayerInteractEvent event) { Player player = event.getPlayer(); if (event.getClickedBlock().getState() instanceof Sign){ Sign sign = (Sign) event.getClickedBlock().getState(); if(sign.getLine(0).equalsIgnoreCase(ChatColor.BLUE + "[PaintBall]")) { if(player.ha...
b5e1eb11-45dd-418d-9b74-8bc878a73d70
5
private void accept() { ConnectionsWorker worker = findWorkerForConnection(); SocketChannel clientSocketChannel = null; SocketChannel proxySocketChannel = null; try { clientSocketChannel = serverSocketChannel.accept(); clientSocketChannel.configureBlocking(f...
104d3091-a80a-482f-9cf8-c71f4c0ebf7b
8
@Override public void spring(MOB target) { if((target!=invoker()) &&(target.location()!=null)) { if((doesSaveVsTraps(target)) ||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target))) target.location().show(target,null,null,CMMsg.MASK_ALWAYS|CMMsg.MSG_NOISE,L("<S-NAME> avoid(s) setting off a...
4b544892-741d-429a-869d-62f3f5ff2676
8
@Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException { if ((this.postOnly) && (!(request.getMethod().equals("POST")))) { throw new AuthenticationServiceException("Authentication method n...
19c16e49-cebe-4c1c-97c5-5e9f98b71593
5
private static IFuzzyCommand parseTest(String[] tokens) throws FuzzyParserException { String[] parts = tokens[3].split(","); String setName = parts[0]; IBinaryOperator operator = null; if(parts.length > 1) { operator = getOperatorForName(parts[1]); } switch(tokens[2]) { case "Symmetric": re...
6bb24b9b-0c14-477a-9e3e-ee92c38031fd
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...
6dd26e6e-6dc4-423e-96c2-5234a2cf2285
1
public long getAverage() { long sum = 0; for (int i = 0; i < duur.size(); i++) { sum += duur.get(i).longValue(); } return sum / duur.size(); }
fdfeefd3-283c-4ef0-a8e8-e1d791e5537f
6
public void actionPerformed(ActionEvent e) { if (e.getSource() == spin) { if(backList.size()!=0){ log.info(playerName + " named player has " + arCassa + " money before the roll."); log.info("The wheel has been rolled."); String Number; int Bet; int random = randomGenerator(); writeRolled(ra...
5505eba4-97d7-4c22-ab5b-451f60400ad3
5
public Challenger(Integer minimum, Integer maximum, Operator operator, Type type){ this.minimum = minimum; this.maximum = maximum; this.operator = operator; this.type = type; if(operator == null){ operator = Operator.values()[Generator.RandomInteger(0, Operator.values().length)]; } else{ operator...
8217d3dc-087f-457d-8038-a0323f1ab008
6
private void adjustBorderInsets() { Insets parentInsets = parent.getInsets(); // May need to adust the height of the parent component to fit // the component in the Border if (edge == Edge.RIGHT || edge == Edge.LEFT) { int parentHeight = parent.getPreferredSize().height - parentInsets.to...
26be0663-ebfc-426a-acdd-99dce0b95c91
9
protected String convertBaseGraphRelationshipForMatchClause(BaseGraphRelationship baseGraphRelationship) throws InformationProblem { String relStr = ""; // the depth first visitor follows outbound relationships, so relationship should be --> this is an assumption that might break if (baseGraphRelationship !...
19c5db8e-acea-4b6a-ac7d-2ac35c8d2d97
4
public static boolean areGraphicsSafeToUse() { if (!GraphicsEnvironment.isHeadless()) { if (HEADLESS_CHECK_RESULT == 0) { // We do the following just in case we're in an X-Windows // environment without a valid DISPLAY device... try { GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScr...
7b88ad48-ce1e-4021-ab2d-811245e27a90
1
int indexOf(String s, int ch) throws BadBytecode { int i = s.indexOf(ch, position); if (i < 0) throw error(s); else { position = i + 1; return i; } }
3f23c514-d97d-4c65-b72e-797d51937d2d
8
public static void loadTree(Task tree, File path) throws Exception { /* must be a directory */ if (!path.isDirectory()) throw new Exception("'" + path.getPath() + "' not a directory"); File indexFile = new File(path, INDEX_FILE); if (indexFile.exists()) { /* the index file exists, load nodes based on the in...
7a3f53fb-3228-4f6f-96d3-f4a14abf9384
1
public final static Date XMLGregorianCalendarToDate(XMLGregorianCalendar gc) throws DateConverterException { if(gc == null) throw new DateConverterException("The input is null "); return gc.toGregorianCalendar().getTime(); }
a66148b4-3c1a-4d81-9f2f-30a4e40042db
1
private void swapTerms(int ind1, int ind2){ if(ind1 != ind2){ Term store = new Term(polynomial.get(ind1)); polynomial.set(ind1, polynomial.get(ind2)); polynomial.set(ind2, store); } }
01a20171-6378-4df0-ab72-12e9d52f4e31
6
public void tellAdmins(String name, String message){ //general chat if (message==null || message.length()==0) return; for (ChatServerThread thread : threads){ if (thread!=null && thread.isLoggedIn() && thread.getIsAdmin()) thread.tell(name, message); } }
e05a566e-b34b-4ac5-b00b-24137a8e19dd
9
@Override public void run() { for (;;) { try { DataInputStream in = new DataInputStream(new BufferedInputStream(socket.getInputStream())); DataOutputStream out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream())); BufferedRead...
63b3df5f-595b-46ca-828b-70bd0cc8bf53
8
public void testUnique() throws Exception { //Return if this is not Windows OS if (!isWindows) { return; } /* * Number of timestamps to generate on each client */ int iterations = 11000; /* * Number of client threads */ ...
6add5b99-4f96-40eb-80de-69318d0851a8
4
public static String getKeysFromValue(HashMap<Integer, String> hm, String value) { Set<?> s = hm.entrySet(); // Move next key and value of HashMap by iterator Iterator<?> it = s.iterator(); while (it.hasNext()) { // key=value separator this by Map.Entry to get key and value Map.Entry m = (Map.Entry) it...
0e4ce49b-876f-4678-a214-7dfcff6a5d4b
1
public static void main(String[] args) throws Exception { File activeUsers = new File("activeUser.txt"); if (!activeUsers.exists()) { System.exit(0); } GraphIndexing graphIndexing = new GraphIndexing(activeUsers); TreeMap<Integer, UserFollowers> map = graphIndexing.buildMap(); System.out.println("buildMa...
7464c18d-efbb-463f-9c80-303beac1a43b
7
@Override public void initializeBoard(PieceLocationPair[] initialPieces) { gameboard.clear(); for(PieceLocationPair pair : initialPieces) { BasicHantoPiece piece = new BasicHantoPiece(pair.pieceType, pair.player); BasicCoordinate location = new BasicCoordinate(pair.location); gameboard.put(location.getkey...
46a456e1-0f2e-48a8-99fc-8e05a5f36ebc
8
public void doGet( HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String script = request.getParameter("bsh.script"); String client = request.getParameter("bsh.client"); String output = request.getParameter("bsh.servlet.output"); String captureOutErr...
c6038c84-e5f0-4ce0-9bb8-79f56b402893
1
@Override public boolean hasStackInSlot(int slot) { return inventory[0] == null ? false : true; }
47a764aa-98dd-4e6e-a36a-208559fc60a8
7
public static void main(String[] args) { Scanner entrada = new Scanner(System.in); Integer seguir=0; while (seguir!=1) { System.out.println("Digite la identificacion"); int cedula=entrada.nextInt(); System.out.println("Digite el nombre completo del cliente"); Str...
12cdb1a7-c398-4a7d-9fab-8f8c360025d7
8
public void validateErrors() { for (int i = 0; i < areaParams.length; i++) { if (((BaseValidator) areaParams[i].getKeyListeners()[0]).hasError) { areaParams[i].setBackground(Color.RED); hasErrors = true; } } for (int i = 0; i < baseCounter....
c471243b-dfc7-4799-a9c5-d68101eeb321
0
public Transition copy(State from, State to) { String[] s = new String[0]; return new TMTransition(from, to, (String[]) toRead.toArray(s), (String[]) toWrite.toArray(s), (String[]) direction.toArray(s)); }
bfaa6bcb-1eb2-4442-8565-8c1148526f9d
5
static public HashMap<String,String> readProperties(String configString) { final HashMap<String,String> map = new HashMap<String,String>(); int endLineIndex; for (int startIndex = 0; startIndex < configString.length(); startIndex = endLineIndex + 1) { endLineIndex = ...
339eeade-fc46-4c08-bd9b-be1b45920a6b
6
public static String escape(String string) { char c; String s = string.trim(); StringBuffer sb = new StringBuffer(); int length = s.length(); for (int i = 0; i < length; i += 1) { c = s.charAt(i); if (c < ' ' || c == '+' || c == '%' ...
6f7668b8-6842-4fad-b22d-ebd2110c86f1
3
public boolean testSecndCell() { for (int i = 0; i < this.fristCell.cellPiece.availableCells.length; i++) { if (this.fristCell.cellPiece.availableCells[i] == null) { this.fristCell.cellPiece.searchAvailableCells(); continue; } else { this.fristCell.cellPiece.searchAvailableCells(); } if (secn...
d163585f-a9ca-4fd6-9224-aea33af16c97
6
public void loadStats(BlackjackGui gui) { switch(gui.numPlayers) { case 1: try { File file1 = new File(players.get(0).getName() + ".txt"); BufferedReader reader = new BufferedReader(new FileReader(file1)); String line; line = reader.readLine(); String [] stats1 = line.split("\\s+...
c9391fef-5fdb-45e9-a93a-e0dfc67e8340
4
public void displayEvent(String msg, Character ch){ if (ch == null){ stream.logEvent(msg); return; } switch(ch.getType()){ case ALLY: stream.allyEvent(msg, ch); break; case BOSS: stream.bossEvent(msg, ch); break; ...
616e7967-f1ba-4434-ac00-3168d551976f
1
public static String getXmlDeclaration(String version) { if (version == null) { version = DEFAULT_XML_VERSION; } return new StringBuffer().append("<?xml version=\"").append(version).append("\"?>").toString(); }
9ed3f81c-3b4a-445e-99a7-f03d94df04a5
5
public Player getPlayer1() { boolean test = false; if (test || m_test) { System.out.println("Game :: getPlayer1() BEGIN"); } if (m_player1 == null) { System.out.println("Game::GetPlayer1 - " + "m_player1 has not yet been set"); throw n...
54f01b69-ef7d-4a09-afa5-d2aecc486577
0
public void setName(String name) { this.name = name; }
b8c88b10-4543-4e99-a62a-6030047524eb
4
@Test public void multiThreadSubscribeAndUnsubscribe() throws InterruptedException { final LocalTurtleEnvironment env = getTurtleEnvironment(); final int subAndUnsub = 50; ExecutorService pollsubAndUnsub = Executors.newFixedThreadPool(subAndUnsub); for (int i = 0; i < subAndUnsub;...
c044696c-f15e-43db-b690-4d0ede0631cd
7
public boolean dialog(){ Font font1 = new Font("Default", Font.PLAIN, 12); Font font1small = new Font("DefaultSmall", Font.PLAIN, 12); //creates the dialog Dialog = new JFrame("Jython Runner Settings"); directory = new JTextField("",20); macrotorun = new JTextField("",20); JLabel labeldir = new JLabel("...
1dcc0fe1-efcb-4e01-8c21-520f63a50c6d
3
private void initButtons() throws SlickException { buttons = new buttonPress[button_count]; for(int i = 0 ;i < button_count ;i++){ buttonPress button; if(i == 0){ button = new MovebuttonPress(); } else if(i == 1){ button = new UnseenbuttonPress(); } else button = new buttonPress(); ...
e9d13a42-0955-4b7f-afc1-857795a5f42a
8
protected int partition(int attIdx, int[] index, int l, int r) { double pivot = m_Instances.instance(index[(l + r) / 2]).value(attIdx); int help; while (l < r) { while ((m_Instances.instance(index[l]).value(attIdx) < pivot) && (l < r)) { l++; } while ((m_Instances.instance(in...
30540a0d-3509-4745-ae9c-1959b3a8e0d6
5
public static MeetingRoom getMeetingRoom(int meetingID){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { Statement stmnt ...
6241ce28-ff9d-4aaa-881a-6d351493e76a
8
@Override public void run() { Random r=new Random(seed); long arbeitsgeschwindigkeit=100l; //in Millisekunden while(!stop){//Liefere solange bis stop() aufgerufen wird try { Thread.sleep(arbeitsgeschwindigkeit); } catch (InterruptedException e) { e.printStackTrace(); } int bestandTeilZfZah...
4962b8e2-1060-4325-a6b5-c3261d9df747
9
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MeterNeedle)) { return false; } MeterNeedle that = (MeterNeedle) obj; if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return f...
4561488b-5e05-4dcc-8989-2ce9b0a747bd
6
public AIThread(String name, String server, String password, AIInterface ai, Status connectionstatus) { try { this.ai = ai; this.setName("AI-Thread for " + name); pfactory = new PacketFactory(); GameNetworkInterface gn = Guice.createInjector(ne...
37c1d20d-e0a6-4a2b-9e5a-cdaccf1dd21e
4
public void testDajGoste() { Osoba o=new Osoba(); o.setImePrezime("Alen Kopic"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { o.setDatumRodjenja(sdf.parse("1992-10-21")); } catch (java.text.ParseException p) { System.out.println(p.toString()); } o.setAdresa(...
96498589-73e8-417c-8b17-5e1f98b6b6b6
8
@Override public void keyPressed(KeyEvent e) { int k = e.getKeyCode(); if (!Virucide.gotuser) { if (k == KeyEvent.VK_ENTER) { Virucide.u.enter(); } else if (k == KeyEvent.VK_BACK_SPACE) { Virucide.u.backSpace(); } else if (!(k == Ke...
1c54dcd3-da51-467f-912a-e75da16bcdff
3
@Override protected void validate(T object) { boolean dirty = false; for (Painter<T> p : painters) { if (p instanceof AbstractPainter) { AbstractPainter<T> ap = (AbstractPainter<T>) p; ap.validate(object); if (ap.isDirty()) { dirty = true; break; } } } clearLocalCacheO...
b02c1c64-ed1b-447f-afe7-7d58b14e6f4d
8
public static byte[] unZipItOnlineWithCache(String zipFileURL, String filename) { byte[] out = null; //fetching if not already fetched byte[] zipbytes = null; if (zipOnlineCacheName1.equals(zipFileURL)) { zipbytes = zipOnlineCacheData1; } else if (zipOnlineCacheName2....
0e630ba8-641a-4239-a142-12e564da5062
9
private Boolean preFlightSanityChecks() { // check whether user entered both values for template id/template file if (!this.templateID.equals("") && !this.templateFile.equals("")) { JenkinsLogger .error("Values were provided for both template id and file. Please provide just one or the other."); return ...
c8a9e2c3-8071-4f74-8ac2-52d81b24bc63
9
private void editAtomaton(String s) throws Exception { if (s.matches("^\\(START\\) \\|- [0-9]+") && !startGevonden) { s = s.replace("(START) |- ", ""); automaton.setStart(Integer.parseInt(s)); startGevonden = true; } else if (s.matches("[0-9]+ -\\| \\(FINAL\\)$") && !...
49671120-1ca1-4125-9196-c78c13f33b28
5
@Path("createUser.html") @Produces(MediaType.TEXT_HTML) @GET public Response getCreateUserView(@CookieParam("authUser") String token, @QueryParam("message") String message) { try { UserToken verifiedUserToken = doVerifyUserToken(token); //Make sure they are logged in ...
abd4fc77-1f86-4c55-b487-fb4391dd3821
4
private LinkedList<Vertex> BFSFloodFill(Vertex start){ Hashtable<Vertex,Color> color=new Hashtable<Vertex,Color>(); LinkedList<Vertex> reached = new LinkedList<Vertex>(); LinkedList<Vertex> vertices = graph.getVertices(); Iterator<Vertex> j = new Iterator<Vertex>(vertices); while...
ea85b1fa-1db1-452b-8f8a-99e4b819104a
4
private void chooseStartingTile(Match match, int number) { Tile[][] tiles = match.getTiles(); int height = tiles.length; int width = tiles[0].length; if (number == 0) { tile = tiles[0][0]; } else if (number == 1) { tile = tiles[height - 1][0]; } el...
7262e7a4-f6e5-42aa-b48d-9c580edd8839
0
private void drawArrowhead(Graphics g, Edge e) { int x = e.getEnd().getX(); int y = e.getEnd().getY(); int startX = e.getStart().getX(); int startY = e.getStart().getY(); /** * Calculate delta between start and end x and y */ double deltaX = x - startX; ...
8078fd6a-aea3-4006-826c-42cc710a36a6
2
private ArrayList<Integer> getReel(String type) { List<String> reel = plugin.configData.config.getStringList("types." + type + ".reel"); ArrayList<Integer> parsedReel = new ArrayList<Integer>(); for(String m : reel) { String[] mSplit = m.split("\\,"); int i = Integer.parseInt(mSplit[1]); while(i > ...
c2e7cf2b-3aa9-4fda-bf19-9ff866ff1690
9
public static void main(final String[] args) throws InterruptedException { // Einlesen Properties-Daten final Data data; // Name von Properties-File als Argument String nameOfPropertiesFile = ""; // Argument könnte Name für Properties-File sein if (args.length > 0) { ...
fb1ef62f-3089-4e2e-b681-b5cfe240595a
7
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub JSONObject jb =new JSONObject(); boolean isMultipart = ServletFileUpload.isMultipartContent(request); if (isMultipart) { FileItemFactory factory = ne...
805d2dd2-1e46-4db6-9b3a-9db8e0b1b753
2
@Override public void run() { System.out.print("."); if (strafing){ float yaw = (float) ((gyro[0]-start_pos)/20.0); double rearValue = speed + -yaw; double rightValue = (-speed / 2.0) + -yaw; double leftValue = (-speed / 2.0) + -yaw; //Update Motor Values FL....
3d8fd8b2-5209-42f3-aa3d-5b56835f68b3
9
void splitMoney(Entity thnStore, int money) { if (money == 0) { return; } if (thnStore.BLN_POPUP) { thnStore.send(""+(char)33+"You have lost "+money+" gp\n"); } else { thnStore.chatMessage("You have lost "+money+" gp\n"); } thnStore.ZENY -= money; int i, i2=0; Vector vctStore; if (t...
a38cecdd-ed77-40de-83d8-af6c04ceccc5
3
public int send (Connection connection, Object object, SocketAddress address) throws IOException { DatagramChannel datagramChannel = this.datagramChannel; if (datagramChannel == null) throw new SocketException("Connection is closed."); synchronized (writeLock) { try { try { serialization.write(connect...
1d47ca2f-57c7-47a5-8749-f8cae6c280e5
2
@Override public boolean loadInstruments(Soundbank soundbank, Patch[] patchList) { boolean success = true; for (Synthesizer s : theSynths) if (!s.loadInstruments(soundbank, patchList)) success = false; return success; }
0bf1653b-9d1d-4414-ae2f-a8ff8cc1ea1b
7
private RepositoryDescriptor getContentJarDescriptor(File jarFile) { InputStream contentsFileInputStream = null; ZipFile zipFile = null; try { zipFile = new ZipFile(jarFile); ZipEntry entry = zipFile.getEntry("content.xml"); if (entry != null) { logger.debug(Messages.RESOLVED_JAR_FILE.value(entry.get...
3ba5e9b5-5516-459d-92b5-8e9597b7384b
1
private void generateRanomizedList(int studentCount) { for (int i = 0; i < studentCount; i++) { Student student = generateRandomStudent(); students[i] = student; } }
6af989ef-51c3-46f4-8d10-f78e123a6527
1
public static void nofailAssertEquals(Object expectedObject, Object testObject) { if (!expectedObject.equals(testObject)) { System.out.println("Expected <" + expectedObject + "> \nfound <" + testObject); } }
19f5f706-a18c-4402-bccc-8587b880cef2
2
public static String getPropertyString(String name) { if(!new File(PROP_FILE).exists()) { PROP_FILE = "/usr/share/tomcat7/.jenkins/jobs/PlagiatsJaeger/workspace/WebContent/WEB-INF/classes/config.properties"; } Properties prop = new Properties(); try { // load a properties file prop.load(new Fi...
16ac72f7-4076-486b-ad9f-e36d6ec9cb6e
2
public synchronized void removeCommandLineListener(CommandLineListener listener){ if (this.listeners != null && this.listeners.contains(listener)){ List<CommandLineListener> listeners = new ArrayList<CommandLineListener>(this.listeners); listeners.remove(listener); this.listeners = listeners; } }
c207b8fb-35d5-4893-af6f-ba6242ad114e
1
public static void sendMessageToServer(String from, String message) { List<World> worlds = Core.getPlugin().getServer().getWorlds(); for (Iterator<World> i = worlds.iterator(); i.hasNext();) { World w = i.next(); sendMessageToWorld(w, from, message); } }
e4a89547-dca5-42fc-ab4c-fc7d86094140
8
protected static Ptg calcMid( Ptg[] operands ) { String s = String.valueOf( operands[0].getValue() ); if( (s == null) || s.equals( "" ) ) { return new PtgStr( "" ); // Don't error out if "" ala Excel } if( (operands[1] instanceof PtgErr) || (operands[2] instanceof PtgErr) ) { return new PtgErr( P...
528ae818-ca28-46f9-bf2d-89f64a985f87
0
public void newAuction(String title, String duration, String auctionType, String desc, String img, String lowPrice, String startPrice, String buyout, String delivery, Account seller, String category, String time) { Auction auction = new Auction(title, duration, auctionType, desc, img, lowPrice, startPr...
b7ff3dfe-21b6-4e3d-9180-d9e75ed22337
9
@Override public void start(CommandSender sender, String[] args, String permissionNode) { if (args.length == 1){ if (sender.hasPermission(permissionNode)) { if (sender instanceof Player){ LL.configHandler.reloadConfig(); if (LL.configHandler.RELOAD){ LL.MSG.commandReply(sender.getName(), C...
b943d2cf-692e-45c6-bd5e-6c4e4a76c11b
4
public static String formatName(String name) { String iName = name.toLowerCase(); if(iName.contains("_") || iName.contains(" ")){ String[] cName = null; if(iName.contains("_")) cName = iName.split("_"); if(iName.contains(" ")) cName = iName.split(" "); String fName = cName[0].substring(0,1).toUp...
dda9a8da-da5a-40a6-94fe-171c8d75b2cb
1
public static void setDefaultMenuBar(JMenuBar menuBar) { if (Platform.isMacintosh()) { Application.getApplication().setDefaultMenuBar(menuBar); } }
f0a45db8-a679-4fee-b74f-f56a1ee2fb25
6
private void copyRGBtoBGRA(ByteBuffer buffer, byte[] curLine) { if(transPixel != null) { byte tr = transPixel[1]; byte tg = transPixel[3]; byte tb = transPixel[5]; for(int i = 1, n = curLine.length; i < n; i ...
3fc5b1fd-bde6-49d6-8b3c-54ce7068bc63
2
public Player getMyPlayer() { for (int playerIndex = players.length - 1; playerIndex >= 0; --playerIndex) { Player player = players[playerIndex]; if (player.isMe()) { return player; } } return null; }
7e4418dd-9699-4847-8cd3-4e9ebf15383e
0
@Override @Transactional public List<Employee> getAll() { List<Employee> employees = sessionFactory.getCurrentSession().createQuery("from Employee e").list(); return employees; }
66d681a1-d37d-4d4a-ae69-e80e557efbc9
3
public static boolean isProbabilistMatrix(double[][] matrix, double precision) { boolean isProbabilist = true; int i = 0; while (isProbabilist && i < matrix.length) { double somme = 0.0; for (int j = 0; j < matrix[i].length; j++) { somme += matrix[i][j]; ...
efab0418-2ab2-4783-9b57-846025170cf7
5
private SqlSessionFactory getSqlSessionFactory(String environment, String configFile) { Map<String, SqlSessionFactory> tempSqlSessionFactoryMap = FACTORY_MAP; if (!tempSqlSessionFactoryMap.containsKey(environment)) { synchronized (LOCK) { if (!tempSqlSessionFactoryMap.contain...
ad3a7f0e-39d1-4477-a7a4-8915d0a90edb
3
public double[] computePowerSpectrum(double[] dataReal) { double sum = 0; for (int i = 0; i < dataReal.length; i++) { sum += dataReal[i]; } if (sum == 0) return computeMagnitude(dataReal); double multiplicator = 2.0 / sum; double multiplicatorQua...
88ce8826-722c-4e9f-9192-c0f9c766428d
2
public Dame(final Couleur couleur, final int position) { super(position); this.couleur = couleur; setOpaque(false); switch (couleur) { case BLANC : setForeground(Color.WHITE); setBackground(new Color(220, 220, 220)); break; case NOIR : setForeground(new Color(70, 70, 70)); setBackgroun...
fdc47211-c02e-47d4-b63a-dae005af53cd
3
public void drawCard(PlayerClass pPlayer) { pPlayer.cout.printGiftCards(x); for(int i = 0; i < this.players.length; i++) // { if(this.players[i].stillPlaying && this.players[i] != pPlayer) { this.players[i].transaction(pPlayer, x); } } }