method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c516f3be-280e-41e4-9731-371a64641470
5
@EventHandler public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent e) { String[] split = e.getMessage().split(" "); if(!split[0].equalsIgnoreCase("/me")) return; e.setCancelled(true); String message = Utils.ArrayToString(split, 1, 0); String message_labeled ...
07e68218-9914-44ff-ae69-bf046736eef9
7
public void accelerate() { double accelRate = baseAccelRate; double currentMagnitude = Math.sqrt(dx*dx + dy*dy); if (isBoosting) { accelRate *= 2; } else if (this instanceof Ship && currentMagnitude < accelRate) { // If currently travelling slowly, then ...
fea4d2d7-3111-4aef-9ca0-624bc8ec5a29
6
final int[] method1275(int i, boolean flag) { int ai[] = super.aClass18_3308.method210(i, flag); if (super.aClass18_3308.aBoolean359) { int j = Class129.anIntArray2049[i]; int k = -2048 + j >> 1; for (int l = 0; l < Class117.anInt1861; l++) { int j1 = ...
a05a92be-1e55-427c-8baf-38274c0686e2
4
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((level == null) ? 0 : level.hashCode()); result = prime * result + ((model == null) ? 0 : model.hashCode()); result = prime * result + ((version == null) ? 0 : version.hashCode()); result = prime * result + (...
af74ed2e-1cc5-4552-9745-321d0faae7c0
2
private String getPattern() { if ((config.getPattern() != null) || (config.getPattern().isEmpty())) return config.getPattern(); else return "%23.23d{dd.MM.yyyy HH:mm:ss.SSS} %-5p [%t] %-8.8x %c ==>> %m%n"; }
ea5fa561-c867-401c-b7a4-7a8e7ff46c65
1
public void writeTo(Socket socket, String data) { try { BufferedWriter out = new BufferedWriter(new OutputStreamWriter( socket.getOutputStream())); out.write(data + "\n"); out.flush(); } catch (Exception ex) { ex.printStackTrace(); } }
fc21e0cd-5c13-4089-b0f2-d4173cb054f0
2
@Override public Answer getRightAnswer() { if (leftPriority == rightPriority) { return ZeroAnswer.getInstance(); } else if (leftPriority < rightPriority) { return OneAnswer.getInstance(); } else { return TwoAnswer.getInstance(); } }
8cdd2bd8-9b90-42b2-9eaa-dc2f0f7154be
7
@Override protected boolean handleTask(DownloadTask mainTask) { myTask = getMyTask(mainTask); while (myTask.getState() != DownloadTaskState.finished && mainTask.getState() == DownloadTaskState.downloading && maxTryTimesPtr.value > 0) { try { myTask.download(mainTask, (long) Math.ceil((float)mainT...
fc571d26-1876-472e-a8e5-c858c7ad75c5
3
private Display createDisplay(Class cl) { try { String className = cl.getName(); Class dcl = Class.forName(className + "Display"); if (Display.class.isAssignableFrom(dcl)) { Display display = (Display) dcl.newInstance(); ...
6e235b90-33fb-4b7a-8615-60c8a9605f25
6
public static void startupStartup() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$); Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get()))); if (S...
6eec9201-2510-41e3-87c0-453030e44b58
9
public static String exeCmd(String cmd) { log.info("execute cmd : " + cmd); InputStream inputStream = null; InputStream errorStream = null; OutputStream outputStream = null; String str = null; String error = null; try { Process process = Runtime.getRuntime().exec(cmd); // int ret = process.waitFor();...
b821bfac-f358-40b6-92f9-7d0b88fe32dd
9
public static void main(String[] args) { int i; TestEncoder te = new TestEncoder("Test PNG Alpha/Filter Encoder"); i = 0; te.encodeAlpha = false; te.filter = 0; te.pixelDepth = 24; te.compressionLevel = 1; while (i < args.length) { ...
b995d70d-2edb-4004-9b49-225d0c515393
5
public OptionFrame() { setResizable(false); setTitle("Options"); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e2) { e2.printStackTrace(); } setDefault...
b81a1162-c8eb-42db-a465-f15498d7673b
3
public static void setLevel(int l) { switch (l) { case 0: level = ERROR; break; case 1: level = INFO; break; case 2: level = DEBUG; println("Ausgabe auf DEBUG gesetzt.", 2); break; } }
85acd95a-3d5d-45f6-aa43-93db049aa038
6
@Override public Article find(int id) { Article found = null; PreparedStatement pst = null; ResultSet rs = null; try { pst=this.connect().prepareStatement("select * from Article where id= ?"); pst.setInt(1, id); rs=pst.executeQuery(); ...
95e8993c-5ab0-46c6-8b11-779c6318d679
5
static String unpluralize(String word) { if (word.startsWith("border") || word.startsWith("motion")) return word; return word.length() > PLURAL_TRESHOLD && !word.contains(" ") && word.endsWith("s") ? word.substring(0, word.length() - 1) : word; }
075e67a9-3739-4b8a-80da-099c0c5aac4c
4
public boolean actionMigrate(Fauna actor, Target point) { if (point instanceof Nest) { final Nest nest = (Nest) point ; if (Nest.crowdingFor(this) < 0.5f) return false ; if (Nest.crowdingFor(nest, species, world) > 0.5f) return false ; if (! nest.inWorld()) { nest.clearSurroun...
43bbb0e3-a469-45d0-aee9-f97cf8dcc711
3
private static int findit( int key )throws RuntimeException { int low = 0, high = 4887, mid; while ( low <= high ) { mid = (high+low) >> 1; // divide by two if ( key < products[mid] ) high = mid - 1; else if ( key > products[mid] ) low = mid + 1;...
9dd69272-c4de-4760-87cd-59f157084358
2
void addHoveringElement(PositionChangedObservable e) { if (e == null || !e.getPositions().contains(position)) throw new IllegalArgumentException("The given Element is invalid!"); hoveringElements.add(e); }
036f6337-a477-49c5-af5e-898fff9998c3
8
@Override public void mouseReleased(MouseEvent e) { Node mouseOverN = manager.getMouseOverN(); if (mouseOverN != null && dragAddNode != null && mouseOverN != dragAddNode) { Edge ed = manager.findEdge(dragAddNode, mouseOverN); if (ed == null) manager.addEdge(dragAddNode, mouseOverN, Edge.DEFAULT_LENGTH);...
1f4572c7-3316-4344-9600-75469c18488e
4
public void loadGame() { String filename = JOptionPane.showInputDialog(this, "Please enter your name:"); if (filename == null) { return; } File savegame = new File(PATH + filename + ".csg"); try { Scanner input = new Scanner(savegame); name = input.nextLine(); money = input.nextInt(); input...
3e269b48-b6ec-46d7-a9df-3c10934f9347
3
public void requestStop() { logger.debug("Server stop requested"); keepRunning = false; //drop ourselves a small useless message to break the loop (kind-of hasckish, but meh) try { DatagramSocket clientSocket = new DatagramSocket(); InetAddress IPAddress = InetAd...
fff885eb-f1e9-447a-a558-f14515df1837
8
public double intersection(Ray ray) { Vector rayOrigin = ray.o(), rayDirection = ray.d(); //get distance to planes along ray double topDistance = topPosition.sub(rayOrigin).dot(orientation), bottomDistance = bottomPosition.sub(rayOrigin).dot(orientation), raySpeed = orientation.dot(rayDirection); t...
22a09525-fb16-4890-9779-76b86d68091d
1
private void loadContent() { try { background_image = ImageIO.read(this.getClass().getClassLoader().getResource("img/Backgound.PNG")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
4ccd308f-73c0-406b-bfb7-514b05069caf
7
public ImportAmountOfCostsAndPlus(){ importBuilding=new int[7][12]; // forester for(int i=0;i<10;i++) { importBuilding[0][i]=forester[i]; } // clay pit for(int i=0;i<10;i++) { importBuilding[1][i]=clayPit[i]; ...
07fede93-48eb-4064-a234-03255cddb539
1
@Override public boolean removeAll(Collection<?> c) { // TODO Auto-generated method stub return false; }
4d76cc09-83b3-4d44-889a-feb6943f807a
6
private void onSave(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onSave toggler.setState(false); chooser.showSaveDialog(this); if (chooser.getSelectedFile() != null) { try (DataOutputStream dos = new DataOutputStream(new FileOutputStream(chooser.getSelectedFile()))) { ...
6f47593f-6eca-452a-863e-232b1177c077
9
private int nextNBits(int bitsToGet) { byte b, next, next2next; int l = data.length - 1; int bp = this.bytePointer; if (fillOrder == 1) { b = data[bp]; if (bp == l) { next = 0x00; next2next = 0x00; } else if ((bp + 1) == l) { next = data[bp + 1]; next2next = 0x00; } el...
ce1bc794-1530-4a08-af0f-aa033eb63c82
6
@Override public void run() { running = true; if (LifecycleAware.class.isAssignableFrom(handler.getClass())) { ((LifecycleAware)handler).onStart(); } T entry = null; long nextSequence = sequence + 1 ; while (running) { try ...
5f4c4386-8fe6-4be9-b0ff-d4dfa5a67cf8
3
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); if(request.getMethod().equals("GET")) { request.getRequestDispatcher("registrarse.jsp").forwa...
8354e3e0-a033-43db-9810-17c8c617747a
9
public static float moveRate(Actor actor, boolean basic) { int motionType = MOTION_NORMAL ; for (Behaviour b : actor.mind.agenda) { final int MT = b.motionType(actor) ; if (MT != MOTION_ANY) { motionType = MT ; break ; } } final float luck = actor.motionWalks() ? moveLuck(actor) : 0.5f ; ...
05358264-2ee5-4f45-985f-247e4a392277
3
private void join() { team.addPlayer(player); oldLoc.put(player, new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ())); potato++; player.setGameMode(GameMode.ADVENTURE); if(potato == 5){ for (OfflinePlayer online : team.getPlayers()) { ...
45584133-a3da-406f-81a6-fd7699d2219d
1
private void applyData(){ if (selectedRow != -1){ dataBase.getFile(selectedRow).setAlgorythmName(textFieldName.getText()); dataBase.getFile(selectedRow).setAlgorythmType(comboBoxType.getSelectedItem().toString()); dataBase.getFile(selectedRow).setAlgorythmFile(file); ...
d7664b68-b586-4a4d-b155-40d2f8487853
8
public static String SentenceTrim(String sentence){ String temp[]; if(sentence.indexOf("null")>-1){ temp=sentence.split("null"); sentence=""; for(int i=0;i<temp.length;i++){ sentence=sentence+temp[i]; } } if(sentence.indexOf("</p>")>-1){ temp=sentence.split("</p>"); sentence=""; f...
8783d2da-4dd4-4bc3-b3a5-64beaa104994
5
private void collectGenerator(Generator generator) { if (generator != null) { Class<?> klass = generator.klass(); // I'm unsure if this can happen if (klass == null) { throw new RuntimeException("Bad @Generator found."); } Class<? ext...
01b84f56-944f-41e8-8bca-72f790a37728
0
protected JPanel buildFilterPanel() { JPanel ans = new JPanel(); GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); ans.setLayout(layout); // filter = new JTextField("ѧŻ", 20); JButton filterByNo = new JButton("ѧŲѯ"); JButton filterByName = new JButton("ѯ"); ...
0578d3fa-0226-495e-a684-d8c9f1e340d6
6
@Override public void copyStudyInto(String newName, Study study) { File newStudyDir = new File("./studies/", newName); if(newStudyDir.exists()) { // Override eixsting study // Need to delete directory contents before deleting directory for(Fi...
013399b3-40bb-448b-b4a7-fde37121d661
1
private void checkEnabled() { Tag tag = env.getTag(env.getActive()); // setEnabled(!(tag instanceof PermanentTag)); if(env.tabbed.getTabCount() == 1) setEnabled(false); else setEnabled(!(tag instanceof PermanentTag)); }
a131a037-ad77-41d3-b13b-a7ef01dc30e0
4
public void drawRotatedSprite(int arg0, double arg1, int arg2) { int j = 15; int k = 20; int l = 15; int j1 = 256; int k1 = 20; try { int i2 = -k / 2; int j2 = -k1 / 2; int k2 = (int) (Math.sin(arg1) * 65536D); int l2 = (int) (Math.cos(arg1) * 65536D); k2 = k2 * j1 >> 8; l2 = l2 * j1 >> 8;...
83683e3c-f29e-40d7-96cc-930444945f4d
2
public MulticastMessagePasser(MessagePasser gMessagePasser){ this.groupSpg = new Hashtable<String, Integer> (); this.localHostName = gMessagePasser.getLocalName(); this.messagePasser = gMessagePasser; for(String key : gMessagePasser.groupsRpg.groups.keySet()){ this.groupSpg.put(key, 0); } this.groupRpg =...
93cd7357-614f-4c0d-959d-e188eecf02a8
8
public void saveData(final String contents) throws IOException { Configuration conf = new Configuration(); // conf.set("yarn.resourcemanager.address","localhost:9005"); // conf.set("fs.defaultFS","hdfs://localhost:9000"); // conf.set("mapreduce.framework.name", "yarn"); // conf.set("yarn.resourcemanager.sched...
1ff82c5c-4b37-466e-8b69-e1473efc26ab
1
@Override public String toString() { String content; if(resolvable != null) content = resolvable.toString(); else content = label; return Integer.toString(position)+": "+content; }
677dca42-b1da-45c3-aaf4-8d3b45691120
0
public void setLargest() { largest = getCurrentLargest(); }
850e94b3-02a7-48eb-9ac6-19487b46fbb6
8
static private int jjMoveStringLiteralDfa6_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(4, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0); return 6; } switch(curChar) { cas...
616cb016-ba2f-473b-bf53-772898cb7e18
0
@Test @TestLink(externalId="ASSUMPTION_FAILED") public void testBlockedBecauseOfFailingAssumption() { // Servername is &auml;&ouml;&uuml;&szlig; - this file should be UTF-8. assumeNoException(new IllegalStateException( "can not proceed because server 'äöüß' not available")); ...
1389c633-565a-49a7-b8e8-a169d831f2bb
6
protected void OnDataRangeChanged() { if (selectedIndex != null) { try { lastData = NetworkManager.showMore(selectedIndex.getSymbol(), selectedRange); lineChart.getData().clear(); if (pointerType != null && !pointerType.equals("hide")) { ...
89d0999f-13ca-4db8-80db-a3c26b6592fa
2
public Map<Integer, InventoryItem> GrabWalls() { Map<Integer, InventoryItem> Items = new HashMap<Integer, InventoryItem>(); for(InventoryItem Item : this.Inventory.values()) { if (Item.GrabBaseItem().Type.contains("i")) { Items.put(Item.ID, Item); } } return Items; }
bccf91aa-80a1-442f-ab86-d099bce6bbab
4
public Scenery getScenery(int x, int y) { if ((x < width && y < height) && (x >= 0 && y >= 0)) { return data[y][x]; } else { return null; } }
2252f684-bba3-48a5-9a11-1366ee4226af
0
public String getW() { return w; }
a1c23567-79ff-4d47-96fa-b7b85aa3f2a4
0
public void setI(int id) { this.id = id; }
dcd20d3f-50c6-4c0c-b80a-fc4598475984
2
private void addRowToTable(List<UserDTO> usersList) { for (UserDTO user : usersList) { if (user.getUserGame() != null) { tableModel.addRow(user.toArray()); } else { tableModel.addRow(user.toArrayOnlyUser()); } } }
cb1c790d-228c-4961-9a21-6712897cbf56
1
private boolean packCardHasBeenPressed(Point pressPt) { if (aFaceDownCard.pressPointIsInsideCard(pressPt)) { return true; } return false; }
2a45b187-7dc3-483a-be70-fc01e62c6830
2
public static void handleKick(String params) { String syntax = "Nesprávná syntaxe příkazu: /kick #kanál uživatel [důvod]"; String match = "#\\w+ \\S+( .+)?"; if ( !params.matches(match) ) { appendError(syntax); return; } String[] parts = params.split(" ",...
c92554cc-6d24-4c2c-b01a-347a011d71cd
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 == '%' ...
9ce03529-235a-430e-9eca-f2a41df8b523
7
public void func_73189_a(int par1, int par2, byte par3ArrayOfByte[], BiomeGenBase par4ArrayOfBiomeGenBase[]) { byte byte0 = 2; int i = byte0 + 1; byte byte1 = 33; int j = byte0 + 1; densities = func_73187_a(densities, par1 * byte0, 0, par2 * byte0, i, byte1, j); for ...
e85d965d-88e7-4fbe-9252-017c90490bde
0
public void afterThrowing(Method method, Object[] args, Object target, Throwable subclass) { log.error("发生异常!"); log.error(subclass.getMessage(), subclass); }
85f355f4-d4b0-454d-9ec2-6e3833e858e0
0
public long getCallId() { return callId; }
1382251d-a84f-4626-aacb-c91985bcd463
2
public static String[] RemoveEmptyStrings(String[] data) { ArrayList<String> result = new ArrayList<String>(); for(int i = 0; i < data.length; i++) if(!data[i].equals("")) result.add(data[i]); String[] res = new String[result.size()]; result.toArray(res); return res; }
3f4fa37d-fa16-4201-9610-9e90365fa43b
5
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String actionDelete = request.getParameter("Delete"); String actionChange = request.getParameter("Change"); Stri...
a6d8f578-8775-49ce-a714-c84384f48807
2
public Iterator<Seance> showNextSeances() { List<Seance> nextSeances = new ArrayList<Seance>(); Calendar now = Calendar.getInstance(); for (Seance seance : seances) { if (seance.getStartDateTime().after(now)) { nextSeances.add(seance); } } Collections.sort(nextSeances, new Seance...
73fb2e4a-c9d3-455b-9c85-f07da6225369
9
final void method774(Class318_Sub4 class318_sub4, int i) { anInt1280++; Class318_Sub1 class318_sub1 = ((Class318_Sub4) class318_sub4).aClass318_Sub1_6410; boolean bool = true; Class318_Sub3[] class318_sub3s = ((Class318_Sub4) class318_sub4).aClass318_Sub3Array6414; for (int i_6_ = 0; class318_sub3s.lengt...
acbe27d5-a81d-4cbd-aa7e-012687d481b0
0
@Test public void testWord2num() { String num = PhonewordFinder.word2num("FLOWER"); assertEquals("356937", num); }
cc0e7d5d-bdc8-4731-80c6-31d01403f240
9
public EGrepResult(EGrepGrader problem_grader, File file) { super(problem_grader, file); regex_file = file; if (file == null || !file.canRead()) { return; } missing = false; BufferedReader br; try { br = new BufferedReader(new FileReader(regex_file)); regex = ""; String line = null; if ((li...
02ae30fe-a30b-4312-a7d9-7fea43087e68
6
public void actionPerformed(ActionEvent event) { if(event.getActionCommand().equals("newsize")&& !this.getText().equals("Width Depth")) { String text = this.getText(); String[] splitted = text.split("\\s+"); int width = 0; int depth = 0; try { width = Integer.parseInt(splitted[0]); depth = Intege...
826c13b1-1a77-4b13-a719-fc6fcf19636d
7
private final boolean cons(int i) { switch (b[i]) { case 'a': case 'e': case 'i': case 'o': case 'u': return false; case 'y': return (i==0) ? true : !cons(i-1); default: return true; } }
0882b949-1b0c-4c20-ab04-98e73eacef2d
7
private boolean checkForWinVertical() { for (int i = 0; i < ROW_COUNT; i++) { Cell cell1 = arrayOfLogicCells[i][0]; Cell cell2 = arrayOfLogicCells[i][1]; Cell cell3 = arrayOfLogicCells[i][2]; if (cell1.isZeroChecked() && cell2.isZeroChecked() ...
36f7c871-4fdf-46e0-89b7-32ecaf2170f6
1
public boolean followUrl(final Url url) { if (url.depth() > depth) { return false; } return visitor.followUrl(url); }
cd8c69ac-9171-40ce-91e5-2bf61797d077
4
public void keyPressed(KeyEvent e){ if(e.getKeyCode() == KeyEvent.VK_UP){ direction = 1; } if(e.getKeyCode() == KeyEvent.VK_DOWN){ direction = 2; } if(e.getKeyCode() == KeyEvent.VK_LEFT){ direction = 3; } if(e.getKeyCode() == KeyEvent.VK_RIGHT){ direction = 4; } froggy.moveFrog...
67a07b71-50d8-4010-9d21-742d9fb75c37
1
private void initUI() { toolkit = this.getToolkit(); menu = new JPopupMenu(); JMenuItem menuItemBeep = new JMenuItem("Beep"); menuItemBeep.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { toolkit.beep(); } }); menu.add(menuItemBeep); JMenuItem menuItemClo...
df8bae3e-f818-4568-a6e6-3aeeeefaefe5
0
public int getBase() { return baseWeeklySalary; }
461b6734-80e2-48d9-9d07-98dbd34b222a
3
private boolean jj_3_42() { if (jj_scan_token(LEFTPARENTHESES)) return true; if (jj_3R_61()) return true; if (jj_scan_token(RIGHTPARENTHESES)) return true; return false; }
69103cce-88d0-4e1c-b9f3-1f5b9cacdf1b
4
public void drawName(Graphics g, Board board, int width, int height){ int leftCoord = this.getCellColumn()*width; int topCoord = this.getCellRow()*height; if(this.getPrintsRoom() && this.getRoomInitial()!='X') { String room = board.getRooms().get(this.getRoomInitial()); Font font = new Font("Verdana", Font....
0f5cdb0a-5010-4b21-97bc-a476fc6c7fd7
1
public void addInterface(CtClass anInterface) { checkModify(); if (anInterface != null) getClassFile2().addInterface(anInterface.getName()); }
cfb43305-e161-4857-a515-3cdb2a546b78
3
public boolean isSailable() { switch(value) { case 13: case 14: case 15: return true; default: return false; } }
2ab566f9-d980-45f4-8215-f19d63e6ca0d
7
public static void paintButton(MinesButton inButton, Graphics inG) { MinesNode node = inButton.getCorrespondingNode(); int x = inButton.getInsets().top; int y = inButton.getInsets().left; int height = inButton.getHeight() - inButton.getInsets().top - inButton.getInsets().bottom; int width = inButton.getWidth...
3450edfc-b013-489c-8af9-aeff45020a99
0
public void setSource(String source) { this.source = source; }
77212d00-fc94-4a42-abfb-11651edf415e
6
public static <E extends Comparable<E>> E kthSmallest(E[] array, int k) { if (array == null || k >= array.length || k < 0) return null; MaxHeap<E> maxheap = new MaxHeap<E>(); for (E e : array) { if (maxheap.size() < k + 1) maxheap.add(e); else if (e.compareTo(maxheap.findMax()) < 0) { maxhe...
acb7e476-4fb7-4ed4-8bae-fb0929fcb47c
7
private static int greatestCommonDivisor( int m, int n ) { // Базовый случай: if ( m == n ) { return m; } if ( m == 0 ) { return n; } if ( n == 0 ) { return m; } // Рекурсивный случай: ...
fefb0834-c348-49e2-96fb-bcbd6faeff7d
9
public String getAnswer() throws Exception { int retVal = 0; boolean [][] duplicates = new boolean[101][101]; //Too avoid using big ints, I simply mark duplicates for (int a = 2; a<= 100; a++) { int power = a*a; for (int b = 2; power<= 100; b++) { ...
1cac9b69-26ac-4509-b3b6-83623fedc815
0
public String getName() { String name = txt_name.getText().trim(); return name; }
25379b67-c55a-4d84-a08c-ce29efe93c8e
6
@EventHandler(priority = EventPriority.NORMAL) public void onSignChange(SignChangeEvent event) { Player player = event.getPlayer(); String[] line = event.getLines(); int i; if (line[0].toLowerCase().contains("[endersgame]")) { try { i = Integer.parseInt(line[1]); } catch (NumberFormatException e) { ...
54ac9a53-f7fc-47dc-a811-cbcc04044afc
9
private void outputData(){ // dimension arrays this.nData = this.xAndYvalues.size()/2; System.out.println("nData " + this.nData); this.xPositions = new double[this.nData]; this.yPositions = new double[this.nData]; this.xPosPixel = new double[this.nData]; this.yPo...
a4b261d7-b382-4bea-b9c2-343d2c701364
0
public Set<Point> getPointSet(){ return new HashSet<Point>(points); }
5e6315c3-a164-4187-b3d6-ae1d5c0a3a22
5
private static String[] separateIntoTokens(String step) { // Basically, each token is a chain of characters delimited by a ' ' character // However, we treat anything between double quotes (") as a single token // That is because anything between double quotes will be a parameter and...
8a366696-137a-42fb-b8e0-ccbc45a18f89
6
@Override public boolean equals (Object target) { if(target instanceof TaskList) { TaskList taskList = (TaskList) target; if(target.getClass() != this.getClass() || this.hashCode() != taskList.hashCode()) return false; else { ...
cba0618b-645c-43dc-ab20-f314ae383539
8
public void genAllMoves(){ int basic = 0, king = 0;//keeps a record of the value of a piece for black or white deleteList = new ArrayList<Move>(); if (colourToPlay == 1){ basic = 2; king = 4; } else{ basic = -2; king = -4; } for (int row = 0; row < EDGE_LENGTH; row++){ for (int col = 0; col < ...
ac96d365-532d-4ffd-8a03-6295ee093f84
8
protected void stepBackward() { CellElement currentCell; switch (m_currentPhase) { case PHASE_CALC_GRID: m_currentStep--; if (m_currentStep <= 0) { stepZero(); return; } Point realD = getCoordsByStep(m_currentStep);...
2a608840-b4ac-44a8-9ff8-de61246d891c
8
@EventHandler public void onPlayerJoin(PlayerJoinEvent event) { for (String p : BungeeUtilities.getInstance().hasPlayersHidden) { Player player = BungeeUtilities.getInstance().getServer().getPlayerExact(p); if (player == null) { BungeeUtilities.getInstance().hasPlayersHidden.remove(p); return; } ...
91854aaa-70ab-40b5-9ba3-a63018f17f1b
0
public Integer getSizeOfProducts() { return sizeOfProducts; }
7c68ef6f-5627-476a-b251-d73eabb91006
1
private Student getStudentFromTable() { DefaultTableModel dtm = (DefaultTableModel) studentsTable.getModel(); Vector data = dtm.getDataVector(); int rowSelected = studentsTable.getSelectedRow(); String name = ((Vector) data.elementAt(rowSelected)).elementAt(1) .toString(); String lastName = ((Vector) data...
c17d38e0-c9ac-4498-bac3-58da28c1454e
1
public State createStateWithStates(Automaton dfa, State[] states, Automaton nfa) { StatePlacer sp = new StatePlacer(); State state = dfa.createState(sp.getPointForState(dfa)); state.setLabel(getStringForStates(states)); if (hasFinalState(states, nfa)) { dfa.addFinalState(state); } return state; }
0560c715-6f5b-4e3b-b00e-f637c5f1dbe0
6
public String getClusterName(int index) { String name = "..."; switch (index) { case (1): name = "Advanced"; break; case (2): name = "FAQ"; break; case (3): name = "3 Shots"; break; case (4): name = "Big 'n Fast"; break; case (5): name = "High Debated"; break; case (6): ...
41680288-a0a7-4bf8-86da-edfdae498fa5
3
@Override public void addWord(String s) { // Equivalent of rho function int nbTrailingZeros = Integer.numberOfTrailingZeros(func.hashString(s)); // Consider only words whose hash value begins with more than b zeros. if (nbTrailingZeros >= b) { HashMap<String, Integer> l = strTab.get(...
acc94c6b-648c-46c9-b334-b7445ef672f6
9
public FeatureList getFeatureList(FeatureVector featureVector) { final FeatureList featureList = new FeatureList(); final int size = featureVector.size(); for (int i = 1; i <= size; i++) { final FeatureValue featureValue = featureVector.getFeatureValue(i-1); if (featureValue != null && !(excludeNullValues...
2731deff-e0d8-4eb8-8c80-5766e2182855
2
public boolean getIsIgnored(UUID passedUUID) { for (String s : ignoredPlayers) { UUID thisUUID = UUID.fromString(s); if (thisUUID.equals(passedUUID)) { return true; } } return false; }
a706c8d4-6056-4f96-a7eb-b5248fa297e5
7
public static void getDividers() { for (Integer prime : primes) { for (Integer pr : primes) { if (pr > prime) { if (primes.contains(pr + pr - prime)) { if (checkNumbers(prime, pr) && checkNumbers(prime, pr + pr - prime) && checkNumbers(pr...
faa44086-7f03-4a86-8ad9-148ce59578e9
8
public static void main(String[] args) { while(true){ System.out.println("Enter the file path of a file you want to encrypt or decrypt: "); filePath = input.nextLine(); System.out.println("Processing..."); reader = new ReadFile(filePath); int k = 1; boolean fileExists = true; String newP...
308d48a6-2dea-4e1f-b62b-a48a155cbf99
4
public static final BruteParams<?>[] valuesLocal() { final BruteParams<?>[] values_ = values(); for (int i = 0; i < values_.length; i++) { if (!values_[i].local) { values_[i] = null; } } return values_; }
1faf7159-5d61-4dcd-bceb-bde11476e298
4
@SuppressWarnings("empty-statement") public static void main(String[] args){ List<String> namen = new ArrayList<>(); try (Scanner scanner = new Scanner(System.in)){ System.out.println("Tik soortnamen, tik stop na de laatste naam"); for (String naam; ! "stop".equalsIgnoreCase(...
28ee6d49-01ef-476d-9cac-a4bd61a2f43b
3
public BeanDeepCopyLens(String fieldName, Class<A> theType) { for (Method m : theType.getMethods()) { if (m.getName().toLowerCase() .equals("get" + fieldName.toLowerCase())) { this.getMethod = m; } if (m.getName().toLowerCase() .equals("set" + fieldName.toLowerCase())) { this.setMethod = m;...