method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
11a5b62f-f7df-475d-8a6d-af17dfbc4648
3
private void save(String kodikosV,String daidromiV){ /* * apothikeuei ta stoixia sthn vash kai emfanizei to katalilo minima ston xristi */ String query="insert into oximata(id,diadromi,lat,lon) values(?,?,'37.973263','23.740768') on duplicate key update diadromi=?"; try { con.pS=con.conn.prepareStatement(query); con.pS.setInt(1, Integer.parseInt(kodikosV)); con.pS.setString(2, daidromiV); con.pS.setString(3, daidromiV); } catch (SQLException e) { e.printStackTrace(); } if(con.makeQuery(query)){ JOptionPane.showMessageDialog(null, "Saved!"); if(id!=0) dispose(); else{ kodikos.setText(""); diadromi.setText(""); } }else{ JOptionPane.showMessageDialog(null, "Something went wrong please try later!"); } }
a2924822-cccb-47b3-b848-dc361c0fce9c
6
@EventHandler public void EnderDragonStrength(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.getEnderDragonConfig().getDouble("EnderDragon.Strength.DodgeChance") / 100; final double ChanceOfHappening = random.nextDouble(); if (ChanceOfHappening >= randomChance) { dodged = true; } if (plugin.getEnderDragonConfig().getBoolean("EnderDragon.Strength.Enabled", true) && damager instanceof EnderDragon && e instanceof Player && plugin.getConfig().getStringList("Worlds").contains(world) && !dodged) { Player player = (Player) e; player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, plugin.getEnderDragonConfig().getInt("EnderDragon.Strength.Time"), plugin.getEnderDragonConfig().getInt("EnderDragon.Strength.Power"))); } }
81a88ecb-f2a0-4cdf-843c-138c95727721
8
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.parseInt(br.readLine().trim()); for (int t = 0; t < T; t++) { int N = Integer.parseInt(br.readLine().trim()); String[] name = new String[N]; int[] lowest = new int[N]; int[] highest = new int[N]; for (int i = 0; i < N; i++) { String[] temp = br.readLine().split(" "); name[i] = temp[0]; lowest[i] = Integer.parseInt(temp[1]); highest[i] = Integer.parseInt(temp[2]); } int Q = Integer.parseInt(br.readLine().trim()); for (int i = 0; i < Q; i++) { int P = Integer.parseInt(br.readLine().trim()); int count = 0; String ret = ""; for (int j = 0; j < N; j++) { if (P >= lowest[j] && P <= highest[j]) { ret = name[j]; count++; } } if (count == 1) { System.out.println(ret); } else { System.out.println("UNDETERMINED"); } } if (t < T - 1) { System.out.println(); } } }
4550c275-3410-4618-9625-941e35b8d21d
2
private void writeBookList() { BookXMLHandler addBook = new BookXMLHandler(); try { addBook.writeToFile(bookList); } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
b7579d65-5d91-4041-b896-75d666272a89
2
@Override public void onEnable() { configData.load(); PluginManager pm = this.getServer().getPluginManager(); pm.registerEvent(Event.Type.PLAYER_INTERACT, this.playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.BLOCK_BREAK, this.blockListener, Priority.Highest, this); pdfFile = this.getDescription(); commandExecutor = new AnCommandExecutor(this); getCommand("casino").setExecutor(commandExecutor); this.logger.info(prefix +" v" + pdfFile.getVersion() + " enabled."); if(!pm.isPluginEnabled("Vault")) { this.logger.warning(prefix +" Vault is required in order to use this plugin."); this.logger.warning(prefix +" dev.bukkit.org/server-mods/vault/"); pm.disablePlugin(this); } else { if(!setupEconomy()) { this.logger.warning(prefix + " An economy plugin is required in order to use this plugin."); pm.disablePlugin(this); } } }
d7ad5380-b3d6-485f-bc4d-12f8776db63b
1
@Override public void setVisible(boolean state) { if (state) { eventStart.setTime(MainWindow.setupData.getEventStartDate()); startDatePicker.getModel().setDate( eventStart.get(Calendar.YEAR), eventStart.get(Calendar.MONTH), eventStart.get(Calendar.DATE)); startDatePicker.getModel().setSelected(true); eventEnd.setTime(MainWindow.setupData.getEventEndDate()); endDatePicker.getModel().setDate( eventEnd.get(Calendar.YEAR), eventEnd.get(Calendar.MONTH), eventEnd.get(Calendar.DATE)); endDatePicker.getModel().setSelected(true); } super.setVisible(state); }
75e1c780-d610-4160-a291-095fcec53d36
5
public static void main(String[] args) throws Exception { switch (args.length) { case 2: expr = args[1]; /*FALLTHROUGH*/ case 1: fileName = args[0]; break; case 0: default: System.err.println("Usage: XPathRunner file [xpath-expr]\n"); return; } DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); document = parser.parse(new FileInputStream(fileName)); if (expr == null) do { expr = promptForPathExpr(); System.out.println(eval(expr)); } while (!done); else { System.out.println(eval(expr)); } }
4081f3e5-e28e-432e-8939-560c798d1a36
0
private String parseMethodName(String signature) { String methodBeforeArguments = signature.substring(0, signature.indexOf("(")); int positionOfMethodNameStart = methodBeforeArguments.lastIndexOf("."); return methodBeforeArguments.substring(positionOfMethodNameStart + 1); }
ce986a6c-23b6-49cc-a07b-b3dd0aeec42c
3
public Objective getObjectiveFromTypes(String type, String name){ for(Objective obj : this.objectives){ if(obj.type.equalsIgnoreCase(type) && obj.getObjectiveName().equalsIgnoreCase(name)) return obj; } //no matching objective return null; }
56baed21-2cfe-43a9-b21d-2e5c75dcfcde
0
public Integer getFrequency() { return frequency; }
fa96505b-3993-447a-9269-2ee10f1b907d
5
public void applicationLoop() { int sign = -1; float height = 0; Transform3D transform = new Transform3D(); Transform3D transform2 = new Transform3D(); screen = canvas.getGraphics2D(); canvas.setFrameRate(String.format("Frame [%d]", frameCounter)); canvas.setCameraPosition(String.format("Camera Position (%f, %f, %f)", cameraX, cameraY, cameraZ)); FPSTimer fpsTimer = new FPSTimer(this); fpsTimer.start(); DecimalFormat decimalFormat = new DecimalFormat("#.##"); while (!shouldStop) { for (Block block : renderMees) { transform.setTranslation(block.getPosition3f()); block.getTransformGroup().setTransform(transform); } // Indicates we want to travel 2 meters in 1 second float travelInterval = 2f / fps; height += travelInterval * sign; if (Math.abs(height * 2) >= 1) { sign = -1 * sign; } transform.setTranslation(new Vector3f(0f, height, 0f)); transformGroup.setTransform(transform); transform2.setTranslation(new Vector3f(.25f, 0f, 0f)); transformGroup2.setTransform(transform2); canvas.setFrameRate(String.format("Frame [%d|%dfps]", frameCounter, averageFPS)); canvas.setCameraPosition(String.format("Camera Position (%s, %s, %s)", decimalFormat.format(cameraX), decimalFormat.format(cameraY), decimalFormat.format(cameraZ))); Transform3D camera = new Transform3D(); camera.setTranslation(new Vector3d(cameraX, cameraY, cameraZ)); cameraTransformGroup.setTransform(camera); Transform3D cameraTransform3D = new Transform3D(); Vector3f cameraPosition = new Vector3f(); cameraTransformGroup.getTransform(cameraTransform3D); cameraTransform3D.get(cameraPosition); try { // For some reason it's required to draw a string here for it to render scaling properly in postRender screen.drawString(" ", 0, 0); } catch (NullPointerException e) { log.warn("InterruptedException"); } try { sleep(timerInterval); } catch (InterruptedException e) { e.printStackTrace(); } frameCounter++; } }
7bad9a65-36e3-412e-9d76-392da3a9722c
3
public String sendMessage(String messageWithName) { Set<String> clientList = this.updater.getClientList(); for (String s : clientList) { try { // Angepasst this.udpVerbindung.send(s, this.userName + ": " + messageWithName); } catch (UnknownHostException ex) { Logger.getLogger(ChatClient.class.getName()).log(Level.SEVERE, null, ex); return "Fehler beim Ziel"; } catch (UnsupportedEncodingException ex) { Logger.getLogger(ChatClient.class.getName()).log(Level.SEVERE, null, ex); return "Falsche Enkodierung, mit UTF8"; } } return ""; }
12f810e9-247f-46f3-b00e-7d10206c6d7d
7
private void jbInit() throws Exception { this.contentPane = (JPanel) this.getContentPane(); this.contentPane.setLayout(this.gridBagLayout2); this.setDefaultCloseOperation(0); this.setJMenuBar(this.menuBar); this.setSize(new Dimension(759, 548)); this.setTitle("State Table Editor"); JComboBox<String> inPinBox = new JComboBox<String>(); inPinBox.addItem("0"); JComboBox<String> outPinBox = new JComboBox<String>(); JComboBox<String> stateBox = new JComboBox<String>(); for (int i = 0; i < OUT_STATE_MAX; i++) { if (i < IN_MAX) { inPinBox.addItem(String.valueOf(i + 1)); } outPinBox.addItem(String.valueOf(i + 1)); stateBox.addItem(String.valueOf(i + 1)); } JOptionPane.showOptionDialog(this, "Please state the number of input pins, output pins\nand states required\n ", "State Table Editor", 2, 3, null, new Object[] { new JLabel("Input Pins"), inPinBox, new JLabel("OutputPins"), outPinBox, new JLabel("States"), stateBox, "Continue" }, "1"); this.inPinNumber = Integer.parseInt((String) inPinBox.getSelectedItem()); this.outPinNumber = Integer.parseInt((String) outPinBox.getSelectedItem()); this.stateNumber = Integer.parseInt((String) stateBox.getSelectedItem()); this.stateTable = new StateTable(this.inPinNumber, this.outPinNumber, this.stateNumber); String[] states = new String[this.stateNumber]; for (int i = 0; i < this.stateNumber; i++) { states[i] = Integer.toString(i); } this.lstStarting.setListData(states); this.lstStarting.setBorder(null); this.lstStarting.setSelectedIndex(0); this.lstStarting.setSelectionMode(0); this.tableFrame.setBorder(BorderFactory.createLoweredBevelBorder()); this.statusBar.setBorder(BorderFactory.createLoweredBevelBorder()); this.statusBar.setLayout(this.borderLayout1); this.lblStatusBar.setText("Click on output pin cells to toggle values. Double-click column headers to change pin labels."); this.jPanel1.setBorder(BorderFactory.createLoweredBevelBorder()); this.jPanel1.setLayout(this.gridBagLayout1); this.lblStarting.setHorizontalAlignment(0); this.lblStarting.setText("Starting State"); this.lblStarting2.setFont(new Font("Dialog", 0, 12)); this.lblStarting2.setText("Please select the"); this.lblStarting3.setText("initial state in"); this.lblStarting3.setFont(new Font("Dialog", 0, 12)); this.lblStarting4.setText("which the chip will"); this.lblStarting4.setFont(new Font("Dialog", 0, 12)); this.lblStarting4.setToolTipText(""); this.lblStarting5.setText("start on power-up"); this.lblStarting5.setFont(new Font("Dialog", 0, 12)); this.scrStarting.setBorder(BorderFactory.createLoweredBevelBorder()); this.contentPane.add(this.tableFrame, new GridBagConstraints(0, 0, 1, 1, 1.0D, 1.0D, 10, 1, new Insets(8, 5, 0, 0), 563, 371)); this.tableFrame.getViewport().add(this.stateTable, null); this.contentPane.add(this.propertiesPanel, new GridBagConstraints(0, 1, 2, 1, 1.0D, 0.0D, 10, 1, new Insets(6, 5, 0, 12), 741, 99)); this.contentPane.add(this.statusBar, new GridBagConstraints(0, 2, 2, 1, 1.0D, 0.0D, 10, 1, new Insets(0, 5, 11, 12), 156, 2)); this.statusBar.add(this.lblStatusBar, "Center"); this.contentPane.add(this.jPanel1, new GridBagConstraints(1, 0, 1, 1, 0.0D, 1.0D, 10, 1, new Insets(8, 9, 0, 12), 3, 7)); this.jPanel1.add(this.lblStarting3, new GridBagConstraints(0, 2, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(0, 11, 0, 25), 20, 0)); this.jPanel1.add(this.lblStarting5, new GridBagConstraints(0, 4, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(0, 11, 0, 9), 6, 0)); this.jPanel1.add(this.lblStarting2, new GridBagConstraints(0, 1, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(23, 11, 0, 16), 9, 0)); this.jPanel1.add(this.lblStarting4, new GridBagConstraints(0, 3, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(0, 11, 0, 9), 4, 0)); this.jPanel1.add(this.lblStarting, new GridBagConstraints(0, 0, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(16, 11, 0, 9), 27, 0)); this.jPanel1.add(this.scrStarting, new GridBagConstraints(0, 5, 1, 1, 1.0D, 1.0D, 10, 1, new Insets(19, 11, 108, 15), -155, 18)); this.scrStarting.getViewport().add(this.lstStarting, null); this.jMenuBar1.getSaveMenuItem().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { StateTableFrame.this.createChipFile(); } }); this.jMenuBar1.getExitMenuItem().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { StateTableFrame.this.exitAction(); } }); this.jMenuBar1.getNewMenuItem().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { try { if (JOptionPane.showConfirmDialog(null, "Are you sure you want to close this table?\nAll unsaved work will be lost", "New Table", 0, 1) == 0) { StateTableFrame.this.closeWindow(); StateTableFrame newFrame = new StateTableFrame(StateTableFrame.this.inApplet); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = newFrame.getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } newFrame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); newFrame.setVisible(true); } } catch (Exception ex) { ex.printStackTrace(); } } }); }
3a82a42b-8ee5-4610-83cb-32c0fffbd4b6
0
public CipherReferenceType createCipherReferenceType() { return new CipherReferenceType(); }
58414b72-1372-4b66-87ec-9eaf59e76666
4
public ProtocolElem(JFrame frame, String key, String type) { this.id = StringUtils.Md5("" + System.nanoTime()); this.setText(key, type); this.setSize(type); this.addMouseListener(new MouseAdapter() { private void button1Clicked() { MessageBox.showPEInfoBox(frame, thisPE.key, thisPE.type, (String newKey, String newType) -> { if (StringUtils.isEmpty(newKey)) { MessageBox.showConfirmBox(frame, "Error", "键不能为空", null); return; } if (StringUtils.isEmpty(newType)) { MessageBox.showConfirmBox(frame, "Error", "类型不能为空", null); return; } Debugger.debug(() -> { System.out.println(String.format("%s:%s vs. %s:%s", thisPE.key, thisPE.type, newKey, newType)); }); thisPE.setText(newKey, newType); thisPE.setSize(newType); frame.repaint(); }); } private void button2Clicked() { thisPE.getParent().remove(thisPE); frame.paintComponents(frame.getGraphics()); } @Override public void mousePressed(MouseEvent e) { Debugger.debug(() -> { System.out.println(e.getButton() == MouseEvent.BUTTON1); System.out.println(e.getButton() == MouseEvent.BUTTON3); }); switch (e.getButton()) { case MouseEvent.BUTTON1: button1Clicked(); break; case MouseEvent.BUTTON3: button2Clicked(); break; default: } } }); }
546d511e-2add-4a92-bb8f-153834fe4d64
6
@Override public Class<?> getColumnClass(int columnIndex){ Class type = String.class; switch (columnIndex){ case 0: type = Integer.class; break; case 1: type = String.class; break; case 2: type = Double.class; break; case 3: type = Double.class; break; case 4: type = Double.class; break; } return type; }
2670bf80-af45-460b-84ca-e01c947198c2
1
public void dividirEquipos(Collection<Inscripcion> equipo1, Collection<Inscripcion> equipo2, PriorityQueue<Inscripcion> primeros10Ordenados){ for (int i=1;i<=5;i++){ equipo1.add(primeros10Ordenados.poll()); equipo2.add(primeros10Ordenados.poll()); } }
0f86de2a-cedf-443f-9d0a-8f8def5ab8c6
0
public Date getEventDate() { return eventDate; }
388bd859-b6a6-4ada-b053-0af7ac5e4d04
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); } } else if (o instanceof Float) { if (((Float) o).isInfinite() || ((Float) o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); } } } }
28c636cc-40a0-4998-87b4-f861b58c3c9e
1
public int getDepth() { Row parent = mParent; int depth = 0; while (parent != null) { depth++; parent = parent.mParent; } return depth; }
c6defda8-1007-4288-be89-647ed9e7a1be
5
public void moveRobot(int ID) { robotar.get(ID).moveForward(); for(int i = 0;i < block.length;i++) { if(robotar.get(ID).touches(block[i])) { feedback.get(ID).setRobotkrock(true); robotar.get(ID).moveBackward(); } } for(int i = 0;i < robotar.size();i++) { if(robotar.get(ID).touches(robotar.get(i)) && robotar.get(i).getID() != robotar.get(ID).getID()) { feedback.get(ID).setRobotkrock(true); feedback.get(i).setRobotkrock(true); robotar.get(ID).moveBackward(); robotar.get(i).moveBackward(); } } }
f5c49124-cc29-4ec4-bf59-d2e44b8a770c
6
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { btn_addeditC = new javax.swing.JButton(); btn_addeditE = new javax.swing.JButton(); btn_refresh = new javax.swing.JButton(); btn_addeditT = new javax.swing.JButton(); jSeparator1 = new javax.swing.JSeparator(); btn_max = new javax.swing.JButton(); btn_addeditP = new javax.swing.JButton(); Logo = new javax.swing.JLabel(); intf_fcontrol = new javax.swing.JInternalFrame(); btn_setfull = new javax.swing.JButton(); btn_setopen = new javax.swing.JButton(); btn_setprocess = new javax.swing.JButton(); btn_setclosed = new javax.swing.JButton(); intf_mycontrol = new javax.swing.JInternalFrame(); Pane_Overview = new javax.swing.JTabbedPane(); pane_fullticket = new javax.swing.JPanel(); scrollpane_fullticket = new javax.swing.JScrollPane(); table_fullticket = new javax.swing.JTable(); intf_fullticket = new javax.swing.JInternalFrame(); scrollpane_full = new javax.swing.JScrollPane(); txp_fullticket = new javax.swing.JEditorPane(); edt_filterfullticket = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); pane_customer = new javax.swing.JPanel(); scrollpane_customer = new javax.swing.JScrollPane(); table_customer = new javax.swing.JTable(); jLabel3 = new javax.swing.JLabel(); edt_filtercustomer = new javax.swing.JTextField(); pane_employee = new javax.swing.JPanel(); scrollpane_employee = new javax.swing.JScrollPane(); table_employee = new javax.swing.JTable(); edt_filteremployee = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); pane_product = new javax.swing.JPanel(); scrollpane_product = new javax.swing.JScrollPane(); table_product = new javax.swing.JTable(); edt_filterproduct = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); intf_product = new javax.swing.JInternalFrame(); scrollpane_his1 = new javax.swing.JScrollPane(); txp_product = new javax.swing.JEditorPane(); pane_history = new javax.swing.JPanel(); scrollpane_history = new javax.swing.JScrollPane(); table_history = new javax.swing.JTable(); edt_filtertickethis = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); intf_history = new javax.swing.JInternalFrame(); scrollpane_his = new javax.swing.JScrollPane(); txp_history = new javax.swing.JEditorPane(); menuBar = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); menu_new = new javax.swing.JMenu(); menu_customer = new javax.swing.JMenuItem(); menu_employee = new javax.swing.JMenuItem(); menu_product = new javax.swing.JMenuItem(); menu_ticket = new javax.swing.JMenuItem(); menu_quit = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Helpdesk"); setBackground(new java.awt.Color(255, 255, 255)); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setForeground(java.awt.Color.white); setMinimumSize(new java.awt.Dimension(800, 600)); setName("frame_main"); // NOI18N btn_addeditC.setFont(new java.awt.Font("Tahoma", 0, 12)); btn_addeditC.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Helpdesk/java/helpdesk/mvc/View/pics/customer_button.png"))); // NOI18N btn_addeditC.setText("Customer"); btn_addeditC.setToolTipText("Add or Edit Customer"); btn_addeditC.setFocusable(false); btn_addeditC.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_addeditC.setMargin(new java.awt.Insets(2, 2, 2, 2)); btn_addeditC.setMaximumSize(new java.awt.Dimension(61, 59)); btn_addeditC.setMinimumSize(new java.awt.Dimension(61, 59)); btn_addeditC.setPreferredSize(new java.awt.Dimension(61, 59)); btn_addeditC.setVerticalAlignment(javax.swing.SwingConstants.TOP); btn_addeditC.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btn_addeditE.setFont(new java.awt.Font("Tahoma", 0, 12)); btn_addeditE.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Helpdesk/java/helpdesk/mvc/View/pics/employee_button.png"))); // NOI18N btn_addeditE.setText("Employee"); btn_addeditE.setToolTipText("Add or Edit Employee"); btn_addeditE.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_addeditE.setMargin(new java.awt.Insets(2, 2, 2, 2)); btn_addeditE.setVerticalAlignment(javax.swing.SwingConstants.TOP); btn_addeditE.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btn_refresh.setFont(new java.awt.Font("Tahoma", 0, 12)); btn_refresh.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Helpdesk/java/helpdesk/mvc/View/pics/svn-update.png"))); // NOI18N btn_refresh.setText("Refresh"); btn_refresh.setToolTipText("Refresh all Datatables"); btn_refresh.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_refresh.setMargin(new java.awt.Insets(2, 2, 2, 2)); btn_refresh.setMaximumSize(new java.awt.Dimension(99, 57)); btn_refresh.setMinimumSize(new java.awt.Dimension(99, 57)); btn_refresh.setPreferredSize(new java.awt.Dimension(99, 57)); btn_refresh.setVerticalAlignment(javax.swing.SwingConstants.TOP); btn_refresh.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btn_addeditT.setFont(new java.awt.Font("Tahoma", 0, 12)); btn_addeditT.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Helpdesk/java/helpdesk/mvc/View/pics/ticket_button.png"))); // NOI18N btn_addeditT.setText("Ticket"); btn_addeditT.setToolTipText("Add or Edit Ticket"); btn_addeditT.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_addeditT.setMargin(new java.awt.Insets(2, 2, 2, 2)); btn_addeditT.setMaximumSize(new java.awt.Dimension(99, 57)); btn_addeditT.setMinimumSize(new java.awt.Dimension(99, 57)); btn_addeditT.setPreferredSize(new java.awt.Dimension(99, 57)); btn_addeditT.setVerticalAlignment(javax.swing.SwingConstants.TOP); btn_addeditT.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btn_max.setFont(new java.awt.Font("Tahoma", 0, 12)); btn_max.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Helpdesk/java/helpdesk/mvc/View/pics/window_fullscreen.png"))); // NOI18N btn_max.setText("Pane max"); btn_max.setEnabled(false); btn_max.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_max.setMargin(new java.awt.Insets(2, 2, 2, 2)); btn_max.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btn_addeditP.setFont(new java.awt.Font("Tahoma", 0, 12)); btn_addeditP.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Helpdesk/java/helpdesk/mvc/View/pics/HD.png"))); // NOI18N btn_addeditP.setText("Product"); btn_addeditP.setToolTipText("Add or Edit Product"); btn_addeditP.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_addeditP.setMargin(new java.awt.Insets(2, 2, 2, 2)); btn_addeditP.setMaximumSize(new java.awt.Dimension(99, 57)); btn_addeditP.setMinimumSize(new java.awt.Dimension(99, 57)); btn_addeditP.setPreferredSize(new java.awt.Dimension(99, 57)); btn_addeditP.setVerticalAlignment(javax.swing.SwingConstants.TOP); btn_addeditP.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); Logo.setFont(new java.awt.Font("Monotype Corsiva", 1, 36)); Logo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Helpdesk/java/helpdesk/mvc/View/pics/helpd_logo.png"))); // NOI18N Logo.setText("<HTML><BODY>Hard & <BR>Software</BODY></HTML>"); Logo.setVerticalAlignment(javax.swing.SwingConstants.TOP); Logo.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); intf_fcontrol.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); intf_fcontrol.setTitle("Fullticket Control"); intf_fcontrol.setToolTipText(""); intf_fcontrol.setMaximumSize(new java.awt.Dimension(300, 33)); intf_fcontrol.setVisible(true); btn_setfull.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Helpdesk/java/helpdesk/mvc/View/pics/all.png"))); // NOI18N btn_setfull.setText("View all"); btn_setfull.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_setfull.setVerticalAlignment(javax.swing.SwingConstants.TOP); btn_setfull.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btn_setopen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Helpdesk/java/helpdesk/mvc/View/pics/open.png"))); // NOI18N btn_setopen.setText(""); btn_setopen.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_setopen.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM); btn_setopen.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btn_setprocess.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Helpdesk/java/helpdesk/mvc/View/pics/process.png"))); // NOI18N btn_setprocess.setText(""); btn_setprocess.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_setprocess.setVerticalAlignment(javax.swing.SwingConstants.TOP); btn_setprocess.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btn_setclosed.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Helpdesk/java/helpdesk/mvc/View/pics/closed.png"))); // NOI18N btn_setclosed.setText(""); btn_setclosed.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btn_setclosed.setVerticalAlignment(javax.swing.SwingConstants.TOP); btn_setclosed.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); javax.swing.GroupLayout intf_fcontrolLayout = new javax.swing.GroupLayout(intf_fcontrol.getContentPane()); intf_fcontrol.getContentPane().setLayout(intf_fcontrolLayout); intf_fcontrolLayout.setHorizontalGroup( intf_fcontrolLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, intf_fcontrolLayout.createSequentialGroup() .addContainerGap() .addGroup(intf_fcontrolLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btn_setfull, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE) .addComponent(btn_setopen, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE) .addComponent(btn_setprocess, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btn_setclosed, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); intf_fcontrolLayout.setVerticalGroup( intf_fcontrolLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(intf_fcontrolLayout.createSequentialGroup() .addContainerGap() .addComponent(btn_setfull, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_setopen) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_setprocess) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_setclosed) .addContainerGap(178, Short.MAX_VALUE)) ); intf_mycontrol.setTitle("My Tickets"); intf_mycontrol.setFocusable(false); intf_mycontrol.setMaximumSize(new java.awt.Dimension(2147483647, 33)); try { intf_mycontrol.setSelected(true); } catch (java.beans.PropertyVetoException e1) { e1.printStackTrace(); } intf_mycontrol.setVisible(true); javax.swing.GroupLayout intf_mycontrolLayout = new javax.swing.GroupLayout(intf_mycontrol.getContentPane()); intf_mycontrol.getContentPane().setLayout(intf_mycontrolLayout); intf_mycontrolLayout.setHorizontalGroup( intf_mycontrolLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 119, Short.MAX_VALUE) ); intf_mycontrolLayout.setVerticalGroup( intf_mycontrolLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 138, Short.MAX_VALUE) ); table_fullticket.setAutoCreateRowSorter(true); table_fullticket.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); table_fullticket.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); scrollpane_fullticket.setViewportView(table_fullticket); intf_fullticket.setClosable(true); intf_fullticket.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); intf_fullticket.setTitle("Fullticket"); intf_fullticket.setToolTipText(""); intf_fullticket.setMinimumSize(new java.awt.Dimension(566, 469)); intf_fullticket.setPreferredSize(new java.awt.Dimension(566, 469)); intf_fullticket.setVisible(true); txp_fullticket.setBackground(new java.awt.Color(204, 204, 204)); txp_fullticket.setContentType("text/html"); txp_fullticket.setEditable(false); txp_fullticket.setText(""); txp_fullticket.setMinimumSize(new java.awt.Dimension(200, 600)); txp_fullticket.setName(""); // NOI18N txp_fullticket.setPreferredSize(new java.awt.Dimension(300, 1000)); scrollpane_full.setViewportView(txp_fullticket); javax.swing.GroupLayout intf_fullticketLayout = new javax.swing.GroupLayout(intf_fullticket.getContentPane()); intf_fullticket.getContentPane().setLayout(intf_fullticketLayout); intf_fullticketLayout.setHorizontalGroup( intf_fullticketLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(scrollpane_full, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE) ); intf_fullticketLayout.setVerticalGroup( intf_fullticketLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(scrollpane_full, javax.swing.GroupLayout.DEFAULT_SIZE, 577, Short.MAX_VALUE) ); jLabel1.setText("Filter"); javax.swing.GroupLayout pane_fullticketLayout = new javax.swing.GroupLayout(pane_fullticket); pane_fullticket.setLayout(pane_fullticketLayout); pane_fullticketLayout.setHorizontalGroup( pane_fullticketLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pane_fullticketLayout.createSequentialGroup() .addContainerGap() .addGroup(pane_fullticketLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pane_fullticketLayout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(edt_filterfullticket, javax.swing.GroupLayout.DEFAULT_SIZE, 785, Short.MAX_VALUE)) .addComponent(scrollpane_fullticket, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 813, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(intf_fullticket, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); pane_fullticketLayout.setVerticalGroup( pane_fullticketLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pane_fullticketLayout.createSequentialGroup() .addContainerGap() .addGroup(pane_fullticketLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(intf_fullticket, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE) .addGroup(pane_fullticketLayout.createSequentialGroup() .addGroup(pane_fullticketLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(edt_filterfullticket, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(scrollpane_fullticket, javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE)))) ); try { intf_fullticket.setIcon(true); } catch (java.beans.PropertyVetoException e1) { e1.printStackTrace(); } Pane_Overview.addTab("FullTickets", pane_fullticket); table_customer.setAutoCreateRowSorter(true); table_customer.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); table_customer.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); scrollpane_customer.setViewportView(table_customer); jLabel3.setText("Filter"); javax.swing.GroupLayout pane_customerLayout = new javax.swing.GroupLayout(pane_customer); pane_customer.setLayout(pane_customerLayout); pane_customerLayout.setHorizontalGroup( pane_customerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pane_customerLayout.createSequentialGroup() .addContainerGap() .addGroup(pane_customerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(scrollpane_customer, javax.swing.GroupLayout.DEFAULT_SIZE, 1375, Short.MAX_VALUE) .addGroup(pane_customerLayout.createSequentialGroup() .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(edt_filtercustomer, javax.swing.GroupLayout.DEFAULT_SIZE, 1347, Short.MAX_VALUE))) .addContainerGap()) ); pane_customerLayout.setVerticalGroup( pane_customerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pane_customerLayout.createSequentialGroup() .addContainerGap() .addGroup(pane_customerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(edt_filtercustomer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(scrollpane_customer, javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE)) ); Pane_Overview.addTab("Customer", pane_customer); table_employee.setAutoCreateRowSorter(true); table_employee.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); table_employee.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); scrollpane_employee.setViewportView(table_employee); jLabel4.setText("Filter"); javax.swing.GroupLayout pane_employeeLayout = new javax.swing.GroupLayout(pane_employee); pane_employee.setLayout(pane_employeeLayout); pane_employeeLayout.setHorizontalGroup( pane_employeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pane_employeeLayout.createSequentialGroup() .addContainerGap() .addGroup(pane_employeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(scrollpane_employee, javax.swing.GroupLayout.DEFAULT_SIZE, 1375, Short.MAX_VALUE) .addGroup(pane_employeeLayout.createSequentialGroup() .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(edt_filteremployee, javax.swing.GroupLayout.DEFAULT_SIZE, 1347, Short.MAX_VALUE))) .addContainerGap()) ); pane_employeeLayout.setVerticalGroup( pane_employeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pane_employeeLayout.createSequentialGroup() .addContainerGap() .addGroup(pane_employeeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(edt_filteremployee, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(scrollpane_employee, javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE)) ); Pane_Overview.addTab("Employee", pane_employee); table_product.setAutoCreateRowSorter(true); table_product.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); table_product.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); scrollpane_product.setViewportView(table_product); jLabel5.setText("Filter"); intf_product.setClosable(true); intf_product.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); intf_product.setTitle("Product"); intf_product.setToolTipText(""); intf_product.setMinimumSize(new java.awt.Dimension(566, 469)); intf_product.setPreferredSize(new java.awt.Dimension(566, 469)); intf_product.setVisible(true); txp_product.setBackground(new java.awt.Color(204, 204, 204)); txp_product.setContentType("text/html"); txp_product.setEditable(false); txp_product.setText(""); txp_product.setMinimumSize(new java.awt.Dimension(200, 600)); txp_product.setName(""); // NOI18N txp_product.setPreferredSize(new java.awt.Dimension(300, 1000)); scrollpane_his1.setViewportView(txp_product); javax.swing.GroupLayout intf_productLayout = new javax.swing.GroupLayout(intf_product.getContentPane()); intf_product.getContentPane().setLayout(intf_productLayout); intf_productLayout.setHorizontalGroup( intf_productLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(scrollpane_his1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE) ); intf_productLayout.setVerticalGroup( intf_productLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(scrollpane_his1, javax.swing.GroupLayout.DEFAULT_SIZE, 577, Short.MAX_VALUE) ); javax.swing.GroupLayout pane_productLayout = new javax.swing.GroupLayout(pane_product); pane_product.setLayout(pane_productLayout); pane_productLayout.setHorizontalGroup( pane_productLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pane_productLayout.createSequentialGroup() .addContainerGap() .addGroup(pane_productLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pane_productLayout.createSequentialGroup() .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(edt_filterproduct, javax.swing.GroupLayout.DEFAULT_SIZE, 785, Short.MAX_VALUE)) .addComponent(scrollpane_product, javax.swing.GroupLayout.DEFAULT_SIZE, 813, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(intf_product, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); pane_productLayout.setVerticalGroup( pane_productLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pane_productLayout.createSequentialGroup() .addContainerGap() .addGroup(pane_productLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(intf_product, javax.swing.GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE) .addGroup(pane_productLayout.createSequentialGroup() .addGroup(pane_productLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(edt_filterproduct, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(scrollpane_product, javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE)))) ); try { intf_product.setIcon(true); } catch (java.beans.PropertyVetoException e1) { e1.printStackTrace(); } Pane_Overview.addTab("Product", pane_product); table_history.setAutoCreateRowSorter(true); table_history.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); table_history.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); scrollpane_history.setViewportView(table_history); jLabel6.setText("Filter"); intf_history.setClosable(true); intf_history.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); intf_history.setTitle("History"); intf_history.setToolTipText(""); intf_history.setMinimumSize(new java.awt.Dimension(566, 469)); intf_history.setPreferredSize(new java.awt.Dimension(566, 469)); intf_history.setVisible(true); txp_history.setBackground(new java.awt.Color(204, 204, 204)); txp_history.setContentType("text/html"); txp_history.setEditable(false); txp_history.setText(""); txp_history.setMinimumSize(new java.awt.Dimension(200, 600)); txp_history.setName(""); // NOI18N txp_history.setPreferredSize(new java.awt.Dimension(300, 1000)); scrollpane_his.setViewportView(txp_history); javax.swing.GroupLayout intf_historyLayout = new javax.swing.GroupLayout(intf_history.getContentPane()); intf_history.getContentPane().setLayout(intf_historyLayout); intf_historyLayout.setHorizontalGroup( intf_historyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(scrollpane_his, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE) ); intf_historyLayout.setVerticalGroup( intf_historyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(scrollpane_his, javax.swing.GroupLayout.DEFAULT_SIZE, 577, Short.MAX_VALUE) ); javax.swing.GroupLayout pane_historyLayout = new javax.swing.GroupLayout(pane_history); pane_history.setLayout(pane_historyLayout); pane_historyLayout.setHorizontalGroup( pane_historyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pane_historyLayout.createSequentialGroup() .addContainerGap() .addGroup(pane_historyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pane_historyLayout.createSequentialGroup() .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(edt_filtertickethis, javax.swing.GroupLayout.DEFAULT_SIZE, 785, Short.MAX_VALUE)) .addComponent(scrollpane_history, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 813, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(intf_history, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); pane_historyLayout.setVerticalGroup( pane_historyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pane_historyLayout.createSequentialGroup() .addContainerGap() .addGroup(pane_historyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(intf_history, javax.swing.GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE) .addGroup(pane_historyLayout.createSequentialGroup() .addGroup(pane_historyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(edt_filtertickethis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(scrollpane_history, javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE)))) ); try { intf_history.setIcon(true); } catch (java.beans.PropertyVetoException e1) { e1.printStackTrace(); } Pane_Overview.addTab("Ticket History", pane_history); menuBar.setNextFocusableComponent(btn_addeditC); fileMenu.setMnemonic(KeyEvent.VK_ALT); fileMenu.setText("File"); fileMenu.setToolTipText(""); fileMenu.setContentAreaFilled(false); fileMenu.setNextFocusableComponent(btn_addeditC); menu_new.setText("New"); menu_customer.setText("Add Customer"); menu_new.add(menu_customer); menu_customer.getAccessibleContext().setAccessibleParent(menu_new); menu_employee.setText("Add Employee"); menu_new.add(menu_employee); menu_employee.getAccessibleContext().setAccessibleParent(menu_new); menu_product.setText("Add Product"); menu_new.add(menu_product); menu_product.getAccessibleContext().setAccessibleParent(menu_new); menu_ticket.setText("Add Ticket"); menu_new.add(menu_ticket); menu_ticket.getAccessibleContext().setAccessibleParent(menu_new); fileMenu.add(menu_new); menu_new.getAccessibleContext().setAccessibleParent(fileMenu); menu_quit.setText("Quit"); fileMenu.add(menu_quit); menu_quit.getAccessibleContext().setAccessibleParent(fileMenu); menuBar.add(fileMenu); fileMenu.getAccessibleContext().setAccessibleParent(null); setJMenuBar(menuBar); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(intf_mycontrol, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(intf_fcontrol, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(Pane_Overview, javax.swing.GroupLayout.DEFAULT_SIZE, 1400, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(btn_addeditC, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btn_addeditE, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btn_addeditP, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btn_addeditT, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btn_refresh, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btn_max, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 686, Short.MAX_VALUE) .addComponent(Logo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btn_addeditC, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_addeditE, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_addeditP, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_addeditT, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_refresh, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_max, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 11, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(Logo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(intf_fcontrol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(intf_mycontrol, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(Pane_Overview, javax.swing.GroupLayout.DEFAULT_SIZE, 645, Short.MAX_VALUE)) .addContainerGap()) ); try { intf_fcontrol.setIcon(true); } catch (java.beans.PropertyVetoException e1) { e1.printStackTrace(); } try { intf_mycontrol.setIcon(true); } catch (java.beans.PropertyVetoException e1) { e1.printStackTrace(); } pack(); }// </editor-fold>//GEN-END:initComponents
0647848a-79c4-477e-a34b-6c7a50a36c91
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; HairDryer other = (HairDryer) obj; if (windSpeed != other.windSpeed) { return false; } if(this.getPower() != other.getPower()) { return false; } if(this.getCost() != other.getCost()) { return false; } if(this.getWeight() != other.getWeight()) { return false; } if(this.isOn() != other.isOn()) { return false; } return true; }
41545ddd-63b9-4ef7-bb78-11f43c9f0eb8
9
private static void buttonPointSettings(final JButton button) { button.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { String text = textField.getText(); if (text.contains(".")) { if (text.contains("+")) { String subText = text.substring(text.indexOf("+") + 1, text.length()); if (!subText.contains(".")) { text = text + button.getText(); textField.setText(text); } } else if (text.contains("-")) { String subText = text.substring(text.indexOf("-") + 1, text.length()); if (!subText.contains(".")) { text = text + button.getText(); textField.setText(text); } } else if (text.contains("*")) { String subText = text.substring(text.indexOf("*") + 1, text.length()); if (!subText.contains(".")) { text = text + button.getText(); textField.setText(text); } } else if (text.contains("/")) { String subText = text.substring(text.indexOf("/") + 1, text.length()); if (!subText.contains(".")) { text = text + button.getText(); textField.setText(text); } } } else { text = text + button.getText(); textField.setText(text); } } }); }
3073757c-f952-44a8-90ff-27897e58fa46
8
private boolean camposCompletos (){ if((!field_codigo.getText().equals(""))&& (!field_descripcion.getText().equals(""))&& (!field_cantidad.getText().equals(""))&& (!field_costo_u.getText().equals(""))&& (!field_precio_venta.getText().equals(""))&& (!field_tasa_iva.getText().equals(""))){ if (combo_tipo_imp.getSelectedIndex()==0){ return true; } else{ if (!field_impuesto.getText().equals("")){ return true; } else{ return false; } } } else{ return false; } }
7c4bac1d-25cf-446f-88fc-d18ede5fa930
5
public boolean checkGuess(String question, String guess) { for(int i = 0; i < wordpairs.size(); i++) { if(question.equalsIgnoreCase(wordpairs.get(i).getDanishWord())) { if(wordpairs.get(i).getEnglishWord().equalsIgnoreCase(guess)) { return true; } } if(question.equalsIgnoreCase(wordpairs.get(i).getEnglishWord())) { if(wordpairs.get(i).getDanishWord().equalsIgnoreCase(guess)) { return true; } } } return false; }
5b44f938-53c1-486c-8139-f8e03f80f9e3
2
public float getLow() { float lowVal = Float.MIN_VALUE; try { lowVal = Float.parseFloat(low.getText()); if (lowVal == lowVal) return lowVal; } catch (Exception e) { } return lowVal; }
f86006b8-170f-4522-a67b-24b2fe9bb15e
0
public static Font getDisplayFont() { return displayFont; }
49e9a983-988c-4e7f-8be2-f64688ff1506
7
private String getSelectClause() { if (!groupByColumns.isEmpty()) { if (selectedColumns.isEmpty()) { throw new RuntimeException("The SELECT list cannot be empty when the GROUP BY clause is specified."); } for (Column column : selectedColumns) { if (!groupByColumns.contains(column) && !(column instanceof AggregatedColumn)) { throw new RuntimeException("The non-aggregated column " + column.getSqlKeyword() + " not named in the GROUP BY clause cannot be included in the SELECT list."); } } } if (selectedColumns.isEmpty()) { for (TableReference tableReference : tableReferences) { selectedColumns.addAll(tableReference.getTable().getAllColumns()); } } return getClauseFromColumns(selectedColumns, "SELECT ", ", ", " "); }
79a9469b-1a5e-40f4-9607-c9cd4aad8b4f
4
@Override public void setGroup(ResourceGroup group) { if (group != null && !group.equals(this.group)) { if (this.group != null) { this.group.removeResourceDefinition(this); } if (!group.containsDefinition(this)) { group.addResourceDefinition(this); } } this.group = group; }
405df4b6-f140-417c-a8ec-fb868c7c7745
8
private final void method212(Frame frame, byte i) { boolean bool = false; if (i <= 47) method212(null, (byte) -25); try { Field field = Class.forName("sun.awt.Win32GraphicsDevice") .getDeclaredField("valid"); field.setAccessible(true); boolean bool_7_ = ((Boolean) field.get(aGraphicsDevice157)).booleanValue(); if (bool_7_) { field.set(aGraphicsDevice157, Boolean.FALSE); bool = true; } } catch (Throwable throwable) { /* empty */ } try { aGraphicsDevice157.setFullScreenWindow(frame); } catch (Throwable object) { if (bool) { try { Field field = Class.forName("sun.awt.Win32GraphicsDevice") .getDeclaredField("valid"); field.set(aGraphicsDevice157, Boolean.TRUE); } catch (Exception e) { } } } if (bool) { try { Field field = Class.forName("sun.awt.Win32GraphicsDevice") .getDeclaredField("valid"); field.set(aGraphicsDevice157, Boolean.TRUE); } catch (Throwable throwable) { /* empty */ } } }
be833281-aa24-458c-894d-f108f2a07c0c
2
@Override public void run() { ServerSocket server; try { server = new ServerSocket(8080); while (true) { Socket socket = server.accept(); ReceivingThread thread = new ReceivingThread(socket, window); thread.start(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
489af7e4-d8d0-4b06-93d2-4d7d879ca06f
4
public static boolean arrayIncludes(Object a[], Object e) { if (a == null || e == null) return false ; for (Object o : a) if (o == e) return true ; return false ; }
424ff1ac-1e38-4f25-b768-4a6040b4b926
5
public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); while (true) { String name = reader.readLine(); if (name.isEmpty()) break; int age = Integer.parseInt(reader.readLine()); if (age == 0) age = 6; int weight = Integer.parseInt(reader.readLine()); if (weight == 0) weight = 5; int tailLength = Integer.parseInt(reader.readLine()); if (tailLength == 0) tailLength = 22; Cat cat = new Cat(name, age, weight, tailLength); CATS.add(cat); } printList(); }
e3baed44-4ae2-4e68-aed9-72a8aefe6bd2
5
public void init(String game){ Connection conn = new Connection("130.243.137.236", 8080); NetManager network = new NetManager(conn); Encoder enc = new Encoder(); try { network.connectToServer(); } catch (IOException e2) { e2.printStackTrace(); } String JSONtext = ""; try { JSONtext = enc.encode(new RefreshMessage()); sendMessage(JSONtext,network); JSONtext = enc.encode(new CreateGameMessage(game, 1, "Viktor")); sendMessage(JSONtext,network); } catch (JSONException e) { e.printStackTrace(); } try { JSONtext = enc.encode(new StartedMessage()); sendMessage(JSONtext,network); System.out.println("Sent message"); } catch (JSONException e) { e.printStackTrace(); } while (true) { try { String mess = receiveMessage(network); System.out.println(Thread.currentThread().getId() + " " + mess); } catch (IOException e1) { e1.printStackTrace(); } } }
eed9de4c-30bc-4f88-b72c-c41f9b079579
0
public Position getHuffPosition() { return huffPosition; }
f20197d3-baa5-453a-a82b-e4b331158e5b
9
public static String multiply(String num1, String num2) { int len1 = num1.length(); int len2 = num2.length(); List<Integer> res = new ArrayList<Integer>(); for (int i = len2 - 1; i >= 0; i--) { //if ('0' == num2.charAt(i)) continue; for (int j = len1 - 1; j >= 0; j--) { int start = len2 - 1 - i + len1 - 1 - j; Integer a = num2.charAt(i) - '0'; Integer b = num1.charAt(j) - '0'; Integer first = a * b % 10; Integer secrd = a * b / 10; int inc = 0; int s = res.size(); for (int k = 0; k < start - s + 2; k++) res.add(0, 0); first = first + res.get(res.size() - 1 - start); inc = first / 10; first = first % 10; res.set(res.size() - 1 - start, first); secrd = secrd + res.get(res.size() - 2 - start) + inc; inc = secrd / 10; secrd = secrd % 10; res.set(res.size() - 2 - start, secrd); int ii = 1; while (0 != inc) { int index = res.size() - 2 - start - ii; ii = ii + 1; if (index < 0) { res.add(0,0); res.set(0, inc); break; } else { int r = res.get(index) + inc; res.set(index, r % 10); inc = r / 10; } } } } StringBuffer sb = new StringBuffer(); int i = 0; for (i = 0; i < res.size(); i++) if (0 != res.get(i)) break; for (;i < res.size(); i++) sb.append(res.get(i)); return 0 == sb.length() ? "0" : sb.toString(); }
5b555b38-e765-4a0e-81a7-2b89b78e12e6
2
public String toString() { if (this == Male) { return "♂"; } if (this == Female) { return "♀"; } return ""; }
54f237f5-9aa3-4ff7-856a-378bbac92b7e
8
public static void main(String[] args) { description = "Description: " + "Testing some crazy hardcore!!!!!" + "Testing overprocessing by Bank. " + "Works until requests == 0."; System.out.println("Main thread started"); String hours = new SimpleDateFormat("HH").format(Calendar.getInstance().getTime()); String minutes = new SimpleDateFormat("mm").format(Calendar.getInstance().getTime()); String seconds = new SimpleDateFormat("ss").format(Calendar.getInstance().getTime()); startTimeLog = hours + "_" + minutes + "_" + seconds; log = new Log(startTimeLog + "_" + className); bank = new Bank(0); userHandler = new UserHandler(bank); log.start(); bank.start(); userHandler.start(); log("Running time", timeRunning); log(description); // The system will run for 'timeRunning' millis System.out.println("Left: " + (timeRunning) + " millis"); try { Thread.sleep((int) timeRunning / 4); } catch (InterruptedException e) { e.printStackTrace(); } try { Thread.sleep((int) timeRunning / 4); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Left: " + (timeRunning - (timeRunning/4)) + " millis"); try { Thread.sleep((int) timeRunning / 4); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Left: " + (timeRunning - (timeRunning/2)) + " millis"); try { Thread.sleep((int) timeRunning / 4); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Left: " + (timeRunning - (timeRunning/4*3)) + " millis"); try { Thread.sleep((int) timeRunning / 4); } catch (InterruptedException e) { e.printStackTrace(); } userHandler.terminate(); bank.terminate(); while (((bankAnalytics == null) || (uhAnalytics == null))) { // Wait for them to terminate try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } analise(); /* String s = "Bank unprocessed: " + bankAnalytics.getUnprocessedOperations(); String s1 = "UserHandler performed: " + uhAnalytics.getPerformedOperations(); String s2 = "Bank performed: " + bankAnalytics.getPerformedOperations(); long r = uhAnalytics.getPerformedOperations() - bankAnalytics.getPerformedOperations() - bankAnalytics.getUnprocessedOperations(); //log.nextLine(); log("Analytics:"); log(s); log(s1); log(s2); log("Should be zero: ", r); //log.nextLine(); */ log.terminate(); System.out.println("Main thread terminated"); }
c79baca1-85ec-41cb-adc1-5fa663ac5004
2
public final JSONObject putOpt(String key, Object value) throws JSONException { if (key != null && value != null) { put(key, value); } return this; }
268e97c5-ee83-46c9-9313-d3ebad5dbcc1
1
public ActionPanel(final Joculus app) { this.app_instance = app; setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); // Setting an empty border on a button removes its decoration. final EmptyBorder btn_border = new EmptyBorder(4, 4, 4, 4); JButton b; b = new JButton(getToolbarIcon("refresh", this)); b.setToolTipText(UIStrings.UI_TOOLBAR_REFRESH_TIP); b.setBorder(btn_border); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { app.refreshDisplay(); } }); add(b); b = new JButton(getToolbarIcon("open", this)); b.setToolTipText(UIStrings.UI_TOOLBAR_OPEN_TIP); b.setBorder(btn_border); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { actionOpenFile(); } }); add(b); b = new JButton(getToolbarIcon("edit", this)); b.setToolTipText(UIStrings.UI_TOOLBAR_EDIT_TIP); b.setBorder(btn_border); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { actionEditFile(); } }); // TODO: open the configured editor -or- the editor that's specified by the EDITOR environment variable. add(b); add(Box.createHorizontalGlue()); label_wc = new JLabel(); label_wc.setBorder(new EmptyBorder(4, 6, 4, 6)); add(label_wc); boolean display_wc = true; label_wc.setVisible(Joculus.settings.display_word_count); add(Box.createHorizontalGlue()); b = new JButton(getToolbarIcon("style", this)); b.setToolTipText(UIStrings.UI_TOOLBAR_STYLE_TIP); b.setBorder(btn_border); // TODO: pop up a menu with the currently configured stylesheets, and the option to manage stylesheets. add(b); b = new JButton(getToolbarIcon("settings", this)); b.setToolTipText(UIStrings.UI_TOOLBAR_SETTINGS_TIP); b.setBorder(btn_border); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if(settings_dlg == null) { settings_dlg = new SettingsDlg(app); } else { settings_dlg.setVisible(true); } } }); add(b); b = new JButton(getToolbarIcon("about", this)); b.setToolTipText(UIStrings.UI_TOOLBAR_ABOUT_TIP); b.setBorder(btn_border); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { AboutDlg d = new AboutDlg(); } }); add(b); }
f723dd45-d5a6-40be-919e-a1cf01ab0293
5
private Station(){ this.lineQueue = new Queue(); switch(Define.batcherType){ case Define.RoundRobinBatcher : this.batcher = new RoundRobinBatcher(); break; case Define.PriorityQueueBatcher : this.batcher = new PriorityQueueBatcher(); break; case Define.RandomBatcher : this.batcher = new RandomBatcher(); break; case Define.FIFOBatcher : this.batcher = new FIFOBatcher(); break; } this.ticketSellers = new ArrayList<TicketSeller>(); for(int i = 0 ; i < Define.theNumberOfTicketSeller; i++){ ticketSellers.add(new TicketSeller(i)); } this.platformQueue = new FlushQueue(); this.totalCustomerInStation = 0; }
9ba9f066-3bc2-423d-91fd-ca51180d6979
9
public static void main(String[] args) throws IOException, ParseException { numArgs = args.length; if(numArgs == 0) { GUI freezeUI = new GUI(); freezeUI.setVisible(true); } else { //Expect multiple switches but one command command = ""; for(int i = 0; i < numArgs; i++) { if(args[i].charAt(0) == '-') { switches.put(args[i].substring(1,args[i].length()), true); } else { command = args[i]; if(!Arrays.asList(validCommands).contains(command)) { throw new UnsupportedOperationException(command + " is not a valid command"); } } } if(command.contentEquals("")) { System.out.println( "No command passed\r\n" + "Current commands are list, upload and download \r\n"); System.exit(NO_COMMAND); } switch(command.toLowerCase()) { case "upload": filePath = args[1]; authorize(); upload(); break; case "download": authorize(); String id = args[1]; download(id); break; case "list": authorize(); list(); break; case "version": Utilities.printVersion(); break; } } }
803b7385-d214-4ae6-b195-2b24deec9f0f
8
protected synchronized void acquire(boolean throwInterrupt) throws InterruptedException { if(acquired) return; if(throwInterrupt && Thread.interrupted()) throw new InterruptedException(); owner=getOwner(); sendGrantLockRequest(name, lock_id, owner, 0, false); boolean interrupted=false; while(!acquired) { try { this.wait(); } catch(InterruptedException e) { if(throwInterrupt && !acquired) { _unlock(true); throw e; } // If we don't throw exceptions then we just set the interrupt flag and let it loop around interrupted=true; } } if(interrupted) Thread.currentThread().interrupt(); }
cb7f0496-61c2-41b0-a541-8e4d643aa73e
1
public static Object best(List quantity_list) { if(quantity_list == null) throw new NullPointerException(); Collections.sort(quantity_list); return quantity_list.get(0); }
17223bb1-5e3d-4e31-9af1-ef148fe9266a
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Vehicle other = (Vehicle) obj; if (!Objects.equals(this.szVehicleId, other.szVehicleId)) { return false; } return true; }
ae27da64-15f8-4f32-b2c8-cfb90fd74357
5
private void addPars() { int beginParCount=0, endParCount=0; for (int i=0;i<input.length();i++) { switch (input.charAt(i)) { case '(': beginParCount+=1; break; case ')': endParCount+=1; break; } } if (endParCount<beginParCount) { for (int i=0;i<(beginParCount-endParCount);i++) { input+=")"; } } }
74dc2285-8b6b-4893-a6cd-9e8d7d88454a
1
public Collection realsAtBlock(final Block block) { LinkedList l = reals[cfg.preOrderIndex(block)]; if (l == null) { l = new LinkedList(); reals[cfg.preOrderIndex(block)] = l; } return l; }
d1b68827-e4d6-4027-b152-82008994228e
0
private Animation createPlayerStanding(Image player1, Image player2) { Animation anim = new Animation(); anim.addFrame(player1, 250); anim.addFrame(player2, 250); return anim; }
dd85d1d3-d775-4e92-866d-f20a9d0b9cad
6
private void loadAdjacentMaps() { String[] ways = new String[] { "north", "east", "south", "west" }; for (int i = 0; i < ways.length; i++) { String way = ways[i]; String newMap = map.getMapProperty(way, null); if (newMap != null) { if (way.equals("north")) { transitions.put(Globals.DIRECTION_UP, ResourceManager.getMap(newMap)); } else if (way.equals("east")) { transitions.put(Globals.DIRECTION_RIGHT, ResourceManager.getMap(newMap)); } else if (way.equals("south")) { transitions.put(Globals.DIRECTION_DOWN, ResourceManager.getMap(newMap)); } else if (way.equals("west")) { transitions.put(Globals.DIRECTION_LEFT, ResourceManager.getMap(newMap)); } } } }
a2417334-d4f6-4f6a-ad10-bd99659121c4
0
AbstractDialog() { super(); setAlwaysOnTop(true); setUndecorated(true); }
10a0ec84-4b72-4623-a27c-9e3c9cbcd7ae
5
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); txt_codigo = new javax.swing.JTextField(); txt_cliente = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); txt_dataAbertura = new javax.swing.JFormattedTextField(); jLabel3 = new javax.swing.JLabel(); txt_dataFechamento = new javax.swing.JFormattedTextField(); jLabel4 = new javax.swing.JLabel(); txt_dataInicio = new javax.swing.JFormattedTextField(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); txt_dataFim = new javax.swing.JFormattedTextField(); txt_dataAgendamento = new javax.swing.JFormattedTextField(); jLabel7 = new javax.swing.JLabel(); txt_origem = new javax.swing.JTextField(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); txt_prioridade = new javax.swing.JTextField(); txt_tipo = new javax.swing.JTextField(); jLabel11 = new javax.swing.JLabel(); txt_usuario = new javax.swing.JTextField(); jLabel12 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); txt_probDetectado = new javax.swing.JTextArea(); jLabel13 = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); txt_probSolucao = new javax.swing.JTextArea(); jLabel14 = new javax.swing.JLabel(); jScrollPane3 = new javax.swing.JScrollPane(); txt_probPendencia = new javax.swing.JTextArea(); jLabel15 = new javax.swing.JLabel(); jScrollPane4 = new javax.swing.JScrollPane(); txt_probInformado = new javax.swing.JTextArea(); jLabel16 = new javax.swing.JLabel(); btn_fechar = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Atendimento detalhado"); setResizable(false); jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); jLabel1.setText("Código:"); txt_codigo.setEnabled(false); txt_cliente.setEnabled(false); jLabel2.setText("Cliente:"); try { txt_dataAbertura.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/#### ##:##"))); } catch (java.text.ParseException ex) { ex.printStackTrace(); } txt_dataAbertura.setHorizontalAlignment(javax.swing.JTextField.CENTER); txt_dataAbertura.setEnabled(false); txt_dataAbertura.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txt_dataAberturaKeyPressed(evt); } }); jLabel3.setText("Data Abertura:"); try { txt_dataFechamento.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/#### ##:##"))); } catch (java.text.ParseException ex) { ex.printStackTrace(); } txt_dataFechamento.setHorizontalAlignment(javax.swing.JTextField.CENTER); txt_dataFechamento.setEnabled(false); txt_dataFechamento.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txt_dataFechamentoKeyPressed(evt); } }); jLabel4.setText("Data Fechamento:"); try { txt_dataInicio.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/#### ##:##"))); } catch (java.text.ParseException ex) { ex.printStackTrace(); } txt_dataInicio.setHorizontalAlignment(javax.swing.JTextField.CENTER); txt_dataInicio.setEnabled(false); txt_dataInicio.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txt_dataInicioKeyPressed(evt); } }); jLabel5.setText("Data Início:"); jLabel6.setText("Data Fim *:"); try { txt_dataFim.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/#### ##:##"))); } catch (java.text.ParseException ex) { ex.printStackTrace(); } txt_dataFim.setHorizontalAlignment(javax.swing.JTextField.CENTER); txt_dataFim.setEnabled(false); txt_dataFim.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txt_dataFimKeyPressed(evt); } }); try { txt_dataAgendamento.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/#### ##:##"))); } catch (java.text.ParseException ex) { ex.printStackTrace(); } txt_dataAgendamento.setHorizontalAlignment(javax.swing.JTextField.CENTER); txt_dataAgendamento.setEnabled(false); txt_dataAgendamento.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N txt_dataAgendamento.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { txt_dataAgendamentoKeyPressed(evt); } }); jLabel7.setText("Data Agendamento:"); txt_origem.setEnabled(false); jLabel9.setText("Origem:"); jLabel10.setText("Prioridade:"); txt_prioridade.setEnabled(false); txt_tipo.setEnabled(false); jLabel11.setText("Tipo:"); txt_usuario.setEnabled(false); jLabel12.setText("Usuário:"); txt_probDetectado.setColumns(5); txt_probDetectado.setLineWrap(true); txt_probDetectado.setRows(5); txt_probDetectado.setWrapStyleWord(true); txt_probDetectado.setEnabled(false); txt_probDetectado.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { txt_probDetectadoKeyReleased(evt); } }); jScrollPane1.setViewportView(txt_probDetectado); jLabel13.setText("Problema Detectado *:"); txt_probSolucao.setColumns(5); txt_probSolucao.setLineWrap(true); txt_probSolucao.setRows(5); txt_probSolucao.setWrapStyleWord(true); txt_probSolucao.setEnabled(false); txt_probSolucao.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { txt_probSolucaoKeyReleased(evt); } }); jScrollPane2.setViewportView(txt_probSolucao); jLabel14.setText("Solução *:"); txt_probPendencia.setColumns(5); txt_probPendencia.setLineWrap(true); txt_probPendencia.setRows(5); txt_probPendencia.setWrapStyleWord(true); txt_probPendencia.setEnabled(false); txt_probPendencia.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { txt_probPendenciaKeyReleased(evt); } }); jScrollPane3.setViewportView(txt_probPendencia); jLabel15.setText("Pendência *:"); txt_probInformado.setColumns(5); txt_probInformado.setLineWrap(true); txt_probInformado.setRows(5); txt_probInformado.setWrapStyleWord(true); txt_probInformado.setEnabled(false); txt_probInformado.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { txt_probInformadoKeyReleased(evt); } }); jScrollPane4.setViewportView(txt_probInformado); jLabel16.setText("Problema Informado *:"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel13) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel14) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel16) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel15) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 265, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addGap(0, 8, Short.MAX_VALUE)) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txt_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txt_cliente)) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(54, 54, 54) .addComponent(jLabel5)) .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txt_dataInicio, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(txt_tipo, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txt_prioridade, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txt_dataAbertura, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 206, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txt_usuario) .addComponent(txt_origem, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(txt_dataAgendamento, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txt_dataFim, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap()))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(txt_dataFechamento, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(txt_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2) .addComponent(txt_cliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(11, 11, 11) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(txt_dataAgendamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(11, 11, 11) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txt_dataInicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6) .addComponent(txt_dataFim, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5)) .addGap(11, 11, 11) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txt_dataAbertura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txt_dataFechamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txt_prioridade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12) .addComponent(txt_usuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txt_tipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9) .addComponent(txt_origem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel11)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel15) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel16) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel13) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel14) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); btn_fechar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Util/Img/fechar.png"))); // NOI18N btn_fechar.setText("Fechar"); btn_fechar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_fecharActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(btn_fechar, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btn_fechar) .addContainerGap()) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents
f6af79e8-9434-43ce-ae01-2740616cfd76
5
*/ public String toString() { int f = front; int r = rear; String outString = ""; if (f < r) { while (f < r) { outString += array.get(f).toString(); f++; } } else if (f > r) { while (f < array.size()) { outString += array.get(f).toString(); } for (int i = 0; i <= r; i++) { outString += array.get(i).toString(); } } return outString; }
ab66a630-4f87-425e-92ab-32034be05724
5
public static CorePhrase[] getPhrases(Connection con, Dictionary dict, User user) { LinkedList<CorePhrase> data = new LinkedList<CorePhrase>(); try { PreparedStatement ps = con.prepareStatement( "SELECT Phrases.ID, Success, RevSuccess, Performances.ID " + "FROM Phrases " + "LEFT OUTER JOIN Performances ON Phrases.ID = Phrase AND UserID = ? " + "WHERE Phrases.Dic = ? " + "ORDER BY Performances.Success ASC "); ps.setString(1, user.getID()); ps.setString(2, dict.getID()); ResultSet rs = ps.executeQuery(); while (rs.next()) { CorePhrase phrase = new CorePhrase(rs.getInt(1), rs.getInt(2), rs.getInt(4), false); CorePhrase revPhrase = new CorePhrase(rs.getInt(1), rs.getInt(3), rs.getInt(4), true); phrase.revPhrase = revPhrase; revPhrase.revPhrase = phrase; data.add(phrase); data.add(revPhrase); } rs.close(); } catch (SQLException sqle) { if (sqle.getSQLState().equals("42X05")) // table does not exist { if (sqle.getMessage().contains(Performance.tableInfo.tableName.toUpperCase())) { DBObject.createTable(con, Performance.tableInfo); return getPhrases(con, dict, user); } else if (sqle.getMessage().contains(Phrase.tableInfo.tableName.toUpperCase())) { DBObject.createTable(con, Phrase.tableInfo); return getPhrases(con, dict, user); } else { System.out.println("MESSAGE: " + sqle.getMessage()); System.out.println("ERROR CODE: " + sqle.getSQLState()); } } } return (CorePhrase[]) data.toArray(new CorePhrase[data.size()]); }
d7d55613-901d-417e-bb4d-3d8866e7df03
9
public void getSavedFiles(String file) { try{ int duplicate = 1; String textLine = ""; Scanner fileScanner = new Scanner(new File(file)); while (fileScanner.hasNextLine()) { textLine = fileScanner.nextLine() + ","; //add a comma to the end to make parsing easier int count = 0; //count the number of components on each line for (int i = 0; i < textLine.length(); i++) { if (textLine.charAt(i) == ',') { count++; } } if (count == 6) { //line contains a plant file String[] parameters = new String[count]; //create array to store values, size set to number of components in the String count = 0; //zero the counter so we can use it to place elements in the parameter array int beg = 0; //indicates where to start our substring for (int i = 0; i < textLine.length(); i++) { if (textLine.charAt(i) == ',') { //break up the text line using commas parameters[count] = textLine.substring(beg, i); //add the substring to the parameter array beg = i + 2; //find the start of the next substring count++; //increase the counter for the parameter array } } Entry newEntry = new Entry(parameters); //create a new Entry using the array of substrings for the text line textLine = fileScanner.nextLine(); //this line says "NOTE:" String notes = fileScanner.nextLine(); //start of the notes textLine = fileScanner.nextLine(); while (!textLine.equals("</NOTES>")) { //continue until we reach the end of the notes notes += "\n" + textLine; //add the line break for each new line textLine = fileScanner.nextLine(); } newEntry.setNotes(notes); //set the notes for the entry textLine = fileScanner.nextLine(); //this line will be blank int a = library.getEntries().size(); //this will be the position in the Library where the Entry will be added duplicate = library.addFromFile(newEntry, duplicate); //duplicate will tell us if we should add repeated files or not int b = library.getEntries().size(); //if the add was successful, the size of the library should have increased by one if ((b - a) == 1){ //if an entry was added setOrderedFalse(); //the list may no longer be sorted } } } fileScanner.close(); } catch (FileNotFoundException efile) {} library.sortString(0); fillDisplay(); }//end getSavedFiles
416fe334-40b4-4ccf-b36e-924521d88fc4
6
public UserRole role(String username) { // Open the connection connect(); // Make the statement PreparedStatement statement; try { statement = getConnection().prepareStatement( "select * from users where username = ?"); statement.setString(1, username); set = statement.executeQuery(); // If we can't access the next result set, it means the user doesn't // exists or he doesn't have a role. if (set == null) { return UserRole.NONE; } // If we can access the next result set we will determine which role // the // user has. else { set.next(); // Save role in a string. String role = set.getString("role"); if (role.equals("Admin")) { return UserRole.ADMIN; } else if (role.equals("Balie")) { return UserRole.BALIE; } else if (role.equals("Garage")) { return UserRole.GARAGE; } else if (role.equals("Klant")) { return UserRole.KLANT; } } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Close the connection close(); // If we came this far something went wrong, return UserRole.None. return UserRole.NONE; }
99528913-2bca-48d7-b9bf-a1fb9652e9e8
4
private KeyValuePair transferColumn(ColumnMapping column,ResultSet records,int i,KeyValuePair pair){ ResultSetMetaData metaData = null; try { metaData = records.getMetaData(); if(R.entity.type.transfer.equalsIgnoreCase(column.getType())){ if(column.getSrc_name().equalsIgnoreCase(metaData.getColumnName(i))){ pair.setKey(column.getTar_name()); pair.setValue(getColumnValue(records,i)); log.debug(String.format("transfer %s to %s", column.getSrc_name(), column.getTar_name())); } }else if(R.entity.type.exclude.equalsIgnoreCase(column.getType())){ pair = null; } } catch (SQLException e) { e.printStackTrace(); } return pair; }
926d0e16-f983-4729-bf5c-e94c66865f10
1
public void setState2(State state2) throws IllegalArgumentException{ if(state2 != null) this.state2 = state2; else throw new IllegalArgumentException(); }
159273e9-606d-4ba4-a0ab-4ece2bcdcd1c
1
protected StdImage getIcon(TreeRow row) { return mIconAccessor != null ? mIconAccessor.getIcon(row) : null; }
77dab48d-0459-4a3b-8d2c-afd690f13e64
3
public static List<String> getFolderNameInList(String path) { List<String> list = null; File file = new File(path); if (file.isDirectory()) { list = new LinkedList<String>(); File[] ary = file.listFiles(); for (int i = 0; i < StringUtil.size(ary); i++) { if (ary[i].isDirectory()) { list.add(ary[i].getName()); } } } return list; }
2a8308cc-6416-44cb-8d33-0c228952c3c1
2
public void execute(final State state) { //do something special if this is the first scan if (isPreInitialScan) { isPreInitialScan = false; doInitialScan(state); } else if (state.targetPosition != null) { // don't bother if we don't know where the enemy is yet doExecute(state); } }
5e2a29b5-2c41-4f43-889e-b11fb51fd523
2
public static void main(String[] args) { Scanner s = new Scanner(System.in); String str; Integer a, b, c, d; System.out.println("This program will divide two numbers that you enter."); System.out.print("Please enter your first number: "); str = s.nextLine(); a = Integer.parseInt(str); System.out.print("Please enter your second number: "); str = s.nextLine(); b = Integer.parseInt(str); if(a < b){ System.out.println("Your first integer must be larger than your divisor."); System.out.println("Exiting program . . ."); } else{ c = 0; d = a; while(d > b){ d = d - b; c++; } System.out.println(a + " divided by " + b + " is " + c + ", remainder " + d); } }
59d263a5-e5b1-48fc-970d-767ba1531df9
2
public void KeyListener(){ for(int i=0;i<keys.length;i++){ keys[i]=false; typed[i]=true; } for(int i=0;i<mouse.length;i++){ mouse[i]=false; } }
2e1f475d-90c5-4c33-938a-e4f9b3631792
0
public void setGraph(LaenderGraph graph) { laenderGraph = graph; }
15febc2a-ddee-4f68-b139-f804fc2287b8
4
protected int unicodeEscapeLexer(int c) throws IOException { int ret = 0; // ignore 'u' (assume c==\ now) and read 4 hex digits c = in.read(); code.clear(); try { for (int i = 0; i < 4; i++) { c = in.read(); if (isEndOfFile(c) || isEndOfLine(c)) { throw new NumberFormatException("number too short"); } code.append((char) c); } ret = Integer.parseInt(code.toString(), 16); } catch (NumberFormatException e) { throw new IOException( "(line " + getLineNumber() + ") Wrong unicode escape sequence found '" + code.toString() + "'" + e.toString()); } return ret; }
b21574fb-d937-4bcc-8bb3-04ab8db2e993
7
public void bucketSort(int[] data){ int max = data[0] , min = data[0]; for (int i = 0; i < data.length; i++) { if(max < data[i]){ max = data[i]; } if(min > data[i]){ min = data[i]; } } int bucketSize = (max - min + 1)/10 + 1; Node[] bucket = new Node[bucketSize]; for (int i = 0; i < bucket.length; i++) { bucket[i] = new Node(); } for (int i = 0; i < data.length; i++) { int k = (data[i] - min + 1)/10; bucket[k].node[bucket[k].num] = data[i]; bucket[k].num++; } int pos = 0 ; QuickSort qs = new QuickSort(); for (int i = 0; i < bucket.length; i++) { qs.quickSortInt(bucket[i].node, bucket[i].num, 0, bucket[i].num-1); for (int j = 0; j < bucket[i].num; j++ , pos++) { data[pos] = bucket[i].node[j]; } } }
c3f334ec-2734-4c8a-abcb-9d7919850ebf
7
public void show(){ Scanner scan = new Scanner(System.in); int choice=0; while(choice!=4){ System.out.println("=============="); System.out.println(" Movie Menu "); System.out.println("=============="); System.out.println("1) Create Movie"); System.out.println("2) Update Movie"); System.out.println("3) Remove Movie"); System.out.println("4) Back"); System.out.print("Please enter your choice : "); choice = scan.nextInt(); if(choice>4 || choice<1){ System.out.println("Invalid choice"); continue; } switch(choice){ case 1: createMovie(); break; case 2: updateMovie(); break; case 3: removeMovie(); break; case 4: return; } } }
5f4ee80b-634b-450a-8a3c-6fe8a88e7986
2
public void deposit(BigInteger amount) throws IllegalArgumentException { if ( (amount == null) || (amount.compareTo(BigInteger.ZERO) < 0) ) throw new IllegalArgumentException(); setBalance(this.getBalance().add(amount)); }
eb7448a3-7a21-458b-8942-24642035c028
3
public String getStateParametersValueKeyPair() { String parameters = ""; for (int i = 0; i < parameterKeys.length; i++) { // Add the parameter key parameters += parameterKeys[i] + "="; // add the parameter values if you can null otherwise if (parameterValues.length > i) { parameters += parameterValues[i]; } else { parameters += "null"; } // add trailing comma to all but the last element if (i < parameterKeys.length - 1) parameters += ","; } return parameters; }
f4520c01-78d8-457f-874c-6031bc1fb87f
3
String transformValue(int val) { switch (val) { case 0: return "Arithmetic"; case 1: return "Geometric"; case -1: default: return "-1"; } }
7a4b940c-8736-4338-ad66-7171dc66ca51
6
private void run() { init(); log("Initializing game"); game.init(); System.out.println(); boolean running = true; long time = 0, lastTime = 0, currentFPSSample = 0; float delta = 0, fps = 0; float[] fpsSamples = new float[targetFPS/2]; while(running) { if(Display.wasResized()) { CobaltApp.width = Display.getWidth(); CobaltApp.height = Display.getHeight(); game.resize(width, height); glViewport(0, 0, width, height); } if(Display.isCloseRequested()) running = false; // Input Stuff Input.update(); if(Input.isKeyPressed(debugKey)) debug = !debug; if(Input.isKeyPressed(screenshotKey)) CobaltUtil.screenshot(); // Timing Stuff time = System.nanoTime(); delta = (time - lastTime)/1000000f; fps = 1f/delta * 1000; lastTime = time; fpsSamples[(int) (currentFPSSample++ % fpsSamples.length)] = fps; game.update(delta); // Rendering Stuff glClear(GL_COLOR_BUFFER_BIT); glClearColor(clearR, clearG, clearB, 1f); batch.begin(); game.render(batch); if(debug) { batch.draw("Width: " + width, 10, height * 2 - 65, 1, CoreGame.camera); batch.draw("Height: " + height, 10, height * 2 - 115, 1, CoreGame.camera); batch.draw("Camera Position: [" + CoreGame.camera.getX() + "," + CoreGame.camera.getY() + "]", 10, height * 2 - 165, 1, CoreGame.camera); batch.draw("Draw calls: " + batch.maxDrawCalls, 10, height * 2 - 215, 1, CoreGame.camera); batch.draw("Max Batch size: " + batch.maxSize, 10, height * 2 - 265, 1, CoreGame.camera); batch.draw("FPS: " + (int)CobaltMath.avg(fpsSamples), 10, height * 2 - 315, 1, CoreGame.camera); } batch.end(); Display.update(); Display.sync(targetFPS); } System.out.println(); shutDown(); }
3ed36aca-4fc8-4cc2-baba-579c76832cb6
7
public NexTClient(){ // The default port int port_number=2222; String host="localhost"; // Initialization section: // Try to open a socket on a given host and port // Try to open input and output streams try { clientSocket = new Socket(host, port_number); inputLine = new BufferedReader(new InputStreamReader(System.in)); os = new PrintStream(clientSocket.getOutputStream()); is = new DataInputStream(clientSocket.getInputStream()); } catch (UnknownHostException e) { System.err.println("Don't know about host "+host); } catch (IOException e) { System.err.println("Couldn't get I/O for the connection to the host "+host); } // If everything has been initialized then we want to write some data // to the socket we have opened a connection to on port port_number if (clientSocket != null && os != null && is != null) { try { // Create a thread to read from the server new Thread(new NexTClient()).start(); while (!closed) { os.println(inputLine.readLine()); } // Clean up: // close the output stream // close the input stream // close the socket os.close(); is.close(); clientSocket.close(); } catch (IOException e) { System.err.println("IOException: " + e); } } }
fb0d2cc1-f6b4-4f8a-b4d3-88d936e35538
8
public Task[] generateWISCandidates(PQModel2 model, PQInput2 input, PQOutput2 correctOutput, double lossWeight) { // Implementation of a method for comparison between two tasks. // It is used to find out in which position we have to insert the // new task in the list of tasks. Ordered by task end. Comparator<Task> comparator = new Comparator<Task>() { public int compare(Task t1, Task t2) { return Integer.valueOf(t1.getEnd()).compareTo( Integer.valueOf(t2.getEnd())); } }; // Each quotation is associated to a number of coreferences, which are // the candidates to quotation author. We transform this problem into // the Weighted Interval Scheduling problem. The interval is: // [quotationStartToken, quotationEndToken]. The prize is given by the // sum of the feature weights that appears in the coreference. LinkedList<Task> tasks = new LinkedList<Task>(); Quotation[] quotationIndexes = input.getQuotationIndexes(); for (int i = 0; i < quotationIndexes.length; ++i) { int[] quotationIndex = quotationIndexes[i].getQuotationIndex(); int correctAuthor = 0; if (correctOutput != null) correctAuthor = correctOutput.getAuthor(i); int numberOfCoreferences = quotationIndexes[i] .getNumberOfCoreferences(); for (int j = 0; j < numberOfCoreferences; ++j) { int[] coreferenceIndex = quotationIndexes[i] .getCoreferenceIndex(j); int start = quotationIndex[0]; int end = quotationIndex[1]; double currentLoss = 0d; if (correctOutput != null) currentLoss = (j != correctAuthor ? lossWeight : 0d); double prize = 0d; int featureIndex; Iterator<Integer> it = input.getFeatureCodes(i, j).iterator(); while (it.hasNext()) { featureIndex = it.next(); prize += currentLoss + model.getFeatureWeight(featureIndex); } Task task = new Task(start, end, prize, i, j, quotationIndex, coreferenceIndex); // We search for a position to insert the new task in // the task list (O(n)). Then we insert the task in // specified position. int insertionIndex = Collections.binarySearch(tasks, task, comparator); if (insertionIndex < 0) tasks.add(-insertionIndex - 1, task); else tasks.add(insertionIndex + 1, task); } } // Convert the LinkedList ''tasks'' in the array of // tasks ''tasksArray''. int tasksSize = tasks.size(); Task[] tasksArray = new Task[tasksSize]; for (int i = 0; i < tasksSize; ++i) { Task task = new Task(tasks.get(i)); tasksArray[i] = task; } return tasksArray; }
4cf6105f-4a6b-427f-843a-6dac6dc1b478
8
static double grad(int hash, double x, double y, double z) { int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE double u = h < 8 || h == 12 || h == 13 ? x : y, // INTO 12 GRADIENT DIRECTIONS. v = h < 4 || h == 12 || h == 13 ? y : z; return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v); }
2f87d3a9-4e48-431b-920f-dfca1e1caed3
8
public void addVertex(double d, double d1, double d2) { if (!this.renderingChunk) { GL11.glVertex3f((float) (d + this.xOffset), (float) (d1 + this.yOffset), (float) (d2 + this.zOffset)); } else { ++this.addedVertices; if (this.drawMode == 7 && Tessellator.convertQuadsToTriangles && this.addedVertices % 4 == 0) { for (int i = 0; i < 2; ++i) { int j = 8 * (3 - i); this.intBuffer.put(this.intBuffer.get(this.rawBufferIndex - j + 0)); this.intBuffer.put(this.intBuffer.get(this.rawBufferIndex - j + 1)); this.intBuffer.put(this.intBuffer.get(this.rawBufferIndex - j + 2)); this.intBuffer.put(this.intBuffer.get(this.rawBufferIndex - j + 3)); this.intBuffer.put(this.intBuffer.get(this.rawBufferIndex - j + 4)); this.intBuffer.put(this.intBuffer.get(this.rawBufferIndex - j + 5)); this.intBuffer.put(0); this.intBuffer.put(0); ++this.vertexCount; this.rawBufferIndex += 8; } } this.intBuffer.put(Float.floatToRawIntBits((float) (d + this.xOffset))); this.intBuffer.put(Float.floatToRawIntBits((float) (d1 + this.yOffset))); this.intBuffer.put(Float.floatToRawIntBits((float) (d2 + this.zOffset))); this.intBuffer.put(Float.floatToRawIntBits((float) this.textureU)); this.intBuffer.put(Float.floatToRawIntBits((float) this.textureV)); this.intBuffer.put(this.color); this.intBuffer.put(0); this.intBuffer.put(0); this.rawBufferIndex += 8; ++this.vertexCount; if (this.renderingChunk && this.addedVertices % 4 == 0 && this.rawBufferIndex >= this.bufferSize - 32) { this.draw(); this.isDrawing = true; } } }
f77e5545-8171-4f92-b7d6-b22aa8e9dc4e
5
public void paintEndFallingBlocks(Graphics g){ Graphics2D g2d = (Graphics2D) g; if(tetrominoes.size()>1) for(int index =0 ; index<tetrominoes.size()-1;index++) for(int x=0; x < coordonneJeu.getNombreColonne(); x++) for(int y=0; y < coordonneJeu.getNombreRangee(); y++) if(!tetrominoes.get(index).IsEmpty(x, y)){ paintBlock((dimension.getWidth()/coordonneJeu.getNombreColonne())*x, (dimension.getHeight()/coordonneJeu.getNombreRangee())*y, tetrominoes.get(index).getCouleur(), g2d); } }
d2cfadfb-a257-427d-a47f-c5bc08492dcd
6
public void file_save_as(){ JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); int r = fc.showSaveDialog(this); if(r==fc.CANCEL_OPTION) return; File myfile = fc.getSelectedFile(); if(myfile==null || myfile.getName().equals("")) { JOptionPane.showMessageDialog(this,"Please enter a file name!","Error",JOptionPane.ERROR_MESSAGE); return; } if(myfile.exists()) { r = JOptionPane.showConfirmDialog(this, "A file with same name already exists!\nAre you sure want to overwrite?"); if(r != 0) return; } try { FileWriter fw = new FileWriter(myfile); fw.write(crypter(t.getText())); content = crypter(t.getText()); setTitle(myfile.getName()+" - Secure Notes"); fw.close(); } catch(IOException e) { JOptionPane.showMessageDialog(this,"Failed to save the file","Error",JOptionPane.ERROR_MESSAGE); } }
619a6b22-11e1-4d5f-b0ab-299a84dfa141
9
public static void main(String[] args) throws Throwable{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(in.readLine()); for (int h = 0; h < n; h++) { in.readLine(); String entrada = in.readLine(); String salida = ""; int ultimoOval = -1; int ultimoCuadrado = -1; for (int i = 0; i < entrada.length(); i++) { char actual = entrada.charAt(i); if( actual == ']'){ if( entrada.substring(0,i).length()==0 ){ entrada = entrada.substring(i+1); i=-1; salida += "[]"; } }else if( actual == ')' ){ if( entrada.substring(0,i).length()==0 ){ entrada = entrada.substring(i+1); i=-1; salida += "[]"; } }else if(actual=='['){ if( entrada.indexOf(']') == -1 ){ salida+="[]"; } else{ } }else{ if( entrada.lastIndexOf(')') == -1 ){ salida+="()"; } else{ } } } System.out.println(salida); } }
2b042848-2799-40dd-8296-4809c01b9854
1
public void testParsePeriod_simple() { Period expect = new Period(1, 2, 3, 4, 5, 6, 7, 8); assertEquals(expect, f.parsePeriod("P1Y2M3W4DT5H6M7.008S")); try { f.parsePeriod("ABC"); fail(); } catch (IllegalArgumentException ex) {} }
648d2a44-5196-46f0-8780-f454e54044ca
0
public CustomConfig(File configFile) { this.config = new YamlConfiguration(); this.configFile = configFile; }
e878c243-3faf-4b42-bad6-6002ee86996f
5
public static void endTurn() { game.totalTurns++; if(isTwoPlayers) { swap(); } else { game.myTurn = true; readyToSwap = false; int[] bombPoint = BattleShipAI.takeShot(game.mySea.getObfuscatedSea()); Ship shipSunk = game.mySea.bombTile(bombPoint[0], bombPoint[1]); int bombedTile = game.mySea.sea[bombPoint[0]][bombPoint[1]]; if(bombedTile == Sea.HIT) { BattleShipAI.hit(bombPoint[0], bombPoint[1]); } else if(bombedTile == Sea.MISS) { BattleShipAI.miss(bombPoint[0], bombPoint[1]); } if(game.mySea.shipDestroyed(shipSunk) && !shipSunk.equals(Ship.placeholderShip)) //if it sunk a ship BattleShipAI.sunkShip(shipSunk); } }
9e8b13a5-9d77-451b-9946-5904c64fca23
5
public boolean sameOrder(Matrix a) { //Doesn't work with jagged arrays, call isJagged() first if (a == null) { return false; } if (this.isJagged || a.isJagged) { return false; } if (this.rowCount != a.rowCount) { return false; //different row number } if (this.columnCount != a.columnCount) { return false; //different column number } return true; }
95a644af-458a-4f1b-9c41-697938b5f10b
2
static Function<Class<?>, Object> getDefaultInstanceSupplier() { return (c) -> { try { return c.newInstance(); } catch (InstantiationException | IllegalAccessException ex) { throw new IllegalStateException("Cannot instantiate view: " + c, ex); } }; }
f81c9dcf-f4be-4bbf-be18-9e0f6a1909f1
1
private void doClearAppenders() { for (Iterator<String> it = appenders.iterator(); it.hasNext();) { removeAppender(it.next()); } }
0f95a931-23d9-4f04-ab0d-136a883118f5
9
public static List<Estado> listaDeEstados() { Estado estado; List<Estado> listaEstado; Statement statement = null; ResultSet tr = null; String select = "SELECT * FROM estados"; listaEstado = new ArrayList<Estado>(); Connection conexion = null; try { conexion = DataSourceFactory.getMySQLDataSource().getConnection(); } catch (SQLException sqle) { System.out.println("Error: " + sqle); } try { statement = conexion.createStatement(); tr = statement.executeQuery(select); while (tr.next()) { estado = new Estado(); estado.setIdEstado(tr.getString("idEstado")); estado.setNombreEstado(tr.getString("nombreEstado")); estado.setLatitud(tr.getString("latitud")); estado.setLongitud(tr.getString("longitud")); listaEstado.add(estado); } } catch (SQLException sqle) { } finally { if (tr != null) try { tr.close(); } catch (SQLException e) { e.printStackTrace(); } if (statement != null) try { statement.close(); } catch (SQLException e) { e.printStackTrace(); } if (conexion != null) try { conexion.close(); } catch (SQLException e) { e.printStackTrace(); } } return listaEstado; }
107e2215-7cd0-4bbe-a611-29ebb70e6eed
9
public synchronized String getShortName(String realName) { realName = realName.trim(); //prüfen, ob bereits ein shortname existiert String shortName = realToShortNames.get(realName.toLowerCase()); if (shortName != null) { return shortName; } //ansonsten prüfen, ob der name zu lang ist, oder ob es einen gleichen shortnamen gibt (dann muss er angepasst werden) if (realName.length() <= NAME_LENGTH_MAX && !shortToRealNames.containsKey(realName.toLowerCase())) { return realName; } //der name ist ungültig, also müssen wir einen passenden namen suchen int counter = 0; while (true) { String countString = counter == 0 ? "" : Integer.toString(counter); shortName = realName.substring(0, NAME_LENGTH_MAX - countString.length()) + countString; String shortNameLower = shortName.toLowerCase(); //namen von vorhandenen spielern sind immer ungültig //namen, die schon kurznamen sind, sind auch ungültig if (plugin.getServer().getOfflinePlayer(shortName).hasPlayedBefore() || realToShortNames.containsKey(shortNameLower) || shortToRealNames.containsKey(shortNameLower)) { counter += 1; continue; } //der name ist gültig: eintragen und speichern realToShortNames.put(realName.toLowerCase(), shortName); shortToRealNames.put(shortNameLower, realName); namesConfig.set(realName, shortName); try { namesConfig.save(databaseFile); } catch (Exception e) { plugin.getLogger().log(Level.SEVERE, "Could not save short names database " + databaseFile, e); } return shortName; } }
5ca56d3a-a9a1-4f0e-8e14-e966a3344761
8
public ArrayList<Point> getPossibleMoves(Point start) { ArrayList<Point> result = new ArrayList<Point>(); int colStart = start.getX(); int rowStart = start.getY(); int numOfPieces = 0; // col. up numOfPieces = getNumPiecesInCol(colStart); if (checkMove(rowStart, colStart, rowStart - numOfPieces, colStart)) { result.add(new Point(colStart, rowStart - numOfPieces)); } // col. down if (checkMove(rowStart, colStart, rowStart + numOfPieces, colStart)) { result.add(new Point(colStart, rowStart + numOfPieces)); } // row right numOfPieces = getNumPiecesInRow(rowStart); if (checkMove(rowStart, colStart, rowStart, colStart + numOfPieces)) { result.add(new Point(colStart + numOfPieces, rowStart)); } // row left if (checkMove(rowStart, colStart, rowStart, colStart - numOfPieces)) { result.add(new Point(colStart - numOfPieces, rowStart)); } // diag. north-east numOfPieces = getNumPiecesInDiagonal(rowStart, colStart, rowStart + 1, colStart - 1); if (checkMove(rowStart, colStart, rowStart + numOfPieces, colStart - numOfPieces)) { result.add(new Point(colStart - numOfPieces, rowStart + numOfPieces)); } // diag. south-east numOfPieces = getNumPiecesInDiagonal(rowStart, colStart, rowStart + 1, colStart + 1); if (checkMove(rowStart, colStart, rowStart + numOfPieces, colStart + numOfPieces)) { result.add(new Point(colStart + numOfPieces, rowStart + numOfPieces)); } // diag. south-west numOfPieces = getNumPiecesInDiagonal(rowStart, colStart, rowStart - 1, colStart + 1); if (checkMove(rowStart, colStart, rowStart - numOfPieces, colStart + numOfPieces)) { result.add(new Point(colStart + numOfPieces, rowStart - numOfPieces)); } // diag. north-west numOfPieces = getNumPiecesInDiagonal(rowStart, colStart, rowStart - 1, colStart - 1); if (checkMove(rowStart, colStart, rowStart - numOfPieces, colStart - numOfPieces)) { result.add(new Point(colStart - numOfPieces, rowStart - numOfPieces)); } return result; }
0a5d552b-af7e-47ba-ab02-39c12a3e28ea
0
@Override public String toString(){ return "id= "+this.getId()+", "+this.getName()+"\n"+getTime()+"\n"+"Высота: "+this.getHig()+"\n"+"Радиус: "+this.getRad()+"\n"+"Диагональ: "+this.getDiag()+"\n"+ "Площадь тела вращения: "+this.getArea_Body()+"\n"+"S=: "+this.getArea()+" V=: "+this.getVolume()+"\n"; }
8799c779-f8c2-4804-a014-c8471d91f82d
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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Pedido2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Pedido2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Pedido2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Pedido2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Pedido2().setVisible(true); } }); }
223f1cbc-70a5-409b-a5d6-6d269b661ce5
8
public List<String> getMinor() { Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; List<String> minor = Constants.Minor; String asString = (String)Constants.Minor.get(0) + "," + (String)Constants.Minor.get(1); try { conn = iConomy.getiCoDatabase().getConnection(); ps = conn.prepareStatement("SELECT minor FROM " + Constants.SQLTable + "_Banks WHERE id = ? LIMIT 1"); ps.setInt(1, this.id); rs = ps.executeQuery(); if (rs.next()) { asString = rs.getString("minor"); String[] denoms = asString.split(","); minor.set(0, denoms[0]); minor.set(1, denoms[1]); } } catch (Exception ex) { } finally { if (ps != null) try { ps.close(); } catch (SQLException ex) { } if (rs != null) try { rs.close(); } catch (SQLException ex) { } if (conn != null) try { conn.close(); } catch (SQLException ex) { } } return minor; }
1c7e0b56-2097-447b-975e-9e3794baf1c3
7
public static boolean MatchRankSuit(Card playercard, Card openedcard) { if (playercard.getRank().equals(Rank.ACE)) { if (openedcard.getRank().equals(Rank.ACE)) {//ace on ace return false; } else {//ace match return true; } } else if ((openedcard.getRank().equals(Rank.SEVEN)) && (CardNo7.isMustTakeCards())) { if (playercard.getRank().equals(Rank.SEVEN)) { //αν δώσει 7 οκ return true; } else { //αλλιώς δεν ταιριάζει και θα πάρει κάρτες return false; } } else if (playercard.getRank().equals(openedcard.getRank())) { //rank match//&& !openedcard.GetRank().equals(Rank.ACE)) { return true; } else if (playercard.getSuit().equals(openedcard.getSuit())) {//suit match return true; } else { //no match return false; } }
b26dbb35-4740-4450-a697-c9bc0a167c1e
0
public void exit() { setVisible(false); }
138b3a7c-66a3-47fb-b228-18c48a51183a
0
public void setDepartureStation(String value) { this._departureStation = value; }
e2130d25-5977-4a82-9a35-d1879a7d3a2e
0
public List findByInputFormat(Object inputFormat) { return findByProperty(INPUT_FORMAT, inputFormat); }
987442cf-9319-4b93-91d7-bd3f36d05913
8
final void method3685(Class98 class98, int i) { Class167 class167 = method3724(Thread.currentThread()); Class318_Sub9 class318_sub9 = (((Class88) ((Class98) class98).aClass88_1569) .aClass318_Sub9_1503); for (Class318_Sub9 class318_sub9_65_ = ((Class318_Sub9) class318_sub9).aClass318_Sub9_6469; class318_sub9_65_ != class318_sub9; class318_sub9_65_ = ((Class318_Sub9) class318_sub9_65_).aClass318_Sub9_6469) { Class318_Sub9_Sub2 class318_sub9_sub2 = (Class318_Sub9_Sub2) class318_sub9_65_; int i_66_ = ((Class318_Sub9_Sub2) class318_sub9_sub2).anInt8791 >> 12; int i_67_ = ((Class318_Sub9_Sub2) class318_sub9_sub2).anInt8796 >> 12; int i_68_ = ((Class318_Sub9_Sub2) class318_sub9_sub2).anInt8789 >> 12; float f = ((((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5681) + ((((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5662) * (float) i_66_ + (((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5680) * (float) i_67_ + (((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5664) * (float) i_68_)); if (!(f < (float) ((SoftwareToolkit) this).anInt7482) && !(f > (float) ((Class167) class167).anInt2210)) { int i_69_ = (((SoftwareToolkit) this).anInt7510 + (int) ((float) ((SoftwareToolkit) this).anInt7491 * ((((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5686) + ((((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5672) * (float) i_66_ + (((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5673) * (float) i_67_ + (((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5669) * (float) i_68_)) / (float) i)); int i_70_ = (((SoftwareToolkit) this).anInt7504 + (int) ((float) ((SoftwareToolkit) this).anInt7497 * ((((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5685) + ((((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5655) * (float) i_66_ + (((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5678) * (float) i_67_ + (((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5666) * (float) i_68_)) / (float) i)); if (i_69_ >= ((SoftwareToolkit) this).widthOffset && i_69_ <= ((SoftwareToolkit) this).width && i_70_ >= ((SoftwareToolkit) this).heightOffset && i_70_ <= ((SoftwareToolkit) this).height) { if (f == 0.0F) f = 1.0F; method3712(class318_sub9_sub2, i_69_, i_70_, (int) f, ((((Class318_Sub9_Sub2) class318_sub9_sub2) .anInt8793) * ((SoftwareToolkit) this).anInt7491 >> 12) / i); } } } }
481b5f9f-b949-4e40-9bda-a683e112d7e9
3
public void drawCities() { cities=new BufferedImage(w.WIDTH,w.HEIGHT,BufferedImage.TYPE_INT_ARGB); Graphics2D page=cities.createGraphics(); for (int y1=0;y1<w.HEIGHT;y1++) for (int x1=0;x1<w.WIDTH;x1++) { if (w.map[x1][y1].owner!=null) { page.setColor(Color.getHSBColor(w.map[x1][y1].owner.owner.hue,w.map[x1][y1].owner.owner.sat,.5F)); page.fillRect(x1,y1,1,1); } } }
31b490eb-5bd3-4c3a-a1f9-08e03ea4216d
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); case '[': this.back(); return new JSONArray(this); } /* * Handle unquoted text. This could be the values true, false, or * null, or it can be a number. An implementation (such as this one) * is allowed to also accept non-standard forms. * * Accumulate characters until we reach the end of the text or a * formatting character. */ StringBuffer sb = new StringBuffer(); while (c >= ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) { sb.append(c); c = this.next(); } this.back(); string = sb.toString().trim(); if ("".equals(string)) { throw this.syntaxError("Missing value"); } return JSONObject.stringToValue(string); }
dcfde899-e22c-4173-988b-60c6b4e0d465
9
public List<String> topTags(){ PreparedStatement stmt = null; Connection conn = null; ResultSet rs = null; List<String> tags = new ArrayList(); try { conn = DbConnection.getConnection(); stmt = conn.prepareStatement(TOP_TAG_STMT); rs = stmt.executeQuery(); for(int i = 0 ;i<10;i++){ if(!rs.next()) break; tags.add(rs.getString("word")); } return tags; } catch (SQLException e) { e.printStackTrace(); throw new RuntimeException(e); } finally { if (rs != null) { try { rs.close(); } catch (SQLException e) { ; } rs = null; } if (stmt != null) { try { stmt.close(); } catch (SQLException e) { ; } stmt = null; } if (conn != null) { try { conn.close(); } catch (SQLException e) { ; } conn = null; } } }
57d50ecc-c11b-44e9-9db8-a881a8b985da
2
protected Stmt createStore(VarExpr target, final Expr source) { target = (VarExpr) target.clone(); // Source is an undefined variable, initialize it if ((source instanceof VarExpr) && (source.def() == null)) { return createUndefinedStore(target); } return new ExprStmt(new StoreExpr(target, (Expr) source.clone(), target .type())); }
55216634-2d52-43fa-ac94-b9ca697ad94e
1
private boolean indexOK(int index) { return index < array.length && index >= 0; }