本文整理汇总了Java中com.cburch.logisim.analyze.model.TruthTable.getRowCount方法的典型用法代码示例。如果您正苦于以下问题:Java TruthTable.getRowCount方法的具体用法?Java TruthTable.getRowCount怎么用?Java TruthTable.getRowCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.cburch.logisim.analyze.model.TruthTable
的用法示例。
在下文中一共展示了TruthTable.getRowCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mousePressed
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent event) {
TruthTablePanel source = (TruthTablePanel) event.getSource();
TruthTable model = source.getTruthTable();
int cols = model.getInputColumnCount() + model.getOutputColumnCount();
int rows = model.getRowCount();
cellX = source.getOutputColumn(event);
cellY = source.getRow(event);
if (cellX < 0 || cellY < 0 || cellX >= cols || cellY >= rows)
return;
oldValue = source.getTruthTable().getOutputEntry(cellY, cellX);
if (oldValue == Entry.ZERO)
newValue = Entry.ONE;
else if (oldValue == Entry.ONE)
newValue = Entry.DONT_CARE;
else
newValue = Entry.ZERO;
source.setEntryProvisional(cellY, cellX, newValue);
}
示例2: mouseReleased
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent event) {
TruthTablePanel source = (TruthTablePanel) event.getSource();
TruthTable model = source.getTruthTable();
int cols = model.getInputColumnCount() + model.getOutputColumnCount();
int rows = model.getRowCount();
if (cellX < 0 || cellY < 0 || cellX >= cols || cellY >= rows)
return;
int x = source.getOutputColumn(event);
int y = source.getRow(event);
TruthTable table = source.getTruthTable();
if (x == cellX && y == cellY) {
table.setOutputEntry(y, x, newValue);
}
source.setEntryProvisional(cellY, cellX, null);
cellX = -1;
cellY = -1;
}
示例3: structureChanged
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
public void structureChanged(TruthTableEvent event) {
TruthTable model = event.getSource();
int inputs = model.getInputColumnCount();
int outputs = model.getOutputColumnCount();
int rows = model.getRowCount();
int cols = inputs + outputs;
boolean changed = false;
if (cursorRow >= rows) {
cursorRow = rows - 1;
changed = true;
}
if (cursorCol >= cols) {
cursorCol = cols - 1;
changed = true;
}
if (markRow >= rows) {
markRow = rows - 1;
changed = true;
}
if (markCol >= cols) {
markCol = cols - 1;
changed = true;
}
if (changed)
table.repaint();
}
示例4: mousePressed
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
public void mousePressed(MouseEvent event) {
TruthTablePanel source = (TruthTablePanel) event.getSource();
TruthTable model = source.getTruthTable();
int cols = model.getInputColumnCount() + model.getOutputColumnCount();
int rows = model.getRowCount();
cellX = source.getOutputColumn(event);
cellY = source.getRow(event);
if (cellX < 0 || cellY < 0 || cellX >= cols || cellY >= rows)
return;
oldValue = source.getTruthTable().getOutputEntry(cellY, cellX);
if (oldValue == Entry.ZERO)
newValue = Entry.ONE;
else if (oldValue == Entry.ONE)
newValue = Entry.DONT_CARE;
else
newValue = Entry.ZERO;
source.setEntryProvisional(cellY, cellX, newValue);
}
示例5: mouseReleased
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
public void mouseReleased(MouseEvent event) {
TruthTablePanel source = (TruthTablePanel) event.getSource();
TruthTable model = source.getTruthTable();
int cols = model.getInputColumnCount() + model.getOutputColumnCount();
int rows = model.getRowCount();
if (cellX < 0 || cellY < 0 || cellX >= cols || cellY >= rows)
return;
int x = source.getOutputColumn(event);
int y = source.getRow(event);
TruthTable table = source.getTruthTable();
if (x == cellX && y == cellY) {
table.setOutputEntry(y, x, newValue);
}
source.setEntryProvisional(cellY, cellX, null);
cellX = -1;
cellY = -1;
}
示例6: mouseReleased
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
public void mouseReleased(MouseEvent event) {
TruthTablePanel source = (TruthTablePanel) event.getSource();
TruthTable model = source.getTruthTable();
int cols = model.getInputColumnCount() + model.getOutputColumnCount();
int rows = model.getRowCount();
if (cellX < 0 || cellY < 0 || cellX >= cols || cellY >= rows) return;
int x = source.getOutputColumn(event);
int y = source.getRow(event);
TruthTable table = source.getTruthTable();
if (x == cellX && y == cellY) {
table.setOutputEntry(y, x, newValue);
}
source.setEntryProvisional(cellY, cellX, null);
cellX = -1;
cellY = -1;
}
示例7: structureChanged
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
@Override
public void structureChanged(TruthTableEvent event) {
TruthTable model = event.getSource();
int inputs = model.getInputColumnCount();
int outputs = model.getOutputColumnCount();
int rows = model.getRowCount();
int cols = inputs + outputs;
boolean changed = false;
if (cursorRow >= rows) {
cursorRow = rows - 1;
changed = true;
}
if (cursorCol >= cols) {
cursorCol = cols - 1;
changed = true;
}
if (markRow >= rows) {
markRow = rows - 1;
changed = true;
}
if (markCol >= cols) {
markCol = cols - 1;
changed = true;
}
if (changed)
table.repaint();
}
示例8: keyPressed
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
public void keyPressed(KeyEvent e) {
if (cursorRow < 0) return;
TruthTable model = table.getTruthTable();
int rows = model.getRowCount();
int inputs = model.getInputColumnCount();
int outputs = model.getOutputColumnCount();
int cols = inputs + outputs;
boolean shift = (e.getModifiers() & InputEvent.SHIFT_MASK) != 0;
switch (e.getKeyCode()) {
case KeyEvent.VK_UP: setCursor(cursorRow - 1, cursorCol, shift); break;
case KeyEvent.VK_LEFT: setCursor(cursorRow, cursorCol - 1, shift); break;
case KeyEvent.VK_DOWN: setCursor(cursorRow + 1, cursorCol, shift); break;
case KeyEvent.VK_RIGHT: setCursor(cursorRow, cursorCol + 1, shift); break;
case KeyEvent.VK_HOME:
if (cursorCol == 0) setCursor(0, 0, shift);
else setCursor(cursorRow, 0, shift);
break;
case KeyEvent.VK_END:
if (cursorCol == cols - 1) setCursor(rows - 1, cols - 1, shift);
else setCursor(cursorRow, cols - 1, shift);
break;
case KeyEvent.VK_PAGE_DOWN:
rows = table.getVisibleRect().height / table.getCellHeight();
if (rows > 2) rows--;
setCursor(cursorRow + rows, cursorCol, shift);
break;
case KeyEvent.VK_PAGE_UP:
rows = table.getVisibleRect().height / table.getCellHeight();
if (rows > 2) rows--;
setCursor(cursorRow - rows, cursorCol, shift);
break;
}
}
示例9: structureChanged
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
public void structureChanged(TruthTableEvent event) {
TruthTable model = event.getSource();
int inputs = model.getInputColumnCount();
int outputs = model.getOutputColumnCount();
int rows = model.getRowCount();
int cols = inputs + outputs;
boolean changed = false;
if (cursorRow >= rows) { cursorRow = rows - 1; changed = true; }
if (cursorCol >= cols) { cursorCol = cols - 1; changed = true; }
if (markRow >= rows) { markRow = rows - 1; changed = true; }
if (markCol >= cols) { markCol = cols - 1; changed = true; }
if (changed) table.repaint();
}
示例10: mousePressed
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
public void mousePressed(MouseEvent event) {
TruthTablePanel source = (TruthTablePanel) event.getSource();
TruthTable model = source.getTruthTable();
int cols = model.getInputColumnCount() + model.getOutputColumnCount();
int rows = model.getRowCount();
cellX = source.getOutputColumn(event);
cellY = source.getRow(event);
if (cellX < 0 || cellY < 0 || cellX >= cols || cellY >= rows) return;
oldValue = source.getTruthTable().getOutputEntry(cellY, cellX);
if (oldValue == Entry.ZERO) newValue = Entry.ONE;
else if (oldValue == Entry.ONE) newValue = Entry.DONT_CARE;
else newValue = Entry.ZERO;
source.setEntryProvisional(cellY, cellX, newValue);
}
示例11: keyPressed
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyEvent e) {
if (cursorRow < 0)
return;
TruthTable model = table.getTruthTable();
int rows = model.getRowCount();
int inputs = model.getInputColumnCount();
int outputs = model.getOutputColumnCount();
int cols = inputs + outputs;
boolean shift = (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0;
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
setCursor(cursorRow - 1, cursorCol, shift);
break;
case KeyEvent.VK_LEFT:
setCursor(cursorRow, cursorCol - 1, shift);
break;
case KeyEvent.VK_DOWN:
setCursor(cursorRow + 1, cursorCol, shift);
break;
case KeyEvent.VK_RIGHT:
setCursor(cursorRow, cursorCol + 1, shift);
break;
case KeyEvent.VK_HOME:
if (cursorCol == 0)
setCursor(0, 0, shift);
else
setCursor(cursorRow, 0, shift);
break;
case KeyEvent.VK_END:
if (cursorCol == cols - 1)
setCursor(rows - 1, cols - 1, shift);
else
setCursor(cursorRow, cols - 1, shift);
break;
case KeyEvent.VK_PAGE_DOWN:
rows = table.getVisibleRect().height / table.getCellHeight();
if (rows > 2)
rows--;
setCursor(cursorRow + rows, cursorCol, shift);
break;
case KeyEvent.VK_PAGE_UP:
rows = table.getVisibleRect().height / table.getCellHeight();
if (rows > 2)
rows--;
setCursor(cursorRow - rows, cursorCol, shift);
break;
}
}
示例12: setCursor
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
private void setCursor(int row, int col, boolean keepMark) {
TruthTable model = table.getTruthTable();
int rows = model.getRowCount();
int cols = model.getInputColumnCount() + model.getOutputColumnCount();
if (row < 0)
row = 0;
if (col < 0)
col = 0;
if (row >= rows)
row = rows - 1;
if (col >= cols)
col = cols - 1;
if (row == cursorRow && col == cursorCol && (keepMark || (row == markRow && col == markCol))) {
; // nothing is changing, so do nothing
} else if (!keepMark && markRow == cursorRow && markCol == cursorCol) {
int oldRow = cursorRow;
int oldCol = cursorCol;
cursorRow = row;
cursorCol = col;
markRow = row;
markCol = col;
expose(oldRow, oldCol);
expose(cursorRow, cursorCol);
} else {
int r0 = Math.min(row, Math.min(cursorRow, markRow));
int r1 = Math.max(row, Math.max(cursorRow, markRow));
int c0 = Math.min(col, Math.min(cursorCol, markCol));
int c1 = Math.max(col, Math.max(cursorCol, markCol));
cursorRow = row;
cursorCol = col;
if (!keepMark) {
markRow = row;
markCol = col;
}
int x0 = table.getX(c0);
int x1 = table.getX(c1) + table.getCellWidth();
int y0 = table.getY(r0);
int y1 = table.getY(r1) + table.getCellHeight();
table.repaint(x0 - 2, y0 - 2, (x1 - x0) + 4, (y1 - y0) + 4);
}
int cx = table.getX(cursorCol);
int cy = table.getY(cursorRow);
int cw = table.getCellWidth();
int ch = table.getCellHeight();
if (cursorRow == 0) {
ch += cy;
cy = 0;
}
table.scrollRectToVisible(new Rectangle(cx, cy, cw, ch));
}
示例13: keyPressed
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
public void keyPressed(KeyEvent e) {
if (cursorRow < 0)
return;
TruthTable model = table.getTruthTable();
int rows = model.getRowCount();
int inputs = model.getInputColumnCount();
int outputs = model.getOutputColumnCount();
int cols = inputs + outputs;
boolean shift = (e.getModifiers() & InputEvent.SHIFT_MASK) != 0;
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
setCursor(cursorRow - 1, cursorCol, shift);
break;
case KeyEvent.VK_LEFT:
setCursor(cursorRow, cursorCol - 1, shift);
break;
case KeyEvent.VK_DOWN:
setCursor(cursorRow + 1, cursorCol, shift);
break;
case KeyEvent.VK_RIGHT:
setCursor(cursorRow, cursorCol + 1, shift);
break;
case KeyEvent.VK_HOME:
if (cursorCol == 0)
setCursor(0, 0, shift);
else
setCursor(cursorRow, 0, shift);
break;
case KeyEvent.VK_END:
if (cursorCol == cols - 1)
setCursor(rows - 1, cols - 1, shift);
else
setCursor(cursorRow, cols - 1, shift);
break;
case KeyEvent.VK_PAGE_DOWN:
rows = table.getVisibleRect().height / table.getCellHeight();
if (rows > 2)
rows--;
setCursor(cursorRow + rows, cursorCol, shift);
break;
case KeyEvent.VK_PAGE_UP:
rows = table.getVisibleRect().height / table.getCellHeight();
if (rows > 2)
rows--;
setCursor(cursorRow - rows, cursorCol, shift);
break;
}
}
示例14: setCursor
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
private void setCursor(int row, int col, boolean keepMark) {
TruthTable model = table.getTruthTable();
int rows = model.getRowCount();
int cols = model.getInputColumnCount() + model.getOutputColumnCount();
if (row < 0)
row = 0;
if (col < 0)
col = 0;
if (row >= rows)
row = rows - 1;
if (col >= cols)
col = cols - 1;
if (row == cursorRow && col == cursorCol
&& (keepMark || (row == markRow && col == markCol))) {
; // nothing is changing, so do nothing
} else if (!keepMark && markRow == cursorRow && markCol == cursorCol) {
int oldRow = cursorRow;
int oldCol = cursorCol;
cursorRow = row;
cursorCol = col;
markRow = row;
markCol = col;
expose(oldRow, oldCol);
expose(cursorRow, cursorCol);
} else {
int r0 = Math.min(row, Math.min(cursorRow, markRow));
int r1 = Math.max(row, Math.max(cursorRow, markRow));
int c0 = Math.min(col, Math.min(cursorCol, markCol));
int c1 = Math.max(col, Math.max(cursorCol, markCol));
cursorRow = row;
cursorCol = col;
if (!keepMark) {
markRow = row;
markCol = col;
}
int x0 = table.getX(c0);
int x1 = table.getX(c1) + table.getCellWidth();
int y0 = table.getY(r0);
int y1 = table.getY(r1) + table.getCellHeight();
table.repaint(x0 - 2, y0 - 2, (x1 - x0) + 4, (y1 - y0) + 4);
}
int cx = table.getX(cursorCol);
int cy = table.getY(cursorRow);
int cw = table.getCellWidth();
int ch = table.getCellHeight();
if (cursorRow == 0) {
ch += cy;
cy = 0;
}
table.scrollRectToVisible(new Rectangle(cx, cy, cw, ch));
}
示例15: setCursor
import com.cburch.logisim.analyze.model.TruthTable; //导入方法依赖的package包/类
private void setCursor(int row, int col, boolean keepMark) {
TruthTable model = table.getTruthTable();
int rows = model.getRowCount();
int cols = model.getInputColumnCount() + model.getOutputColumnCount();
if (row < 0) row = 0;
if (col < 0) col = 0;
if (row >= rows) row = rows - 1;
if (col >= cols) col = cols - 1;
if (row == cursorRow && col == cursorCol
&& (keepMark || (row == markRow && col == markCol))) {
; // nothing is changing, so do nothing
} else if (!keepMark && markRow == cursorRow && markCol == cursorCol) {
int oldRow = cursorRow;
int oldCol = cursorCol;
cursorRow = row;
cursorCol = col;
markRow = row;
markCol = col;
expose(oldRow, oldCol);
expose(cursorRow, cursorCol);
} else {
int r0 = Math.min(row, Math.min(cursorRow, markRow));
int r1 = Math.max(row, Math.max(cursorRow, markRow));
int c0 = Math.min(col, Math.min(cursorCol, markCol));
int c1 = Math.max(col, Math.max(cursorCol, markCol));
cursorRow = row;
cursorCol = col;
if (!keepMark) {
markRow = row;
markCol = col;
}
int x0 = table.getX(c0);
int x1 = table.getX(c1) + table.getCellWidth();
int y0 = table.getY(r0);
int y1 = table.getY(r1) + table.getCellHeight();
table.repaint(x0 - 2, y0 - 2, (x1 - x0) + 4, (y1 - y0) + 4);
}
int cx = table.getX(cursorCol);
int cy = table.getY(cursorRow);
int cw = table.getCellWidth();
int ch = table.getCellHeight();
if (cursorRow == 0) {
ch += cy;
cy = 0;
}
table.scrollRectToVisible(new Rectangle(cx, cy, cw, ch));
}