Search in sources :

Example 1 with ConcurrentVisitedTree

use of common.tree.ConcurrentVisitedTree in project solution-finder by knewjade.

the class ConcurrentCheckerNoHoldInvoker method search.

@Override
public List<Pair<Pieces, Boolean>> search(Field field, List<Pieces> searchingPieces, int maxClearLine, int maxDepth) throws FinderExecuteException {
    ConcurrentVisitedTree visitedTree = new ConcurrentVisitedTree();
    Obj obj = new Obj(field, maxClearLine, maxDepth, visitedTree);
    ArrayList<Task> tasks = new ArrayList<>();
    for (Pieces target : searchingPieces) tasks.add(new Task(obj, commonObj, target));
    try {
        return execute(tasks);
    } catch (InterruptedException | ExecutionException e) {
        throw new FinderExecuteException(e);
    }
}
Also used : CheckerCommonObj(concurrent.checker.invoker.CheckerCommonObj) ArrayList(java.util.ArrayList) ExecutionException(java.util.concurrent.ExecutionException) FinderExecuteException(exceptions.FinderExecuteException) ConcurrentVisitedTree(common.tree.ConcurrentVisitedTree) Pieces(common.datastore.blocks.Pieces)

Example 2 with ConcurrentVisitedTree

use of common.tree.ConcurrentVisitedTree in project solution-finder by knewjade.

the class SingleCheckerNoHoldInvoker method search.

@Override
public List<Pair<Pieces, Boolean>> search(Field field, List<Pieces> searchingPieces, int maxClearLine, int maxDepth) throws FinderExecuteException {
    ConcurrentVisitedTree visitedTree = new ConcurrentVisitedTree();
    Obj obj = new Obj(field, maxClearLine, maxDepth, visitedTree);
    try {
        ArrayList<Pair<Pieces, Boolean>> results = new ArrayList<>();
        for (Pieces target : searchingPieces) {
            Task task = new Task(obj, commonObj, target);
            results.add(task.call());
        }
        return results;
    } catch (Exception e) {
        throw new FinderExecuteException(e);
    }
}
Also used : CheckerCommonObj(concurrent.checker.invoker.CheckerCommonObj) ArrayList(java.util.ArrayList) FinderExecuteException(exceptions.FinderExecuteException) ConcurrentVisitedTree(common.tree.ConcurrentVisitedTree) FinderExecuteException(exceptions.FinderExecuteException) Pair(common.datastore.Pair) Pieces(common.datastore.blocks.Pieces)

Example 3 with ConcurrentVisitedTree

use of common.tree.ConcurrentVisitedTree in project solution-finder by knewjade.

the class ConcurrentCheckerUsingHoldInvoker method search.

@Override
public List<Pair<Pieces, Boolean>> search(Field field, List<Pieces> searchingPieces, int maxClearLine, int maxDepth) throws FinderExecuteException {
    ConcurrentVisitedTree visitedTree = new ConcurrentVisitedTree();
    Obj obj = new Obj(field, maxClearLine, maxDepth, visitedTree);
    ArrayList<Task> tasks = new ArrayList<>();
    for (Pieces target : searchingPieces) tasks.add(new Task(obj, commonObj, target));
    try {
        return execute(tasks);
    } catch (InterruptedException | ExecutionException e) {
        throw new FinderExecuteException(e);
    }
}
Also used : CheckerCommonObj(concurrent.checker.invoker.CheckerCommonObj) ArrayList(java.util.ArrayList) ExecutionException(java.util.concurrent.ExecutionException) FinderExecuteException(exceptions.FinderExecuteException) ConcurrentVisitedTree(common.tree.ConcurrentVisitedTree) Pieces(common.datastore.blocks.Pieces)

Example 4 with ConcurrentVisitedTree

use of common.tree.ConcurrentVisitedTree in project solution-finder by knewjade.

the class SingleCheckerUsingHoldInvoker method search.

@Override
public List<Pair<Pieces, Boolean>> search(Field field, List<Pieces> searchingPieces, int maxClearLine, int maxDepth) throws FinderExecuteException {
    ConcurrentVisitedTree visitedTree = new ConcurrentVisitedTree();
    Obj obj = new Obj(field, maxClearLine, maxDepth, visitedTree);
    ArrayList<Pair<Pieces, Boolean>> results = new ArrayList<>();
    try {
        for (Pieces target : searchingPieces) {
            Task task = new Task(obj, commonObj, target);
            Pair<Pieces, Boolean> call = task.call();
            results.add(call);
        }
    } catch (Exception e) {
        throw new FinderExecuteException(e);
    }
    // 結果をリストに追加する
    return results;
}
Also used : CheckerCommonObj(concurrent.checker.invoker.CheckerCommonObj) ArrayList(java.util.ArrayList) FinderExecuteException(exceptions.FinderExecuteException) ConcurrentVisitedTree(common.tree.ConcurrentVisitedTree) ExecutionException(java.util.concurrent.ExecutionException) FinderExecuteException(exceptions.FinderExecuteException) Pair(common.datastore.Pair) Pieces(common.datastore.blocks.Pieces)

Aggregations

Pieces (common.datastore.blocks.Pieces)4 ConcurrentVisitedTree (common.tree.ConcurrentVisitedTree)4 CheckerCommonObj (concurrent.checker.invoker.CheckerCommonObj)4 FinderExecuteException (exceptions.FinderExecuteException)4 ArrayList (java.util.ArrayList)4 ExecutionException (java.util.concurrent.ExecutionException)3 Pair (common.datastore.Pair)2