本文整理汇总了Java中battlecode.serial.RoundDelta类的典型用法代码示例。如果您正苦于以下问题:Java RoundDelta类的具体用法?Java RoundDelta怎么用?Java RoundDelta使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RoundDelta类属于battlecode.serial包,在下文中一共展示了RoundDelta类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOutput
import battlecode.serial.RoundDelta; //导入依赖的package包/类
public List<Object> getOutput() {
// Copy data
ArrayList<Object> output = new ArrayList<Object>(data);
// Insert awesomeness stats into RoundDelta
int statNum = 0;
for (ListIterator<Object> iter = output.listIterator(); iter.hasNext(); ) {
Object round = iter.next();
if (round instanceof RoundDelta) {
RoundDelta rd = (RoundDelta) round;
//iter.add(stats.get(statNum++));
//Signal[] oldSignals = rd.getSignals();
Signal[] oldSignals = stripIndicatorStrings(rd.getSignals());
final int len = oldSignals.length;
Signal[] newSignals = new Signal[len + 1];
System.arraycopy(oldSignals, 0, newSignals, 1, len);
newSignals[0] = stats.get(statNum++);
rd.setSignals(newSignals);
}
}
return output;
}
示例2: unmarshal
import battlecode.serial.RoundDelta; //导入依赖的package包/类
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
RoundDelta rd = new RoundDelta();
rd.setInternalSignals((InternalSignal[]) context.convertAnother
(rd, InternalSignal[].class));
return rd;
}
示例3: apply
import battlecode.serial.RoundDelta; //导入依赖的package包/类
public synchronized void apply(RoundDelta rd) {
preUpdateRound();
for (InternalSignal internalSignal : rd.getInternalSignals()) {
visitSignal(internalSignal);
}
postUpdateRound();
}
示例4: addData
import battlecode.serial.RoundDelta; //导入依赖的package包/类
public void addData(Object o) {
data.add(o);
if (o instanceof MatchHeader) {
visitHeader((MatchHeader) o);
System.out.println("Center: " + centerX + " " + centerY + " " + radius);
} else if (o instanceof RoundDelta) {
stats.add(visitRound((RoundDelta) o));
}
}
示例5: canConvert
import battlecode.serial.RoundDelta; //导入依赖的package包/类
public boolean canConvert(Class cls) {
return cls.equals(RoundDelta.class);
}
示例6: marshal
import battlecode.serial.RoundDelta; //导入依赖的package包/类
public void marshal(Object value, HierarchicalStreamWriter writer,
MarshallingContext context) {
context.convertAnother(((RoundDelta) value).getInternalSignals());
}
示例7: applyDelta
import battlecode.serial.RoundDelta; //导入依赖的package包/类
private void applyDelta(E gs, RoundDelta delta) {
long startTime = System.nanoTime();
gs.apply(delta);
applyTime += (System.nanoTime() - startTime);
numApplies++;
}
示例8: marshal
import battlecode.serial.RoundDelta; //导入依赖的package包/类
public void marshal(Object value, HierarchicalStreamWriter writer,
MarshallingContext context) {
context.convertAnother(((RoundDelta) value).getSignals());
}
示例9: unmarshal
import battlecode.serial.RoundDelta; //导入依赖的package包/类
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
RoundDelta rd = new RoundDelta();
rd.setSignals((Signal[]) context.convertAnother(rd, Signal[].class));
return rd;
}
示例10: writeRound
import battlecode.serial.RoundDelta; //导入依赖的package包/类
/**
* Writes round data to the recipient.
*
* @param data the round data bytes to write
* @throws IOException if the recipient could not be written to
*/
public void writeRound(RoundDelta round) throws IOException {
writeObject(round);
}