channelofinteger.java
来自「java实现的一个pascal编译器」· Java 代码 · 共 24 行
JAVA
24 行
package uk.co.brainycreatures.jpascal.type;
import jcsp.lang.*;
/**
* represents a channel that writes and reads
* integers to and from a channel
*/
public class ChannelOfInteger extends One2OneChannel {
/**
* writes an integer value to the channel;
*/
public void send(long value) {
write(new Long(value)); // write the value as an Integer object
}
/**
* returns the integer written to the channel
*/
public int receive() {
return ((Long) read()).intValue(); // return the int value
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?