<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tonegod.gui.effects;

import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author t0neg0d
 */
public class EffectQueue {
	EffectManager effectManager;
	List<EffectQueueItem> queue = new LinkedList();
	EffectQueueItem currentEffectItem = null;
	float currentDelay;
	float updateTime = 0;
	float targetTime = 0;
	boolean effectSet = false;
	boolean effectStarted = false;
//	boolean delayComplete = true;
	boolean isActive = true;
	
	public EffectQueue() {
		
	}
	
	public void addEffect(Effect effect, float delayTime) {
		EffectQueueItem item = new EffectQueueItem(effect, delayTime);
		queue.add(item);
	}
	
	public void update(float tpf) {
		if (isActive) {
			if (!effectSet) {
				currentEffectItem = queue.remove(0);
				targetTime = currentEffectItem.getDelay();
				updateTime  = 0;
				effectSet = true;
				effectStarted = false;
			} else {
				if (!effectStarted) {
					if (updateTime < targetTime) {
						updateTime += tpf/targetTime;
					} else {
						effectManager.applyEffect(currentEffectItem.getEffect());
						effectStarted = true;
					}
				} else {
					if (!currentEffectItem.getEffect().getIsActive()) {<commit_msg>Update that ingores the addition of cycled effects.  These being: Pulse & PulseColor<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tonegod.gui.effects;

import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author t0neg0d
 */
public class EffectQueue {
	EffectManager effectManager;
	List<EffectQueueItem> queue = new LinkedList();
	EffectQueueItem currentEffectItem = null;
	float currentDelay;
	float updateTime = 0;
	float targetTime = 0;
	boolean effectSet = false;
	boolean effectStarted = false;
//	boolean delayComplete = true;
	boolean isActive = true;
	
	public EffectQueue() {
		
	}
	
	public void addEffect(Effect effect, float delayTime) {
		if (effect.getEffectType() != Effect.EffectType.Pulse && effect.getEffectType() != Effect.EffectType.PulseColor) {
			EffectQueueItem item = new EffectQueueItem(effect, delayTime);
			queue.add(item);
		}
	}
	
	public void update(float tpf) {
		if (isActive) {
			if (!effectSet) {
				currentEffectItem = queue.remove(0);
				targetTime = currentEffectItem.getDelay();
				updateTime  = 0;
				effectSet = true;
				effectStarted = false;
			} else {
				if (!effectStarted) {
					if (updateTime < targetTime) {
						updateTime += tpf/targetTime;
					} else {
						effectManager.applyEffect(currentEffectItem.getEffect());
						effectStarted = true;
					}
				} else {
					if (!currentEffectItem.getEffect().getIsActive()) {
{'fraction_non_alphanumeric': 0.10735080058224163, 'fraction_numerical': 0.004366812227074236, 'mean_word_length': 3.66723259762309, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '7474273', 'n_tokens_mistral': 978, 'n_tokens_neox': 831, 'n_words': 220}