id
stringlengths
36
36
text
stringlengths
1
1.25M
18698e7f-0581-42d5-a5ef-6c54be17d209
public void setFullTimer(boolean fullTimer) { this.fullTimer = fullTimer; }
661e917a-4feb-4c14-96e7-dabb640bcfc6
public Engineer(String firstName, String lastName, String department, int employeeNumber, String skillSet){ super(firstName, lastName, department, employeeNumber); this.skillSet = skillSet; }
f4152fe0-25c2-4e8f-a3ee-d32b94eab477
public String getSkillSet(){ return skillSet; }
f19a4c65-acd9-4bac-8999-35b90f6218c1
public void setSkillSet(String skillSet){ this.skillSet = skillSet; }
7f3ad824-7e49-4592-ae77-5c3afc3fa2fe
public Employee(String firstName, String lastName, String department, int employeeNumber){ this.firstName = firstName; this.lastName = lastName; this.department = department; this.employeeNumber = employeeNumber; }
b5029f05-f638-4981-aef7-c0e711b46743
public String getDetails () { return firstName + " " + lastName + ", afdeling: " + department + ", nummer: " + employeeNumber; }
2238cbad-8005-4742-a408-1c594a855082
public String getFirstName(){ return firstName; }
da83529c-de14-4e96-931e-a1e23a9fbbde
public String getLastName(){ return lastName; }
c716c11c-c9f0-4024-9f80-f15005ef0802
public String getDepartment(){ return department; }
c4cd5169-4994-4939-81a9-f8bda73c057a
public int getEmployeeNumber(){ return employeeNumber; }
7dd500ea-c123-43fe-a607-52bdcf17cc76
public void setFirstName(String firstName){ this.firstName = firstName; }
771202e0-5317-407d-9c0b-8de35d6c1c8a
public void setLastName(String lastName){ this.lastName = lastName; }
24adfa58-5256-4f24-a37d-05fe0917a5e6
public void setDepartment(String department){ this.department = department; }
47230a5c-6ff8-41b0-b1b8-2ed05c254f08
public void setemployeeNumber(int employeeNumber){ this.employeeNumber = employeeNumber; }
8e21a6aa-e267-430a-8534-209fc3c645b6
public Director(String firstName, String lastName, String department, int employeeNumber, String autoNaam, double budget){ super(firstName, lastName, department, employeeNumber, autoNaam); this.budget = budget; }
2a24b6ab-aa59-453d-8d6c-d69707b98451
public double getBudget() { return budget; }
ad33cfbb-4c49-43f2-ad5e-4e26718bb483
public void setBudget(double budget) { this.budget = budget; }
96cfdb3e-9189-410c-bf03-dc92e7b82eac
public void approveExpense(double exp){ }
821b4162-2440-4e67-a0db-b1d249d0e1e7
public static HashMap<String, LinkedList<String>> create_google_map() { HashMap<String, LinkedList<String>> google_map = new HashMap<String, LinkedList<String>>(); LinkedList<String> list1 = new LinkedList<String>(); list1.add("http://mondego.ics.uci.edu/"); list1.add("http://sdcl.ics.uci.edu/mondego-g...
4c820a1d-e1b4-4397-86f1-c65d2fb1042c
public static double calculate_ndcg(String query, LinkedList<String> url_list) { HashMap<String,LinkedList<String>> google_resultmap=create_google_map(); Iterator<String> It = url_list.iterator(); LinkedList<String> google_querymap = google_resultmap.get(query); if(google_querymap==null)return 1.0; ...
868bd50b-0086-4c82-9680-a7038d662299
public Server(int port) throws IOException { serverSocket = new ServerSocket(port); serverSocket.setSoTimeout(0);; }
9bbe1a1f-ac05-4910-957f-a8e0d13c2cca
public void run() { while(true) { try { System.out.println("Waiting for client on port " + serverSocket.getLocalPort() + "..."); Socket server = serverSocket.accept(); System.out.println("Just connected to "+ server.getRemoteS...
8a462b0e-6401-4fee-a003-f2a247d550a8
public static void main(String [] args) throws ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver"); Connection connect = DriverManager .getConnection("jdbc:mysql://localhost/crawlerindex?" + "user=root&password=connect"); connect.setAutoCommit(true); PreparedStatement ...
3811d449-a8b4-407a-a4e4-eada1fb08c65
public double update(String url) throws SQLException{ double temp=0.0; docMagStatement.setString(1,url); docmag=docMagStatement.executeQuery(); if(docmag.next()) temp= docmag.getDouble("td"); return temp; }
c5fa0e18-72cb-4713-8d5e-0ab54e755416
private HashMap<String, Double> sortByValues(HashMap<String, Double> map) { List<Double> list = new LinkedList(map.entrySet()); // Defined Custom Comparator here Collections.sort(list, new Comparator() { public int compare(Object o1, Object o2) { return ((Comparabl...
4a5666c7-135e-47f4-b2f5-f90f5597e5ef
public int compare(Object o1, Object o2) { return ((Comparable) ((Map.Entry) (o2)).getValue()) .compareTo(((Map.Entry) (o1)).getValue()); }
8740a164-894e-4ce6-a533-6e4857ed36d6
public page_rank(String query) throws ClassNotFoundException, SQLException { try { Class.forName("com.mysql.jdbc.Driver"); connect = DriverManager .getConnection("jdbc:mysql://localhost/crawlerindex?" + "user=root&password=connect"); connect.setAutoCommit(true); } catch (SQLException e) { e....
bb5a23df-387f-4eb8-9a9c-02e67f579f51
public ArrayList<String> get_search_urls() throws ClassNotFoundException, SQLException { String url; int docn, i; double freq, idf, tf, tfidf; ArrayList<String> url_list = new ArrayList<String>(); for (i = 0; i < query_words.length; i++) { if (query_map.containsKey(query_words[i])) { freq =...
07f1839b-1fd4-491d-a754-5705002d6799
public HashMap<String, Double> get_cosine_score_map( ArrayList<String> url_list) throws SQLException { HashMap<String, Result> temp_resultmap = null; String query_word, url; double score = 0, query_mag = 1; double tfidf_doc, tfidf_query, doc_mag; double temp_score; String first_result=null; for (int i ...
c89b78c4-021d-40e6-a8a6-9ae067a3427a
public ArrayList<String> page() throws ClassNotFoundException, SQLException { BufferedReader reader = null; ArrayList<String> url_lst = null; HashMap<String, Double> score_map = null; long startTime = System.currentTimeMillis(); url_lst = get_search_urls(); score_map = get_cosine_score_map(url_lst)...
79cfffbe-f6f7-40d6-96a0-be359c5c3e4a
public Stemmer() { b = new char[INC]; i = 0; i_end = 0; }
2d60b907-80bf-468f-85fb-7d7a7803ae6f
public void add(char ch) { if (i == b.length) { char[] new_b = new char[i+INC]; for (int c = 0; c < i; c++) new_b[c] = b[c]; b = new_b; } b[i++] = ch; }
5bf1840f-f567-4f70-aee9-0d8919d26f4f
public void add(char[] w, int wLen) { if (i+wLen >= b.length) { char[] new_b = new char[i+wLen+INC]; for (int c = 0; c < i; c++) new_b[c] = b[c]; b = new_b; } for (int c = 0; c < wLen; c++) b[i++] = w[c]; }
6670f1c6-cc81-41ab-96dd-aa4ead48ed61
public String toString() { return new String(b,0,i_end); }
e1a10b84-91bf-4f74-96da-f597bf679d7c
public int getResultLength() { return i_end; }
c36b6d90-c227-48bf-969e-1c74c1ff9256
public char[] getResultBuffer() { return b; }
2eab2d4f-6a7b-435b-8c0a-9a63193da8e1
private final boolean cons(int i) { switch (b[i]) { case 'a': case 'e': case 'i': case 'o': case 'u': return false; case 'y': return (i==0) ? true : !cons(i-1); default: return true; } }
85dc3d98-a99e-4c93-90ae-98066b758667
private final int m() { int n = 0; int i = 0; while(true) { if (i > j) return n; if (! cons(i)) break; i++; } i++; while(true) { while(true) { if (i > j) return n; if (cons(i)) break; i++; } i++; ...
e42aa381-8e9d-49eb-9bc5-3ffa4e2228b0
private final boolean vowelinstem() { int i; for (i = 0; i <= j; i++) if (! cons(i)) return true; return false; }
7df2f7d2-0a26-487a-9bd5-cb1b91bebfbd
private final boolean doublec(int j) { if (j < 1) return false; if (b[j] != b[j-1]) return false; return cons(j); }
741d328e-3f82-4dfb-9bec-218c4fd95c48
private final boolean cvc(int i) { if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false; { int ch = b[i]; if (ch == 'w' || ch == 'x' || ch == 'y') return false; } return true; }
2fe87c3d-cdef-407a-b83a-52219fd04adb
private final boolean ends(String s) { int l = s.length(); int o = k-l+1; if (o < 0) return false; for (int i = 0; i < l; i++) if (b[o+i] != s.charAt(i)) return false; j = k-l; return true; }
bedff391-7bbb-4588-ac00-fae5b61454e1
private final void setto(String s) { int l = s.length(); int o = j+1; for (int i = 0; i < l; i++) b[o+i] = s.charAt(i); k = j+l; }
9ffdbc39-72e2-4490-ab03-e47887244ca9
private final void r(String s) { if (m() > 0) setto(s); }
76f43edc-34f1-4060-a674-3557130c7d86
private final void step1() { if (b[k] == 's') { if (ends("sses")) k -= 2; else if (ends("ies")) setto("i"); else if (b[k-1] != 's') k--; } if (ends("eed")) { if (m() > 0) k--; } else if ((ends("ed") || ends("ing")) && vowelinstem()) { k = j; if (ends("at"))...
d444e340-000e-4e22-81bd-f32cf4d1e12d
private final void step2() { if (ends("y") && vowelinstem()) b[k] = 'i'; }
4a0c6e77-e72a-42f0-b2d4-493aa9e3cc42
private final void step3() { if (k == 0) return; /* For Bug 1 */ switch (b[k-1]) { case 'a': if (ends("ational")) { r("ate"); break; } if (ends("tional")) { r("tion"); break; } break; case 'c': if (ends("enci")) { r("ence"); break; } if (ends("anci")) ...
83fb129b-c612-4e93-bc55-b88d0b54407e
private final void step4() { switch (b[k]) { case 'e': if (ends("icate")) { r("ic"); break; } if (ends("ative")) { r(""); break; } if (ends("alize")) { r("al"); break; } break; case 'i': if (ends("iciti")) { r("ic"); break; } break; ...
31521b66-40b8-48b8-8a03-479091d4ac5d
private final void step5() { if (k == 0) return; /* for Bug 1 */ switch (b[k-1]) { case 'a': if (ends("al")) break; return; case 'c': if (ends("ance")) break; if (ends("ence")) break; return; case 'e': if (ends("er")) break; return; case 'i': if (ends("ic")...
09db3ff9-d39a-4c2b-beb6-ad5f7b938a4d
private final void step6() { j = k; if (b[k] == 'e') { int a = m(); if (a > 1 || a == 1 && !cvc(k-1)) k--; } if (b[k] == 'l' && doublec(k) && m() > 1) k--; }
e20e82ed-0849-486a-a378-53fe25580a7c
public void stem() { k = i - 1; if (k > 1) { step1(); step2(); step3(); step4(); step5(); step6(); } i_end = k+1; i = 0; }
cbd1d4dc-92bf-4cba-985e-cba209651a79
public static void main(String[] args) { char[] w = new char[501]; Stemmer s = new Stemmer(); for (int i = 0; i < args.length; i++) try { FileInputStream in = new FileInputStream(args[i]); try { while(true) { int ch = in.read(); if ...
ceef0ae7-f27e-4ce9-bfe2-e3df88583a72
public static String readURLContent(String urlString) throws IOException { URL url = new URL(urlString); Scanner scan = new Scanner(url.openStream()); String content = new String(); while (scan.hasNext()) content += scan.nextLine(); ...
7a70923b-80cd-4adb-9646-042ecd6caa7a
public static String findTitle(String str) { String tagOpen = "<title>"; String tagClose = "</title>"; int begin = str.indexOf(tagOpen) + tagOpen.length(); int end = str.indexOf(tagClose); return str.substring(begin, end); }
3dc250ec-ed13-49fc-9aa9-7727b4509db0
public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); String title; String urlString = "http://luci.ics.uci.edu/lightweight/bioFaculty/index.html"; if(urlString != null) { String content = readURLContent(urlString); ...
85881cdf-9bb9-45f5-950a-01acd3baf38a
public LinkedList<Integer> get_list_from_string(String pos) { String temp_str; temp_str = pos.replaceAll("[^0-9]", " "); String[] sar = temp_str.split("\\s+"); LinkedList<Integer> intArray = new LinkedList<Integer>(); for (int i = 0; i < sar.length; i++) { if((sar[i].compareTo("")!=0)) { in...
1da67547-8a4d-43a6-88bb-cf0d9c7a38bb
public HashMap<String, Double> postionScore(HashMap<String,HashMap<String,Result>> resultsetmap, HashMap<String, Double> score_map, String[] query_words, HashMap<String, Double>query_map){ if(query_words.length!=2)return null; HashMap<String, Result> temp_map = null; HashMap<String, Result> temp_map2 = null; t...
8b7ec622-f897-43ba-aac4-41391e85b2d9
public static void main(String[] args) { ServerNode server = new ServerNode(5555); server.run(); // new ServerDriver().testDB(); }
8a9b0e6a-2c9f-44a5-b407-d4020d67647a
public void testDB() { TidepoolDatabase db = new TidepoolDatabase(); // Insert User /*User userDummy = new User(); userDummy.setId(6); userDummy.setEmail("becky@gmail.com"); userDummy.setGender("female"); userDummy.setPassword("pwd"); userDummy.setPhoneNo("123"); userDummy.setRole("patient"); use...
f61b0250-adef-4977-ba50-e458ad093956
public ServerNode( int p ) { port = p; }
72df7ca6-f132-4cf5-a532-b03c516e63b9
public void setServerPort() throws IOException { serverSocket = new ServerSocket(port); }
f40a8984-1494-4e61-8b1e-2ca6c441e66f
public void setClientSocket() throws IOException { Socket clientSocket = serverSocket.accept(); ServerClient client = new ServerClient(clientSocket); Thread clientThread = new Thread(client); clientThread.start(); }
15276f37-8528-44a8-8053-2531d125191c
public void close() throws Exception { db.close(); serverSocket.close(); }
f0f9e869-b8db-495b-b2d7-19fecd46ca1f
public void run() { try { setServerPort(); while(true) setClientSocket(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
294a028b-2d06-4837-9923-deea40108583
public ServerClient(Socket sock) { client = sock; try { out = new ObjectOutputStream( client.getOutputStream() ); in = new ObjectInputStream( client.getInputStream() ); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
dbb1201b-c70e-4d85-a5f5-6d9611d7d65d
public void close() { try { if(!allClients.isEmpty() && allClients.get(email)!=null) allClients.remove(email); in.close(); out.close(); client.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
67697fdf-92cd-4d53-a60a-71f2b598193c
private void getEmail() { try { email = (String) in.readObject(); } catch (ClassNotFoundException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("email is " + email); }
2015a644-1b92-49c6-af01-d4413993be08
private boolean getUser() { user = db.getUser(email); if(user.getUsername()!=null) { System.out.println(user.getId() + " " + user.getUsername()); return true; } return false; }
1ea77197-7ee8-40c1-90d2-164020fa734a
public void signin() { try { // Receive email and pwd out.writeObject("email"); getEmail(); if(email==null) { out.writeObject("Fail to receive email!"); return; } // Find the user if(!getUser()) { out.writeObject("No such user!"); return; } // Receive the pwd...
fafa4512-f7f2-4947-a0fe-fc689fe65b50
public void register() { try { // Receive the user out.writeObject("user"); user = (User) in.readObject(); // Add the user int id = db.addUser(user); if(id==-1) { out.writeObject("Duplicate User"); return; } // Save and send back the user id user.setId(id); allClie...
feeb372a-c2eb-40b9-8a4b-de2ad581b4d7
public void update() { try { // Receive the user out.writeObject("update user"); user = (User) in.readObject(); // Add the user int res = db.updateUser(user); System.out.println("lat is " + user.getLocation_lat()); System.out.println("lng is " + user.getLocation_lng()); out.writeObje...
db31c903-42b6-4eb2-81ca-b939949804f7
public void sendData() { try { out.writeObject("userId"); long id = (long) in.readObject(); out.writeObject(db.getData(id)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.pr...
e512fb03-a431-45ae-8c60-ed58a358268d
public void sendUser() { try { // Receive the user out.writeObject("get uid"); long uid = (Long)in.readObject(); // Add the user User user = db.getUser(uid); out.writeObject(user); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStac...
40a4bd28-664d-46e6-b0cd-b07cef08b93a
public void sendFriends() { try { out.writeObject(db.getFriends(user.getId())); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
2904fdbe-08ad-4772-b0a9-4a9ba5ab6b1b
public void sendMsgProcess() { try { // Get friend email out.writeObject("friend email"); String friendEmail = (String) in.readObject(); // Maintain the friend if(friendEmail==null || allClients.get(friendEmail)==null) { out.writeObject("No such friend!"); return; } // Receive...
b7e2df5c-cee5-4a10-8e94-53295ba562db
public void sendMsg(String msg) { try { out.writeObject(msg); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
85e3896c-2d1f-4063-b40a-3137868e5155
public void sendRequest() { try { out.writeObject("friend email"); long id1 = user.getId(); String friendEmail = (String) in.readObject(); //Find the friend in the database User friend = db.getUser(friendEmail); if(friendEmail==null || friend==null) { out.writeObject("No such user!"); ...
cd9f1492-0922-48a2-bc83-21410dfc638b
public void receiveRequest() { try { // Return the request list to receiver ArrayList<User> res = db.getRequest(user.getId()); out.writeObject(res); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
516ed01e-95bc-425f-b595-8590101f18cd
public void sendRespond() { try { out.writeObject("sender id"); long friendId = (long) in.readObject(); //Get the respond, either "admit" or "refuse" out.writeObject("respond"); String status = (String) in.readObject(); if(status.equals("admit")) db.addFriend(user.getId(), friendId); ...
e87d04d4-63b7-4cdf-a0e7-f91bd2400cd5
public void receiveRespond() { try { // Get the respond from receivers ArrayList<User> res = db.getRespond(user.getId()); out.writeObject(res); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
d358a286-36a6-4fe5-9ac4-1e081ccd5319
public void deleteFriend() { try { out.writeObject("friend email"); long id1 = user.getId(); String friendEmail = (String) in.readObject(); //Find the friend in the database User friend = db.getUser(friendEmail); if(friendEmail==null || friend==null) { out.writeObject("No such friend!")...
c6f9ed23-07e3-4480-b384-c0999c405437
public void run() { String tmp = null; try { System.out.println("Start connection!"); while((tmp = (String) in.readObject())!=null){ System.out.println("From Client-" + email + ": " + tmp); if(tmp.equalsIgnoreCase("signout")) break; if(tmp.equalsIgnoreCase("signin")) signin(); if(tmp...
1b660265-cf2c-4c0b-b37e-82fa1957bb07
public double getLocation_lat() { return location_lat; }
aa654d88-abc5-41fa-b107-6ce575fb73c6
public void setLocation_lat(double location_lat) { this.location_lat = location_lat; }
24e9d376-55e2-40d5-98e4-9ade22e05ee0
public double getLocation_lng() { return location_lng; }
61357735-cf13-4736-b38e-5c10d046ef6c
public void setLocation_lng(double location_lng) { this.location_lng = location_lng; }
6b02fd78-3913-4316-a74d-5eac5fb259d6
public long getId() { return id; }
ba9cc469-f7a6-4b5f-bc82-3f545e338c2b
public void setId(long id) { this.id = id; }
3bffac3f-ba00-4d79-9555-8166068bd7e8
public String getEmail() { return email; }
822b6324-0b85-43ee-8643-310a2162312b
public void setEmail(String email) { this.email = email; }
58a72c25-dc2a-4c23-8839-15a0540396f7
public String getUsername() { return username; }
31ce0508-feed-4434-8849-5e5ef2cd2e32
public void setUsername(String username) { this.username = username; }
92ac9251-b189-44c4-a8e9-f304d3bc9f89
public String getPassword() { return password; }
7b4966ea-5d28-437d-b8bd-5287ea7f46d9
public void setPassword(String password) { this.password = password; }
6515df9c-8db6-46ef-83cb-276f442050ea
public String getConfirmPwd() { return confirmPwd; }
4ea38782-f45e-447c-93cb-af3b7f5bbec2
public void setConfirmPwd(String confirmPwd) { this.confirmPwd = confirmPwd; }
6c9c559f-5b64-425b-b67e-9d550013344d
public String getPhoneNo() { return phoneNo; }
d6c21141-c087-4d6c-ba1b-0ae12888d016
public void setPhoneNo(String phoneNo) { this.phoneNo = phoneNo; }
e04bdc9e-80a1-42b5-9c34-49eaf63c4855
public Date getDateOfBirth() { return dateOfBirth; }
2dafc43b-ca96-414a-bde1-8a5ee6f7b0ba
public void setDateOfBirth(Date dateOfBirth) { this.dateOfBirth = dateOfBirth; }