id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
2c739eb4-7650-4619-bbcd-88e7aa1a8f47 | public void display() {
System.out.println("I'm a real Mallard duck.");
} |
319f5431-5e4a-4c8a-b16c-6568db83b1db | public void quack() {
System.out.println("Quack");
} |
b56fae11-e9af-48f1-8066-0f8f01ec67c4 | public static void main(String[] args) {
Duck mallard = new MallardDuck();
mallard.performQuack();
mallard.performFly();
} |
25d61c53-32a3-4d1f-8041-652ffd743a11 | public void fly() {
System.out.println("I can't fly.");
} |
084b8480-29e2-4823-9a73-76c7c60ca08a | public void quack() {
System.out.println("<< silence >>");
} |
f02f7171-84ef-4315-add4-f3c2d08912e3 | public void quack() {
System.out.println("Squeak");
} |
ed002980-3ba6-493f-b538-352e652ca41d | public void fly(); |
8095108e-a662-46ec-9add-fcdead684592 | public static String outStartEnd(Object obj , int isStart){
String StartEndMsg = "START";
if(isStart == OUT_END){
StartEndMsg = "END";
}
String restr = "======"+ StartEndMsg +"======" + obj.getClass().getName() + "============";
System.out.println(restr);
return restr;
} |
99f240af-fffd-4450-969e-db7f5336f88b | public TicketJPanel() {
super();
setBounds(10, 10, 300, 300);
JButton button = new JButton();
button.setBounds(10,10,100,50);
button.setText("button");
add(button, BorderLayout.NORTH);
} |
0ca8e7a0-79e8-4e3e-952d-5b7697a49065 | public SampleSplitPane() {
setBounds(50,50,300,300);
} |
f5f6c006-f2de-45f0-b78a-5d163ef932b0 | public SampleSplitPane(int newOrientation) {
super(newOrientation);
setBounds(50,50,300,300);
} |
5e2b1db0-ea0c-4d5c-89cb-363f0c99546e | @Override
public String toString() {
SampleStringUtility.outStartEnd(this, SampleStringUtility.OUT_START);
StringBuffer retSb = new StringBuffer();
// output to component list
Component[] coms = getComponents();
for(Component com : coms){
retSb.append("com:" + com.toString());
retSb.append(System.getP... |
331028dd-7166-44ba-908e-97f7e4aa17de | @Override
public String toString() {
SampleStringUtility.outStartEnd(this, SampleStringUtility.OUT_START);
StringBuffer retSb = new StringBuffer();
// output to component list
Component[] coms = getComponents();
for(Component com : coms){
retSb.append("com:" + com.toString());
retSb.append(System.getP... |
697765e5-6f61-4376-b0ed-b82d55eab54c | public SampleScreen(){
super();
setTitle("SampleAppliationDefaultTitle");
setBounds(10,10,1200,800);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} |
1e43571d-bcae-45bb-91f8-dc9f2d01dbf2 | private TicketJPanel getLeftPanel(){
if (leftPanel == null){
leftPanel = new TicketJPanel();
leftPanel.setBackground(Color.BLUE);
}
return leftPanel;
} |
3aca39b6-1d59-4206-b62e-8ce69d502249 | private TicketJPanel getRightPanel(){
if (rightPanel == null){
rightPanel = new TicketJPanel();
rightPanel.setBackground(Color.RED);
}
return rightPanel;
} |
5f702612-baac-471a-9cc8-984c695f28cd | private SampleSplitPane getSpiltPane(){
return getSpiltPane(JSplitPane.HORIZONTAL_SPLIT);
} |
08deecc8-9381-4baa-8039-fd2ee4220fb3 | private SampleSplitPane getSpiltPane(int SplitPaneLayout){
if (splitpane == null){
splitpane = new SampleSplitPane(SplitPaneLayout);
System.out.println(splitpane.getLayout().toString());
}
return splitpane;
} |
cf771ea5-f73a-45cc-84f9-c9a2329348e2 | public void setContent(){
JButton jb = new JButton("button");
jb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// TODO θͺεηζγγγγ‘γ½γγγ»γΉγΏγ
System.out.println(e.getSource().getClass().getName());
}
});
getLeftPanel().add(jb);
getSpiltPane().add(getLeftPanel()... |
630268db-3e54-4c73-ae4e-ac40d600a115 | public void actionPerformed(ActionEvent e) {
// TODO θͺεηζγγγγ‘γ½γγγ»γΉγΏγ
System.out.println(e.getSource().getClass().getName());
} |
31f9382a-9b9e-4b3b-98e0-9dd8f210b2bb | public String toString(){
SampleStringUtility.outStartEnd(this, SampleStringUtility.OUT_START);
StringBuffer retSb = new StringBuffer();
// output to component list
Component[] coms = getContentPane().getComponents();
for(Component com : coms){
retSb.append("com:" + com.toString());
retSb.append(Syste... |
08497b53-86c9-4285-b8ba-58f420b279a3 | public static void main(String[] args){
SampleGUIApplication sampleGUI = new SampleGUIApplication();
sampleGUI.makeScreenBoxLayout();
sampleGUI.makeScreen();
} |
3f4f7f6e-1dcf-47c2-afdc-09cff51b7e88 | private void makeScreenBoxLayout(){
SampleScreen screen = new SampleScreen();
screen.setContent();
screen.setTitle("makeScreenBoxLayout");
screen.setVisible(true);
screen.toString();
} |
33efbf35-eb13-45cc-9bb2-aa902956fb2f | private void makeScreen(){
SampleScreen screen = new SampleScreen();
// screen.setLayout(new BoxLayout(screen, BoxLayout.LINE_AXIS));
screen.setContent();
screen.setTitle("makeScreenBoxLayout");
screen.setVisible(true);
screen.toString();
} |
d993344b-1120-4d03-a0ad-a5e259ade52b | public Item(String link) {
this.url = link;
// If there isn't a problem loading the information then get the image that corresponds
// with the item.
if (loadInformation())
this.smallImg = createImageIcon(SMALL_HEIGHT);
} |
002ce64e-4fb8-4860-bb96-dcbc6512c635 | public Item(String title, String link) {
this.title = title;
this.url = link;
if (loadInformation())
this.medImg = createImageIcon(MED_HEIGHT);
} |
aa61b57f-bfcf-4b76-bdba-eed7c405d426 | private boolean loadInformation() {
Document doc = null;
try {
doc = Jsoup.connect(url).get();
} catch (IOException e) {
e.printStackTrace();
return false;
}
// If a title has not been set, retrieving the title of the item.
if (this.title == null) {
Elements title = doc
.select("td.bibInfo... |
4fb8e9ff-3270-4c13-b6f7-c7ddc35c5698 | private ImageIcon createImageIcon(int height) {
ImageIcon img;
// Getting image location.
if (typeOfMedia.contains("Jones Media DVD")) {
// If Jones DVD.
File f = new File(BEG_DVD_PATH
+ Integer.toString(jonesAccesionNum) + ".jpg");
if (f.exists()) {
img = new ImageIcon(BEG_DVD_PATH
+ Int... |
f11c5665-bf1b-456a-a694-ccc5b3d83b79 | public ArrayList<ArrayList<String>> getAllWebpageInformation(){
ArrayList<ArrayList<String>> data = new ArrayList<ArrayList<String>>();
Document doc = null;
try {
doc = Jsoup.connect(url).get();
} catch (IOException e) {
e.printStackTrace();
// TODO: return empty array?
}
labelInfoPairs ... |
f133226d-2036-4a04-83e7-995e96936922 | public void reloadInformation() {
loadInformation();
} |
dc72db3e-f0ec-4155-9292-89a50019adf8 | public ImageIcon getMedImgIcon() {
if (this.medImg == null)
this.medImg = createImageIcon(MED_HEIGHT);
return this.medImg;
} |
30038199-48d7-49c1-9a88-5764c66b79b7 | public ImageIcon getImgIcon() {
if (this.smallImg == null)
this.smallImg = createImageIcon(SMALL_HEIGHT);
return this.smallImg;
} |
d237ca76-328f-4ad7-9fc6-ea002dd012ce | public String getTitle() {
return this.title;
} |
4fd1329c-e8d5-47e7-8234-5dca6d3306c4 | public ArrayList<String> getType() {
return this.typeOfMedia;
} |
674e83b8-d9bc-484f-a683-54ab3ad01272 | public ArrayList<String> getCallNumberString() {
return this.callNumberString;
} |
7b50e2f3-5d61-4cb3-8793-cc5c59f4772a | public ArrayList<String> getStatus() {
return this.status;
} |
50f24d3d-aeab-4d14-8573-67a3f18972c2 | public String getSummary() {
return this.summary;
} |
e97f9894-4c0e-487c-9424-e356c4da1a71 | public int getJonesAccesionNum(){
return this.jonesAccesionNum;
} |
57048ab6-38cf-41de-aba5-306f24e52803 | public String getLanguage(){
return this.language;
} |
539564b9-bfd0-41a4-9107-2e6335ac267f | public String getPerformer(){
return this.performer;
} |
42675325-527b-46ef-9bcf-40fec332c672 | public String getRating(){
return this.rating;
} |
72f64698-54c7-45aa-9dbc-267a76ce1da4 | public GenreButton(int x, int y, String img_path, String url, ActionListener l){
ImageIcon icon = new ImageIcon(getClass().getResource(img_path));
this.setIcon(icon);
// Each buttons was placed by absolute positioning (no other layout allowed the flexibility
// needed).
this.setBounds(x, y, icon.getI... |
bf6b895d-bc12-4679-8d72-af5185d88707 | public URL getURL(){
return search_url;
} |
4daf275c-a35a-41a7-966b-2e5ad53e4e22 | public PromotionPanel() {
promotionalMovies = new ArrayList<Item>();
// Reading text file.
File f = new File(DISPLAY_MOVIES_FILE);
String title = "";
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(f));
String currentLine;
title = br.readLine();
br.readLine(); // Empty l... |
c03062ae-b183-4956-87b1-6c9b27ebd552 | private JPanel createRotatingMoviesPanel() {
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());
panel.setBorder(BorderFactory.createEmptyBorder());
// Adds the five next movies to the panel.
for (int a = 0, counter = current; a < 4; a++, counter++) {
if (counter == total)
counter = 0; //... |
6d5f39d7-6722-4e43-9738-2c8cf72139d4 | private void recreateRotatingMoviesPanel(){
BorderLayout layout = (BorderLayout) centerPanel.getLayout();
centerPanel.remove(layout.getLayoutComponent(BorderLayout.CENTER));
rotatingPanel = createRotatingMoviesPanel();
centerPanel.add(rotatingPanel, BorderLayout.CENTER);
centerPanel.validate();
timer.re... |
322be3f9-c4bf-449e-8e0f-12a263071cd0 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == next || e.getSource() == timer) {
// If next is clicked or if the timer goes off, rotation is increased and the movies
// will shift to the left.
if (current < total-1)
current++;
else
current = 0;
recreateRotatin... |
6153b3fc-b688-4d5b-b54a-2393f4ce9868 | @Override
public void mousePressed(MouseEvent e) {
if (e.getSource().getClass() == DisplayMoviePanel.class){
// If there is a mouse click and it was on a DisplayItemPanel the verbosePanel for that
// item is displayed.
DisplayMoviePanel panelClicked = (DisplayMoviePanel) e.getSource();
Item i = pane... |
236ff59d-6fd0-45ca-bba1-b512f9a9d9a3 | @Override
public void mouseEntered(MouseEvent arg0) {} |
704c0695-3b85-40cb-9d70-51c061c29e1c | @Override
public void mouseExited(MouseEvent arg0) {} |
65dc5f25-c6c8-45ff-8a0e-4e7c2c96a577 | @Override
public void mouseClicked(MouseEvent arg0) {} |
9918fa34-831d-4272-b1ad-c6ceb86e9012 | @Override
public void mouseReleased(MouseEvent arg0) {} |
59488405-5dd1-4979-848e-d3013d8fc638 | public ShortDescriptionPanel(Item i) {
this.setLayout(new BorderLayout());
this.item = i;
StringBuilder info = new StringBuilder(
"<html><body><font face=\"Corbel\"><font size=\"6\"><strong>");
info.append(item.getTitle());
info.append("</strong></font><font size=\"5\"><br/>");
ArrayList<String> t... |
00b8a989-48fb-4e39-b8c8-c3e0e8acd46b | public Item getItem(){
return this.item;
} |
36b6e1b6-b58d-4788-817b-eedd44da0d48 | public JTextPane getSummaryTextArea(){
// Needed for the MouseListener in SearchPanel.
return this.summary;
} |
bbec67f3-21a6-4d97-93b3-a05571a95ecf | public DisplayMoviePanel(Item i){
this.i = i;
// Movie Image.
JLabel cover = new JLabel(i.getMedImgIcon());
cover.setAlignmentX(Component.CENTER_ALIGNMENT);
cover.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
// Title.
JLabel name = new JLabel(i.getTitle());
name.setFont(MyFont.SMAL... |
93a6b562-e857-4edf-b858-41b95b0e0927 | public Item getItem(){
return this.i;
} |
a35210b0-1e53-4ae2-aa0c-ddf1e2b00b9d | private MovieKiosk() {
fullScreenSetUp();
// Jones Media Center logo in the upper left hand corner of the screen.
logo = new JButton(new ImageIcon(getClass().getResource("resources/Jones_Logo.png")));
logo.setBorder(BorderFactory.createEmptyBorder());
logo.setContentAreaFilled(false);
logo.addActionListen... |
fb80a1d5-84ff-47eb-a1ac-f73bf5f7376e | public void focusGained(java.awt.event.FocusEvent evt) {
SwingUtilities.invokeLater( new Runnable() {
@Override
public void run() {
searchBar.selectAll();
}
});
} |
5e0ed549-33ac-4838-965a-a7e8b1deefda | @Override
public void run() {
searchBar.selectAll();
} |
3b5236ee-ca80-4db8-80b2-6591d9fba1c7 | private void fullScreenSetUp() {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] devices = env.getScreenDevices();
boolean isFullScreen = devices[MONITOR].isFullScreenSupported();
setUndecorated(isFullScreen);
setResizable(!isFullScreen);
if (isFullScreen) {
... |
a3b594b4-66a2-4694-b202-5eba38a71577 | private JPanel createGenrePanel(){
JPanel genreButtons = new JPanel();
genreButtons.setLayout(null);
genreButtons.setPreferredSize(new Dimension(1694, 216));
// Animation.
genreButtons.add(
new GenreButton(0, 1, "resources/Genre_Animation.png", ANIMATION_SEARCH, this));
// Horror.
genreButtons.add... |
c8b87216-c714-4e01-8ce8-0053b221af9d | @Override
public void actionPerformed(ActionEvent e) {
// Gets cardLayout needed to switch cards.
CardLayout cards = (CardLayout) (bottom.getLayout());
if (e.getSource() == logo) {
// When the JMC logo is clicked the user is directed back to the display of promotional
// movies.
cards.show(bottom, NE... |
bcc1500b-a8c4-4623-b6b1-4490a5642c26 | public static void main(String[] args) {
new MovieKiosk();
} |
2b8bd6a3-6e08-4ea8-b402-66dc39adade8 | public SearchPanel(String searchTerm) {
// Based on search term create search URL.
String[] words = searchTerm.split(" ");
StringBuilder formatedSearchTerm = new StringBuilder("");
for (String s : words){
if (!s.equals("")){
// If the string is not empty then it is appended.
formatedSearchTerm.appen... |
e521e8d9-59a3-44f2-9ca9-dcdfe70bedb6 | public SearchPanel(URL url){
setupPanelAndSearch(url.toString());
} |
10087016-1758-4e57-95f2-388bee52d156 | private void setupPanelAndSearch (String url){
this.setLayout(new CardLayout());
search = new JPanel();
search.setLayout(new BorderLayout());
movies = new JPanel();
movies.setLayout(new CardLayout());
System.out.println(url.toString());
if (performSearch(url.toString())) {
// If results were f... |
e4af0313-2e1c-4434-b279-371fff12fddc | private boolean performSearch(String url) {
// If search term was empty return false.
if (url.equals(BEG_URL + END_URL))
return false;
Document doc = null;
try {
doc = Jsoup.connect(url).get();
} catch (IOException e) {
e.printStackTrace();
return false; // Return false if there was a proble... |
6d73c5d0-aa8a-4c2b-9b54-a93173523a40 | private void retrieveAndDisplaySearchResults(int page) {
ArrayList<Item>searchResults = new ArrayList<Item>();
// If there is only one link, the link is formatted differently and once the link is
// displayed the method can return.
if (links.size() == 1) {
String url = links.get(0).select("a[href]").attr("... |
55a2a17c-10a3-4adb-9b14-2614c4777993 | private void createNavigationBar() {
// Creating navigation bar at the bottom of the screen.
navigationBar = new JPanel();
navigationBar.setLayout(new BoxLayout(navigationBar, BoxLayout.X_AXIS));
navigationBar
.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
// Creating the next button with i... |
be95542d-2fef-48e3-ae69-55f02cfe64dc | @Override
public void actionPerformed(ActionEvent e) {
if ((e.getSource() == moreResults) && (currentPage >= 1)
&& (currentPage < totalPages)) {
// If the next arrow is clicked and its not the last page, load and display the next
// page.
currentPage++;
retrieveAndDisplaySearchResults(currentPage);
... |
b024b95c-8fef-40e0-a473-f2cae8fad1ac | @Override
public void mousePressed(MouseEvent e) {
ShortDescriptionPanel panelClicked = null;
// If the ShortDescriptionPanel or any of its ancestors were clicked display the
// LongDescriptionPanel.
if (e.getSource().getClass() == ShortDescriptionPanel.class)
panelClicked = (ShortDescriptionPanel) e.getSo... |
5b7a199e-bee7-4117-a598-077563e1a08b | @Override
public void mouseEntered(MouseEvent arg0) {} |
7fc6fde5-4bf4-4843-b3ec-d823d2baffa5 | @Override
public void mouseExited(MouseEvent arg0) {} |
6bb45573-775f-4f4e-83c5-1527b3ad8543 | @Override
public void mouseClicked(MouseEvent arg0) {} |
9a8cd232-6ded-4e15-9b15-eecc6c1fc39a | @Override
public void mouseReleased(MouseEvent arg0) {} |
0ecff2e9-dfb7-4308-bd57-e70c50d230ba | public LongDescriptionPanel(Item i){
this.setBorder(BorderFactory.createEmptyBorder());
this.setLayout(new BorderLayout());
this.i = i;
ArrayList<String> types = i.getType();
ArrayList<String> callNum = i.getCallNumberString();
ArrayList<String> status = i.getStatus();
// Retrieving status informa... |
50f6937a-1f58-44d3-9729-585a8762d122 | private String entireRecord(){
entireRecord = true;
if (completeRecord == null){
// Display information to the left of the screen and placing it in a ScrollPane.
StringBuilder info = new StringBuilder("<html><body><font face=\"Corbel\">"
+ "<font size=\"11\"><strong>");
info.append(i.getTitle... |
56759747-6933-47b0-8c9d-39439af26854 | private String summarizedRecord(){
entireRecord = false;
if (sumRecord == null){
// Display information to the left of the screen and place it in a JScrollPane.
StringBuilder info = new StringBuilder("<html><body>"
+ "<font face=\"Corbel\"><font size=\"11\"><strong>");
info.append(i.getTitle());... |
f21a78af-000f-4cfa-b426-68b282b7131e | @Override
public void actionPerformed(ActionEvent e) {
// Show the entire record.
if (e.getSource() == switchRecords && !entireRecord){
switchRecords.setIcon(new ImageIcon(
getClass().getResource("resources/Display_Summarized_Record.png")));
text.setText(entireRecord());
text.setCaretPosition(0);
... |
3c740325-b082-48c1-89b9-e99fe9675abe | public static void main(String[] argv) {
System.out.println("-------- MySQL JDBC Connection Testing ------------");
try
{
Class.forName("com.mysql.jdbc.Driver");
}
catch (ClassNotFoundException e)
{
System.out.println("Driver Missing");
}
System.out.println("Driver Connected");
Connection conn... |
9cae695d-e48e-4cd6-8362-5e07b0a63b08 | @Override
public String fieldName(){return "Z";} |
894690f4-43de-42e4-b5da-fbb02f7f8a6a | @Override
public String testName(){return "<html>Z</html>";} |
b552a287-97db-4874-a30a-a6f8f63b0734 | @Override
public boolean calibrateToLessThan(){return true;} |
3e968c00-2dfe-42fb-b401-d3d83fb5c58f | @Override
public double test(double[][] calib, double[][] test, double N){
double Z = 0.0;
for (int i=0; i<calib.length; i++) {
for (int j=0; j<calib[i].length; j++) {
Z += ZScore.calcZScore( test[i][j], calib[i][j], N);
}
}
if ( Double.isNaN... |
b51e7209-e87c-4ae0-97f2-c62538fe0263 | public double test(double[][] calib, double[][] test){
double N=0.0;
// Calculate total count
for (int i=0; i<calib.length; i++) {
for (int j=0; j<calib[i].length; j++) {
N += calib[i][j];
}
}
return test(calib, test, N);... |
253a95cf-f429-4e9e-8524-7896d2d38e06 | public boolean isPerfect(double testStat){
//this method needs to be completed
//should return true if the testStat represents a perfect fit
return false;
} |
f74a3e78-d24b-410f-a8e3-f6b4a6bd90d7 | @Override
public String fieldName(){return "Chi2";} |
e6e4bf69-d6a8-4f2c-a1ef-78c3b9c32922 | @Override
public String testName(){return "<html>χ<sup>2</sup></html>";} |
1d9a0daa-c04c-4151-afae-aa7c1f121b41 | @Override
public boolean calibrateToLessThan(){return true;} |
dcc1a3cc-1f0c-4cb2-9a93-6627dc27bf6d | @Override
public double test(double[][] calib, double[][] test, double N){
return test(calib,test);
} |
22f13837-b214-4134-b6c2-9dbb3fd36276 | @Override
public double test(double[][] calib, double[][] test){
//sum of ((Tij-Pij)^2/Pij)
//where
//Tij is the number of interactions between origin i and destination j
//Pij is the predicted number of interactions between origin i and destination j
double chi=0;
... |
66886684-8f4d-4223-8eea-b7c15520bdb0 | public boolean isPerfect(double testStat){
//this method needs to be completed
//should return true if the testStat represents a perfect fit
return false;
} |
7f263176-c567-453b-af72-d7f75d82f3bf | @Override
public String fieldName(){return "SRMSE";} |
ea7f178a-90be-4955-a3e5-fef6416afbf6 | @Override
public String testName(){return "Standardized Root Mean Square Error";} |
4afc1f2a-ef8d-48d3-a14f-571ecfcfe4db | @Override
public boolean calibrateToLessThan(){return true;} |
04c0876d-7ccd-46c1-a5fa-59e1cfe09231 | @Override
public double test(double[][] calib, double[][] test, double N){
return test(calib,test);
} |
55fe5cb3-ed8d-445b-a6d2-cd17471cf6d2 | @Override
public double test(double[][] calib, double[][] test){
double m = (double)calib.length * (double)calib[0].length;
double ss = 0;
double T = 0;
for (int i=0;i<calib.length;i++){
for (int j=0;j<calib[i].length;j++){
ss += (Math.pow(calib[i][j]-t... |
6c7b766b-862e-45d9-aa4b-2a3c81405fcb | @Override
public boolean isPerfect(double testStat){
if ( testStat == 0.0 ){return true;}else{return false;}
} |
072223c3-6d18-444b-b3e6-75d6359040fa | @Override
public double test(double[][] calib, double[][] test, double N){
return test(calib,test);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.