Blame |
Last modification |
View Log
| RSS feed
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();
}
}