Search in sources :

Example 6 with FinderExecuteException

use of exceptions.FinderExecuteException 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 7 with FinderExecuteException

use of exceptions.FinderExecuteException in project solution-finder by knewjade.

the class PathEntryPoint method close.

@Override
public void close() throws FinderTerminateException {
    try {
        flush();
        logWriter.close();
    } catch (IOException | FinderExecuteException e) {
        throw new FinderTerminateException(e);
    }
}
Also used : IOException(java.io.IOException) FinderExecuteException(exceptions.FinderExecuteException) FinderTerminateException(exceptions.FinderTerminateException)

Example 8 with FinderExecuteException

use of exceptions.FinderExecuteException in project solution-finder by knewjade.

the class SetupEntryPoint method close.

@Override
public void close() throws FinderTerminateException {
    try {
        flush();
        logWriter.close();
    } catch (IOException | FinderExecuteException e) {
        throw new FinderTerminateException(e);
    }
}
Also used : IOException(java.io.IOException) FinderExecuteException(exceptions.FinderExecuteException) FinderTerminateException(exceptions.FinderTerminateException)

Example 9 with FinderExecuteException

use of exceptions.FinderExecuteException 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 10 with FinderExecuteException

use of exceptions.FinderExecuteException 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

FinderExecuteException (exceptions.FinderExecuteException)15 IOException (java.io.IOException)10 Pieces (common.datastore.blocks.Pieces)6 Field (core.field.Field)6 FinderInitializeException (exceptions.FinderInitializeException)5 SizedBit (searcher.pack.SizedBit)5 PatternGenerator (common.pattern.PatternGenerator)4 ConcurrentVisitedTree (common.tree.ConcurrentVisitedTree)4 CheckerCommonObj (concurrent.checker.invoker.CheckerCommonObj)4 BufferedWriter (java.io.BufferedWriter)4 ArrayList (java.util.ArrayList)4 LongPieces (common.datastore.blocks.LongPieces)3 Piece (core.mino.Piece)3 PathEntryPoint (entry.path.PathEntryPoint)3 PathPair (entry.path.PathPair)3 PathSettings (entry.path.PathSettings)3 FinderTerminateException (exceptions.FinderTerminateException)3 File (java.io.File)3 ExecutionException (java.util.concurrent.ExecutionException)3 Collectors (java.util.stream.Collectors)3