id
stringlengths
36
36
text
stringlengths
1
1.25M
9daf3f53-9a29-40bf-af22-ab3e23bb376a
public BaseAction( int recordingID, Date index ) { m_recordingID = recordingID; m_index = index; }
072b2f7d-24c3-4715-a72b-d7a37b89a6a8
public int getRecordingID() { return m_recordingID; }
ca8e9168-1b51-42c1-befc-15603c52a90a
public Date getiIndex() { return m_index; }
bf9aad9f-7505-46b7-8da0-476b65be318b
public boolean isTurn() { return turn; }
e4333900-47bf-4abf-b35e-8c0efb6072d7
public void setTurn(boolean turn) { this.turn = turn; }
944a78f9-b0e7-4709-8cb4-1038e778b444
public boolean isAlive() { return alive; }
75d394f1-19a1-4084-94eb-31337bf30cf6
public void setAlive(boolean alive) { this.alive = alive; }
3e535b2e-57a8-415a-8b2d-82609479152a
public String getName() { return name; }
276f441a-aff4-4f52-aa05-c6bbd8f87357
public void setName(String name) { this.name = name; }
6409e0f8-27dc-4604-be15-eab9ddb18d0e
public void createCharacter(String name){ this.setName(name); this.setTurn(turn); this.setAlive(alive); this.getName(); this.isTurn(); this.isAlive(); }
efbcab4b-bf38-427c-9deb-61fae2466fe2
public MainGUI() { initComponents(); }
4f760d94-9435-4e15-969f-98b5963a6925
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE) ); pack(); }
f865b54e-4a30-4deb-bdab-aaf25b820960
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(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MainGUI.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 MainGUI().setVisible(true); } }); }
4411705b-68a0-49bf-ae48-36d17bf478f5
public void run() { new MainGUI().setVisible(true); }
46abf7b0-f086-43d5-b332-f67250566503
public void playGame() { gameBoard.createGameBoard(); character1.createCharacter("Mario"); }
21d842ba-8d34-49e8-957d-93f590753670
public String getSpace() { return space; }
3c277428-fe79-4556-bdde-5fc88519187d
public boolean isStart() { return start; }
5a804214-38b0-40a5-9ebd-e8811b383faa
public void setStart(boolean start) { this.start = start; }
e42fc019-2e24-449a-b7bf-ef86be7ba53b
public boolean isEnd() { return end; }
b3b4226c-63d0-4ccd-b6d5-0cf69fb5dabb
public void setEnd(boolean end) { this.end = end; }
7fb2f449-be04-497d-8983-659ad11dfb5b
public void setSpace(String space) { this.space = space; }
03ff7331-3d6e-40ab-a3c3-ebef79d2e76f
public void createGameBoard(){ this.setStart(start); this.setSpace(space); this.setEnd(end); this.isStart(); this.getSpace(); this.isEnd(); }
ef9c15e7-7cd3-42ac-b15b-3fb8cc1ceb44
public static void main(String[] args) { Game game = new Game(); game.playGame(); }
ce9d774b-6b4a-454b-ac1b-6a1d93194059
public static void main(String[] args) { // TODO code application logic here }
6268bd8c-4756-42a7-9000-f86cdcd8b6b8
public Employee() { }
f7758592-edf2-4901-9eab-ab34b7f170e1
public String getFirstName() { return firstName; }
f7968c9a-b2d9-4f43-93de-b8894888a128
public void setFirstName(String firstName) { //validate name this.firstName = firstName; }
a6afa988-829d-4e80-9728-fcd301cbb9c6
public String getLastName() { return lastName; }
bc2f3308-9081-41cc-9f23-f6b15cd3bd8b
public void setLastName(String lastName) { //validate name this.lastName = lastName; }
ede2f867-9087-4cfc-b4eb-dd0b97563be8
public String getSsn() { return ssn; }
f393d84a-5f8b-47b1-b514-4e7bf0ec4d0f
public void setSsn(String ssn) { //validate ssn this.ssn = ssn; }
8b21d551-aed2-49b5-9bbb-80090999ef61
public Date getBirthDate() { return birthDate; }
c970e004-a18c-4d08-a78a-35a03bfc0681
public void setBirthDate(Date birthDate) { //validate birthdate this.birthDate = birthDate; }
3a2e519d-560f-4c23-a151-46fc07813da2
public String getCubeId() { return cubeId; }
a38aebe3-de2e-4fe4-8ad9-575ca878628b
public void setCubeId(String cubeId) { this.cubeId = cubeId; }
f3aa1cc8-aeaa-4994-bd5c-f84d196115d5
public void attendFirstDay() { meetWithHrForBenefitAndSalaryInfo(); meetDepartmentStaff(); reviewDeptPolicies(); moveIntoCubicle(); }
3de48253-19c9-492e-8181-50b6d9821ae1
private void meetWithHrForBenefitAndSalaryInfo() { metWithHr = true; }
88edbb21-0817-495e-af57-10fc71e15922
private void meetDepartmentStaff() { if(metWithHr) { metDeptStaff = true; } else { throw new IllegalStateException("Sorry, you cannot meet with " + "department staff until you have met with HR."); } }
08ebbe75-5328-4b8b-8515-4d818a9196ab
private void reviewDeptPolicies() { if(metWithHr && metDeptStaff) { reviewedDeptPolicies = true; } else { throw new IllegalStateException("Sorry, you cannot review " + " department policies until you have first met with HR " + "and then with department staff."); } }
80aa0228-c2b3-4402-97fc-6e0c61364df7
private void moveIntoCubicle() { if(metWithHr && metDeptStaff && reviewedDeptPolicies) { getCubeId(); this.movedIn = true; } else { throw new IllegalStateException("Sorry, you cannot move in to a " + "cubicle until you have first met with HR " + "and then with department staff, and then reviewed" + "department policies."); } }
7fda29f9-cb53-4c2d-ad9c-945663f1ea74
public String getStatus() { if(metWithHr && metDeptStaff && reviewedDeptPolicies && movedIn) { return "Orientation is complete"; } else { return "Orientation in progress..."; } }
01595e9b-0e94-43c6-9be0-6dc15faf43f7
public static void main(String[] args) { Employee employee = new Employee(); employee.setFirstName("Peter"); employee.setLastName("Piper"); employee.setSsn("333-1234"); employee.setCubeId("10"); employee.attendFirstDay(); System.out.println("The employee's status is: " + employee.getStatus()); }
23a3fc09-2566-41e0-a9e0-f47eb6c021b1
public MainGUI() { initComponents(); this.txtNewProdNo.requestFocus(); }
af00c606-9dbf-4b5f-9469-a6402a43d302
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); txtNewProdNo = new javax.swing.JTextField(); txtNewProdDesc = new javax.swing.JTextField(); txtNewProdPrice = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); btnEnterRecord = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); listProducts = new javax.swing.JTextArea(); btnDisplayList = new javax.swing.JButton(); btnSortList = new javax.swing.JButton(); btnSearch = new javax.swing.JButton(); txtSearchPartNo = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); txtCurProdNo = new javax.swing.JTextField(); txtCurDesc = new javax.swing.JTextField(); txtCurPrice = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); btnUpdate = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("ACME Hardware Product Manager"); setResizable(false); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); jLabel1.setText("ACME Hardware"); txtNewProdNo.setNextFocusableComponent(txtNewProdDesc); txtNewProdDesc.setNextFocusableComponent(txtNewProdPrice); txtNewProdPrice.setNextFocusableComponent(txtSearchPartNo); jLabel2.setText("Enter Product No:"); jLabel3.setText("Enter Product Description:"); jLabel4.setText("Enter Product Price:"); btnEnterRecord.setText("Enter Record"); btnEnterRecord.addActionListener(this); listProducts.setColumns(20); listProducts.setEditable(false); listProducts.setRows(5); listProducts.setFocusable(false); jScrollPane1.setViewportView(listProducts); btnDisplayList.setText("Display List"); btnDisplayList.addActionListener(this); btnSortList.setText("Sort List"); btnSortList.addActionListener(this); btnSearch.setText("Search"); btnSearch.addActionListener(this); txtSearchPartNo.setNextFocusableComponent(txtCurDesc); jLabel5.setText("Enter Product Number to Search For:"); txtCurProdNo.setEditable(false); txtCurProdNo.setFocusable(false); txtCurDesc.setNextFocusableComponent(txtCurPrice); jLabel6.setText("Current Product No:"); jLabel7.setText("Current Desc:"); jLabel8.setText("Current Price:"); btnUpdate.setText("Update"); btnUpdate.addActionListener(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( 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(jLabel2) .addComponent(jLabel1) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addComponent(jLabel7)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel8) .addGap(40, 40, 40))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtCurDesc, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(txtCurPrice, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnUpdate, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)) .addComponent(txtCurProdNo, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtNewProdNo, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3) .addComponent(txtNewProdDesc, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4) .addComponent(txtNewProdPrice, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 429, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))) .addContainerGap(68, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(btnSortList, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnDisplayList, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnEnterRecord, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addComponent(btnSearch, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(27, 27, 27) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5) .addComponent(txtSearchPartNo, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(167, 167, 167))) .addGap(266, 266, 266)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(jLabel2) .addGap(2, 2, 2) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(txtNewProdNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtNewProdDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtNewProdPrice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(btnEnterRecord, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btnDisplayList, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btnSortList, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(55, 55, 55) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(btnSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtSearchPartNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(txtCurProdNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(txtCurDesc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(15, 15, 15) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(txtCurPrice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(btnUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); this.getRootPane().setDefaultButton(btnEnterRecord); pack(); }
14f1747d-fdcc-428f-82d0-70deae5d1faf
public void actionPerformed(java.awt.event.ActionEvent evt) { if (evt.getSource() == btnEnterRecord) { MainGUI.this.btnEnterRecordActionPerformed(evt); } else if (evt.getSource() == btnDisplayList) { MainGUI.this.btnDisplayListActionPerformed(evt); } else if (evt.getSource() == btnSearch) { MainGUI.this.btnSearchActionPerformed(evt); } else if (evt.getSource() == btnUpdate) { MainGUI.this.btnUpdateActionPerformed(evt); } else if (evt.getSource() == btnSortList) { MainGUI.this.btnSortListActionPerformed(evt); } }// </editor-fold>//GEN-END:initComponents
2a31f04b-bc6d-49fe-864d-702297eb60b0
private void btnEnterRecordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEnterRecordActionPerformed foundIndex = NOT_FOUND; partNo = this.txtNewProdNo.getText(); partDesc = this.txtNewProdDesc.getText(); try { partPrice = Double.parseDouble(this.txtNewProdPrice.getText()); } catch(Exception e) { JOptionPane.showMessageDialog(this, "Sorry, the price entry must be a whole or floating point number only.\n", "Number Format Error", JOptionPane.WARNING_MESSAGE); return; } if (emptyRow > 10) { JOptionPane.showMessageDialog(this, "Sorry, you have reach the maximum of 10 items.\n" + "No more items can be saved.", "Maximum Reached", JOptionPane.WARNING_MESSAGE); } else if (partNo.length() == 0 || partDesc.length() == 0 || this.txtNewProdPrice.getText().length() == 0) { JOptionPane.showMessageDialog(this, "Sorry, you must complete all fields. Please try again.", "Incomplete Part Entry", JOptionPane.WARNING_MESSAGE); this.txtNewProdNo.requestFocus(); } else { partNums[emptyRow] = partNo; partDescs[emptyRow] = partDesc; partPrices[emptyRow] = partPrice; this.emptyRow += 1; } clearEntryFields(); this.txtNewProdNo.requestFocus(); }//GEN-LAST:event_btnEnterRecordActionPerformed
e0034ac3-43ef-4c65-82e5-b4446bb99999
private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearchActionPerformed String searchNum = txtSearchPartNo.getText(); if (searchNum != null && searchNum.length() > 0) { for (int i = 0; i < this.partNums.length; i++) { if (searchNum.equalsIgnoreCase(partNums[i])) { foundIndex = i; break; } } if (foundIndex == NOT_FOUND) { JOptionPane.showMessageDialog(this, "Part Number not found. Please try again.", "Not Found", JOptionPane.WARNING_MESSAGE); } else { txtCurProdNo.setText(partNums[foundIndex]); txtCurDesc.setText(partDescs[foundIndex]); txtCurPrice.setText("" + partPrices[foundIndex]); } } else { JOptionPane.showMessageDialog(this, "Please enter a Part No. to search", "Entry Missing", JOptionPane.WARNING_MESSAGE); } }//GEN-LAST:event_btnSearchActionPerformed
2f6ea103-3e57-4a56-8d02-af75dd2b261e
private void btnDisplayListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDisplayListActionPerformed displayList(); }//GEN-LAST:event_btnDisplayListActionPerformed
6d6a7b32-062a-4cda-94a0-a7a60c9c5c82
private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed if (foundIndex == NOT_FOUND) { JOptionPane.showMessageDialog(this, "Part Number not found. Please try again.", "Search Failure", JOptionPane.WARNING_MESSAGE); } else { partNums[foundIndex] = txtCurProdNo.getText(); partDescs[foundIndex] = txtCurDesc.getText(); partPrices[foundIndex] = Double.parseDouble(txtCurPrice.getText()); displayList(); JOptionPane.showMessageDialog(this, "Part updated successfully!", "Success Confirmation", JOptionPane.INFORMATION_MESSAGE); } }//GEN-LAST:event_btnUpdateActionPerformed
dd9af321-fae4-426c-ae9c-989a57a081d5
private void btnSortListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSortListActionPerformed sortList(); }//GEN-LAST:event_btnSortListActionPerformed
5412902b-900e-44c4-a1cb-4a7fed7a6323
private void displayList() { NumberFormat nf = NumberFormat.getCurrencyInstance(); listProducts.setText(""); // clear list listProducts.append("Part\tDesc\t\tPrice\n====\t====\t\t=====\n"); for (int i = 0 ; i < emptyRow; i++) { String rLine = partNums[i] + "\t" + partDescs[i] + "\t\t" + nf.format(partPrices[i]) + "\n"; listProducts.append(rLine); } }
9e041010-b1bc-49c3-8fad-8d9738f46d75
private void sortList() { // Only perform the sort if we have records if(emptyRow > 0) { // Bubble sort routine adapted from sample in text book... // Make sure the operations are peformed on all 3 arrays! for(int passNum = 1; passNum < emptyRow; passNum++) { for(int i = 1; i <= emptyRow-passNum; i++) { String temp = ""; temp += partPrices[i-1]; partPrices[i-1] = partPrices[i]; partPrices[i] = Double.parseDouble(temp); temp = partNums[i-1]; partNums[i-1] = partNums[i]; partNums[i] = temp; temp = partDescs[i-1]; partDescs[i-1] = partDescs[i]; partDescs[i] = temp; } } // Once it's sorted, display in the list box displayList(); } else { JOptionPane.showMessageDialog(this, "Sorry, there are not items to sort", "Sort Error", JOptionPane.WARNING_MESSAGE); } }
6fa81142-75d0-4c29-a5e3-a7f1cc26d2c1
private void clearEntryFields() { txtNewProdNo.setText(""); txtNewProdDesc.setText(""); txtNewProdPrice.setText(""); }
81234485-8c75-4b0a-bb88-c2ed1c7f4817
public static void main(String[] args) { // Don't worry if you don't understand this code. It // will be explained later. java.awt.EventQueue.invokeLater(new Runnable() { public void run() { (new MainGUI()).setVisible(true); } }); }
ac1dde06-baa3-4553-91be-9f6de878b32e
public void run() { (new MainGUI()).setVisible(true); }
fcaeff8c-70a0-47aa-92e4-57e1ba6de24d
public int getBpl() { return bpl; }
ee79d813-4e7c-424f-98a2-093031950444
public void setBpl(int bpl) { this.bpl = bpl; }
57c4fc8c-a695-4b4e-9ff6-b6127d831d83
public String getDataId() { return dataId; }
5dc74297-d8f8-4131-8a28-a15f0a46d735
public void setDataId(String dataId) { this.dataId = dataId; }
87f77564-448d-4413-8903-145992a33488
public int getHp() { return hp; }
1ea18552-3027-48ab-bda6-a09ad1d429ec
public void setHp(int hp) { this.hp = hp; }
19b5f5df-0cc9-4f6b-82e7-5d84033705fe
public int getHr() { return hr; }
f106aac8-8c34-4fdd-b2ac-dc5e72264fea
public void setHr(int hr) { this.hr = hr; }
e1407e88-c104-473e-9f76-81ae487a1820
public int getIsArr() { return isArr; }
941ac6cb-f990-4e6e-9f96-dce4da597218
public void setIsArr(int isArr) { this.isArr = isArr; }
1845f45a-2a5e-4dcb-bf43-398e4337c403
public int getLp() { return lp; }
188b2883-8735-48c7-8e02-37e072a131dc
public void setLp(int lp) { this.lp = lp; }
166ca7e2-c11b-4e0e-938d-aafbaa9d412c
public int getLastChangeTime() { return LastChangeTime; }
37534e52-6391-4837-bba5-55a72a68c23f
public void setLastChangeTime(int lastChangeTime) { LastChangeTime = lastChangeTime; }
b919c561-5766-4a28-9dea-901d7c9f9764
public int getLat() { return lat; }
baeed270-ac9b-4c9d-920a-c972429800f7
public void setLat(int lat) { this.lat = lat; }
449adcc6-4dcd-47ce-b845-c776916702ec
public int getLon() { return lon; }
7fd435bd-0007-40d4-840b-6385ca00fe41
public void setLon(int lon) { this.lon = lon; }
aa06f872-75dc-4e8d-af8d-b4919fdd9841
public String getmDate() { return formatter.print(mDate); }
22aab75c-11b7-4d9e-b3ed-6d2102e10403
public void setmDate(int mDate) { this.mDate = new DateTime(mDate*1000L, DateTimeZone.UTC); }
223ca4c4-4903-40d4-8d54-d2700890e109
public String getNote() { return note; }
7602e2b7-9859-4106-ba36-37dbd956d9e2
public void setNote(String note) { this.note = note; }
8cd33a3f-f6ab-49f3-b4eb-8eb24685c948
@Override public String getAccessToken(String code) { AccessToken accessToken = ihealthApi.getAccessToken(clientId, clientSecret, redirectUri, code); String token = accessToken.getAccessToken(); accessTokenSession.setAccessToken(token); accessTokenSession.setUserId(accessToken.getUserId()); return token; }
e48f5b48-4b2a-4c54-a623-ea9a2b1a66a2
@Override public BloodPressure getBloodPresure(String userId, String accessToken, DateTime starTime, DateTime endTime, int pageIndex) { BloodPressure bloodPressure = ihealthApi.getBp(userId, clientId, clientSecret, redirectUri, accessToken, starTime, endTime, pageIndex, sc, sv); return bloodPressure; }
5f0a960d-5dbb-428f-8d15-bd066b7dfc84
@Override public String getUserAuthorizationUri() { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(userAuthorizationUri); builder.queryParam("client_id", clientId); builder.queryParam("response_type", "code"); builder.queryParam("redirect_uri", redirectUri); builder.queryParam("APIName", "OpenApiBP"); return builder.build().toString(); }
0efce398-154c-47b3-9458-5170ea2a99fb
@Override public boolean isValidAccessToken() { if (accessTokenSession.getAccessToken() != null) { return true; } else { return false; } }
8183c2b0-834f-4e56-b5b8-4f24e43d67d5
@Override public String getAccessToken() { return accessTokenSession.getAccessToken(); }
825cdfe4-77b9-4f5a-a282-6b84b87f1992
@Override public String getUserId() { return accessTokenSession.getUserId(); }
9c834941-c893-458e-82ff-55b29a5aac78
public String getAccessToken() { return accessToken; }
b40bf4f6-231b-46fa-b4a2-e19e0dcd273e
public void setAccessToken(String accessToken) { this.accessToken = accessToken; }
12199ce2-529f-46a9-9a34-e1bb6cd16920
public String getUserId() { return userId; }
18278bab-24e0-4e84-b701-c2ec7f422885
public void setUserId(String userId) { this.userId = userId; }
dd185d36-2caf-4201-8b62-af904e0222c4
public static long getSerialversionuid() { return serialVersionUID; }
e3f46080-871f-4f2c-9bd3-b82543f5936e
String getAccessToken(String code);
a11e44d0-1bf9-4b4d-9929-a1145d3c9296
BloodPressure getBloodPresure(String userId, String accessToken, DateTime starTime, DateTime endTime, int pageIndex);
45d57b32-bab1-4b06-af17-780de85c855c
String getUserAuthorizationUri();
7e3d56fc-f0ca-49d0-a7a8-7bd5be3a2617
boolean isValidAccessToken();
fff1e977-bce5-4f6a-ac59-92f8b15427f1
String getAccessToken();
a232a2d3-af6c-4bcd-9ce6-40e119d53d4d
String getUserId();
14b01bd6-2781-43f5-a500-e991a9a121b7
@Autowired public IhealthApi(RestTemplate restTemplate) { this.restTemplate = restTemplate; }
3b8b649b-f7f3-462e-a017-5105be63926a
public AccessToken getAccessToken(String client_id, String client_secret, String redirect_uri, String code) { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(userAuthorizationUri); builder.queryParam("client_id", client_id); builder.queryParam("client_secret", client_secret); builder.queryParam("grant_type", "authorization_code"); builder.queryParam("redirect_uri", redirect_uri); builder.queryParam("code", code); AccessToken accessToken = restTemplate.getForObject(builder.build().toString(), AccessToken.class); return accessToken; }
a0a2d6c5-f51e-4a64-8e7a-35a533c9cbb2
public BloodPressure getBp(String userId, String clientId, String clientSecret, String redirectUri, String accessToken, DateTime starTime, DateTime endTime, int pageIndex, String sc, String sv) { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(bpApiUrl); builder.pathSegment(userId); builder.pathSegment("bp.json"); builder.queryParam("client_id", clientId); builder.queryParam("client_secret", clientSecret); builder.queryParam("grant_type", "authorization_code"); builder.queryParam("redirect_uri", redirectUri); builder.queryParam("access_token", accessToken); if (starTime != null) { builder.queryParam("start_time", Long.toString(starTime.getMillis() / 1000)); } else { builder.queryParam("start_time", Long.toString((new DateTime(DateTimeZone.UTC)).minusYears(5).getMillis() / 1000)); } if (endTime != null) { builder.queryParam("end_time", Long.toString(endTime.getMillis() / 1000)); } builder.queryParam("page_index", pageIndex); builder.queryParam("sc", sc); builder.queryParam("sv", sv); BloodPressure bloodPressure = restTemplate.getForObject(builder.build().toString(), BloodPressure.class); return bloodPressure; }
26abe95b-ff76-4f6f-ad5d-fc6db574a604
public List<BpData> getBpDataList() { return bpDataList; }
5a2e9464-fbac-458b-95a0-5946325bb95c
public void setBpDataList(List<BpData> bpDataList) { this.bpDataList = bpDataList; }
983e5290-0f3f-4102-8316-045ae3a3b5a7
public String getNextPageUrl() { return nextPageUrl; }