<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.team254.lib;

/**
 *
 * @author Richard
 */
public class Util {
    
    public static double limit(double v, double limit) {
        return Math.abs(v) < limit ? v : limit * (v < 0? -1 : 1);
    }
    
    // Sine Wave
    public static double SineWave(double timeSec, double periodSec, double amplitude) {
        return Math.sin(timeSec * 2 * Math.PI / periodSec) * amplitude;
    }
    
    // Square Wave
    public static double SquareWave(double timeSec, double periodSec, double amplitude) {
        int periodMs = (int)(periodSec * 1000);
        int incrementTimeMs = (int)(timeSec * 1000) % periodMs;
        if (incrementTimeMs < periodMs / 2) {
            return amplitude;
        } 
        else {
            return -amplitude;
        }
    }
}<commit_msg>Added Functions.java and explicit Button getters<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.team254.lib;

/**
 *
 * @author Richard
 */
public class Util {
    
    public static double limit(double v, double limit) {
        return Math.abs(v) < limit ? v : limit * (v < 0? -1 : 1);
    }
    
}
{'fraction_non_alphanumeric': 0.10946051602814699, 'fraction_numerical': 0.017200938232994525, 'mean_word_length': 2.3074935400516794, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 3, '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': '1757602', 'n_tokens_mistral': 402, 'n_tokens_neox': 375, 'n_words': 127}