method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1831c666-44de-4241-88ae-f52867536afa
0
public void setName(String name) { this.name = name; setDirty(); }
3f39030f-720d-4566-940d-cd902653bdf2
9
public static void main(String[] args) throws IOException { Library stopWordDictionary = new StopWordLibrary(new Settings().getStopWordLibrary()); File directory = new File("dataSource/samples/Teste/comp.os.ms-windows.misc"); String[] arquivos = directory.list(); if (arquivos != null) { for (int i = 0; i < a...
d5502200-27eb-4b05-a2cd-3040fe980c3b
8
private void drawLine(Graphics g, int x, int y, int xMax, int xLen, FontMetrics fm, int alignment) { if (y > getHeight() - 3) return; StringBuffer s = new StringBuffer(); String str1; int xx = x; while (true) { int m = random.nextInt(10) + 1; str1 = dummy.substring(0, m) + " "; int len = ...
cfc006f5-054d-4ed1-a9e4-8938bc10d1ff
4
public Data serverMsg() { Object obj; try { try { obj = input.readObject(); } catch (ClassNotFoundException ex) { setDef("No connection to the server! Don't run Server.java" + ex.getMessage(), 1); return null; } ...
bec33d28-08a0-4d4f-be98-71c96fbfb71d
5
protected void setupTempInventory(Clan doer) { for (int i = 0; i < tmpInventory.length; i++) {tmpInventory[i] = 0;} QStack qs = doer.MB.QuestStack; if (qs.isEmpty()) {return;} Quest q = qs.peek(); if (!(q instanceof LaborQuest)) {return;} LaborQuest lq = (LaborQuest) q; int[] wm = lq.getWM(); int[]wmx =...
ffd3fa92-3f08-4d30-b7e1-e5849566ec0f
8
public static MovieData parseMovieFileName(File fileEntry) throws Exception { String fileName = fileEntry.getName(); System.out.println(fileName); MovieData data = null; if (data == null) { // Rule1: Braveheart.1995.1080p.BrRip.x264.YIFY+HI // ^^^^^^^^^^ ^^...
95dc22bb-2cec-40d9-8536-5de89ae22fa8
6
@Override public void update() { if (this.lastAlphaUpdate == 0) { this.lastAlphaUpdate = Timer.getTime(); } if (Timer.getTime() - this.lastAlphaUpdate >= 75) { if (this.increaseAlpha) { this.alpha += 0.04f; if (this.alpha >= 1.0f) { ...
c26f44d6-50f7-4a5b-963c-f3a3f0c9ebef
0
FileType(String type) { this.type = type; }
f1d8b8e4-c5cf-4cca-a9d2-a5dc87f6761a
5
public static void main(String[] args) { try { workDir=new File(ModManager.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath().replace("McLauncher.jar", "")); System.out.println("Running McLauncher from " + workDir); } catch (URISyntaxException e1) { workDir=new File(""); e1.prin...
5d110d60-b194-4097-99b3-394c65b72acd
4
public boolean isInArea(Area checkArea) { if (x <= checkArea.getLocation1().getX() || x >= checkArea.getLocation2().getX() || y <= checkArea.getLocation1().getY() || y >= checkArea.getLocation2().getY()) return false; else return tr...
19c1063d-3c67-4cba-9bc5-9f84ba560741
3
@SuppressWarnings("static-access") private void ROUND8() { enemises.clear(); System.out.println("Round8!!!!!!"); for (int i = 0; i < level.getWidth(); i++) { for (int j = 0; j < level.getHeight(); j++) { if ((level.getPixel(i, j) & 0x0000FF) == 2) { ...
ce862bf6-70ff-49ae-a9b8-3456fd83893f
5
private Widget creerCreateRoomPanel() { setWidth("100%"); setHeight("100%"); addSallePan.isVisible(); addSallePan.setTitle("Ajouter une salle"); // Create a table to layout the form options FlexTable layout = new FlexTable(); layout.setCellSpacing(6); layout.setWidth("350px"); layout.setHeight("450px...
8d2d3f2f-7d95-495e-8a34-f4aca0ee1b99
5
private boolean checkForNakedQuads(LinkedList<NakedCandidates> pool, NakedCandidates comparator) { LinkedList<String> candidates = new LinkedList<String>(); for (int index=0; index < pool.size(); index++) { for (int i=0; i < pool.get(index).values.size(); i++) { if (!passOver(candidates, pool.get(index)....
2832b9bf-1a2a-4c66-bb11-a74b3d2a62d5
5
@Override public String getText() { String res = ""; res = res + this.text + " "; Iterator<Integer> it_operands = this.operands.iterator(); Iterator<Character> it_operators = this.operators.iterator(); Iterator<Integer> it_unknowns = this.unknowns.iterator(); res = re...
1e8a6dec-2f5f-4e39-b9e8-d4dcb802d006
1
@Override public void addCandidate(Route route) { if (route.getNumberOfStops() == limit) { routes.add(route); } }
dc1386bd-5722-4de1-b305-6b559ce68207
1
public void testParseStandardFail2() { PeriodFormatter parser = ISOPeriodFormat.standard(); try { parser.parsePeriod("PS"); fail(); } catch (IllegalArgumentException ex) {} }
fa426dc3-0b08-4de7-9d3e-b757bf0e54ea
1
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((k == null) ? 0 : k.hashCode()); return result; }
c43227f0-d70a-404d-a1eb-156b8ddff549
2
private void drawGrid(){ //indicate the intervals between vertical lines int vertDist = APPLICATION_WIDTH/NDECADES; //window fit int fit = 60; //a buffer for everything int buffer =5; bottomLineY = APPLICATION_HEIGHT-GRAPH_MARGIN_SIZE-fit; for(int i=0;i<NDECADES;i++){ decadeArray[i] = START_...
448bb8bc-27c1-474b-b5bc-942e20774554
3
protected boolean isElementoEnListas(String elemento) { if (isElementoEnHechosInicio(elemento)) { return true; } if (isElementoEnHechosInferidos(elemento)) { return true; } if (isElementoEnHechosPreguntados(elemento)) { return true; ...
42308e26-b3f3-4087-a6aa-b21dd5846716
7
public void draw(Object obj, Component comp, Graphics2D g2) { Color color; if (obj == null) color = null; else color = (Color) getProperty(obj, "color"); String imageSuffix = (String) getProperty(obj, "imageSuffix"); if (imageSuffix == null) ...
3d7aec3d-88a9-48f4-bbf1-7dc9712e3f0a
8
public void completeRows() { int count = 0; for (int i = 0; i < NUM_ROWS; i++) // Loop through rows { for (int j = 1; j < NUM_COLUMNS - 1; j++) // Loop through columns { // Check each column in the row to see if it is occupied by an INACTIVE_BLOCK if(gameBoard[i][j] == INACTIVE_BLOCK) { ...
997063c7-8cde-4832-8412-2fff16286de3
5
private void decodeParameters(String parameters) { StringTokenizer tokenizer = new StringTokenizer(parameters, "&"); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); int index = token.indexOf('='); String name = decodePercent(index == -1 ? token : token.substring(0, index)).trim();...
2bd9e2c7-2ebc-42d8-a62e-6f5f7901113e
6
public static void showFrame () { /* 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://download.or...
97cd5274-a4b2-4100-994f-1c7495c5b176
1
@Test(expected = ParkException.class) public void in_a_car_when_all_park_is_full() { for(int i = 0; i <= 15; i ++) { parkBoy.in(new Car(String.valueOf(i))); } }
710731d2-11e3-440e-a9d7-213696dc1f56
2
public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("Exit")) { JOptionPane.showMessageDialog(null, "Are you Sure you want to exit?"); System.exit(0); } else if(e.getActionCommand().equals("About")) { JOptionPane.showMessageDialog(null, "Medical Application Integr...
fd1e01d1-c3bb-4acf-81db-0b728973054b
1
public Voiture ajouterVoiture(VoieEnum depart, VoieEnum destination) { VoieExterne entree, sortie; entree = voiesExternes.get(depart.ordinal()); sortie = voiesExternes.get(destination.ordinal()); Voiture voiture = new Voiture(sortie); if (statistiques != null) { voiture.addObserver(statistiques); } en...
e31bc3ff-be9e-48d5-823a-b2e0628ea53a
1
public void visit_baload(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
674ce8ca-3462-4359-a270-4c1c367d5331
1
@Override public void removeDefi(long id) { em.clear(); try { Defi defiToRemove = em.find(Defi.class, id); em.remove(defiToRemove); } catch(Exception e) {} }
b8724129-a604-47a1-bc20-1dbef11cdd80
8
public static String getMIME(String str){ //This method gets the MIME according to the extension. if(str.endsWith("/")) return "text/html"; String extension = str.substring(str.lastIndexOf(".")+1); switch (extension){ case "html": return "text/html"; case "htm": return "text/html"; case "jpeg": ...
a6dd5f78-d327-4765-b028-9267c699974c
0
public int getIndex() { return this.index; }
609deb80-2af1-4a72-be58-5dfc7c2521c7
4
private boolean insertStrict(T model, Long oldUpdatedAt) throws JackException, IOException { PreparedStatement insertStmt = conn.getPreparedStatement(getInsertWithIdStatement(fieldNames)); try { setAttrs(model, insertStmt); insertStmt.setLong(fieldNames.size() + 1, model.getId()); insertStmt.e...
30e40d42-7c49-4571-9958-170785276e64
0
protected AutomatonPane getView() { return view; }
6ad13fe0-e06b-47a2-aac6-36fa7575b428
0
private Animation createPlayerAnim(Image player1, Image player2, Image player3, Image player4, Image player5, Image player6, Image player7, Image player8, Image player9, Image player10) { Animation anim = new Animation(); anim.addFrame(player1, 80); anim.addFrame(play...
d332852b-90d2-487a-af45-306153cc3c1c
1
@RequestMapping(value="/edit.do", method=RequestMethod.GET) public String editProfile(@RequestParam(value="userId", required = false) Long userId, Model model) { if(userId == null) { model.addAttribute("user", new User()); } else { model.addAttribute("user", new User() ); //...
484842ae-2db0-4f6f-9c3a-be8dbbb23bdc
8
* @throws IOException * if there is a low-level IO error */ public void updateDocValues(Term term, Field... updates) throws IOException { ensureOpen(); DocValuesUpdate[] dvUpdates = new DocValuesUpdate[updates.length]; for (int i = 0; i < updates.length; i++) { final Field f = update...
6c6288f7-e115-4930-8fb2-21626f3f1ed4
0
public void clear() { this.data = new int[DEFAULT_SIZE]; size = 0; }
0bb8e4e5-8e5e-4511-b99a-496f54ca67e7
7
private void moveNewZipFiles(String zipPath) { File[] list = listFilesOrError(new File(zipPath)); for (final File dFile : list) { if (dFile.isDirectory() && this.pluginExists(dFile.getName())) { // Current dir final File oFile = new File(this.plugin.getDataFol...
17860710-2d79-4193-8ec5-158ac041658f
2
public void keyPressed(KeyEvent e) { if(!credits) { input.set(e.getKeyCode(), true); } else if (credits) { System.exit(0); } }
d3c11ee6-8cc6-410c-8527-e418b103f608
5
public int findFirstOccurrence(int [] arrA, int x, int start, int end){ if(end>=start){ int mid = (start+end)/2; if((mid==0||(arrA[mid-1]<x)) && arrA[mid]==x){ return mid; }else if(arrA[mid]<x){ return findFirstOccurrence(arrA, x, mid+1, end); }else{ return findFirstOccurrence(arrA, x, star...
13c06249-b508-4479-adf1-6f5bf2729bb6
8
public ListNode rotateRight(ListNode head, int n) { if (null == head || null == head.next) return head; ListNode p = head; int len = 0; while (p != null) { len++; p = p.next; } n %= len; if (n == 0) r...
a80dcf52-e1ef-4749-a9c7-70423d26bc3a
0
@Override public void handlePieceAvailability(SharingPeer peer, Piece piece) { /* Do nothing */ }
6094cca7-e9ac-495b-b7fb-9054ec1c1df2
8
public void splitAndInsert(String value, long split_ts) { for (Map.Entry<String, String> entry : optimizedData.entrySet()) { String times = entry.getValue(); String[] timespan = times.split(","); Long firstTime = Long.parseLong(timespan[0]); if (split_ts < firstTime) continue; Long secondTime = Lon...
80ebb935-99e2-4879-a5c3-5ce1581fe122
6
private static int getASMModifiers(Modifiers modifiers) { int mods = 0; if (modifiers == null) { return mods; } if (modifiers.hasModifier("public")) { mods += ACC_PUBLIC; } if (modifiers.hasModifier("protected")) { mods += ACC_PROTECTED; } if (modifiers.hasModifier("static")) { mods += ACC_...
f5eb27e4-2dbb-4105-9b73-b0a85ce90cdc
2
public static IRCCommand getResponse(String command){ if (requiresResponse(command)){ IRCCommand cmd; try { cmd = IRCCommand.valueOf(command.toUpperCase()).response; return cmd; } catch (IllegalArgumentException e){System.out.println("Unkown command: " + command);} } return null; }
bd412dc2-5424-445b-83f8-3b5c82dd4d50
0
public TreeDrawer getTreeDrawer() { return treeDrawer; }
8dd93023-6e02-4d8a-b0a5-0ff42475d3a8
7
public static int minPathSum(int[][] grid) { int m = grid.length; int n = grid[0].length; int[][] pathsum = new int[m][n]; for (int i = m - 1; i >= 0; i--) { for (int j = n - 1; j >= 0; j--) { if (i == m - 1 && j == n - 1) pathsum[i][j] = grid[i][j]; else if (i ...
807730a3-1c92-4ac7-ac0e-84c1c6c30072
1
public boolean equals(Object object) { return object == null || object == this; }
473b08ea-38f4-4927-9a06-23d0cc7895fe
8
Result tryRule( TotalisticRule r, int fieldSize ){ double p = 0.5; ArrayField field = new ArrayField(); field.setCells( Util.randomField( fieldSize, p) ); Path[] soup = field.getAliveCellsArray(); //it returns reference sortCells( soup ); int initialPopulation = soup.length; int limitPopulaion = ...
5d7d9be3-a7f1-469e-8ff1-5122f0d76940
2
public Polynomial modPow(long e, Polynomial p) throws Exception { Polynomial x = this; Polynomial r = one(); while (e > 0) { if ((e & 1L) != 0) r = r.mul(x).div(p)[1]; // r *= x mod p e >>= 1; x = x.mul(x).div(p)[1]; // x = x^2 mod p } return ...
382952a1-9ee0-483b-b89f-37bf8e8bd3cc
0
@Override public String[] getHelp() { return new String[]{ "ttp debug <username> [on/off]", "Toggles the debug state of a user" }; }
7243ef62-f450-4f79-839f-1d9f317938de
3
@Test public void testSingleReaderManyWriters() { final int MESSAGES = 10000; final int WRITERS = 10; final int MESSAGES_PER_WRITER = MESSAGES / WRITERS; final AtomicInteger nullCounter = new AtomicInteger(); final BlockableQueue<Integer> q = new BlockableQueue<Integer>(); q.setBlocking(true); Run...
62a63935-ca9a-46c3-b0b6-e958152daf7d
8
public static void main (String[] args) { int i = 1; for (; ; i++) { if (i % 20 == 0 && i % 19 == 0 && i % 18 == 0 && i % 17 == 0 && i % 16 == 0 && i % 14 == 0 && i % 13 == 0 & i % 11 == 0) { break; } } System.out.println(i); }
43769d60-b2a6-4c0b-af6e-211a4554c86c
5
private void waitTime () { if (isFirstTimeToDisplay) { isFirstTimeToDisplay = false; // Wait a little time for gui initial display. try { Thread.sleep(INPUT_WAITING_TIME_LONG); } catch (final InterruptedException e) { e.printStackTr...
c2ee2c9e-7a77-42c2-aadc-fcdd928b6924
8
private void autoSelectListBox(List<String> headers) { String loc; if ((loc = Utils.getBestMatch(controller.getLocationKeywords(), headers)) != null) { locationHeaderCB.setSelectedItem(loc); } String category; if ((category = Utils.getBestMatch(controller.getCategoryKeywords(), headers)) != null) { ca...
5be1abae-74b8-49e4-99fb-b74a75d584b2
0
public void mouseExited(MouseEvent e) { mouseMoved(e); }
b48572e8-ebf4-47d7-a34d-12f665535a33
4
public void setMenuIcons(ImageIcon normal, ImageIcon selected) { if (normal != null) { for (AccordionRootItem menu : getMenus()) { menu.setNormalIcon(normal); } } if (selected != null) { for (AccordionRootItem menu : getMenus()) { ...
f033e010-f595-4a40-b682-5e40e462ab00
9
public static void main(String args[]) throws ClassNotFoundException { /* * Load core config */ ConfigLoaderCore cf = new ConfigLoaderCore(); cf.LoadCoreConfig(); // Load core properties // Проверяем обновление и качаем если надо jmc.minecraft.utils.LauncherUpdater.UpdateLauncher(); //TODO обновылен...
152da517-6d8e-4926-b5f8-152ab3605a95
1
@Override public void setUp() { mapping = new HashMap<>(); final List<ColumnMetaData> listColumns = new ArrayList<>(); for (final String column : new String[] { "Id", "Description" }) { final ColumnMetaData columnMetadata = new ColumnMetaData(); columnMetadata.setColN...
4006bd6f-bb91-4cd6-b766-b455532c1e7a
4
@Override public void execute() { Variables.status = "Looting nest"; if(Inventory.getItem(Variables.seedNest_ID) != null) Inventory.getItem(Variables.seedNest_ID).getWidgetChild().interact("Search"); sleep(1000,1200); if(Inventory.contains(Variables.seed_IDs)) System.out.println("yo"); if(Inventory.con...
d4cdfd6a-03b7-46de-a3a7-cfbe63afee7c
1
public void visit_idiv(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
458c181f-3973-4437-9b0e-262a7bd95cf8
9
private void checkEvictionOrder(boolean lifo) throws Exception { SimpleFactory factory = new SimpleFactory(); GenericKeyedObjectPool pool = new GenericKeyedObjectPool(factory); pool.setNumTestsPerEvictionRun(2); pool.setMinEvictableIdleTimeMillis(100); pool.setLifo(lifo); ...
f5405d91-e999-4909-aa83-80a884313603
6
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int nSet = Integer.parseInt(line.trim()); for (int...
ac119691-6b10-441d-8532-8788e4cb4e15
0
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub }
b846cbff-8367-4505-9179-9ca19ff4e72c
5
public static void adjustComponentBounds(Component comp, Component parentComp){ if(parentComp == null){ int x = Math.max(comp.getX(), 12); int y = Math.max(comp.getY(), 12); int width = Math.min(comp.getWidth(), Toolkit.getDefaultToolkit().getScreenSize().width-1...
735b4f92-c906-4355-8c3e-e56b8957d832
4
public void addTime(String playerName, int time, DB_Timers timer) { String message, bmessage; Integer timerID = timer.getId(); String st_time = this.plugin.util.formatTime(Integer.valueOf(time)); DB_Times data = this.plugin.database.getDatabase().find(DB_Times.class).where().ieq("Playername", playerName).where(...
4348b4bb-2d31-4d0b-8f37-db30325060b6
0
public int[] getPosition() { return this.position; }
171168fb-546c-47b1-a711-ceeb1512e62b
2
public double visibleNode(int index) { if(index < 0 || index >= m) throw new RuntimeException("given m=" + m + ", illegal value for index: " + index); return _visibleNodes[index]; }
10330e5e-660a-4720-bafd-a4e6edd39092
3
public void add(E element) { if (root == null && element != null) { root = new Node<E>(element); size++; } else if (element != null) { root = insert(root, element); } }
631823bb-ed04-4610-825c-c73e8a122974
8
public boolean pass(int[] bowl, int bowlId, int round, boolean canPick, boolean musTake) { counter++; if(counter==1){ for(int i=0;i<12;i++){ bowSize+=bowl[i]; } //update(bowSize*6); } update(bowl,bowlId,round); ...
4e69363b-6cd1-4f1b-9807-e8e378d7a41c
8
public int characterAt(int at) throws JSONException { int c = get(at); if ((c & 0x80) == 0) { return c; } int character; int c1 = get(at + 1); if ((c1 & 0x80) == 0) { character = ((c & 0x7F) << 7) | c1; if (character > 0x7F) { ...
8c29ca8a-0dfa-4ea4-9ebc-09a714b55488
4
public void save() throws IOException { try { // Generate XML builder // (thanks to // http://www.mkyong.com/java/how-to-create-xml-file-in-java-dom/) DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder ...
04d835cf-6eeb-46e9-b1ea-c16cd45bc1ba
7
public RepairGUI() { setBounds(100, 100, 537, 393); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JPanel panel = new JPanel(); panel.setBounds(0, 0, 535, 364); contentPane.add(panel); panel.setLayout(null);...
49861481-c6b6-43cc-b1f5-9e7a7cd02c14
0
protected void end() { Robot.tilter.stop(); }
4e29aa82-c686-4438-9a53-6ca04ab1209b
4
public static void main(String[] args) { JSAP jsap = initParameters(); JSAPResult jsapResult = jsap.parse(args); if(!jsapResult.success()) { printHelp(jsap); } boolean withShortedPath = jsapResult.getBoolean("shortedPath"); //Boolean reduced = jsapResult.getBoolean("reduced"); File inputFile = new ...
2f2f7d40-0426-4bfc-9ae2-585cae0ade06
7
public void writeAttributeList(Writer writer, Iterable<? extends Iterable<Tuple2<?, ?>>> attributes) throws IOException { if (attributes != null) { for (Iterable<Tuple2<?, ?>> alist : attributes) { writeAList(writer, alist); } } }
fd3a324c-1d77-4497-9a0e-b8d4d5046689
7
public static Surrogate coerceToBoundOrLocalSurrogate(GeneralizedSymbol self) { { Surrogate surrogate = null; if (Logic.explicitlyQualifiedLogicObjectNameP(self, ((Module)(Stella.$MODULE$.get())))) { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$....
dd3e3892-0cbc-47de-8377-a0bfdc014252
0
public PartnerRole(final String name) { super(name); }
3d0eb585-f7fb-468a-aec3-7acda67eeef7
9
private void jbtnValiderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnValiderActionPerformed if (modeCMS.equals("C")) { if (JOptionPane.showConfirmDialog(this, "Etes-vous sûr de vouloir créer ce livre ?", "Confirmation", YES_NO_OPTION)==YES_OPTION){ creer(); ...
1202612c-71b4-479f-882d-ac5343c8b921
6
public FileStorage() { super(); File citationsFile = new File(serializationFilename); ObjectInputStream objectInputStream = null; try { if (!citationsFile.exists()) { return; } FileInputStream fileInputStream = new FileInputStream(citat...
ce1b024e-90cb-4f57-81d7-988bd6029963
3
public T getById(int id) throws SQLException { Session session = null; T t = null; try { session = HibernateUtil.getSessionFactory().openSession(); t = (T) session.load(this.getRealClass(), id); } catch (Exception e) { JOptionPane.showMessageDialog(nul...
38da6a63-9387-4517-86e5-ca6c1af1b902
1
@Override public void setPerPage(int per_page) { this.per_page = (per_page > 0) ? per_page : 1; this.pages = (int) Math.ceil((double) this.rows / (double) this.per_page); }
8584e84f-23a1-41d6-9475-25f7d8c653dd
4
public String search() { ProductService productService = new ProductService(); try { if (this.item.getQuantity() != 0) { this.searchList = productService.searchProduct( item.getCategory(), item.getTitle(), item.getLeadSinger(), item.getQuantity(), searchList); if (this.searchList.size() == ...
44332714-f691-4d08-a7a1-e22bcec6f501
4
public void keyPressed(KeyEvent e){ int key = e.getKeyCode(); switch(key){ case KeyEvent.VK_D : br = true; break; case KeyEvent.VK_A : bl = true; break; case KeyEvent.VK_W : bu = true; break; case KeyEvent.VK_S : bd = true; break; } locateDirection(); }
7f72df84-f287-4352-a132-b856ee9e6b51
5
public boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception { DecoderState state = (DecoderState) session.getAttribute(DECODER_STATE_KEY); if (state == null) { state = new DecoderState(); session.setAttribute(DECODER_STATE_KEY, state); } if (sta...
1614ff0b-1eb0-4c6f-88e3-736287afa3c5
7
private void menuItemNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItemNuevoActionPerformed int change=-1; if (changed){ change= JOptionPane.showOptionDialog(rootPane, ((currentFile==null)? "El Archivo nuevo": (currentFile.getName() )) ...
321e402e-1fa4-4ab0-8055-589fa06488de
4
@Override public boolean handleRightClick(Point clickPoint) { if (this.isActivated()) { Point mapPoint = new Point( placeableManager.panelToMapX(clickPoint.x), placeableManager.panelToMapY(clickPoint.y)); if (currentState == State.Placed) { ...
6b361317-1716-4dec-80c4-61bc954ca5fa
4
public static void main(String[] args) { System.out.println("Task 5 - Smallest Multiple.\n" + "\n2520 is the smallest number that can be divided by each of " + "the numbers from 1 to 10 without any remainder.\n" + "What is the smallest positive number t...
2c87d1a7-1749-452c-bbbe-a62d4cee2ff4
2
public void updateTicket() { Database db = dbconnect(); String noEmployee = null; try { String query = "UPDATE ticket SET customer_CID = ?, " + "employee_EID = ?, CategoryID = ?, " + "StatusID = ?, Topic = ?, " + "Problem = ?, Note = ?...
0d0611cd-3276-4222-aa03-77c3c0bf2e34
5
public static String convertJavaStyletoDBConvention( String name ) { char[] chars = name.toCharArray(); StringBuffer buf = new StringBuffer(); for( int i = 0; i < chars.length; i++ ) { // if there is a single upper-case letter, then it's a case-word if( Character.isUpperCase( chars[i] ) ) { if( (i...
1e10eabf-48d6-4b67-89e8-61593dabdb63
0
public static void main(String[] args) { Test test=new Test(); }
a3644c3c-5796-40e6-bd95-c399e53c4a63
6
String order(double x, double y, double z ){ String classify = null; double []store = new double[3]; store[0] = x; store[1] = y; store[2] = z; classify = (store[0] < store[1] && store[1] < store[2] || store[2] < store[1] && store[1] < store[0]) ? store[0] < store[1] && s...
a8f6eb48-b870-462d-b535-1d68a11e8422
6
protected void newGame(MouseEvent e, int nx, int nw, int ny, int nh, TicTacToeBoard tb, TicTacToePlayer tp, Main m, LinkedList<Square> SquareStore) { // new game button if (tb.getGameOver()) { if (e.getX() > nx && e.getX() < nx + nw) { if (e.getY() > ny && e.getY() < ny + nh)...
0c91a970-0d83-473f-8f56-528deef9404e
5
public void selectCell(int r, int c) { if (this.stateTable && c > this.stateColumn || !this.stateTable && c >= this.inPinCount) { if (this.cells[r][c].equals("0")) { this.cells[r][c] = "1"; } else { this.cells[r][c] = "0"; } } }
8463b674-bb3e-428c-b5a9-850963d2d7f7
8
private String prepareConfigString(String configString) { int lastLine = 0; int headerLine = 0; String[] lines = configString.split("\n"); StringBuilder config = new StringBuilder(""); for(String line : lines) { if(line.startsWith(this.getPluginName() + "_COMM...
15fe502b-324a-4344-8d22-21a09501f74c
1
public void componentResized(ComponentEvent e) { if (adapt) transformNeedsReform = true; repaint(); }
291d2984-5c86-42b2-94e3-8fccfd53de54
3
public void addUpdatedFilesData(List<String> updatedFiles) { for (int i = 0; i < updatedFiles.size(); i++) { try { Map<String, Set<Flight>> flightCSVData = readCsvAddData(updatedFiles .get(i)); /* * Sends every set related to a particular location along with * the Departure-Arrival key to ...
be588104-0c2f-4531-8b8c-c14c39b96df4
2
public void setDates(String start, String end) { this.dates = start + " - " + ((end == null || end.equalsIgnoreCase("null")) ? "no end" : end); }
890fcd0e-926f-41d9-97bd-9e3a2a43181a
9
private String readFileAsString(String filename) throws Exception { StringBuilder source = new StringBuilder(); FileInputStream in = new FileInputStream(filename); Exception exception = null; BufferedReader reader; try { reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); Exception inne...
2ad0af2f-bf5d-4fce-a626-13382f5bcc6e
2
public void run() { while (true) { // cambio de colision y actualiza actualiza(); checaColision(); repaint(); // Se actualiza el <code>JFrame</code> repintando el contenido. try { // El thread se duerme. Thread.sleep(80...
becf37ff-6cf8-4d33-8dd5-ffbda26c443b
8
private String setParam(int columnType) { if (columnType == java.sql.Types.INTEGER) { return "Int"; } else if (columnType == java.sql.Types.VARCHAR || columnType == java.sql.Types.CHAR) { return "String"; } else if (columnType == java.sql.Types.TIMESTAMP) { re...