本文整理汇总了Java中li.cil.oc.api.network.Component类的典型用法代码示例。如果您正苦于以下问题:Java Component类的具体用法?Java Component怎么用?Java Component使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Component类属于li.cil.oc.api.network包,在下文中一共展示了Component类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: hardwareInvoke
import li.cil.oc.api.network.Component; //导入依赖的package包/类
private Object[] hardwareInvoke(String address, String method, Object[] params) throws Exception {
if(method.equals("_getMethods")) {
Node node = machine.node().network().node(address);
if(node == null || !(node instanceof Component)) return new Object[]{null, "node disappeared?"};
Component component = (Component)node;
TreeMap<Object, Object> ret = new TreeMap<Object, Object>();
for(String name : component.methods()) {
Callback cb = component.annotation(name);
if(cb != null) {
TreeMap<Object, Object> map = new TreeMap<Object, Object>();
map.put("direct", cb.direct());
map.put("getter", cb.getter());
map.put("setter", cb.setter());
ret.put(name, map);
}
}
return new Object[]{ret};
}
else return machine.invoke(address, method, params);
}
开发者ID:SolraBizna,项目名称:jarm,代码行数:21,代码来源:CP3.java
示例2: reset
import li.cil.oc.api.network.Component; //导入依赖的package包/类
public synchronized void reset() {
// Reset CPU.
cpu.reset(false, true, true);
// Reset components.
for (Component c : ((FakeMachine) ((CP3) cpu.getCoprocessor(3)).getMachine()).getComponents()) {
if (c instanceof SimComponent) {
((SimComponent) c).reset();
}
};
// Reset simulator.
setState(State.PAUSED);
sleep = 0;
}
开发者ID:SolraBizna,项目名称:jarm,代码行数:16,代码来源:BasicDebugger.java
示例3: invoke
import li.cil.oc.api.network.Component; //导入依赖的package包/类
@Override
public Object[] invoke(String address, String method, Object[] args)
throws Exception {
Node n = network.node(address);
if (n == null || !(n instanceof Component)) {
throw new NoSuchMethodError();
}
return ((Component) n).invoke(method, this, args);
}
开发者ID:SolraBizna,项目名称:jarm,代码行数:10,代码来源:FakeMachine.java
示例4: setupOpenComputersApiMock
import li.cil.oc.api.network.Component; //导入依赖的package包/类
private static Node setupOpenComputersApiMock() {
final Component node = mock(Component.class);
final NodeBuilder nodeBuilderMock = mock(NodeBuilder.class);
final ComponentBuilder componentBuilderMock = mock(ComponentBuilder.class);
final NetworkAPI networkMock = mock(NetworkAPI.class);
li.cil.oc.api.API.network = networkMock;
when(networkMock.newNode(any(Environment.class), any(Visibility.class))).thenReturn(nodeBuilderMock);
when(nodeBuilderMock.withComponent(anyString())).thenReturn(componentBuilderMock);
when(componentBuilderMock.create()).thenReturn(node);
return node;
}
开发者ID:OpenMods,项目名称:OpenPeripheral,代码行数:13,代码来源:EnvironmentGeneratorTest.java
示例5: populateComponentList
import li.cil.oc.api.network.Component; //导入依赖的package包/类
public void populateComponentList(Map<String, String> ret) {
for(Node n : nodes.values()) {
ret.put(n.address(), ((Component)n).name());
}
}
开发者ID:SolraBizna,项目名称:jarm,代码行数:6,代码来源:FakeNetwork.java
注:本文中的li.cil.oc.api.network.Component类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论