id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
6a2b31a8-cf25-4406-993f-1ff922cf74b7 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Vertex other = (Vertex) obj;
if (id == null) {
... |
6ab6b8a0-b48b-4f70-bd50-23841abb10e3 | @Override
public String toString() {
return name;
} |
e9510c12-df6b-44e8-85d1-f2e4d6fc85f2 | public DijkstraAlgorithm(Graph graph, DataStore ds) {
// Create a copy of the array so that we can operate on this array
this.nodes = new ArrayList<Vertex>(graph.getVertexes());
this.edges = new ArrayList<Edge>(graph.getEdges());
this.ds = ds;
} |
ae7a0387-a18b-4792-b7e0-b2011c095d5d | public void execute(Vertex source) {
//System.out.println("source.toString() " + source.toString());
settledNodes = new HashSet<Vertex>();
unSettledNodes = new HashSet<Vertex>();
distance = new HashMap<Vertex, Integer>();
predecessors = new HashMap<Vertex, Vertex>();
dist... |
cefcc079-0373-4020-8f54-ef8bc528e49d | private void findMinimalDistances(Vertex node) {
List<Vertex> adjacentNodes = getNeighbors(node);
Vertex lasttarget = null;
for (Vertex target : adjacentNodes) {
System.out.println("target.toString() " + target.toString());
if (getShortestDistance(target) > getShortestDi... |
1836f22a-ece2-49ee-9133-6e37bea55b35 | private int getDistance(Vertex node, Vertex target) {
for (Edge edge : edges) {
if (edge.getSource().equals(node)
&& edge.getDestination().equals(target)) {
return edge.getWeight();
}
}
throw new RuntimeException("Should not happen");
... |
27b612ba-7dd0-4023-b488-8d1b1c32f72a | private List<Vertex> getNeighbors(Vertex node) {
List<Vertex> neighbors = new ArrayList<Vertex>();
for (Edge edge : edges) {
if (edge.getSource().equals(node)
&& !isSettled(edge.getDestination())) {
neighbors.add(edge.getDestination());
}
... |
ec90dbe5-6318-4af0-a8bd-2fad81acdb6a | private Vertex getMinimum(Set<Vertex> vertexes) {
Vertex minimum = null;
for (Vertex vertex : vertexes) {
if (minimum == null) {
minimum = vertex;
} else {
if (getShortestDistance(vertex) < getShortestDistance(minimum)) {
minimu... |
d9bac947-4fe1-471e-9ef0-e5c6cd81eeb8 | private boolean isSettled(Vertex vertex) {
return settledNodes.contains(vertex);
} |
0a6a6cb6-9cbb-4c45-8875-e26f5559c55c | private int getShortestDistance(Vertex destination) {
Integer d = distance.get(destination);
if (d == null) {
return Integer.MAX_VALUE;
} else {
return d;
}
} |
46f7a0f1-096b-42a9-87c5-743b9cfca20e | public LinkedList<Vertex> getPath(Vertex target) {
LinkedList<Vertex> path = new LinkedList<Vertex>();
Vertex step = target;
// Check if a path exists
if (predecessors.get(step) == null) {
return null;
}
path.add(step);
while (predecessors.get(step) !=... |
43ae1e2d-42ef-4c7d-9300-e2d920b8dac1 | public DataStore optorderlista(DataStore ds3, OptPlan op) {
//Massa bra variabler
LinkedList<Vertex> path;
DataStore ds4 = new DataStore();
ds4.orders = ds3.orders;
int start, stop, diff, mindiff;
//De orderpar som redan betjänats
int[] nextnode = new int[20];
... |
d4bf9505-daaa-49c3-afe5-750ad1db367f | public DataStore onodigaforflytt(DataStore ds2) {
//Det här är bra skit, tar bort onödiga förflyttningar
boolean plockatorder = false;
for (int i = 0; i < ds3.orders; i++) {
System.out.println("\n\n\n" + "i " + i);
for (int j = i + 1; j < ds3.orders; j++) {
... |
cce19b5b-6382-4c69-bca5-44e7d4b66ef4 | OverordnatSystem() {
ds = new DataStore();
DataStore ds2 = new DataStore();
DataStore ds4 = new DataStore();
DataStore ds5 = new DataStore();
DataStore ds6 = new DataStore();
ds3 = new DataStore();
//läser in lagernätet och orderlistan
ds.setFileName("C:/... |
1cb4b114-a620-4269-acc5-b10faf943c2e | public static void main(String[] args) {
// TODO code application logic here
OverordnatSystem x = new OverordnatSystem();
} |
a829bca5-73e4-43f8-846c-2070011eb4e9 | public Graph(List<Vertex> vertexes, List<Edge> edges) {
this.vertexes = vertexes;
this.edges = edges;
} |
4bed3dc2-0e5e-40a9-b0bd-20b420ba85c2 | public List<Vertex> getVertexes() {
return vertexes;
} |
e1677ad2-7b8a-41fc-9804-5d7893797819 | public List<Edge> getEdges() {
return edges;
} |
339f0e23-09dd-495c-b6e6-b7af302ab643 | public static void main( String[] args )
{
System.out.println( "Hi hello hello hello" );
tst1();
tst2();
} |
7a88e09d-21c1-438a-bb15-963064154feb | public static void tst1() {
TrackDto trackDto = new TrackDto();
List<Track> tracks1 = trackDto.getAllTracks();
for (Track track : tracks1) {
System.out.println(track);
}
System.out.println("------");
Track track11 = trackDto.getTrackByTitle("One");
System.out.p... |
3e48a863-aaab-4e6e-ba96-3965dce1a042 | public static void tst2() {
PassReqApi reqApi = new PassReqApi();
System.out.println("sending post request");
String response = reqApi.sendingPost("023");
System.out.println(response);
System.out.println("------");
} |
6c5ecd54-8c14-40ad-829d-2940ae3517a9 | public Track() {
super();
} |
83c34cd6-aa76-43a9-abc1-49e83227c74b | public Track(Integer id, String title, String singer) {
super();
this.id = id;
this.title = title;
this.singer = singer;
} |
7fc12acd-9a13-46c2-b9b4-305ea6baf602 | public Integer getId() {
return id;
} |
cec8fba2-e549-4e79-8726-62c46a074886 | public void setId(Integer id) {
this.id = id;
} |
d9133b1d-c557-4bef-894f-bdfb2843c63a | public String getTitle() {
return title;
} |
cbfce0ce-06bb-4ffe-8955-c4829b1ec5ed | public void setTitle(String title) {
this.title = title;
} |
32fda37b-ce85-4cde-a508-d0723d80a9fb | public String getSinger() {
return singer;
} |
be47878e-f424-4164-9c4e-02ac8ceda8c3 | public void setSinger(String singer) {
this.singer = singer;
} |
a9020639-2726-491b-80a5-acad8a6a16e9 | @Override
public String toString() {
return "Track [ id=" + id + ", title=" + title + ", singer=" + singer + " ]";
} |
f417bfd3-4ad5-478d-88c8-7de0b0ff5b34 | public List<Track> getAllTracks() {
List<Track> trackList = new ArrayList<Track>();
for (Object value : tracks.values()) {
Track track = (Track)value;
trackList.add(track);
}
return trackList;
} |
474f3275-704f-4c70-91c8-40a6f4dcad4e | public Track getTrackById(Integer id) {
Track track = tracks.get(id);
return track;
} |
37c2be4d-7046-4f17-aae9-50b3df4c97ea | public Track getTrackByTitle(String name) {
for (Object value : tracks.values()) {
Track track = (Track)value;
if (name.equals(track.getTitle())) {
return track;
}
}
return null;
} |
87aeb18a-7dd3-4846-a0b3-19ccd4ad41c1 | public String createTrack(Track track) {
tracks.put(track.getId(), track);
String result = "Track saved : " + track;
return result;
} |
69d43854-135d-4724-9590-ef57ee9810e8 | public void deleteTrackById(Integer id) {
tracks.remove(id);
} |
4ed31e83-0004-4961-8026-56a68b6a437b | public String updateTrack(Track track) {
tracks.put(track.getId(), track);
String result = "Track updated : " + track;
return result;
} |
bab27445-f6ba-423d-921b-e40f1406e941 | public String getMorning(String msg) {
String output = "Good Morning " + msg;
return output;
} |
4017a10e-1f30-4a86-bd06-65edbbde19ee | public String getAfternoon(String msg) {
String output = "Good Afternoon " + msg;
return output;
} |
51939e78-9255-42de-af05-fb6f60b2607e | public ReqRunnable(String pid) {
this.pid = pid;
} |
8c54e6fa-b2fe-412d-abbd-52a70134a8bb | public void run() {
String response = "server not available";
try {
response = sendPost(pid);
} catch (Exception e) {
//e.printStackTrace();
}
System.out.println(response);
System.out.println("------");
} |
6025b361-3c5c-4036-b0c6-3fedf814e959 | public String sendingPost(String pid) {
String result = "message with pid "+pid+" was sent";
try {
ReqRunnable myRunnable = new ReqRunnable(pid);
Thread t = new Thread(myRunnable);
t.start();
} catch (Exception e) {
//e.printStackTrace();
}
return result;
} |
a43c5b6a-ce30-4a25-866d-007c4f870f0c | private String sendPost(String pid) throws Exception {
String url = "http://localhost:4567/person/"+pid;
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
Thread.sleep(3000);
//add reuqest header
con.setRequestMethod("POST");
con.setRequestProperty("User-Agen... |
42f092a4-10a4-4b7b-9638-c2ff4c5b3ff3 | public AppTest( String testName )
{
super( testName );
System.out.println("starting AppTest");
} |
41f78826-4bf2-4ef7-9eb1-176d9f4291b0 | public static Test suite()
{
return new TestSuite( AppTest.class );
} |
76949af9-ad08-4607-9c94-ace76179a5dc | public void testApp()
{
assertTrue( true );
} |
356da1d7-55a7-45d7-9156-ddea7c0dfea2 | public SubSketch1(EmbeddedSketch parent, int xOrigin, int yOrigin,
int width, int height) {
mySketch = parent;
myXOrigin = xOrigin;
myYOrigin = yOrigin;
myWidth = width;
myHeight = height;
} |
5f062bf7-e82c-4e19-adbb-832a81df1873 | public void setup() {
defaultFontSize = 12;
font = mySketch.createFont("Helvetica", defaultFontSize);
mySketch.textFont(font);
searchX = myXOrigin + 20;
searchY = myYOrigin + 30;
tagsOfInterestX = searchX;
tagsOfInterestY = searchY + 30;
textFieldX = (int) (searchX + 65);
textFieldY = (int) search... |
0dfed5f1-326a-425e-a0fb-f86d740a7824 | public void draw() {
drawTexts();
} |
7a70f641-688b-4393-948b-f9edb144a273 | public void keyPressed() {
if (tagSearchField.isActive()) {
// Re-Draw...
mySketch.loop();
}
} |
92ba318a-e19e-408a-9598-8c2ec26ca659 | private void drawTexts() {
mySketch.fill(0);
mySketch.textAlign(PApplet.LEFT);
mySketch.textSize(15);
String text = "Search:";
mySketch.text(text, searchX, searchY);
mySketch.textSize(12);
text = "Tags of Interest:";
mySketch.text(text, tagsOfInterestX, tagsOfInterestY);
} |
e8fe0a9f-9e93-4a24-b0f8-49cb6228d185 | public void input(String theText) {
theText = theText.toLowerCase();
usefulQuestions = QeAData.getQuestionToTags();
if (lists.size() != 0) {
clearList();
}
ArrayList<Integer> keys = new ArrayList<Integer>(QeAData
.getTagDictionary().keySet());
ArrayList<String> values = new ArrayList<String>(QeAData... |
7364febb-6e49-4879-ba75-8cc2a6426dab | public void controlEvent(ControlEvent theEvent) {
if (theEvent.isGroup()) {
int tagId = (int) theEvent.getValue();
selectedTags.add(tagId);
selectedTagsNames.add(QeAData.getTagDictionary().get(tagId));
updateUsefulQuestions(tagId);
createRelatedTags();
// Disable the last list
disableDDL(lists.... |
45ce42b3-ac0c-494f-9e3d-339ff3d983b5 | private void addDropDownList(int tagId, ArrayList<Integer> newTags) {
float x = ddlX + ddlWidth + 10;
float y = ddlY;
// Create the new DropdownList
PFont font2 = mySketch.createFont("Helvetica", defaultFontSize);
DropdownList newD = cp5
.addDropdownList("Select Another Tag " + (lists.size() + 1))
.... |
be377a15-fa17-4aa4-b64a-d31e09659773 | private void disableDDL(int index, int tagId) {
// Set the TAG in the Tags of Interest list position
float newX = ddlX;
float newY = ddlY + ddlHeight * index;
lists.get(index).setPosition(newX, newY);
// Disable list
lists.get(index).disableCollapse();
// Set its name
lists.get(index).setLabel(QeADat... |
8c03d504-417e-4fa8-9bac-34899bb0c0ca | public void clearList() {
for (DropdownList list : lists) {
list.remove();
}
lists.clear();
relatedTags.clear();
selectedTags.clear();
selectedTagsNames.clear();
} |
c9c9b497-748a-4bd7-b93c-e5e50079d6ce | private void updateUsefulQuestions(Integer newTag) {
Hashtable<Integer, ArrayList<Integer>> result = new Hashtable<Integer, ArrayList<Integer>>();
for (int question : QeAData.getTagToQuestions().get(newTag)) {
if (usefulQuestions.keySet().contains(question)) {
result.put(question, usefulQuestions.get(questio... |
d1dcd65d-0d1b-4dc8-a861-dbb5169fc1a5 | private void createRelatedTags() {
relatedTags = new ArrayList<Integer>();
for (int question : usefulQuestions.keySet()) {
addRelatedTag(usefulQuestions.get(question));
}
} |
f3c90edb-dc7b-4a60-8271-c397f482697f | private void addRelatedTag(ArrayList<Integer> tagList) {
for (int tag : tagList) {
if (!selectedTags.contains(tag) && !relatedTags.contains(tag)) {
relatedTags.add(tag);
}
}
} |
5646b402-17da-4cd3-a0b5-c0d15598d16b | public void setup() {
try {
QeAData.setPApplet(this);
QeAData.readTagLinksFile();
QeAData.readTagDictionaryFile();
QeAData.readPostTagsFile();
// The QuestionData and QuestionAnswers are read by demand, but
// after demanded the first time, they are completely stored in
// memory as the others.
... |
22d13f2d-5310-4ae2-922a-5dd2857758e3 | @SuppressWarnings("unchecked")
public QuestionData(int id, String title, ArrayList<Float> values,
int cluster) {
if (values.size() <= 0
|| values.size() != QuestionData.featureNames.size()) {
throw new RuntimeException(
"The Values and Names of the features are not of the same size or are empty!");
... |
7339cbd3-14ab-43fa-8d53-5619ee3a9c3d | @SuppressWarnings("unchecked")
public static void setFeatureNames(ArrayList<String> featureNames) {
QuestionData.featureNames = (ArrayList<String>) featureNames.clone();
} |
cc3d2c7a-f37d-4656-bce3-84e2f6c27e54 | @SuppressWarnings("unchecked")
public static void setFeaturePostNames(ArrayList<String> featurePostNames) {
QuestionData.featurePostNames = (ArrayList<String>) featurePostNames
.clone();
} |
17228ecf-9b84-4507-b31b-62cba1e50efd | public static void setSortByIndex(int sortByIndex) {
if (sortByIndex < QuestionData.featureNames.size()) {
QuestionData.sortByIndex = sortByIndex;
} else {
throw new RuntimeException(
"The sortByIndex is larger than the amount of features!");
}
} |
f4ac4634-9ac3-42f9-aa70-55314e7b6dd6 | public static String getFeatureNameOfSortIndex() {
return QuestionData.featureNames.get(sortByIndex);
} |
27b9f357-1552-496b-8cc5-28e5959840e6 | public static String getFeaturePostNameOfSortIndex() {
return QuestionData.featurePostNames.get(sortByIndex);
} |
c84b091b-217c-4ba4-9cc9-eae78595e08c | public static ArrayList<String> getFeatureNames() {
return QuestionData.featureNames;
} |
186f3d62-9703-46f7-b34d-a71d8ed6b014 | public static ArrayList<String> getFeaturePostNames() {
return featurePostNames;
} |
ec826dd8-684f-4c8b-ac1d-49be45c2093b | public static int getSortByIndex() {
return sortByIndex;
} |
02784ca1-e8b6-4d23-b914-6f5bbd90e002 | public int getId() {
return id;
} |
03ab677d-5fe4-4ca7-996c-cc31666951e8 | public String getTitle() {
return title;
} |
93a6dce1-fca6-4129-b99f-02f31c1a6b1d | public int getCluster() {
return cluster;
} |
4d15d4d6-dd94-4d5f-a7a1-60b207974e9d | public ArrayList<Float> getFeatureValues() {
return featureValues;
} |
259cc49f-5c38-4fbc-b1fc-c38ac646b821 | public Float getFeatureValueByName(String name) {
Float result = null;
for (int i = 0; i < QuestionData.featureNames.size(); i++) {
if (QuestionData.featureNames.get(i).equals(name)) {
result = featureValues.get(i);
break;
}
}
if (result == null) {
throw new RuntimeException("Unexistent Feature... |
b8cba05e-8b14-4653-b8de-ea57d86c64bc | public Float getFeatureValueOfSortIndex() {
return featureValues.get(sortByIndex);
} |
780c3b3c-fcd4-4bc9-9a72-0e277a51373a | @Override
public int compareTo(QuestionData other) {
float diff = other.getFeatureValueOfSortIndex()
- this.getFeatureValueOfSortIndex();
if (diff == 0) {
return other.getTitle().compareTo(this.getTitle());
} else {
return (int) (diff * 1000000);// Decimal precision
}
} |
bce22a4a-c88c-4398-9430-526b3776a4dd | @Override
public String toString() {
return this.getId() + " - " + this.getFeatureValueOfSortIndex();
} |
63ab9323-2675-4875-99e3-c68153fe0682 | public CentroidData(int clusterId, int numFeatures) {
this.clusterId = clusterId;
questionIds = new ArrayList<Integer>();
sumAttributeValues = new ArrayList<Float>();
for (int i = 0; i < numFeatures; i++) {
sumAttributeValues.add((float) 0.0);
}
} |
d9cf466b-ef9c-40a7-b635-c9014b7cc117 | public void addQuestion(QuestionData qData) {
questionIds.add(qData.getId());
for (int i = 0; i < qData.getFeatureValues().size(); i++) {
sumAttributeValues.set(i, sumAttributeValues.get(i)
+ qData.getFeatureValues().get(i));
}
} |
808ce96a-8344-4ed8-9e08-7d3e64e01f6f | public int getClusterId() {
return clusterId;
} |
9bb83bbb-e21b-4f1b-9557-76330d57f35d | public ArrayList<Integer> getQuestionIds() {
return questionIds;
} |
ad77cc9b-ed13-4af5-9d07-065cacd0d0e5 | public int getClusterSize() {
return questionIds.size();
} |
dc8188d2-2c93-481d-9d79-6a23fd35481d | public float getMeanByIndex(int index) {
return (getClusterSize() > 0) ? this.sumAttributeValues.get(index)
/ getClusterSize() : 0;
} |
b76db6de-ee83-4571-883e-336366ad3f2b | public AnswerData(int id, int score, Date creationDate) {
this.id = id;
this.score = score;
this.creationDate = creationDate;
} |
6c1cf5c2-8372-4786-a12c-471481033689 | public AnswerData(int id, int score, Date creationDate, int commentsCount, boolean isAccepted) {
this.id = id;
this.score = score;
this.creationDate = creationDate;
this.commentsCount = commentsCount;
this.isAccepted = isAccepted;
} |
314684ce-926f-4d50-81d6-a17f00a61183 | public int getCommentsCount() {
return commentsCount;
} |
516b64cd-8075-491e-b50e-d5d326c06b54 | public boolean isAccepted() {
return isAccepted;
} |
7791f673-d9b8-4db1-a623-bf81812c70c6 | public int getId() {
return id;
} |
2a1b64e3-b91d-4eb3-aa85-e31e02cab301 | public Date getCreationDate() {
return creationDate;
} |
1a7a113a-6ba8-454b-9e5f-1b601488e980 | public int getScore() {
return score;
} |
1a36d3b8-c733-421d-84b3-fd3bd725c5ed | @SuppressWarnings("unchecked")
public static void setTagList(ArrayList<Integer> tagList,
ArrayList<String> tagNameList) {
if (tagList.size() == tagNameList.size()
&& !tagList.equals(chosenTagIds)) {
// CLEAR everything
chosenTagIds.clear();
chosenTagNames.clear();
chosenQuestions.clear();
cent... |
00f383b3-5ed9-480c-9068-513cd71b60a8 | public static ArrayList<Integer> getQuestionIdsByCluster(int cluster) {
ArrayList<Integer> clusterQuestions = new ArrayList<Integer>();
for (Integer qId : chosenQuestions) {
if (questionIdsToData.get(qId).getCluster() == cluster) {
clusterQuestions.add(qId);
}
}
return (clusterQuestions);
} |
3f802aef-6f45-4feb-aa32-c0147cb31c37 | @SuppressWarnings("unchecked")
public static void readPostTagsFile() throws IOException {
String[] reader = pApplet.loadStrings(POST_TAGS_FILE);
int question, tag;
ArrayList<Integer> tmpList;
// Reads the file header
for (int i = 1;i<reader.length;i++) {
String[] nextLine = reader[i].replace("\"", "").s... |
a967ca91-80ff-444d-b255-1bed230e4925 | public static void readTagLinksFile() throws IOException {
String[] reader = pApplet.loadStrings(TAG_LINKS_FILE);
for (int i = 1;i<reader.length;i++) {
String[] nextLine = reader[i].replace("\"", "").split(",");
int key = Integer.valueOf(nextLine[0]);
if (tagLinks.containsKey(key)) {
tagLinks.put(Int... |
42ac4111-d340-4e8f-b1fe-65516db2f342 | public static void readTagDictionaryFile() throws IOException {
String[] reader = pApplet.loadStrings(TAGS_FILE);
for (int i = 1;i<reader.length;i++) {
String[] nextLine = reader[i].replace("\"", "").split(",");
tagDictionary.put(Integer.valueOf(nextLine[0]), nextLine[1]);
}
} |
c6f2863a-eadf-4a69-bd31-765f5899b3a5 | public static void readQuestionsDataFile() throws IOException {
String[] reader = pApplet.loadStrings(QUESTIONS_DATA_FILE);
// Unique columns used... At this moment...
int questionId, cluster;
String title;
ArrayList<Float> values = new ArrayList<Float>();
ArrayList<String> names = new ArrayList<String>()... |
1638d779-de53-4b71-828b-cf9897ce7f8e | public static void readQuestionAnswersFile() throws IOException,
ParseException {
// Unique features used... At this moment...
int questionId;
int answerId;
int score;
Date creationDate;
int answerCommentsCount;
boolean isAccepted;
DateFormat format = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
... |
fa72b0db-3be0-415c-9db4-efc08737a575 | private static String[] parseQuestion(String line){
String[] result = new String[7];
String workingLine = line;
int index;
for (int i = 6; i>1;i--){
index = workingLine.lastIndexOf(",");
result[i] = workingLine.substring(index+1, workingLine.length());
workingLine = workingLine.substring(0, index);
... |
ef7c33a2-24e8-4ae1-9d46-0084d822ed52 | public static Hashtable<Integer, ArrayList<Integer>> getTagToQuestions() {
return tagToQuestions;
} |
cc06206d-72bd-4ce2-9471-d0f10095fc8a | public static Hashtable<Integer, ArrayList<Integer>> getQuestionToTags() {
return questionToTags;
} |
17aa0faa-da5e-4806-97f1-54db764dacfb | public static Hashtable<Integer, QuestionData> getQuestionIdsToData() {
return questionIdsToData;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.