Search in sources :

Example 1 with ArrayChunk

use of com.jetbrains.python.debugger.ArrayChunk in project intellij-community by JetBrains.

the class PyDataViewerPanel method apply.

public void apply(@NotNull PyDebugValue debugValue) {
    myErrorLabel.setVisible(false);
    String type = debugValue.getType();
    DataViewStrategy strategy = DataViewStrategy.getStrategy(type);
    if (strategy == null) {
        setError(type + " is not supported");
        return;
    }
    try {
        ArrayChunk arrayChunk = debugValue.getFrameAccessor().getArrayItems(debugValue, 0, 0, -1, -1, getFormat());
        updateUI(arrayChunk, debugValue, strategy);
    } catch (PyDebuggerException e) {
        LOG.error(e);
    }
}
Also used : ArrayChunk(com.jetbrains.python.debugger.ArrayChunk) PyDebuggerException(com.jetbrains.python.debugger.PyDebuggerException)

Example 2 with ArrayChunk

use of com.jetbrains.python.debugger.ArrayChunk in project intellij-community by JetBrains.

the class AsyncArrayTableModel method addToCache.

public void addToCache(final ArrayChunk chunk) {
    Object[][] data = chunk.getData();
    int cols = data.length;
    int rows = data[0].length;
    for (int roffset = 0; roffset < rows / CHUNK_ROW_SIZE; roffset++) {
        for (int coffset = 0; coffset < cols / CHUNK_COL_SIZE; coffset++) {
            Pair<Integer, Integer> key = itemToChunkKey(roffset * CHUNK_ROW_SIZE, coffset * CHUNK_COL_SIZE);
            final Object[][] chunkData = new Object[CHUNK_ROW_SIZE][CHUNK_COL_SIZE];
            for (int r = 0; r < CHUNK_ROW_SIZE; r++) {
                System.arraycopy(data[roffset * CHUNK_ROW_SIZE + r], coffset * 30, chunkData[r], 0, CHUNK_COL_SIZE);
            }
            myChunkCache.put(key, new ListenableFuture<ArrayChunk>() {

                @Override
                public void addListener(@NotNull Runnable listener, @NotNull Executor executor) {
                }

                @Override
                public boolean cancel(boolean mayInterruptIfRunning) {
                    return false;
                }

                @Override
                public boolean isCancelled() {
                    return false;
                }

                @Override
                public boolean isDone() {
                    return true;
                }

                @Override
                public ArrayChunk get() throws InterruptedException, ExecutionException {
                    return new ArrayChunkBuilder().setValue(chunk.getValue()).setSlicePresentation(null).setRows(0).setColumns(0).setMax(null).setMin(null).setFormat(null).setType(null).setData(chunkData).createArrayChunk();
                }

                @Override
                public ArrayChunk get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
                    return new ArrayChunkBuilder().setValue(chunk.getValue()).setSlicePresentation(null).setRows(0).setColumns(0).setMax(null).setMin(null).setFormat(null).setType(null).setData(chunkData).createArrayChunk();
                }
            });
        }
    }
    handleChunkAdded(0, 0, chunk);
}
Also used : ArrayChunk(com.jetbrains.python.debugger.ArrayChunk) ArrayChunkBuilder(com.jetbrains.python.debugger.ArrayChunkBuilder)

Aggregations

ArrayChunk (com.jetbrains.python.debugger.ArrayChunk)2 ArrayChunkBuilder (com.jetbrains.python.debugger.ArrayChunkBuilder)1 PyDebuggerException (com.jetbrains.python.debugger.PyDebuggerException)1