com.tacitknowledge.slowlight.proxyserver.handler.behavior.SinusoidalBehavior Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of slowlight-proxy Show documentation
Show all versions of slowlight-proxy Show documentation
Standalone proxy tool for creating issues with synchronous RPC calls
The newest version!
package com.tacitknowledge.slowlight.proxyserver.handler.behavior;
import java.util.Map;
/**
* Sinusoidal function implementation, values of this function could be controlled by passing amplitude and period parameters.
*
* @author Alexandr Donciu ([email protected])
*/
public class SinusoidalBehavior extends IntervalBehaviorFunction
{
private static final String ARG_PERIOD = "period";
private static final String ARG_AMPLITUDE = "amplitude";
@Override
public Object evaluate(final Map params)
{
long period = Long.parseLong((String) params.get(ARG_PERIOD));
long amplitude = Long.parseLong((String) params.get(ARG_AMPLITUDE));
long time = System.currentTimeMillis();
return Long.toString((long) (amplitude * Math.sin(time / period) + amplitude));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy