id
stringlengths
36
36
text
stringlengths
1
1.25M
0fe35960-237d-4000-be92-c0fa7a343d2c
public String getUserName() { return userName; }
2f7cff96-69f4-41f1-938e-f6595453fe91
public void setUserName(String userName) { this.userName = userName; }
87d47191-ad1a-4a03-98cb-b833570a3752
public String getPassWord() { return passWord; }
e10b2a7f-dc17-4da9-9376-49d2537c1773
public void setPassWord(String passWord){ this.passWord = passWord; }
ff0453ef-fc19-498b-b15b-720d798d033e
public int getUserId() { return userId; }
fa4547e2-dfa8-4dda-9ac8-326a13795ed2
public void setUserId(int userId) { this.userId = userId; }
ff6f31c4-a3ad-43cf-8975-f648850eee06
public void databaseConnection() throws Exception{ // This will load the MySQL driver Class.forName("com.mysql.jdbc.Driver"); // Setup the connection with the DB connect = DriverManager.getConnection("jdbc:mysql://localhost?" + "user=admin&password=admin"); // Statements allow to...
fe2cb4a6-4f97-461f-8b79-f68ec6c6e38a
public User getUserbyName(String username) throws Exception { try { databaseConnection(); // Result set get the result of the SQL query resultSet = statement.executeQuery("select * from room_booking.user where userName = '"+ username+"'"); User newuser = new User(); // ResultSet ...
1dfddc9e-c57c-4a43-9774-31072941d4b5
public void addBooking(String name, Date date,int time) throws Exception { try { databaseConnection(); // change the format of the date SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); //System.out.println("insert into room_booking.booking set name='"+ name+"',...
42103f27-5d65-40c3-a994-88ca03df3cc2
private void close() { try { if (resultSet != null) { resultSet.close(); } if (statement != null) { statement.close(); } if (connect != null) { connect.close(); } } catch (Exception e) { } }
5bd6462c-599f-4d22-81aa-1e4dc3b7264f
public String getAvailableTimes(Date date) throws Exception { try { databaseConnection(); SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); // Result set get the result of the SQL query resultSet = statement.executeQuery("select ID,timeslots.timeslot from room_booking.tim...
8076ed5a-79e3-4d3b-b37b-452b58ceb570
public String getAllUsers() throws Exception { try { databaseConnection(); // Result set get the result of the SQL query resultSet = statement.executeQuery("select userName from room_booking.user"); String allusers = new String();//new String object to store the users while ...
a03aa3b1-b621-4f42-9738-4f25b3f91725
public String getBookedTimes(Date date) throws Exception { try { databaseConnection(); SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); // Result set get the result of the SQL query resultSet = statement.executeQuery("select ID,timeslots.timeslot,name from room_book...
47e15f00-94b2-4d40-84a2-051a95266d5b
public void deleteBooking(String name, Date date,int time) throws Exception { try { databaseConnection(); // change the format of the date SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); //sql to delete a booking from the booking table statement.execute("delete...
1bab6cb4-7f9b-474c-af50-82adfff2baf1
public void addUser(int userId, String username, String pass, String fname, String lname, String userType) throws Exception { try { databaseConnection(); //add a new user to the user table statement.execute("insert into room_booking.user set userid='"+ userId+"',userName='"+username+ ...
26ead16a-8b12-4b35-bd38-edddc549de35
public void deleteUser(String username) throws Exception { try { databaseConnection(); statement.execute("delete from room_booking.booking where name='"+ username+"'");//delete the users bookings when deleting of //the corresponding user //sql to delete a booking from the booking table st...
783bd756-1634-4dbc-8807-1478d4f40148
public Booking(){ setBookingNum(0); setName(""); setDate(null); setTime(0); }
a019245a-9e4c-4938-84b6-10c70a36ed34
public Booking(int bookingNum, String bookedBy,int time, Date date ){ this.setBookingNum(bookingNum); this.setName(bookedBy); this.setDate(date); this.setTime(time); }
19da9b20-5f96-49f3-9b58-79f4f4c76f19
public String getName() { return name; }
4c339f27-9714-49ae-ab7d-67e4b8db46f0
public void setName(String name) { this.name = name; }
2c447b36-bdd6-4189-ad1b-f06f66d74385
public int getTime() { return time; }
b8a3861b-3eb6-4665-8181-ef199989a97f
public void setTime(int time) { this.time = time; }
61aac297-95f9-4602-abbf-04f7bd4deb64
public Date getDate() { return date; }
f0f97e8b-5e6b-4c26-aec6-c9fb59ff3e11
public void setDate(Date date) { this.date = date; }
3531c66c-b3c0-4152-8b49-5f87c4a35677
public int getBookingNum() { return bookingNum; }
583da288-f1bd-4c6f-b74d-1a133a092c0f
public void setBookingNum(int bookingNum) { this.bookingNum = bookingNum; }
fd0e7406-f399-4855-bf6c-b86d2e31847c
public void AddBooking() throws Exception { try { MysqlAction newMysqlAction = new MysqlAction(); newMysqlAction.addBooking(this.name, this.date, this.time); } catch (Exception e) { throw e; } }
85019d85-1c69-4783-876d-cbf786ed53d4
public static void main(String[] args) {//main method which call the login window EventQueue.invokeLater(new Runnable() { public void run() { try { framelogin.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
e96af6e8-cf26-4fe0-b63f-0db6e97d3790
public void run() { try { framelogin.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }
60fe8fa9-9304-45fc-9519-7ef243b3f88c
public Login() { setFont(new Font("Dialog", Font.BOLD, 14)); setTitle("Conference Room Booking System"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); SpringLayou...
1830c52f-3476-4c8d-971b-56bf0d4cb7b9
public void actionPerformed(ActionEvent e) { RoomBooking frameBooking = new RoomBooking(); try { myUser = tabrec.getUserbyName(txtuserName.getText());//call the method } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String name = myU...
c7d5375c-a428-4406-8d15-b24406f03e00
public String getCurrentUser(String username){//method to get the current user username = myUser.getUserName();// call the user class method return username; }
102bf14f-74ed-4a54-b0da-4d097a4c6988
public Admin() { // initializing components setTitle("Conference Room Booking System"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); SpringLayout sl_contentPane ...
7dbd9c3e-6927-43da-9d96-e1ca81dc341d
public void actionPerformed(ActionEvent e) { //assign the variable values to text boxes int id = Integer.valueOf(txtUserid.getText()); newUser.setUserId(id); newUser.setUserName(txtUsername.getText()); newUser.setPassWord(txtPass.getText()); newUser.setFName(txtFname.getText()); newUser.setL...
4b5a7243-4003-4941-b720-cb653c6659ab
public void actionPerformed(ActionEvent arg0) {//delete button actions String name = txtUsername.getText(); try { sqlaction.deleteUser(name);//call the delete user method } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
cccf50b3-086d-41ed-a085-c3061252bd3d
public void actionPerformed(ActionEvent e) { System.exit(0); }
6dd7620d-3dd5-40ce-b450-a00d2e44e0d7
public void actionPerformed(ActionEvent arg0) {// get button actions....i could not find a method //to get the nemes directly by combobox action method. //then jumped to a button try { String userlist = sqlaction.getAllUsers();// call the method System.out.println(userlist.toS...
d088a517-4217-40eb-b8a4-4abe11018aba
public void actionPerformed(ActionEvent arg0)//action to selecting of an item of comboBox { try { String name = (String) comboBox.getSelectedItem(); newUser = sqlaction.getUserbyName(name);// call the method } catch (Exception e1) { // TODO Auto-generated catch bloc...
d114080b-34fa-41b6-bdbf-dd17a96a4d8b
public void actionPerformed(ActionEvent arg0) {//clear button actions txtUserid.setText(""); txtUsername.setText(""); txtPass.setText(""); txtFname.setText(""); txtLname.setText(""); txtUtype.setText(""); }
6392899e-15f3-46ef-b598-a429acce3619
@SuppressWarnings({ "unchecked", "rawtypes" }) public RoomBooking() { setBackground(UIManager.getColor("CheckBoxMenuItem.selectionBackground")); setForeground(Color.WHITE); setFont(new Font("Cordia New", Font.BOLD, 14)); setTitle("Conference Room Booking System"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOS...
68cfedbe-8542-4ad5-9117-9d9eb575c484
public void actionPerformed(ActionEvent arg0) { Date date =dateChooser.getDate(); //get the date from datechooser int timeslot = Integer.valueOf(timelist.getSelectedValue().toString().substring(0, 1));// get the time from the list Booking newBooking = new Booking(); String uname =Login.myU...
75d321c1-3458-4aff-b584-72edd0f6409e
public void actionPerformed(ActionEvent arg0) { System.exit(0); }
53b132bf-df93-4410-9b76-b7ad187c9aae
public void actionPerformed(ActionEvent e) { String times; try { times = actions.getAvailableTimes(dateChooser.getDate());//call the method by date and assign to a string variable //System.out.println(times.toString()); listModel.clear(); String[] available ...
ab87548b-4f79-477f-9bad-73f85e3b91ba
public void actionPerformed(ActionEvent e) { String bookings; try { bookings = actions.getBookedTimes(dateChooser.getDate()); //System.out.println(bookings.toString()); listModel.clear(); String[] booked = bookings.split(","); int j=0; ...
e75421c9-1fc7-4c76-9768-dafb925ed22f
public void actionPerformed(ActionEvent e) { String name = Login.myUser.getUserName(); Date date = dateChooser.getDate(); int time = Integer.valueOf(timelist.getSelectedValue().toString().substring(0, 1));//select the time from list int endIndex = timelist.getSelectedValue().toString().lastIndexO...
41ca1491-feea-4a1a-948a-777492eec3ce
public static void main(String[] args) { Winkelwagen wagen = new Winkelwagen(); wagen.add( new Game(42.95, "World of warcraft", "Mijn broertje is hieraan verslaafd", 10000)); wagen.add( new Game(44.95, "World of warcraft 2", "Mijn broertje is hie...
831edc1d-b2d1-4c01-bc9b-e2ccc898336f
public Winkelwagen() { this.producten = new ArrayList(); }
211e025e-b09d-478a-97cd-6bc2b23694f6
public void add(AbstractProduct product) { this.producten.add(product); }
33bb0633-06fb-4009-9054-f42bc5bc85aa
public void remove(AbstractProduct product) { this.producten.remove(product); }
4c37cd81-2a45-49b3-80d9-533ebbc3e908
public ArrayList<AbstractProduct> getProducten() { return producten; }
ef70e0cc-e0b5-49b0-bd41-1f8b2529cf13
@Override public String toString() { String response = ""; for (AbstractProduct product : this.getProducten()) { response += product.toString() + "\n\n"; } return response; }
55e5327a-4200-4d0c-996b-dfc59311fc84
public Cd(double prijs, String omschrijving, String naam, String artiest, int aantalTracks) { this.setPrijs(prijs); this.setOmschrijving(omschrijving); this.setNaam(naam); this.setArtiest(artiest); this.setAantalTracks(aantalTracks); }
009b07fd-e09b-4c34-9b9a-205d6679915e
public String getArtiest() { return artiest; }
2536a2a8-4284-49da-8e61-b22030000a3f
public void setArtiest(String artiest) { this.artiest = artiest; }
5a12ce15-45d6-4e28-b6c9-6a667c863348
public int getAantalTracks() { return aantalTracks; }
50cd1063-a648-4179-baca-8afc490b64ec
public void setAantalTracks(int aantalTracks) { this.aantalTracks = aantalTracks; }
86c102d0-2ed6-42b2-9458-630cbd06453b
@Override public String toString() { return super.toString() + ": Cd{" + "artiest=" + artiest + ", aantalTracks=" + aantalTracks + '}'; }
a9015b51-a94d-4ce1-8e7f-44f4b64aa380
public Boek(double prijs, String omschrijving, String naam, String artiest, int aantalTracks) { this.setPrijs(prijs); this.setOmschrijving(omschrijving); this.setNaam(naam); this.setAutheur(autheur); this.setIsbn(Isbn); }
d53b25dc-53de-45e4-bf7e-0ecfc5487f1e
public String getAutheur() { return autheur; }
b6fbc521-5d4e-4175-b3f2-e25915cd4894
public void setAutheur(String autheur) { this.autheur = autheur; }
53305b48-661c-4bb2-8ecb-30d80625e31f
public int getIsbn() { return Isbn; }
d161b880-36ba-47ad-aa12-853749eea6b5
public void setIsbn(int Isbn) { this.Isbn = Isbn; }
77dd936a-1898-4354-8f99-3bcc0b3f3eb7
@Override public String toString() { return super.toString() + ": Boek{" + "autheur=" + autheur + ", Isbn=" + Isbn + '}'; }
8f2b75ab-6ac3-4220-a69d-76b7ad98c9e4
public double getPrijs() { return prijs; }
6befa30f-67e5-420a-8ec3-7cee6b41f3de
public void setPrijs(double prijs) { this.prijs = prijs; }
e0013d7b-56f1-438f-86ff-f7858c73c0dc
public String getOmschrijving() { return omschrijving; }
7b4162d5-3070-4663-b906-adea4cb62968
public void setOmschrijving(String omschrijving) { this.omschrijving = omschrijving; }
3bbb3eb1-c4ca-4754-8001-103d0c5bdb6b
public String getNaam() { return naam; }
4f2f5a55-c824-41af-bdf4-b246d36830a0
public void setNaam(String naam) { this.naam = naam; }
15865258-c71e-4613-aed2-f7c7561ce678
@Override public String toString() { return "AbstractProduct{" + "prijs=" + prijs + ", omschrijving=" + omschrijving + ", naam=" + naam + '}'; }
ebbdb395-a9ad-4484-a084-273ede5fd579
public Game(double prijs, String omschrijving, String naam, int aantalSpelers) { this.setPrijs(prijs); this.setOmschrijving(omschrijving); this.setNaam(naam); this.setAantalSpelers(aantalSpelers); }
aee52c1b-128b-4621-88c5-d81d8608eaa2
public int getAantalSpelers() { return aantalSpelers; }
590f5653-386a-460e-b2f9-90946a216a9d
public void setAantalSpelers(int aantalSpelers) { this.aantalSpelers = aantalSpelers; }
ac15347a-d9e9-4b39-b510-6de0e238817b
@Override public String toString() { return super.toString() + ": Game{" + "aantalSpelers=" + aantalSpelers + '}'; }
1cc7ce3a-83b5-4492-a5e2-c2ffe1bf1191
public Layer(int numNeurons, int numInputs, int bias) { neurons = new Neuron[numNeurons]; for (int i = 0; i < neurons.length; i++) { neurons[i] = new Neuron(numInputs, bias); // a bias of 0 has no effect } }
c0c6f264-3e11-4d5c-a296-eb3ed43b7510
public int[] input(int[] inputs) { int[] outputs = new int[neurons.length]; for (int i = 0; i < neurons.length; i++) { if (neurons[i].sum(inputs) > 1) { // current threshold is 0.5, may change function in future outputs[i] = 1; } else { outputs[i] ...
4f26ba3a-9a79-4565-b324-eaa22aa3a4ca
public Neuron[] getNeurons() { return neurons; }
abfc9126-324b-4749-ba6e-e713abce5f78
public Solution(int[] input, int[] output) { this.input = input; this.output = output; }
4e7b26dd-cf7a-44f3-8716-457eda261e85
public int[] getInput() { return input; }
cb706f6e-726a-4545-834a-f4bdf7a655bc
public int[] getOutput() { return output; }
6f97d2ed-26fa-4414-bca7-57e090bbf187
public Neuron(int numInputs, int bias) { this.numInputs = numInputs; this.bias = bias; // set bias to 0 to remove its effect weights = new double[numInputs + 1]; // one extra for the bias input Random rand = new SecureRandom(); for (int i = 0; i < weights.length; i++) { ...
714d7f1a-feef-4557-a4ac-b5cb2d3c53d4
public double sum(int[] inputs) { double sum = 0; for (int i = 0; i < inputs.length; i++) { sum += inputs[i] * weights[i]; } sum += bias * weights[weights.length - 1]; // bias has no effect if 0 return sum; }
de92c142-d430-4d70-b3f1-f9f01fb582c8
public void setWeights(double[] weights) { this.weights = weights; // this replaces random weights with specific weights }
cc0e5858-a8d9-43f7-8911-bff52e0f0b8b
public double[] getWeights() { return weights; }
dbd10ebe-c8dc-4ea4-846f-18061ed2da30
public int getNumInputs() { return numInputs; }
c1097f58-8736-4198-a7f3-0885529d31f1
public Trainer(Network size, int numNetworks, double mutationRate) { this.size = size; this.mutationRate = mutationRate; this.numNetworks = numNetworks; currentGen = new Generation(numNetworks, size, mutationRate); solutions = new ArrayList<Solution>(); }
02b59d85-61e5-472c-a0b4-a5c7738bce79
public void addSolution(Solution s) { solutions.add(s); }
61ef9b2a-942f-4ea5-8492-c0d1117acabf
public void test() { Network[] fittest = fittest(1); System.out.println(fitness(fittest[0])); }
aa2bedeb-859d-4e2e-a23e-c8e336b9c04c
public void train(int numFittest) { Network[] fittest = fittest(numFittest); Network[] children = currentGen.children(fittest); currentGen = new Generation(children, numNetworks, mutationRate); }
2ad23174-b38f-41fb-acb7-60b526c5d63f
private Network[] fittest(int numFittest) { ArrayList<Network> nets = new ArrayList<Network>(Arrays.asList(currentGen.getGen())); Network[] fittest = new Network[numFittest]; for (int i = 0; i < fittest.length; i++) { fittest[i] = largest(nets); nets.remove(fittest[i]); ...
2a795a85-cfc3-49d1-a01b-cbfde1660862
private Network largest(ArrayList<Network> nets) { Network largest = nets.get(0); int fitness = fitness(nets.get(0)); for (int i = 0; i < nets.size(); i++) { int f = fitness(nets.get(i)); if (f > fitness) { largest = nets.get(i); fitness =...
ff9e1d9e-e0e9-4939-911f-6b39aa491f48
private int fitness(Network net) { int fitness = 0; for (int i = 0; i < solutions.size(); i++) { fitness += net.fitness(solutions.get(i).getInput(), solutions.get(i).getOutput()); } return fitness; }
51468602-843f-4ace-95b4-bcb446e12f96
public static void main(String[] args) { Network size = new Network(4, 4, 2, 8, 1); Trainer t = new Trainer(size, 50, 0.01); int[] i1 = {1, 0, 0, 0}; int[] o1 = {0, 0, 0, 1}; t.addSolution(new Solution(i1, o1)); int[] i2 = {0, 1, 0, 0}; int[] o2 = {0, 0, 1, 0};...
bd18bc9a-b228-4786-af5e-5b839b1a80fc
public Generation(int numNetworks, Network size, double mutationRate) { this.mutationRate = mutationRate; generation = new Network[numNetworks]; for (int i = 0; i < numNetworks; i++) { generation[i] = new Network(size.numInputs, size.numOutputs, size.numHiddenLayers, size.sizeHiddenL...
8c6f9285-d873-4024-ba25-fdd7ca10e5dc
public Generation(Network[] children, int numNetworks, double mutationRate) { this.mutationRate = mutationRate; generation = new Network[numNetworks]; for (int i = 0; i < children.length; i++) { generation[i] = children[i]; } for (int i = children.length; i < numNetwo...
7e487da6-7d85-40c9-9eed-55c901fa76bd
public Network[] fittest(int numFittest, int[] inputs, int[] outputs) { ArrayList<Network> gen = new ArrayList<Network>(Arrays.asList(generation)); Network[] fittest = new Network[numFittest]; int num = 0; while (num < fittest.length) { Network f = gen.get(0); int...
9f7e21cf-92d4-43ce-a5bd-c7a64f099411
public Network[] children(Network[] fittest) { ArrayList<Network> children = new ArrayList<Network>(); for (int i = 0; i < fittest.length; i++) { for (int j = i; j < fittest.length; j++) { if (fittest[i] != fittest[j]) { Network child = fittest[i].child(fi...
1c0b72dd-0c15-444b-a3e8-42dab19e41cc
public Network[] getGen() { return generation; }
5bec262f-6e89-46c1-beb8-d4a564609251
public int numGenerations() { return generation.length; }
58737320-a730-492d-aa98-9985ea78ac2c
public Network(int numInputs, int numOutputs, int numHiddenLayers, int sizeHiddenLayers, int bias) { this.numInputs = numInputs; this.numOutputs = numOutputs; this.numHiddenLayers = numHiddenLayers; this.sizeHiddenLayers = sizeHiddenLayers; this.bias = bias; build(); ...