package com.efiAnalytics.tuningwidgets.panels;

import G.GComponentBu;
import com.efiAnalytics.ui.NumericTextField;
import com.efiAnalytics.ui.et;
import java.awt.Component;
import java.awt.GridLayout;
import javax.swing.BorderFactory;
import s.SComponentGolf;

public class LinearGeneratorPanel extends aL {
  GComponentBu a = null;
  
  NumericTextField b = new NumericTextField();
  
  NumericTextField c = new NumericTextField();
  
  NumericTextField d = new NumericTextField();
  
  NumericTextField e = new NumericTextField();
  
  public LinearGeneratorPanel(GComponentBu parambu) {
    this.a = parambu;
    setBorder(BorderFactory.createTitledBorder(SComponentGolf.b(parambu.h())));
    setLayout(new GridLayout(3, 3, 3, 3));
    add(new GeneratorPanelLabel(this, "", 4));
    add(new GeneratorPanelLabel(this, parambu.a(), 0));
    add(new GeneratorPanelLabel(this, parambu.b(), 0));
    add(new GeneratorPanelLabel(this, "Point 1", 4));
    add((Component)this.b);
    add((Component)this.d);
    add(new GeneratorPanelLabel(this, "Point 2", 4));
    add((Component)this.c);
    add((Component)this.e);
  }
  
  public double[] a(int paramInt) {
    double[] arrayOfDouble = new double[paramInt];
    double d1 = Double.parseDouble(this.b.getText());
    double d2 = Double.parseDouble(this.c.getText());
    double d3 = Double.parseDouble(this.d.getText());
    double d4 = Double.parseDouble(this.e.getText());
    double d5 = (d4 - d3) / (d2 - d1);
    double d6 = 1.0D;
    double d7 = d3 - d5 * d1;
    for (byte b = 0; b < arrayOfDouble.length; b++)
      arrayOfDouble[b] = d5 * b * 5.0D / 1024.0D + d7; 
    return arrayOfDouble;
  }
  
  public String a() {
    return "//-- generated by Custom linear generator using user input data:\n//-- " + this.a.a() + ":" + this.b.getText() + ", " + this.c.getText() + "     " + this.a.b() + ":" + this.d.getText() + ", " + this.e.getText();
  }
  
  public void setEnabled(boolean paramBoolean) {
    for (byte b = 0; b < getComponentCount(); b++)
      getComponent(b).setEnabled(paramBoolean); 
    super.setEnabled(paramBoolean);
  }
  
  public void a(et paramet) {
    paramet.a("txtX1", this.b.getText());
    paramet.a("txtX2", this.c.getText());
    paramet.a("txtY1", this.d.getText());
    paramet.a("txtY2", this.e.getText());
  }
  
  public void b(et paramet) {
    String str = paramet.a("txtX1");
    if (str != null && str.length() > 0) {
      this.b.setText(str);
    } else {
      this.b.setText("" + this.a.c());
    } 
    str = paramet.a("txtX2");
    if (str != null && str.length() > 0) {
      this.c.setText(str);
    } else {
      this.c.setText("" + this.a.d());
    } 
    str = paramet.a("txtY1");
    if (str != null && str.length() > 0) {
      this.d.setText(str);
    } else {
      this.d.setText("" + this.a.e());
    } 
    str = paramet.a("txtY2");
    if (str != null && str.length() > 0) {
      this.e.setText(str);
    } else {
      this.e.setText("" + this.a.f());
    } 
  }
}


/* Location:              /home/rewrich/Downloads/TunerStudioMS/TunerStudioMS/!/com/efiAnalytics/tuningwidgets/panels/M.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */