/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/RequestFrameVisitor.java |
---|
File deleted |
\ No newline at end of file |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/ProfilerLabelRequestFrame.java |
---|
0,0 → 1,21 |
package dongfang.mkt.frames; |
import java.io.IOException; |
import dongfang.mkt.RequestFrameVisitor; |
public class ProfilerLabelRequestFrame extends RequestFrame { |
int channel; |
public ProfilerLabelRequestFrame(int address, int channel) { |
super(address); |
this.channel = channel; |
} |
public int getChannel() { |
return channel; |
} |
public void accept(RequestFrameVisitor o) throws IOException { |
o.visit(this); |
} |
} |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/ProfilerLabelResponseFrame.java |
---|
0,0 → 1,42 |
package dongfang.mkt.frames; |
public class ProfilerLabelResponseFrame extends ResponseFrame { |
private int channel; |
private char[] label; |
public ProfilerLabelResponseFrame(int address) { |
super(address); |
} |
@Override |
public boolean isResponseTo(RequestFrame r) { |
return r instanceof ProfilerLabelRequestFrame |
&& ((ProfilerLabelRequestFrame)r).getChannel() == channel; |
} |
public int getChannel() { |
return channel; |
} |
public void setChannel(int channel) { |
this.channel = channel; |
} |
public char[] getLabel() { |
return label; |
} |
public String getLabelAsString() { |
return new String(label); |
} |
public void setLabel(char[] label) { |
this.label = label; |
} |
public String toString() { |
return getClass().getSimpleName() + ": label=" + getLabelAsString(); |
} |
} |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/ProfilerRequestFrame.java |
---|
0,0 → 1,26 |
package dongfang.mkt.frames; |
import java.io.IOException; |
import dongfang.mkt.RequestFrameVisitor; |
public class ProfilerRequestFrame extends RequestFrame { |
private int autoSendInterval; |
public ProfilerRequestFrame(int address) { |
super(address); |
} |
public int getAutoSendInterval() { |
return autoSendInterval; |
} |
public void setAutoSendInterval(int autoSendInterval) { |
this.autoSendInterval = autoSendInterval; |
} |
public void accept(RequestFrameVisitor o) throws IOException { |
o.visit(this); |
} |
} |
/dongfang_FC_rewrite_tool/src/dongfang/mkt/frames/ProfilerResponseFrame.java |
---|
0,0 → 1,51 |
package dongfang.mkt.frames; |
public class ProfilerResponseFrame extends ResponseFrame { |
private final static int NUM_ENTRIES = 16; |
private int[] activities= new int[NUM_ENTRIES]; |
private int totalHits; |
public ProfilerResponseFrame(int address) { |
super(address); |
} |
public int[] getActivities() { |
return activities; |
} |
public void setActivity(int index, int value) { |
this.activities[index ]= value; |
} |
@Override |
public boolean isResponseTo(RequestFrame r) { |
return r instanceof ProfilerRequestFrame; |
} |
public int getTotalHits() { |
return totalHits; |
} |
public void setTotalHits(int totalHits) { |
this.totalHits = totalHits; |
} |
public double asFraction(int activity) { |
return (double)activities[activity] / (double)totalHits; |
} |
public String toString() { |
StringBuilder result = new StringBuilder(); |
result.append(getClass().getSimpleName()+"\r"); |
result.append("activities\r"); |
for (int i=0; i<activities.length; i++) { |
result.append(i); |
result.append(':'); |
result.append(activities[i]); |
result.append('\r'); |
} |
return result.toString(); |
} |
} |