func New() (Logic, error) { pageLoader, err := wiki.GetBoltPageLoader() if err != nil { return nil, err } pathFinder := bfs.GetBfsPathFinder(pageLoader) return &logicImpl{pageLoader, pathFinder}, nil }
func getPathFinder(algorithm string, pageLoader wiki.PageLoader) wiki.PathFinder { switch algorithm { case "bfs": return bfs.GetBfsPathFinder(pageLoader) case "iddfs": return iddfs.GetIddfsPathFinder(pageLoader) default: log.Fatal("Unknown path finding algorithm: ", algorithm) return nil } }