1 package net.mograsim.plugin.memory;
3 import org.eclipse.jface.viewers.IStructuredContentProvider;
5 import net.mograsim.machine.MainMemory;
7 public class MemoryTableContentProvider implements IStructuredContentProvider
11 public final static int limit = 128;
14 public Object[] getElements(Object arg0)
18 MainMemory memory = (MainMemory) arg0;
19 lower = Long.max(lower, memory.getDefinition().getMinimalAddress());
20 Object[] rows = new Object[amount];
21 for (int i = 0; i < amount; i++)
22 rows[i] = new MemoryTableRow(lower + i, memory);
27 * Sets the bounds for the addresses in memory to be provided to the table.
29 * @param lower lower bound for address (inclusive)
30 * @param amount amount of cells to show; limited to {@link MemoryTableContentProvider#limit}
32 public void setAddressRange(long lower, int amount)
35 this.amount = Integer.min(Integer.max(amount, 0), limit);
38 public void setLowerBound(long lower)
40 setAddressRange(lower, amount);
43 public void setAmount(int amount)
45 setAddressRange(lower, amount);
48 public long getLowerBound()
53 public int getAmount()