<commit_before>package com.newrelic.examples.waveform;

import com.newrelic.data.in.Agent;
import com.newrelic.data.in.processors.EpochCounter;
import com.newrelic.data.in.processors.Processor;

public class Waveform extends Agent {
	private String name = "Default";
	private int sawtoothMax;
	private int sawtouthCounter = 0;
	private int squarewaveMax;
	private int squarewaveCounter = 0;
	private Processor sawRate = new EpochCounter();
	
    public Waveform(String name, int sawtoothMax, int squarewaveMax) {
    	super("com.newrelic.examples.waveform", "0.0.1");
    	this.name = name;
    	this.sawtoothMax = sawtoothMax;
    	this.squarewaveMax = squarewaveMax;
    }
    
	@Override
	public String getComponentHumanLabel() {
		return name + ":" + sawtoothMax + "," + squarewaveMax;
	}
	
	@Override
	public void pollCycle() {
		int nextSawTooth = nextSawtouthNumber();
		reportMetric("Waveforms/Sawtooth", "value", nextSawTooth);
		reportMetric("Waveforms/Square", "value", nextSquareNumber());
		reportMetric("Waveforms/Sawtooth Rate", "value/sec", sawRate.process(nextSawTooth).floatValue());
	}
	
	private int nextSawtouthNumber() {
		sawtouthCounter = sawtouthCounter + 1;
		if(sawtouthCounter > sawtoothMax) {
			sawtouthCounter = 0;
		}
		return sawtouthCounter;
	}
	
	private int nextSquareNumber() {
		int returnValue = 0;
		squarewaveCounter = squarewaveCounter + 1;
		if(squarewaveCounter < squarewaveMax / 2) {
			returnValue = 0;
		} else {
			returnValue = squarewaveMax;
		}
		if(squarewaveCounter > squarewaveMax) {
			squarewaveCounter = 0;
		}
		return returnValue;
	}

}

<commit_msg>AgentFactory createConfiguredAgent throws ConfigurationException. Config file now optional: simply instantiate the AgentFactory without specifying a config file and one agent will get created with a null map.<commit_after>package com.newrelic.examples.waveform;

import com.newrelic.data.in.Agent;
import com.newrelic.data.in.processors.EpochCounter;
import com.newrelic.data.in.processors.Processor;

public class Waveform extends Agent {
	private String name = "Default";
	private int sawtoothMax;
	private int sawtouthCounter = 0;
	private int squarewaveMax;
	private int squarewaveCounter = 0;
	private Processor sawRate = new EpochCounter();
	
    public Waveform(String name, int sawtoothMax, int squarewaveMax) {
    	super("com.newrelic.examples.waveform", "0.0.1");
    	this.name = name;
    	this.sawtoothMax = sawtoothMax;
    	this.squarewaveMax = squarewaveMax;
    }
    
	@Override
	public String getComponentHumanLabel() {
		return name;
	}
	
	@Override
	public void pollCycle() {
		int nextSawTooth = nextSawtouthNumber();
		reportMetric("Waveforms/Sawtooth", "value", nextSawTooth);
		reportMetric("Waveforms/Square", "value", nextSquareNumber());
		reportMetric("Waveforms/Sawtooth Rate", "value/sec", sawRate.process(nextSawTooth).floatValue());
	}
	
	private int nextSawtouthNumber() {
		sawtouthCounter = sawtouthCounter + 1;
		if(sawtouthCounter > sawtoothMax) {
			sawtouthCounter = 0;
		}
		return sawtouthCounter;
	}
	
	private int nextSquareNumber() {
		int returnValue = 0;
		squarewaveCounter = squarewaveCounter + 1;
		if(squarewaveCounter < squarewaveMax / 2) {
			returnValue = 0;
		} else {
			returnValue = squarewaveMax;
		}
		if(squarewaveCounter > squarewaveMax) {
			squarewaveCounter = 0;
		}
		return returnValue;
	}

}


{'fraction_non_alphanumeric': 0.10234351824384455, 'fraction_numerical': 0.0071195490952239695, 'mean_word_length': 4.482926829268293, 'pattern_counts': {'":': 1, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6275353', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1094, 'n_words': 246}