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


Java InstanceDataSingleton.setValue方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:17,代码来源:SevenSegment.java

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

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

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

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

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

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

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

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

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


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