当前位置: 首页>>代码示例>>Java>>正文


Java TruthTable.getOutputColumnCount方法代码示例

本文整理汇总了Java中com.cburch.logisim.analyze.model.TruthTable.getOutputColumnCount方法的典型用法代码示例。如果您正苦于以下问题:Java TruthTable.getOutputColumnCount方法的具体用法?Java TruthTable.getOutputColumnCount怎么用?Java TruthTable.getOutputColumnCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.cburch.logisim.analyze.model.TruthTable的用法示例。


在下文中一共展示了TruthTable.getOutputColumnCount方法的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);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:20,代码来源:TruthTableMouseListener.java

示例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;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:20,代码来源:TruthTableMouseListener.java

示例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();
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:27,代码来源:TableTabCaret.java

示例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);
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:19,代码来源:TruthTableMouseListener.java

示例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;
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:19,代码来源:TruthTableMouseListener.java

示例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;
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:18,代码来源:TruthTableMouseListener.java

示例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();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:28,代码来源:TableTabCaret.java

示例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;
	}
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:34,代码来源:TableTabCaret.java

示例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();
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:14,代码来源:TableTabCaret.java

示例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);
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:15,代码来源:TruthTableMouseListener.java

示例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;
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:50,代码来源:TableTabCaret.java

示例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));
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:53,代码来源:TableTabCaret.java

示例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;
	}
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:49,代码来源:TableTabCaret.java

示例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));
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:54,代码来源:TableTabCaret.java

示例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));
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:50,代码来源:TableTabCaret.java


注:本文中的com.cburch.logisim.analyze.model.TruthTable.getOutputColumnCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。