本文整理汇总了Java中com.cburch.logisim.instance.InstanceDataSingleton.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java InstanceDataSingleton.setValue方法的具体用法?Java InstanceDataSingleton.setValue怎么用?Java InstanceDataSingleton.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.cburch.logisim.instance.InstanceDataSingleton
的用法示例。
在下文中一共展示了InstanceDataSingleton.setValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: propagate
import com.cburch.logisim.instance.InstanceDataSingleton; //导入方法依赖的package包/类
@Override
public void propagate(InstanceState state) {
int summary = 0;
for (int i = 0; i < 8; i++) {
Value val = state.getPort(i);
if (val == Value.TRUE)
summary |= 1 << i;
}
Object value = Integer.valueOf(summary);
InstanceDataSingleton data = (InstanceDataSingleton) state.getData();
if (data == null) {
state.setData(new InstanceDataSingleton(value));
} else {
data.setValue(value);
}
}
示例2: propagate
import com.cburch.logisim.instance.InstanceDataSingleton; //导入方法依赖的package包/类
@Override
public void propagate(InstanceState state) {
int summary = 0;
for (int i = 0; i < 3; i++) {
Value val = state.getPortValue(i);
if (val == Value.TRUE)
summary |= 1 << i;
}
Object value = Integer.valueOf(summary);
InstanceDataSingleton data = (InstanceDataSingleton) state.getData();
if (data == null) {
state.setData(new InstanceDataSingleton(value));
} else {
data.setValue(value);
}
}
示例3: propagate
import com.cburch.logisim.instance.InstanceDataSingleton; //导入方法依赖的package包/类
@Override
public void propagate(InstanceState state) {
int summary = 0;
for (int i = 0; i < 8; i++) {
Value val = state.getPortValue(i);
if (val == Value.TRUE)
summary |= 1 << i;
}
Object value = Integer.valueOf(summary);
InstanceDataSingleton data = (InstanceDataSingleton) state.getData();
if (data == null) {
state.setData(new InstanceDataSingleton(value));
} else {
data.setValue(value);
}
}
示例4: setActive
import com.cburch.logisim.instance.InstanceDataSingleton; //导入方法依赖的package包/类
private void setActive(InstanceState state, boolean active) {
InstanceDataSingleton data = (InstanceDataSingleton) state.getData();
if (data == null) {
state.setData(new InstanceDataSingleton(active));
} else {
data.setValue(active);
}
state.getInstance().fireInvalidated();
}
示例5: propagate
import com.cburch.logisim.instance.InstanceDataSingleton; //导入方法依赖的package包/类
@Override
public void propagate(InstanceState state) {
Value val = state.getPort(0);
InstanceDataSingleton data = (InstanceDataSingleton) state.getData();
if (data == null) {
state.setData(new InstanceDataSingleton(val));
} else {
data.setValue(val);
}
}
示例6: setValue
import com.cburch.logisim.instance.InstanceDataSingleton; //导入方法依赖的package包/类
private void setValue(InstanceState state, Value val) {
InstanceDataSingleton data = (InstanceDataSingleton) state.getData();
if (data == null) {
state.setData(new InstanceDataSingleton(val));
} else {
data.setValue(val);
}
state.getInstance().fireInvalidated();
}
示例7: propagate
import com.cburch.logisim.instance.InstanceDataSingleton; //导入方法依赖的package包/类
@Override
public void propagate(InstanceState state) {
Value val = state.getPortValue(0);
InstanceDataSingleton data = (InstanceDataSingleton) state.getData();
if (data == null) {
state.setData(new InstanceDataSingleton(val));
} else {
data.setValue(val);
}
}
示例8: setValue
import com.cburch.logisim.instance.InstanceDataSingleton; //导入方法依赖的package包/类
private void setValue(InstanceState state, Value val) {
InstanceDataSingleton data = (InstanceDataSingleton) state
.getData();
if (data == null) {
state.setData(new InstanceDataSingleton(val));
} else {
data.setValue(val);
}
state.getInstance().fireInvalidated();
}
示例9: propagate
import com.cburch.logisim.instance.InstanceDataSingleton; //导入方法依赖的package包/类
@Override
public void propagate(InstanceState state) {
int summary = 0;
for (int i = 0; i < 8; i++) {
Value val = state.getPort(i);
if (val == Value.TRUE) summary |= 1 << i;
}
Object value = Integer.valueOf(summary);
InstanceDataSingleton data = (InstanceDataSingleton) state.getData();
if (data == null) {
state.setData(new InstanceDataSingleton(value));
} else {
data.setValue(value);
}
}
示例10: propagate
import com.cburch.logisim.instance.InstanceDataSingleton; //导入方法依赖的package包/类
@Override
public void propagate(InstanceState state) {
int summary = 0;
Value baseVal = state.getPort(0);
if (baseVal == null) baseVal = Value.createUnknown(BitWidth.create(4));
int segs; // each nibble is one segment, in top-down, left-to-right
// order: middle three nibbles are the three horizontal segments
switch (baseVal.toIntValue()) {
case 0: segs = 0x1110111; break;
case 1: segs = 0x0000011; break;
case 2: segs = 0x0111110; break;
case 3: segs = 0x0011111; break;
case 4: segs = 0x1001011; break;
case 5: segs = 0x1011101; break;
case 6: segs = 0x1111101; break;
case 7: segs = 0x0010011; break;
case 8: segs = 0x1111111; break;
case 9: segs = 0x1011011; break;
case 10: segs = 0x1111011; break;
case 11: segs = 0x1101101; break;
case 12: segs = 0x1110100; break;
case 13: segs = 0x0101111; break;
case 14: segs = 0x1111100; break;
case 15: segs = 0x1111000; break;
default: segs = 0x0001000; break; // a dash '-'
}
if ((segs & 0x1) != 0) summary |= 4; // vertical seg in bottom right
if ((segs & 0x10) != 0) summary |= 2; // vertical seg in top right
if ((segs & 0x100) != 0) summary |= 8; // horizontal seg at bottom
if ((segs & 0x1000) != 0) summary |= 64; // horizontal seg at middle
if ((segs & 0x10000) != 0) summary |= 1; // horizontal seg at top
if ((segs & 0x100000) != 0) summary |= 16; // vertical seg at bottom left
if ((segs & 0x1000000) != 0) summary |= 32; // vertical seg at top left
if (state.getPort(1) == Value.TRUE) summary |= 128;
Object value = Integer.valueOf(summary);
InstanceDataSingleton data = (InstanceDataSingleton) state.getData();
if (data == null) {
state.setData(new InstanceDataSingleton(value));
} else {
data.setValue(value);
}
}