-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblemServiceImpl.java
More file actions
72 lines (48 loc) · 1.68 KB
/
Copy pathProblemServiceImpl.java
File metadata and controls
72 lines (48 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.test.GraphImpl.Service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Service;
import com.test.GraphImpl.Service.ProblemService;
import com.test.GraphImpl.bean.Graph;
import com.test.GraphImpl.bean.Vertex;
@Service
public class ProblemServiceImpl implements ProblemService{
private static final Logger LOGGER =Logger.getLogger(ProblemServiceImpl.class.getName());
@Autowired
private Graph graph;
@Override
public Graph addingInventorFundsHold(Graph bean, HttpHeaders headers) {
LOGGER.info("addingInventorFundsHold has called");
try {
bean.getVertices().stream().forEach(vertex->{
graph.addVertex(vertex.getData());
});
bean.getVertices().stream().forEach(edge->{
edge.getEdges().stream().forEach(ed->{
graph.addEdge(ed.getStart(), ed.getEnd(), ed.getWeight());
int ans=100*ed.getWeight();
bean.setGetMarKetValue(String.valueOf(ans));
});
});
LOGGER.info("addingInventorFundsHold has Finish its Execution");
}catch (Exception e) {
e.printStackTrace();
}
return bean;
}
@Override
public Vertex getInventorFundsHold(String investorId) {
LOGGER.info("getInventorFundsHold has called");
Vertex vertexList = null;
try {
vertexList = graph.getVertices().get(Integer.valueOf(investorId));
} catch (Exception e) {
e.printStackTrace();
}
LOGGER.info("getInventorFundsHold has Finish its Execution");
return vertexList;
}
}