id
stringlengths
36
36
text
stringlengths
1
1.25M
029d2bec-0870-455a-870b-b4db5032894c
public void incrementCompteur() { int tmp = compteur; tmp++; try { Thread.sleep((long) (Math.random() * 50)); } catch (InterruptedException e) { e.printStackTrace(); } this.compteur = tmp; }
935f7bf3-1ada-49cd-abe0-f5d7b0edb503
public int getCompteur() { return compteur; }
c8bd14fd-e16e-48d9-9ee8-64a1a523951a
public static void main(String[] args) { Exemple1Thread1 thread1 = new Exemple1Thread1(1); Exemple1Thread1 thread2 = new Exemple1Thread1(2); new Thread(thread1).start(); new Thread(thread2).start(); }
0ab44a9d-77dd-4741-b7ea-3a13506a5658
public Exemple1Thread1(int numero) { super(); this.numero = numero; }
f905341b-be5b-42cf-a66e-4c8244b5bc2a
@Override public void run() { int i = 0; while (i < 5) { System.out.println("Thread " + numero); i++; } }
372e3166-7eea-40dc-9e05-ab7359344b34
public static String[] readVolumes() { String[] volumes = new String[NUMBERS]; for (int i = 0; i < volumes.length; i++) { try { volumes[i] = FileUtils.readFileToString(new File( "volumes/quote" + i + ".txt")); } catch (IOException e) { System.err.println("Erreur de lecture du volume " + i); ...
1bb7a7ee-3c01-4e86-b2b1-34b7bff873c7
public static void main(String[] args) { String contenu = "Ceci est le contenu de mon fichier"; String filename = "contenu.txt"; // TODO Ecrire le contenu dans un fichier }
46f74d4e-f8a1-4688-bf14-1eed31d13d64
public OwlWriter(Generator generator) { super(generator); }
bc29eb9d-d227-42b4-8f15-0542349e148a
void writeHeader() { String s; s = "xmlns:" + T_RDF_NS + "=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\""; out.println(s); s = "xmlns:" + T_RDFS_NS + "=\"http://www.w3.org/2000/01/rdf-schema#\""; out.println(s); s = "xmlns:" + T_OWL_NS + "=\"http://www.w3.org/2002/07/owl#\""; out.p...
4b495337-aec4-48b4-9be2-b85fb5215a02
public void start();
04656d79-0fdb-4aae-9d91-8d585707733b
public void end();
4d97bcc7-323a-4b33-a9b5-5558dba0b3d6
public void startFile(String fileName);
6be6fe7a-4343-4885-9e6f-399d3b15e999
public void endFile();
16fb2cf3-d6f0-4b23-ba02-88d72233b73c
public void startSection(int classType, String id);
7643c8f1-f958-43d6-ae6e-cb3b60dd2644
public void startAboutSection(int classType, String id);
f85c0361-c361-469c-bfd2-d6bd783e3cbe
public void endSection(int classType);
9a1ba279-101c-43b7-a5d1-d53954ed3ff5
public void addProperty(int property, String value, boolean isResource);
5bb59ff1-5f4e-4d9e-a4aa-7319a049d9de
public void addProperty(int property, int valueClass, String valueId);
424e2250-e735-4f5b-be44-b2685c2f0ea2
public RdfWriter(Generator generator) { this.generator = generator; }
7fbeb88b-9048-42ff-b6c2-17595bb84020
public void start() {}
23bf7a61-1a4e-4bd6-9e6d-794b3a549bc8
public void end() {}
602f49f9-ad7c-469e-9307-b217b0ad14de
public void startFile(String fileName) { String s; try { out = new PrintStream(new FileOutputStream(fileName)); s = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; out.println(s); s = "<" + T_RDF_PREFIX + "RDF"; out.println(s); writeHeader(); } catch (IOException e) { ...
b51cbfc3-48ac-4134-97d2-fb2852540e5d
public void endFile() { String s; s = "</" + T_RDF_PREFIX + "RDF>"; out.println(s); out.close(); }
6b2a893d-1e81-4fba-af78-81e4eef773b5
public void startSection(int classType, String id) { generator.startSectionCB(classType); out.println(); String s = "<" + T_ONTO_PREFIX + Generator.CLASS_TOKEN[classType] + T_SPACE + T_RDF_ABOUT + "=\"" + id + "\">"; out.println(s); }
be0253ba-9f97-44d5-aa6c-cd4e01e7181c
public void startAboutSection(int classType, String id) { generator.startAboutSectionCB(classType); out.println(); String s = "<" + T_ONTO_PREFIX + Generator.CLASS_TOKEN[classType] + T_SPACE + T_RDF_ABOUT + "=\"" + id + "\">"; out.println(s); }
ba1f2d0f-47e4-4e69-962c-783b2c73d065
public void endSection(int classType) { String s = "</" + T_ONTO_PREFIX + Generator.CLASS_TOKEN[classType] + ">"; out.println(s); }
188c8152-2e6e-4450-9bd1-3d56a3a63ab0
public void addProperty(int property, String value, boolean isResource) { generator.addPropertyCB(property); String s; if (isResource) { s = " <" + T_ONTO_PREFIX + Generator.PROP_TOKEN[property] + T_SPACE + T_RDF_RES + "=\"" + value + "\" />"; } else { //literal s = " <" +...
4807540b-29bd-4386-b0c1-54cbfbf951b6
public void addProperty(int property, int valueClass, String valueId) { generator.addPropertyCB(property); generator.addValueClassCB(valueClass); String s; s = " <" + T_ONTO_PREFIX + Generator.PROP_TOKEN[property] + ">\n" + " <" + T_ONTO_PREFIX + Generator.CLASS_TOKEN[valueClass] + T_SPA...
2ffe88b8-85b6-49a7-853f-c338fe755b09
abstract void writeHeader();
c53fd1d0-49a7-49e0-8321-e0e1d29db7f9
public static void main(String[] args) { //default values int univNum = 1, startIndex = 0, seed = 0; boolean daml = false; String ontology = null; try { String arg; int i = 0; while (i < args.length) { arg = args[i++]; if (arg.equals("-univ")) { if (i < a...
90823634-535e-4b54-a75d-39349087e140
public Generator() { instances_ = new InstanceCount[CLASS_NUM]; for (int i = 0; i < CLASS_NUM; i++) { instances_[i] = new InstanceCount(); } properties_ = new PropertyCount[PROP_NUM]; for (int i = 0; i < PROP_NUM; i++) { properties_[i] = new PropertyCount(); } random_ = new Rand...
9c246d1e-71de-4765-bf2b-eda884448bdd
public void start(int univNum, int startIndex, int seed, boolean daml, String ontology) { this.ontology = ontology; isDaml_ = daml; if (daml) writer_ = new DamlWriter(this); else writer_ = new OwlWriter(this); startIndex_ = startIndex; baseSeed_ = seed; inst...
99a28fd5-499f-406e-86bd-bbd856b4f34a
void startSectionCB(int classType) { instances_[classType].logNum++; instances_[classType].logTotal++; }
026a4ba2-7715-4bcd-8880-d14a51865768
void startAboutSectionCB(int classType) { startSectionCB(classType); }
997d9cac-e344-49de-8f69-6e20232b38cc
void addPropertyCB(int property) { properties_[property].logNum++; properties_[property].logTotal++; }
ade59ad4-7a9d-4508-983f-181c2a4eb2e1
void addValueClassCB(int classType) { instances_[classType].logNum++; instances_[classType].logTotal++; }
3e5977e3-887c-4044-856c-b0e8d0c84486
private void _setInstanceInfo() { int subClass, superClass; for (int i = 0; i < CLASS_NUM; i++) { switch (i) { case CS_C_UNIV: break; case CS_C_DEPT: break; case CS_C_FULLPROF: instances_[i].num = _getRandomFromRange(FULLPROF_MIN, FULLPROF_MAX); ...
93f01b89-72d4-4c23-a59c-0c18a02093e7
private void _generate() { System.out.println("Started..."); try { log_ = new PrintStream(new FileOutputStream(System.getProperty("user.dir") + "\\" + LOG_FILE)); writer_.start(); for (int i = 0; i < instances_[CS_C_UNIV].num; i++) { _ge...
931db8aa-2db5-4fec-b90b-47cfa159da46
private void _generateUniv(int index) { //this transformation guarantees no different pairs of (index, baseSeed) generate the same data seed_ = baseSeed_ * (Integer.MAX_VALUE + 1) + index; random_.setSeed(seed_); //determine department number instances_[CS_C_DEPT].num = _getRandomFromRange(DEPT_MIN...
87c18bb7-8b90-4155-b314-c5f05ab19ce1
private void _generateDept(int univIndex, int index) { String fileName = System.getProperty("user.dir") + "\\" + _getName(CS_C_UNIV, univIndex) + INDEX_DELIMITER + index + _getFileSuffix(); writer_.startFile(fileName); //reset _setInstanceInfo(); underCourses_.clear(); gradCourses_.clea...
16302a80-47e2-45b5-80d5-0bd7ef7e0a0f
private void _generateASection(int classType, int index) { _updateCount(classType); switch (classType) { case CS_C_UNIV: _generateAUniv(index); break; case CS_C_DEPT: _generateADept(index); break; case CS_C_FACULTY: _generateAFaculty(index); bre...
5d872d49-b891-4e24-845c-1451f2255105
private void _generateAUniv(int index) { writer_.startSection(CS_C_UNIV, _getId(CS_C_UNIV, index)); writer_.addProperty(CS_P_NAME, _getRelativeName(CS_C_UNIV, index), false); writer_.endSection(CS_C_UNIV); }
3eea2160-b552-43cb-a162-473e529c9762
private void _generateADept(int index) { writer_.startSection(CS_C_DEPT, _getId(CS_C_DEPT, index)); writer_.addProperty(CS_P_NAME, _getRelativeName(CS_C_DEPT, index), false); writer_.addProperty(CS_P_SUBORGANIZATIONOF, CS_C_UNIV, _getId(CS_C_UNIV, instances_[CS_C_UNIV].count - 1)); ...
fe8ded7c-7bb7-48d4-a83e-61a24802015e
private void _generateAFaculty(int index) { writer_.startSection(CS_C_FACULTY, _getId(CS_C_FACULTY, index)); _generateAFaculty_a(CS_C_FACULTY, index); writer_.endSection(CS_C_FACULTY); }
9e295a74-fd02-4cbb-816a-4cdb4109bdea
private void _generateAFaculty_a(int type, int index) { int indexInFaculty; int courseNum; int courseIndex; boolean dup; CourseInfo course; indexInFaculty = instances_[CS_C_FACULTY].count - 1; writer_.addProperty(CS_P_NAME, _getRelativeName(type, index), false); //undergradutate cours...
89cd8e2a-1be4-4f5a-be85-ef149781bf18
private int _AssignCourse(int indexInFaculty) { //NOTE: this line, although overriden by the next one, is deliberately kept // to guarantee identical random number generation to the previous version. int pos = _getRandomFromRange(0, remainingUnderCourses_.size() - 1); pos = 0; //fetch courses in sequenc...
584d12be-e183-49c9-95b8-25b42b522efb
private int _AssignGraduateCourse(int indexInFaculty) { //NOTE: this line, although overriden by the next one, is deliberately kept // to guarantee identical random number generation to the previous version. int pos = _getRandomFromRange(0, remainingGradCourses_.size() - 1); pos = 0; //fetch courses in ...
f793ad55-6e4e-448c-b553-840ea540bd1a
private void _generateAProf(int index) { writer_.startSection(CS_C_PROF, _getId(CS_C_PROF, index)); _generateAProf_a(CS_C_PROF, index); writer_.endSection(CS_C_PROF); }
23480455-469a-46f9-a726-f3a1c83062ad
private void _generateAProf_a(int type, int index) { _generateAFaculty_a(type, index); writer_.addProperty(CS_P_RESEARCHINTEREST, _getRelativeName(CS_C_RESEARCH, random_.nextInt(RESEARCH_NUM)), false); }
b377ef08-c5e6-4829-8218-8882a64c7125
private void _generateAFullProf(int index) { String id; id = _getId(CS_C_FULLPROF, index); writer_.startSection(CS_C_FULLPROF, id); _generateAProf_a(CS_C_FULLPROF, index); if (index == chair_) { writer_.addProperty(CS_P_HEADOF, _getId(CS_C_DEPT, instances_[CS_C_DEPT]....
84124f2a-2427-4fa3-9333-5c36c20387d1
private void _generateAnAssociateProfessor(int index) { String id = _getId(CS_C_ASSOPROF, index); writer_.startSection(CS_C_ASSOPROF, id); _generateAProf_a(CS_C_ASSOPROF, index); writer_.endSection(CS_C_ASSOPROF); //_assignFacultyPublications(id, ASSOPROF_PUB_MIN, ASSOPROF_PUB_MAX); _assignFacul...
ed881c97-0293-410b-8d98-cd94e6122ee2
private void _generateAnAssistantProfessor(int index) { String id = _getId(CS_C_ASSTPROF, index); writer_.startSection(CS_C_ASSTPROF, id); _generateAProf_a(CS_C_ASSTPROF, index); writer_.endSection(CS_C_ASSTPROF); //_assignFacultyPublications(id, ASSTPROF_PUB_MIN, ASSTPROF_PUB_MAX); _assignFacul...
78f5044d-7c19-4e5e-8fc6-3dc41e6cd628
private void _generateALecturer(int index) { String id = _getId(CS_C_LECTURER, index); writer_.startSection(CS_C_LECTURER, id); _generateAFaculty_a(CS_C_LECTURER, index); writer_.endSection(CS_C_LECTURER); //_assignFacultyPublications(id, LEC_PUB_MIN, LEC_PUB_MAX); _assignFacultyConferencePapers...
6fc3e717-3441-49d7-b71f-d94e969a65e1
private void _assignFacultyPublications(String author, int min, int max) { int num; PublicationInfo publication; num = _getRandomFromRange(min, max); for (int i = 0; i < num; i++) { publication = new PublicationInfo(); publication.id = _getId(CS_C_PUBLICATION, i, author); publication....
5bd2879a-800d-43b6-9f0f-c88da1db4b97
private void _assignFacultyConferencePapers(String author, int min, int max) { //Added int num; ConferencePaperInfo conferencePaper; num = _getRandomFromRange(min, max); for (int i = 0; i < num; i++) { conferencePaper = new ConferencePaperInfo(); conferencePaper.id = _getId(CS_C_CONFPAPER, ...
977f5414-f92c-4294-9de7-b57034e3b3a6
private void _assignFacultyJournalArticles(String author, int min, int max) { //Added int num; JournalArticleInfo journalArticle; num = _getRandomFromRange(min, max); for (int i = 0; i < num; i++) { journalArticle = new JournalArticleInfo(); journalArticle.id = _getId(CS_C_JOURNALARTICLE, ...
dfa66e96-ce62-4201-9fe9-80a36e8c3db7
private void _assignGraduateStudentPublications(String author, int min, int max) { int num; PublicationInfo publication; num = _getRandomFromRange(min, max); ArrayList list = _getRandomList(num, 0, publications_.size() - 1); for (int i = 0; i < list.size(); i++) { publication = (PublicationIn...
160687a1-ade2-43a8-b80e-663903c6d859
private void _generatePublications() { for (int i = 0; i < publications_.size(); i++) { Object publication = publications_.get(i); if (publication instanceof ConferencePaperInfo) { //Added _generateAConferencePaper((ConferencePaperInfo) publication); } else if (publication instanceof Journ...
0e6f3500-0198-4963-a0b5-7ba292ce5f4c
private void _generateAPublication(PublicationInfo publication) { writer_.startSection(CS_C_PUBLICATION, publication.id); writer_.addProperty(CS_P_NAME, publication.name, false); for (int i = 0; i < publication.authors.size(); i++) { writer_.addProperty(CS_P_PUBLICATIONAUTHOR, ...
64c8c27d-5e43-4657-b813-b33befaf8e8e
private void _generateAConferencePaper(ConferencePaperInfo conferencePaper) { //Added writer_.startSection(CS_C_CONFPAPER, conferencePaper.id); writer_.addProperty(CS_P_NAME, conferencePaper.name, false); writer_.addProperty(CS_P_YEAR, Integer.toString(conferencePaper.year), false); writer_.addProperty...
1f432a6d-bc19-46ad-823a-48753ce5e038
private void _generateAJournalArticle(JournalArticleInfo journalArticle) { //Added writer_.startSection(CS_C_JOURNALARTICLE, journalArticle.id); writer_.addProperty(CS_P_NAME, journalArticle.name, false); writer_.addProperty(CS_P_YEAR, Integer.toString(journalArticle.year), false); writer_.addProperty(C...
adb371e9-68ca-45f2-b5bb-9aa40aa58455
private void _generateAStudent_a(int type, int index) { writer_.addProperty(CS_P_NAME, _getRelativeName(type, index), false); writer_.addProperty(CS_P_MEMBEROF, _getId(CS_C_DEPT, instances_[CS_C_DEPT].count - 1), true); writer_.addProperty(CS_P_EMAIL, _getEmail(type, index), false); ...
bdef680d-cf08-4402-b7dd-8507427df2bb
private void _generateAnUndergraduateStudent(int index) { int n; ArrayList list; writer_.startSection(CS_C_UNDERSTUD, _getId(CS_C_UNDERSTUD, index)); _generateAStudent_a(CS_C_UNDERSTUD, index); n = _getRandomFromRange(UNDERSTUD_COURSE_MIN, UNDERSTUD_COURSE_MAX); list = _getRandomList(n, 0, unde...
e9ee1cd5-836c-44d1-81da-df170695681c
private void _generateAGradudateStudent(int index) { int n; ArrayList list; String id; id = _getId(CS_C_GRADSTUD, index); writer_.startSection(CS_C_GRADSTUD, id); _generateAStudent_a(CS_C_GRADSTUD, index); n = _getRandomFromRange(GRADSTUD_COURSE_MIN, GRADSTUD_COURSE_MAX); list = _getRan...
c0d674d5-8732-44f7-96b7-6ed4fd0e6bde
private String _selectAdvisor() { int profType; int index; profType = _getRandomFromRange(CS_C_FULLPROF, CS_C_ASSTPROF); index = random_.nextInt(instances_[profType].total); return _getId(profType, index); }
78dfd985-fd34-40df-bf18-0ec68dec3f83
private void _generateATa(TaInfo ta) { writer_.startAboutSection(CS_C_TA, _getId(CS_C_GRADSTUD, ta.indexInGradStud)); writer_.addProperty(CS_P_TAOF, _getId(CS_C_COURSE, ta.indexInCourse), true); writer_.endSection(CS_C_TA); }
77c7ba5f-c3f4-4248-aa30-0aef7a74b2dc
private void _generateAnRa(RaInfo ra) { writer_.startAboutSection(CS_C_RA, _getId(CS_C_GRADSTUD, ra.indexInGradStud)); writer_.endSection(CS_C_RA); }
831f9d6a-4934-42c4-9e21-e59ca80714b9
private void _generateACourse(int index) { writer_.startSection(CS_C_COURSE, _getId(CS_C_COURSE, index)); writer_.addProperty(CS_P_NAME, _getRelativeName(CS_C_COURSE, index), false); writer_.endSection(CS_C_COURSE); }
89524e83-0ca3-46ed-b25b-5e066d6f41a4
private void _generateAGraduateCourse(int index) { writer_.startSection(CS_C_GRADCOURSE, _getId(CS_C_GRADCOURSE, index)); writer_.addProperty(CS_P_NAME, _getRelativeName(CS_C_GRADCOURSE, index), false); writer_.endSection(CS_C_GRADCOURSE); }
8ec1f84b-5fa3-4077-84ef-e838fddefe27
private void _generateCourses() { for (int i = 0; i < underCourses_.size(); i++) { _generateACourse( ( (CourseInfo) underCourses_.get(i)).globalIndex); } for (int i = 0; i < gradCourses_.size(); i++) { _generateAGraduateCourse( ( (CourseInfo) gradCourses_.get(i)).globalIndex); } }
67ac8653-5384-4422-8b0a-533c0d799d52
private void _generateRaTa() { ArrayList list, courseList; TaInfo ta; RaInfo ra; ArrayList tas, ras; int i; tas = new ArrayList(); ras = new ArrayList(); list = _getRandomList(instances_[CS_C_TA].total + instances_[CS_C_RA].total, 0, instances_[CS_C_GRADSTUD].total...
78294fb1-fca3-45f0-beb1-42a0c40aa4e2
private void _generateAResearchGroup(int index) { String id; id = _getId(CS_C_RESEARCHGROUP, index); writer_.startSection(CS_C_RESEARCHGROUP, id); writer_.addProperty(CS_P_SUBORGANIZATIONOF, _getId(CS_C_DEPT, instances_[CS_C_DEPT].count - 1), true); writer_.endSection(CS_C_RES...
4a9ffbdd-3e6e-4e9a-b638-5feab18a9897
private String _getFileSuffix() { return isDaml_ ? ".daml" : ".owl"; }
7393c496-ccd7-4fd1-af52-8a1a43e8dc39
private String _getId(int classType, int index) { String id; switch (classType) { case CS_C_UNIV: id = "http://www." + _getRelativeName(classType, index) + ".edu"; break; case CS_C_DEPT: id = "http://www." + _getRelativeName(classType, index) + "." + _getRelative...
9b1127e4-544f-44b2-a050-c427492c6f18
private String _getId(int classType, int index, String param) { String id; switch (classType) { case CS_C_PUBLICATION: case CS_C_CONFPAPER: case CS_C_JOURNALARTICLE: //NOTE: param is author id id = param + ID_DELIMITER + CLASS_TOKEN[classType] + index; break; def...
c97d2428-8895-407b-8cb3-36b09ce688ab
private String _getName(int classType, int index) { String name; switch (classType) { case CS_C_UNIV: name = _getRelativeName(classType, index); break; case CS_C_DEPT: name = _getRelativeName(classType, index) + INDEX_DELIMITER + (instances_[CS_C_UNIV].count - 1)...
6e88f7b9-0db1-4d78-a02a-e581b6ac7f71
private String _getRelativeName(int classType, int index) { String name; switch (classType) { case CS_C_UNIV: //should be unique too! name = CLASS_TOKEN[classType] + index; break; case CS_C_DEPT: name = CLASS_TOKEN[classType] + index; break; default: ...
9ae92c7f-714d-465e-b4ae-48ec3d931d07
private String _getEmail(int classType, int index) { String email = ""; switch (classType) { case CS_C_UNIV: email += _getRelativeName(classType, index) + "@" + _getRelativeName(classType, index) + ".edu"; break; case CS_C_DEPT: email += _getRelativeName(classTyp...
3f6716ff-56a3-45fd-85fc-bf47f12a43b1
private void _updateCount(int classType) { int subClass, superClass; instances_[classType].count++; subClass = classType; while ( (superClass = CLASS_INFO[subClass][INDEX_SUPER]) != CS_C_NULL) { instances_[superClass].count++; subClass = superClass; } }
271446c5-b92b-4aa8-84d3-5f54570e002a
private ArrayList _getRandomList(int num, int min, int max) { ArrayList list = new ArrayList(); ArrayList tmp = new ArrayList(); for (int i = min; i <= max; i++) { tmp.add(new Integer(i)); } for (int i = 0; i < num; i++) { int pos = _getRandomFromRange(0, tmp.size() - 1); list.add...
d85826e3-a0e8-4a6e-91ed-097413cd317f
private int _getRandomFromRange(int min, int max) { return min + random_.nextInt(max - min + 1); }
9477229b-a076-4dbd-a9a4-8853731b6209
private double _getRandomFromRange(int max) { return random_.nextDouble() * max; }
f930425a-3377-4f1f-9d4f-5a50c9974f2c
private void _generateComments() { int classInstNum = 0; //total class instance num in this department long totalClassInstNum = 0l; //total class instance num so far int propInstNum = 0; //total property instance num in this department long totalPropInstNum = 0l; //total property instance num so far ...
d14c9e32-f6da-48b1-b716-ab2a6a2e7180
public DamlWriter(Generator generator) { super(generator); }
347f15de-4f3f-4225-ba13-8f8130c66b77
void writeHeader() { String s; s = "xmlns:" + T_RDF_NS + "=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\""; out.println(s); s = "xmlns:" + T_RDFS_NS + "=\"http://www.w3.org/2000/01/rdf-schema#\""; out.println(s); s = "xmlns:" + T_DAML_NS + "=\"http://www.daml.org/2001/03/daml+oil#\""; ...
1f3a2285-837b-4e09-a9a2-b26ab6266c6a
private static List<String> parseFile(String filename) throws IOException { BufferedReader br = new BufferedReader(new FileReader(filename)); String line = null; List<String> list = new ArrayList<String>(); while ((line = br.readLine()) != null) { list.add(line); } br.close(); return list;...
1e51e3d3-5ac7-4f3f-9355-9452e4de2a04
public static List<SimpleEntry<String, Long>> parseIntoMap(String namesFile, String timesFile) throws IOException { List<String> listNames = parseFile(namesFile); List<String> listTimes = parseFile(timesFile); List<SimpleEntry<String, Long>> list = new ArrayList<AbstractMap.SimpleEntry<String,Long>>(); f...
46ad5587-54a0-4908-a58d-90359cc1de22
void requestFile(String url);
07d440ed-490a-415f-b180-945873d57a37
@Override public void requestFile(String url) { try { long initTime = System.currentTimeMillis(); ContentName contentName = ContentName.fromURI(url); CCNHandle handle = CCNHandle.open(); CCNInputStream input; if (CommonParameters.unversioned) { input = new CCNInputStrea...
a66be40d-710e-434e-9515-aa656ee80bae
@Override public void requestFile(String url) { try { long initTime = System.currentTimeMillis(); HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", "Mozilla 5.0"); int responseCode = con.get...
60b26e44-09c4-4ccb-a54f-50f40f86e2cc
public RequestThread(ConcurrentLinkedQueue<SimpleEntry<String, Long>> queue, Client client, String server) { this.queue = queue; this.client = client; this.server = server; }
1f140c3a-4e6d-4ba0-9ca7-ab6a9a87b933
@Override public void run() { SimpleEntry<String, Long> entry; while ((entry = this.queue.poll()) != null) { logger.info("Requisitando arquivo " + server + entry.getKey()); client.requestFile(server + entry.getKey()); /** * De forma randômica (50% - 50...
8aa270f0-4b01-46a2-af02-600acdef5c92
public static void main(String[] args) { if (args.length < 5) { logger.warn("Como usar: java -jar ctg {Tipo de Requisição} {Arquivo de nomes} {Arquivo de tempos} {Servidor} {Quantidade de threads}"); System.exit(0); } String requestType = args[0]; String namesFile = args[1]; String timesFile = arg...
a2b878b0-0d39-48ef-bce8-a6db4c81283d
@Test public void test() { List<SimpleEntry<String, Long>> list = new ArrayList<AbstractMap.SimpleEntry<String,Long>>(); SimpleEntry<String, Long> e1 = new SimpleEntry<String, Long>("0.txt", 123l); SimpleEntry<String, Long> e2 = new SimpleEntry<String, Long>("0.txt", 123l); list.add(e1); list.add(e2);...
86211582-6964-4b2d-b0bb-f01fc3466779
public LowArray(int size) { array = new long[size]; }
9b7fe1fc-af0a-4dfb-8b14-9f58e60c9f1e
public void setElement(int index, long value) { array[index] = value; }
81768e83-a0d1-40f2-9234-ada8f134b4fe
public long getElement(int index) { return array[index]; }
e0fc249a-32c7-40f5-b90c-4968008271ad
public Person(String lastName, String firstName, int age) { this.lastName = lastName; this.firstName = firstName; this.age = age; }
e9ed9cd1-ddc9-4967-9827-203fcb37c9df
public String getLastName() { return lastName; }
958d6da7-43fa-43e0-b73d-37807b20a1c6
public void display() { System.out.println(this.toString()); }