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);
System.exit(-1);
}
}
try {
FileUtils.writeStringToFile(new File("gros.txt"), volumes[0]);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return volumes;
} |
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.println(s);
s = "xmlns:" + T_ONTO_NS + "=\"" + generator.ontology + "#\">";
out.println(s);
out.println("\n");
s = "<" + T_OWL_PREFIX + "Ontology " + T_RDF_ABOUT + "=\"\">";
out.println(s);
s = "<" + T_OWL_PREFIX + "imports " + T_RDF_RES + "=\"" +
generator.ontology + "\" />";
out.println(s);
s = "</" + T_OWL_PREFIX + "Ontology>";
out.println(s);
} |
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) {
System.out.println("Create file failure!");
}
} |
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 = " <" + T_ONTO_PREFIX + Generator.PROP_TOKEN[property] + ">" + value +
"</" + T_ONTO_PREFIX + Generator.PROP_TOKEN[property].split(" ")[0] + ">"; //Added Hack for adding rdf:datatype
}
out.println(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_SPACE +
T_RDF_ABOUT + "=\"" + valueId + "\" />" +
" </" + T_ONTO_PREFIX + Generator.PROP_TOKEN[property] + ">";
out.println(s);
} |
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 < args.length) {
arg = args[i++];
univNum = Integer.parseInt(arg);
if (univNum < 1)
throw new NumberFormatException();
}
else
throw new NumberFormatException();
}
else if (arg.equals("-index")) {
if (i < args.length) {
arg = args[i++];
startIndex = Integer.parseInt(arg);
if (startIndex < 0)
throw new NumberFormatException();
}
else
throw new NumberFormatException();
}
else if (arg.equals("-seed")) {
if (i < args.length) {
arg = args[i++];
seed = Integer.parseInt(arg);
if (seed < 0)
throw new NumberFormatException();
}
else
throw new NumberFormatException();
}
else if (arg.equals("-daml")) {
daml = true;
}
else if (arg.equals("-onto")) {
if (i < args.length) {
arg = args[i++];
ontology = arg;
}
else
throw new Exception();
}
else
throw new Exception();
}
if ( ( (long) startIndex + univNum - 1) > Integer.MAX_VALUE) {
System.err.println("Index overflow!");
throw new Exception();
}
if (null == ontology) {
System.err.println("ontology url is requested!");
throw new Exception();
}
}
catch (Exception e) {
System.err.println("Usage: Generator\n" +
"\t[-univ <num of universities(1~" + Integer.MAX_VALUE +
")>]\n" +
"\t[-index <start index(0~" + Integer.MAX_VALUE +
")>]\n" +
"\t[-seed <seed(0~" + Integer.MAX_VALUE + ")>]\n" +
"\t[-daml]\n" +
"\t-onto <univ-bench ontology url>");
System.exit(0);
}
new Generator().start(univNum, startIndex, seed, daml, ontology);
} |
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 Random();
underCourses_ = new ArrayList();
gradCourses_ = new ArrayList();
remainingUnderCourses_ = new ArrayList();
remainingGradCourses_ = new ArrayList();
publications_ = new ArrayList();
} |
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;
instances_[CS_C_UNIV].num = univNum;
instances_[CS_C_UNIV].count = startIndex;
_generate();
System.out.println("See log.txt for more details.");
} |
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);
break;
case CS_C_ASSOPROF:
instances_[i].num = _getRandomFromRange(ASSOPROF_MIN, ASSOPROF_MAX);
break;
case CS_C_ASSTPROF:
instances_[i].num = _getRandomFromRange(ASSTPROF_MIN, ASSTPROF_MAX);
break;
case CS_C_LECTURER:
instances_[i].num = _getRandomFromRange(LEC_MIN, LEC_MAX);
break;
case CS_C_UNDERSTUD:
instances_[i].num = _getRandomFromRange(R_UNDERSTUD_FACULTY_MIN *
instances_[CS_C_FACULTY].total,
R_UNDERSTUD_FACULTY_MAX *
instances_[CS_C_FACULTY].total);
break;
case CS_C_GRADSTUD:
instances_[i].num = _getRandomFromRange(R_GRADSTUD_FACULTY_MIN *
instances_[CS_C_FACULTY].total,
R_GRADSTUD_FACULTY_MAX *
instances_[CS_C_FACULTY].total);
break;
case CS_C_TA:
instances_[i].num = _getRandomFromRange(instances_[CS_C_GRADSTUD].total /
R_GRADSTUD_TA_MAX,
instances_[CS_C_GRADSTUD].total /
R_GRADSTUD_TA_MIN);
break;
case CS_C_RA:
instances_[i].num = _getRandomFromRange(instances_[CS_C_GRADSTUD].total /
R_GRADSTUD_RA_MAX,
instances_[CS_C_GRADSTUD].total /
R_GRADSTUD_RA_MIN);
break;
case CS_C_RESEARCHGROUP:
instances_[i].num = _getRandomFromRange(RESEARCHGROUP_MIN, RESEARCHGROUP_MAX);
break;
default:
instances_[i].num = CLASS_INFO[i][INDEX_NUM];
break;
}
instances_[i].total = instances_[i].num;
subClass = i;
while ( (superClass = CLASS_INFO[subClass][INDEX_SUPER]) != CS_C_NULL) {
instances_[superClass].total += instances_[i].num;
subClass = superClass;
}
}
} |
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++) {
_generateUniv(i + startIndex_);
}
writer_.end();
log_.close();
}
catch (IOException e) {
System.out.println("Failed to create log file!");
}
System.out.println("Completed!");
} |
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, DEPT_MAX);
instances_[CS_C_DEPT].count = 0;
//generate departments
for (int i = 0; i < instances_[CS_C_DEPT].num; i++) {
_generateDept(index, i);
}
} |
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_.clear();
remainingUnderCourses_.clear();
remainingGradCourses_.clear();
for (int i = 0; i < UNDER_COURSE_NUM; i++) {
remainingUnderCourses_.add(new Integer(i));
}
for (int i = 0; i < GRAD_COURSE_NUM; i++) {
remainingGradCourses_.add(new Integer(i));
}
publications_.clear();
for (int i = 0; i < CLASS_NUM; i++) {
instances_[i].logNum = 0;
}
for (int i = 0; i < PROP_NUM; i++) {
properties_[i].logNum = 0;
}
//decide the chair
chair_ = random_.nextInt(instances_[CS_C_FULLPROF].total);
if (index == 0) {
_generateASection(CS_C_UNIV, univIndex);
}
_generateASection(CS_C_DEPT, index);
for (int i = CS_C_DEPT + 1; i < CLASS_NUM; i++) {
instances_[i].count = 0;
for (int j = 0; j < instances_[i].num; j++) {
_generateASection(i, j);
}
}
_generatePublications();
_generateCourses();
//_generateRaTa(); //Removed.
System.out.println(fileName + " generated");
String bar = "";
for (int i = 0; i < fileName.length(); i++)
bar += '-';
log_.println(bar);
log_.println(fileName);
log_.println(bar);
_generateComments();
writer_.endFile();
} |
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);
break;
case CS_C_PROF:
_generateAProf(index);
break;
case CS_C_FULLPROF:
_generateAFullProf(index);
break;
case CS_C_ASSOPROF:
_generateAnAssociateProfessor(index);
break;
case CS_C_ASSTPROF:
_generateAnAssistantProfessor(index);
break;
case CS_C_LECTURER:
_generateALecturer(index);
break;
case CS_C_UNDERSTUD:
_generateAnUndergraduateStudent(index);
break;
case CS_C_GRADSTUD:
_generateAGradudateStudent(index);
break;
case CS_C_COURSE:
_generateACourse(index);
break;
case CS_C_GRADCOURSE:
_generateAGraduateCourse(index);
break;
case CS_C_RESEARCHGROUP:
_generateAResearchGroup(index);
break;
default:
break;
}
} |
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));
writer_.endSection(CS_C_DEPT);
} |
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 courses
courseNum = _getRandomFromRange(FACULTY_COURSE_MIN, FACULTY_COURSE_MAX);
for (int i = 0; i < courseNum; i++) {
courseIndex = _AssignCourse(indexInFaculty);
writer_.addProperty(CS_P_TEACHEROF, _getId(CS_C_COURSE, courseIndex), true);
}
//gradutate courses
courseNum = _getRandomFromRange(FACULTY_GRADCOURSE_MIN, FACULTY_GRADCOURSE_MAX);
for (int i = 0; i < courseNum; i++) {
courseIndex = _AssignGraduateCourse(indexInFaculty);
writer_.addProperty(CS_P_TEACHEROF, _getId(CS_C_GRADCOURSE, courseIndex), true);
}
//person properties
writer_.addProperty(CS_P_UNDERGRADFROM, CS_C_UNIV,
_getId(CS_C_UNIV, random_.nextInt(UNIV_NUM)));
writer_.addProperty(CS_P_GRADFROM, CS_C_UNIV,
_getId(CS_C_UNIV, random_.nextInt(UNIV_NUM)));
writer_.addProperty(CS_P_DOCFROM, CS_C_UNIV,
_getId(CS_C_UNIV, random_.nextInt(UNIV_NUM)));
writer_.addProperty(CS_P_WORKSFOR,
_getId(CS_C_DEPT, instances_[CS_C_DEPT].count - 1), true);
writer_.addProperty(CS_P_EMAIL, _getEmail(type, index), false);
writer_.addProperty(CS_P_TELEPHONE, "xxx-xxx-xxxx", false);
} |
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 sequence
CourseInfo course = new CourseInfo();
course.indexInFaculty = indexInFaculty;
course.globalIndex = ( (Integer) remainingUnderCourses_.get(pos)).intValue();
underCourses_.add(course);
remainingUnderCourses_.remove(pos);
return course.globalIndex;
} |
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 sequence
CourseInfo course = new CourseInfo();
course.indexInFaculty = indexInFaculty;
course.globalIndex = ( (Integer) remainingGradCourses_.get(pos)).intValue();
gradCourses_.add(course);
remainingGradCourses_.remove(pos);
return course.globalIndex;
} |
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].count - 1), true);
}
writer_.endSection(CS_C_FULLPROF);
//_assignFacultyPublications(id, FULLPROF_PUB_MIN, FULLPROF_PUB_MAX);
_assignFacultyConferencePapers(id, FULLPROF_CONF_MIN, FULLPROF_CONF_MAX);
_assignFacultyJournalArticles(id, FULLPROF_JOURN_MIN, FULLPROF_JOURN_MAX);
} |
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);
_assignFacultyConferencePapers(id, ASSOPROF_CONF_MIN, ASSOPROF_CONF_MAX);
_assignFacultyJournalArticles(id, ASSOPROF_JOURN_MIN, ASSOPROF_JOURN_MAX);
} |
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);
_assignFacultyConferencePapers(id, ASSTPROF_CONF_MIN, ASSTPROF_CONF_MAX);
_assignFacultyJournalArticles(id, ASSTPROF_JOURN_MIN, ASSTPROF_JOURN_MAX);
} |
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(id, LEC_CONF_MIN, LEC_CONF_MAX);
_assignFacultyJournalArticles(id, LEC_JOURN_MIN, LEC_JOURN_MAX);
} |
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.name = _getRelativeName(CS_C_PUBLICATION, i);
publication.authors = new ArrayList();
publication.authors.add(author);
publications_.add(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, i, author);
conferencePaper.name = _getRelativeName(CS_C_CONFPAPER, i);
conferencePaper.year = _getRandomFromRange(PUB_MIN_YEAR, PUB_MAX_YEAR);
conferencePaper.conferenceName = "Conference" + random_.nextInt(CONF_NUM);
conferencePaper.authors = new ArrayList();
conferencePaper.authors.add(author);
publications_.add(conferencePaper);
}
} |
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, i, author);
journalArticle.name = _getRelativeName(CS_C_JOURNALARTICLE, i);
journalArticle.year = _getRandomFromRange(PUB_MIN_YEAR, PUB_MAX_YEAR);
journalArticle.impactFactor = _getRandomFromRange(IF_MAX);
journalArticle.journalName = "Journal" + random_.nextInt(JOURNAL_NUM);
journalArticle.authors = new ArrayList();
journalArticle.authors.add(author);
publications_.add(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 = (PublicationInfo) publications_.get( ( (Integer) list.get(i)).
intValue());
publication.authors.add(author);
}
} |
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 JournalArticleInfo) {
_generateAJournalArticle((JournalArticleInfo) publication);
}
else {
_generateAPublication( (PublicationInfo) publications_.get(i));
}
}
} |
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,
(String) publication.authors.get(i), true);
}
writer_.endSection(CS_C_PUBLICATION);
} |
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(CS_P_CONFNAME, conferencePaper.conferenceName, false);
for (int i = 0; i < conferencePaper.authors.size(); i++) {
writer_.addProperty(CS_P_PUBLICATIONAUTHOR, (String) conferencePaper.authors.get(i), true);
}
writer_.endSection(CS_C_CONFPAPER);
} |
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(CS_P_IF, Double.toString(journalArticle.impactFactor), false);
writer_.addProperty(CS_P_JOURNALNAME, journalArticle.journalName, false);
for (int i = 0; i < journalArticle.authors.size(); i++) {
writer_.addProperty(CS_P_PUBLICATIONAUTHOR, (String) journalArticle.authors.get(i), true);
}
writer_.endSection(CS_C_JOURNALARTICLE);
} |
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);
writer_.addProperty(CS_P_TELEPHONE, "xxx-xxx-xxxx", 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, underCourses_.size() - 1);
for (int i = 0; i < list.size(); i++) {
CourseInfo info = (CourseInfo) underCourses_.get( ( (Integer) list.get(i)).
intValue());
writer_.addProperty(CS_P_TAKECOURSE, _getId(CS_C_COURSE, info.globalIndex), true);
}
if (0 == random_.nextInt(R_UNDERSTUD_ADVISOR)) {
writer_.addProperty(CS_P_ADVISOR, _selectAdvisor(), true);
}
writer_.endSection(CS_C_UNDERSTUD);
} |
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 = _getRandomList(n, 0, gradCourses_.size() - 1);
for (int i = 0; i < list.size(); i++) {
CourseInfo info = (CourseInfo) gradCourses_.get( ( (Integer) list.get(i)).
intValue());
writer_.addProperty(CS_P_TAKECOURSE,
_getId(CS_C_GRADCOURSE, info.globalIndex), true);
}
writer_.addProperty(CS_P_UNDERGRADFROM, CS_C_UNIV,
_getId(CS_C_UNIV, random_.nextInt(UNIV_NUM)));
if (0 == random_.nextInt(R_GRADSTUD_ADVISOR)) {
writer_.addProperty(CS_P_ADVISOR, _selectAdvisor(), true);
}
_assignGraduateStudentPublications(id, GRADSTUD_PUB_MIN, GRADSTUD_PUB_MAX);
writer_.endSection(CS_C_GRADSTUD);
} |
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 - 1);
courseList = _getRandomList(instances_[CS_C_TA].total, 0,
underCourses_.size() - 1);
for (i = 0; i < instances_[CS_C_TA].total; i++) {
ta = new TaInfo();
ta.indexInGradStud = ( (Integer) list.get(i)).intValue();
ta.indexInCourse = ( (CourseInfo) underCourses_.get( ( (Integer)
courseList.get(i)).intValue())).globalIndex;
_generateATa(ta);
}
while (i < list.size()) {
ra = new RaInfo();
ra.indexInGradStud = ( (Integer) list.get(i)).intValue();
_generateAnRa(ra);
i++;
}
} |
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_RESEARCHGROUP);
} |
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) + "." +
_getRelativeName(CS_C_UNIV, instances_[CS_C_UNIV].count - 1) +
".edu";
break;
default:
id = _getId(CS_C_DEPT, instances_[CS_C_DEPT].count - 1) + ID_DELIMITER +
_getRelativeName(classType, index);
break;
}
return id;
} |
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;
default:
id = _getId(classType, index);
break;
}
return id;
} |
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);
break;
//NOTE: Assume departments with the same index share the same pool of courses and researches
case CS_C_COURSE:
case CS_C_GRADCOURSE:
case CS_C_RESEARCH:
name = _getRelativeName(classType, index) + INDEX_DELIMITER +
(instances_[CS_C_DEPT].count - 1);
break;
default:
name = _getRelativeName(classType, index) + INDEX_DELIMITER +
(instances_[CS_C_DEPT].count - 1) + INDEX_DELIMITER +
(instances_[CS_C_UNIV].count - 1);
break;
}
return name;
} |
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:
name = CLASS_TOKEN[classType] + index;
break;
}
return name;
} |
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(classType, index) + "@" +
_getRelativeName(classType, index) + "." +
_getRelativeName(CS_C_UNIV, instances_[CS_C_UNIV].count - 1) + ".edu";
break;
default:
email += _getRelativeName(classType, index) + "@" +
_getRelativeName(CS_C_DEPT, instances_[CS_C_DEPT].count - 1) +
"." + _getRelativeName(CS_C_UNIV, instances_[CS_C_UNIV].count - 1) +
".edu";
break;
}
return email;
} |
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( (Integer) tmp.get(pos));
tmp.remove(pos);
}
return list;
} |
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
String comment;
comment = "External Seed=" + baseSeed_ + " Interal Seed=" + seed_;
log_.println(comment);
log_.println();
comment = "CLASS INSTANCE# TOTAL-SO-FAR";
log_.println(comment);
comment = "----------------------------";
log_.println(comment);
for (int i = 0; i < CLASS_NUM; i++) {
comment = CLASS_TOKEN[i] + " " + instances_[i].logNum + " " +
instances_[i].logTotal;
log_.println(comment);
classInstNum += instances_[i].logNum;
totalClassInstNum += instances_[i].logTotal;
}
log_.println();
comment = "TOTAL: " + classInstNum;
log_.println(comment);
comment = "TOTAL SO FAR: " + totalClassInstNum;
log_.println(comment);
comment = "PROPERTY---INSTANCE NUM";
log_.println();
comment = "PROPERTY INSTANCE# TOTAL-SO-FAR";
log_.println(comment);
comment = "-------------------------------";
log_.println(comment);
for (int i = 0; i < PROP_NUM; i++) {
comment = PROP_TOKEN[i] + " " + properties_[i].logNum;
comment = comment + " " + properties_[i].logTotal;
log_.println(comment);
propInstNum += properties_[i].logNum;
totalPropInstNum += properties_[i].logTotal;
}
log_.println();
comment = "TOTAL: " + propInstNum;
log_.println(comment);
comment = "TOTAL SO FAR: " + totalPropInstNum;
log_.println(comment);
System.out.println("CLASS INSTANCE #: " + classInstNum + ", TOTAL SO FAR: " +
totalClassInstNum);
System.out.println("PROPERTY INSTANCE #: " + propInstNum +
", TOTAL SO FAR: " + totalPropInstNum);
System.out.println();
log_.println();
} |
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#\"";
out.println(s);
s = "xmlns:" + T_ONTO_NS + "=\"" + generator.ontology + "#\">";
out.println(s);
s = "<" + T_RDF_PREFIX + "Description " + T_RDF_ABOUT + "=\"\">";
out.println(s);
s = "<" + T_DAML_PREFIX + "imports " + T_RDF_RES + "=\"" +
generator.ontology + "\" />";
out.println(s);
s = "</" + T_RDF_PREFIX + "Description>";
out.println(s);
} |
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>>();
for (int i = 0; i < listNames.size(); i++)
{
list.add(new SimpleEntry<String, Long>(listNames.get(i), Long.valueOf(listTimes.get(i))));
}
return list;
} |
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 CCNInputStream(contentName, handle);
}
else
{
input = new CCNFileInputStream(contentName, handle);
}
if (CommonParameters.timeout != null) {
input.setTimeout(CommonParameters.timeout);
}
byte[] buffer = new byte[1024];
int readcount = 0;
long readtotal = 0;
while ((readcount = input.read(buffer)) != -1) {
readtotal += readcount;
}
input.close();
handle.close();
KeyManager.closeDefaultKeyManager();
long time = System.currentTimeMillis() - initTime;
logger.info("Tempo da requisição: " + time);
logger.info("Tamanho da requisição: " + readtotal);
}
catch (Exception e)
{
logger.error("Erro: " + e.getMessage());
}
} |
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.getResponseCode();
logger.debug("Código de resposta HTTP: " + responseCode);
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = br.readLine()) != null) {
response.append(inputLine);
}
br.close();
long time = System.currentTimeMillis() - initTime;
logger.info("Tempo da requisição:" + time);
logger.info("Tamanho da requisição: " + response.toString().getBytes().length);
logger.debug(response.toString());
}
catch (MalformedURLException mue)
{
logger.error("Erro: " + mue.getMessage());
}
catch (ProtocolException pe)
{
logger.error("Erro: " + pe.getMessage());
}
catch (IOException ioe)
{
logger.error("Erro: " + ioe.getMessage());
}
} |
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%), verifica se a thread dorme
* o valor definido pelo arquivo de entrada ou segue com as
* requisições.
*/
if (new Random(13).nextInt(1000) % 2 == 0)
{
logger.info("Essa thread de requisição vai dormir " + entry.getValue() + " milisegundos.");
try
{
Thread.sleep(entry.getValue());
}
catch (InterruptedException e)
{
logger.error("Erro da thread ao dormir.");
}
}
}
logger.debug("Thread encerrada.");
} |
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 = args[2];
String server = args[3];
Integer quantityThreads = Integer.valueOf(args[4]);
List<SimpleEntry<String, Long>> list = null;
try
{
list = ParseInputFile.parseIntoMap(namesFile, timesFile);
}
catch (IOException e)
{
logger.info("Erro ao fazer o parse nos arquivos de entrada.");
}
ConcurrentLinkedQueue<SimpleEntry<String, Long>> queue = new ConcurrentLinkedQueue<AbstractMap.SimpleEntry<String,Long>>(list);
Client client = null;
if (requestType.equals("ccn"))
{
client = new CCNClient();
logger.debug("Tipo de requisição escolhida: ccn");
}
else if (requestType.equals("http"))
{
client = new HTTPClient();
logger.debug("Tipo de requisição escolhida: http");
}
for (int i = 0; i < quantityThreads; i++)
{
RequestThread rt = new RequestThread(queue, client, server);
Thread thread = new Thread(rt);
thread.start();
logger.debug("Thread " + i + " iniciada.");
}
} |
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);
Assert.assertEquals(2, list.size());
} |
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());
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.