Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Path[] CalculateFinalPoints(Point startPoint, int remainingDistance)//not forget to change PN!!
- {
- List <Path> pathsList = new ArrayList<Path>();
- for (int i=0;i<startPoint.GetPN();i++)
- {
- Path tempPath = startPoint.GetPath(i);
- if (tempPath.GetLength()<=remainingDistance)
- {
- Path[] tempArray = CalculateFinalPoints(points[tempPath.GetFinishPoint()], remainingDistance-tempPath.GetLength());
- for (int j=0;j<tempArray.length;j++)
- {
- pathsList.add(new Path(startPoint.GetNumber(), tempArray[j].GetFinishPoint(), tempPath.GetLength()+tempArray[j].GetLength(), tempPath.GetPrice()+tempArray[j].GetPrice()));
- }
- }
- }
- return convertPathListToArray(pathsList);
- }
- public static Path[] convertPathListToArray(List<Path> list)
- {
- Path[] toReturn = new Path[list.size()];
- for (int i=0;i<list.size();i++)
- {
- toReturn[i]=list.get(i);
- }
- return toReturn;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement