author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Thu, 30 Oct 2014 21:30:10 +0100 | |
changeset 409 | 40cabcdcd2be |
permissions | -rw-r--r-- |
jtulach@208 | 1 |
package org.apidesign.sidemeanings; |
jtulach@208 | 2 |
|
jtulach@208 | 3 |
// BEGIN: sidemeanings.Mixed.Dirty |
jtulach@208 | 4 |
public abstract class MixedClass { |
jtulach@208 | 5 |
private int counter; |
jtulach@208 | 6 |
private int sum; |
jtulach@208 | 7 |
|
jtulach@208 | 8 |
protected MixedClass() { |
jtulach@208 | 9 |
super(); |
jtulach@208 | 10 |
} |
jtulach@208 | 11 |
|
jtulach@208 | 12 |
public final int apiForClients() { |
jtulach@208 | 13 |
int subclass = toBeImplementedBySubclass(); |
jtulach@208 | 14 |
sum += subclass; |
jtulach@208 | 15 |
return sum / counter; |
jtulach@208 | 16 |
} |
jtulach@208 | 17 |
|
jtulach@208 | 18 |
protected abstract int toBeImplementedBySubclass(); |
jtulach@208 | 19 |
|
jtulach@208 | 20 |
protected final void toBeCalledBySubclass() { |
jtulach@208 | 21 |
counter++; |
jtulach@208 | 22 |
} |
jtulach@208 | 23 |
} |
jtulach@208 | 24 |
// END: sidemeanings.Mixed.Dirty |