id
stringlengths
36
36
text
stringlengths
1
1.25M
8fa1c4e3-e662-447e-87ac-9b9449ff441c
@Override public String toString(){ String s=Arrays.toString(this.getArrival()); return s; }
61f09b0c-94f9-4959-97e0-deeba3b44aae
public static void main(String...args){ int LAMBDA=3; int NUM_TASKS=50; out.println( Arrays.toString(new ArrivalGenerator(NUM_TASKS,LAMBDA).getArrival()) ); }
0507e2c1-38bf-4fae-86e8-3d9c591dc1ab
private MachineHeterogeneity(int h){ this.h=h; }
0b4077cb-af7c-4df1-8787-1082cb198592
public int getNumericValue(){ return h; }
bbcef444-849e-48cd-b6f3-214c7c03bf36
public Task(int arrivalTime, int task_id){ tid=task_id; aTime=arrivalTime; }
634343c1-e089-4fe7-9783-2afd381467c3
public int get_aTime() { return aTime; }
6b7e3929-5b6f-4908-9dfe-fc50bb07dcdc
public void set_aTime(int aTime) { this.aTime = aTime; }
2d7ab847-473d-4fab-ba8e-c30e8f040369
public int get_cTime() { return cTime; }
3e3a4745-d81b-4011-b427-472f60431f17
public void set_cTime(int cTime) { this.cTime = cTime; }
613cf0af-5bbf-45e2-84ed-b5ec8ab7902d
public int get_eTime() { return eTime; }
fe265423-ca35-4e11-afe4-af9f7e09d5a9
public void set_eTime(int eTime) { this.eTime = eTime; }
d5cde320-3a9e-48b8-930d-649e5a0496a4
public AppTest( String testName ) { super( testName ); }
10cfb957-e391-4f5d-86eb-fe100e207b41
public static Test suite() { return new TestSuite( AppTest.class ); }
3cd60783-c6b2-4d53-ab51-7df3c7227be0
public void testApp() { assertTrue( true ); }
9b66fe84-f3d5-4f20-90fc-ff6d7fff1fdb
public static void main (String[] args){ Book b1, b2, b3, b4, b5; b1 = new Book("From Russia With Love", "Greg Hines"); b2 = new Book("Living Smart", "Rita Langill"); b3 = new Book("Singing in the Rain", "Harry Conner"); b4 = new Book("Good Housekeeping", "Pat Burns"); b5...
315b233a-126d-4d81-8170-af541249d275
public GuessingGame() { initComponents(); machine = new GuessMachine(); }
67c91d0e-d20f-476f-b3a8-a22303310fd4
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jProgressBar1 = new javax.swing.JProgressBar(); jLabel1 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); ...
71e32567-5df3-4148-a532-58bacb63c2a0
public void actionPerformed(java.awt.event.ActionEvent evt) { btnsubmitActionPerformed(evt); }
b1bf4ffa-4148-406f-afa1-7d826f32ef2d
private void btnsubmitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsubmitActionPerformed guess = Integer.parseInt(txtguess.getText()); if(machine.setGuess(guess)){ lblresult.setText(machine.giveHint()); lblattempts.setText("" + machine.getNumGuesses()); ...
385f668f-b38c-4abd-9a8f-ab873bf4a599
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://down...
7430f83a-9c13-475e-ad0a-d8de61e83ed2
public void run() { new GuessingGame().setVisible(true); }
3ac0e69a-a490-490d-9ac3-9e907ce4984f
public Employee(){ name = ""; type = 0; rate = 0; hours = 0; }
c3412f08-55f7-448c-be50-1d5a41832241
public String getTypeRules(){ return "1 or 2"; }
b267bef3-82f3-4b96-84e9-af8e61521237
public String getNameRules(){ return "nonblank"; }
03d2b4cb-9a48-41d9-bc84-04ef63552b40
public String getRateRules(){ return "between 6.75 and 30.50, inclusive"; }
e2b5a232-760c-4b11-b798-4bb4b8a09fa7
public String getHourRules(){ return "between 1 and 60, inclusive"; }
79f783d7-6c66-4ce9-bab0-1a5fe1e493b0
public boolean setName(String nm){ boolean blank = (nm.equals("")); if(blank) return false; else{ name = nm; return true; } }
4b4b5de8-7868-4acf-aba4-d2187ce98a5e
public boolean setType(int tp){ boolean oneortwo = (tp == 1 || tp == 2); if (oneortwo){ type = tp; return true; } else return false; }
e8d978dc-d0e1-4d79-8b75-aea04f26ee65
public boolean setRate(double rt){ boolean rateok = (rt >= 6.75 && rt <= 30.50); if(rateok){ rate = rt; return true; } else return false; }
7db383af-d754-4409-ae59-759fb2d0c9e9
public boolean setHours(int hrs){ boolean hoursok = (hrs >= 1 && hrs <= 60); if (hoursok){ hours = hrs; return true; } else return false; }
76365575-873e-4edb-a871-88f2c32b12ff
public String getName(){ return name; }
2c85c515-3257-484d-98d2-e81b30343c6c
public double getPay(){ double pay; boolean noovertime = (hours <= 40 || type == 2); if (noovertime) pay = rate *hours; else pay = (hours-40)*(rate * 2) + rate * 40; return pay; }
0d24122b-aa67-468e-99a6-1468a1b4315a
public static void main(String[] args) { KeyboardReader r = new KeyboardReader(); Employee emp; //employee String name; //name int type; //type double rate; //hourly pay rate int hours; //hours worked String prompt; //user prompt emp = new Employee(); ...
7c0f9e5a-d64b-4698-b68c-bca037704d60
public Book(String title, String writer){ name = title; author = writer; }
53e8c07f-64a8-4e38-92bc-a35d5cbc4c45
public String getTitle(){ return name; }
88eea114-fd22-476a-a974-177f96f1d5f9
public Patron(String n){ name = n; b1 = null; b2 = null; b3 = null; }
5e130aea-6f09-41d2-9a1e-ffa6cca1f63d
public boolean borrow(Book b){ boolean canborrow = (b1 == null || b2 == null || b3 == null); if (canborrow){ if (b1 == null)b1=b; else if (b2 == null)b2=b; else b3=b; return true; } else return false; }
b50e8ce7-ba0b-40ca-8325-fb1d5f2a437c
public boolean hasBook(Book b){ if(b1 == b)return true; else if(b2 == b)return true; else if(b3 == b)return true; else return false; }
fb1ba71a-a61d-438c-bf0c-f57efc8491a3
public boolean returnBook(Book b){ if(hasBook(b)){ if(b1 == b)b1 = null; else if(b2 == b)b2 = null; else b3 = null; return true; } else return false; }
66e0f2e3-4ec8-46bd-a01b-03eb806355b5
public String getName(){ return name; }
55b3d3b0-fa8f-4bcf-b35b-09fa78cc0f6b
public GuessMachine(){ //generates random number from 1 to 100 number = (int)(Math.floor(Math.random()*100))+1; guess = 0; numguesses = 0; }
e3e5047e-9523-4f3f-85c9-81bce13a4102
public String giveHint(){ if(guess > number) return "Your guess was greater than the number"; else if(guess < number) return "Your guess was less than the number"; else return "You got it!"; }
20b582f3-79c3-4de9-833e-f20fb332f388
public boolean setGuess(int valid){ if(valid >=1 && valid <= 100){ numguesses++; guess = valid; return true; } else return false; }
924fac65-a9ed-4fae-a07d-2f47d5e0eb26
public int getNumGuesses(){ return numguesses; }
8c2677e5-dc79-428b-932c-6b7b50daa48b
public static void getFromDocAndPrint (Document doc, String id){ System.out.println("getFromDocAndPrint : " + doc.getElementById(id)); System.out.println("getFromDocAndPrint inner html : " + doc.getElementById(id).html()); }
806f4565-0128-47a9-8f84-e913e23203cc
private static void sendPost() { try { new PSEHTTPClient(); } catch (IllegalStateException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
5d3292b2-3ef8-468c-86b6-d5c4053beb73
public static void writeToFile(String element){ try { String filename= WRITE_LOGS_TO_FILE; FileWriter fw = new FileWriter(filename,true); //the true will append the new data fw.write(element +"\n");//appends the string to the file fw.close(); } catch(IOException ioe) { System.err...
7c110639-190f-4215-a00a-e557896b390f
public static void writeToFile(Element element){ try { String filename= WRITE_LOGS_TO_FILE; FileWriter fw = new FileWriter(filename,true); //the true will append the new data fw.write(element +"\n");//appends the string to the file fw.close(); } catch(IOException ioe) { System.er...
7ce4e101-34c8-4e35-a23a-e4ee379b73c6
private static Document parseFromFile () throws IOException{ File input = new File(STOCK_LIST_SOURCE_FILE); Document doc = Jsoup.parse(input, ENCODING, PSE_URL); return doc; }
82560758-d3a0-4194-af39-342b77ccdcbc
private static void setupProxies (){ if (!USE_PROXIES) return; System.setProperty("http.proxyHost", PROXY); System.setProperty("http.proxyPort", PORT); }
3e826c38-5bea-43a8-98ca-b39285ea2cc7
private static void parseFinancialsFromDocument(Document doc){ Elements el = doc.getElementsByTag("tr").select(".stripe"); for (int j = 0 ; j < el.size(); j++){ Element row = el.get(j); String statName = row.getAllElements().get(1).text().trim(); // Stat name int statID = fDAO.insertSecurityStatAndGetI...
339681a4-9caa-4310-8cbd-b66d2db17c26
public static void main (String [] args){ setupProxies(); sendPost(); SQLite4jWrapper.getInstance().open(); try { Document doc = parseFromFile(); Elements tables = doc.getElementsByTag("table"); System.out.print("List length : " + tables.size() + "\n"); String reutersURL; try { SQLite4jWrappe...
168dec07-9920-4bb8-94f7-075b2ffd7d34
public PSEHTTPClient() throws IllegalStateException, IOException{ HttpClient httpClient = HttpClientBuilder.create().build(); HttpHost proxy = new HttpHost(Main.PROXY, Integer.valueOf(Main.PORT)); RequestConfig config = RequestConfig.custom() .setProxy(proxy) .build(); H...
1cf25a22-c93d-457b-92f3-34ac1004510f
public String getResult() { return result; }
42d3840d-c63f-45c4-b6bc-dd16a29d5917
private SQLite4jWrapper() { // private constructor }
f80ae052-c156-4152-8a32-353cdf50aa36
public static SQLite4jWrapper getInstance() { return SQLite4jWrapperHolder.INSTANCE; }
5624db42-652e-4824-bdb0-3fa4d960ed5c
public boolean open(){ db = SQLite4jWrapperHolder.db; if (db == null) db = new SQLiteConnection(new File(DB_PATH)); if (db.isOpen()) return true; try { db.open(true); } catch (SQLiteException e) { db = null; e.printStackTrace(); } if (db != null){ initiateDBSchema(db); return true; ...
5b2d69d5-0477-4c40-89d3-2788090eb24e
public int queryWithIntResult (String query) throws SQLiteException{ open(); int result = -1; SQLiteStatement stmt = db.prepare(query); while (stmt.step()){ result = stmt.columnInt(0); } return result; }
50562470-c09f-443f-8082-534dddd35548
private void initiateDBSchema(SQLiteConnection db){ int currentDBVersion = -1; try { currentDBVersion = queryWithIntResult("PRAGMA user_version"); System.out.println("CURRENT DB VERSION : " + currentDBVersion); if (currentDBVersion < 1) v1Updates(db); } catch (SQLiteException e1) { // TODO Aut...
3d7a67e6-024b-40b6-9a84-a440e00102cb
public void close(){ if (db != null) { if (db.isOpen() && !db.isDisposed()){ db.dispose(); } } }
f39a05dd-f569-4253-904d-ce9e6b8f77b1
public SQLiteStatement prepare (String sql) throws SQLiteException{ // Tracer.trace("query : " + sql); return db.prepare(sql); }
e1219135-6fd0-4eeb-a706-b7fc03fa9c75
public int insertUniqueAndRetrieveID(){ return -1; }
b9c1082d-f655-498d-956c-def3a7d4bea2
public void exec (String sql) throws SQLiteException{ db.exec(sql); }
95263a7b-1b86-463c-965d-ea2d6c5569e6
protected SQLite4jWrapper readResolve() { return getInstance(); }
873fd8b2-a895-47a1-8d64-caf6c0fde7bd
private void v1Updates(SQLiteConnection db) throws SQLiteException{ System.out.println("V1 UPDATE INITIATED"); db.exec(Securities.CREATE_STMT); db.exec(Financials.CREATE_STMT); db.exec(SecurityStats.CREATE_STMT); db.exec("PRAGMA user_version = 1"); System.out.println("V1 UPDATE FINISHED"); }
f0ed4648-76f8-4bfb-8610-e4c46fc995dd
public String getValCompany() { return valCompany; }
36d569bf-456a-46c1-8202-0c3e11b42da4
public void setValCompany(String valCompany) { this.valCompany = valCompany; }
6563ec33-303e-44f5-8107-51fd552ccac4
public String getValSector() { return valSector; }
b87eaf49-04ac-4a0d-b870-1829dfa41d59
public void setValSector(String valSector) { this.valSector = valSector; }
4783fe79-6198-4ad8-ae5c-875fdc9c5616
public String getValIndustry() { return valIndustry; }
f18df7a9-be59-463e-835f-a86b89bcdd6a
public void setValIndustry(String valIndustry) { this.valIndustry = valIndustry; }
1e43781e-e469-4e02-bd96-ddb27639d30f
public int getStatID() { return statID; }
c23fd447-75be-4981-9441-6c7a2f863dd4
public void setStatID(int statID) { this.statID = statID; }
33924fd8-ef62-4d2b-823d-6e41f30c835d
public String getSymbol() { return symbol; }
a1d7a19e-c72f-49db-85cf-af69c59955e6
public void setSymbol(String symbol) { this.symbol = symbol; }
e81ddf09-9931-4a5f-b7d9-8bf657427cf9
public String getSymbolCode() { return symbolCode; }
3dcd72f9-7a6a-47ee-81df-9b495798310a
public void setSymbolCode(String symbolCode) { this.symbolCode = symbolCode; }
861c33b6-2b59-4fe3-8e8b-66b36d9f3e23
public String getLastTradeDate() { return lastTradeDate; }
83f7bcf2-ee4b-482e-963c-5a70ee24819d
public void setLastTradeDate(String lastTradeDate) { this.lastTradeDate = lastTradeDate; }
f0a4b3d0-d0ee-4b90-9ba0-0d42e1f674dd
public BigDecimal getLastTradePrice() { return lastTradePrice; }
13695e6a-c870-4bf7-a561-dda6bb999cd5
public void setLastTradePrice(BigDecimal lastTradePrice) { this.lastTradePrice = lastTradePrice; }
e353a312-5b88-4660-ba60-7be9ede4fa53
public double getFreeFloatLevel() { return freeFloatLevel; }
f60b57ed-76df-40dc-852f-523aca3eaed8
public void setFreeFloatLevel(double freeFloatLevel) { this.freeFloatLevel = freeFloatLevel; }
5c2fc7bb-17a6-4364-bb5c-1ba865635218
public double getPercentWeight() { return percentWeight; }
3608b12a-641f-4d18-b103-53c1aa44d32d
public void setPercentWeight(double percentWeight) { this.percentWeight = percentWeight; }
30f41817-2896-4b29-b8f3-913b0b48ee10
public long getOutstandingShares() { return outstandingShares; }
08252ebc-980e-4991-a9d7-58e72531c7be
public void setOutstandingShares(long outstandingShares) { this.outstandingShares = outstandingShares; }
3a120107-09ad-4dba-8e85-01faf4f2cd4b
public long getFreeFloatMarketCap() { return freeFloatMarketCap; }
eb1b9095-0c74-482f-8728-abd2199fa171
public void setFreeFloatMarketCap(long freeFloatMarketCap) { this.freeFloatMarketCap = freeFloatMarketCap; }
80cbfa69-00d9-4bac-bd1e-3c73bd8c24fa
public String getSecurityName() { return securityName; }
3fd7c03f-fb4b-4493-b6b1-a17f11bd6b9e
public void setSecurityName(String securityName) { this.securityName = securityName; }
33b38322-b76d-4d11-866c-22da168f50a0
public int insertSecurityStatAndGetID(String statName){ db = SQLite4jWrapper.getInstance(); int id = -1; if (db.open()){ try { String query = "INSERT OR IGNORE INTO " + Financials.TABLE_NAME + " (" + Financials.C_KEY + ") VALUES (?)"; SQLiteStatement stmt = db.prepare(query); st...
186e86b8-48db-40b1-a48f-e29986127281
public void getSymbol() { }
30dfea9a-a174-4ab8-bfce-8d54e0dd72d5
public void saveSymbol(Security security){ db = SQLite4jWrapper.getInstance(); if (db.open()){ try { String query = "INSERT OR REPLACE INTO " + Securities.TABLE_NAME + " (" + Securities.C_FULL_MARKET_CAP + ", " + Securities.C_LAST_TRADE_DATE + ", " + Securities.C_LAST_TRADE_PRICE + ", " +...
2847eae5-dc4e-429d-a62a-588fc66130c7
public void getSymbol() { }
3f145414-e22c-4721-9cab-3a3cc69da860
public int insertStatsForSecurity(Stat stat){ db = SQLite4jWrapper.getInstance(); int id = -1; if (db.open()){ try { String query = "INSERT OR REPLACE INTO " + SecurityStats.TABLE_NAME + " (" + SecurityStats.C_FINANCIALS_ID + ", " + SecurityStats.C_SECURITY_SYMBOL + ", " + SecurityStats....
4b04a95d-f0ef-44fe-9222-9a6833cf9b68
public void getSymbol() { }
9d2ee8e7-b26c-43cd-953a-d0634c168c72
public static void trace (Object what){ System.out.println(what); // System.out.println("\n"); }
8c512dfc-1906-48cf-8ba9-350a37f6c7ab
public static void main(String[] args) { DBFiller db = new DBFiller("86030925", 2); db.fillDB(); db.setAllRelations(); }
89487492-e970-4502-8121-8e0b2ef25bdc
public DownloaderGroup(String gid) { super(gid); }