123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package holeg.interfaces;
- public interface LocalMode {
-
- int STANDARD_GRAPH_ACCURACY=100;
- class Period {
- public Period(Period other) {
- this.type = other.type;
- this.interval = other.interval;
- }
- public enum PeriodType{
- Local, Global
- }
- private final PeriodType type;
- private int interval;
- public Period(int interval){
- this.interval = interval;
- type = PeriodType.Local;
- }
- public Period(){
- type = PeriodType.Global;
- };
- /**
- * Sets the local period of the element.
- * If the simulation has 100 steps and the local period is 50,
- * then there will be two full cycles during the simulation.
- * @param interval The local period for this element.
- */
- public void setInterval(int interval){
- this.interval = interval;
- }
- /**
- * Used to query the local period of an element.
- * @return The local period of this element.
- * This should return the set local period,
- * which may be anything, even if the component is set to be "stretching",
- * that is,
- * acting as if the local period was the same
- * as the number of total iterations for this simulation.
- */
- public int getInterval(){
- if (type == PeriodType.Local) {
- return interval;
- }
- return STANDARD_GRAPH_ACCURACY;
- }
- public Period.PeriodType getType() {
- return type;
- }
- }
- Period getPeriod();
- /**
- * Determine if it should use his own LocalPeriod or use the global Period over the entire simulation.
- * Local Period is opposed to repeated once the period is over.
- */
- void setPeriod(Period period);
- }
|