當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。