text:
package quickfix.fix42;
import quickfix.FieldNotFound;

import quickfix.Group;

public class SecurityDefinitionRequest extends Message
{

  static final long serialVersionUID = 20050617;
  public static final String MSGTYPE = "c";

  public SecurityDefinitionRequest()
  {
    super();
    getHeader().setField(new quickfix.field.MsgType(MSGTYPE));
  }

  public SecurityDefinitionRequest(quickfix.field.SecurityReqID securityReqID, quickfix.field.SecurityRequestType securityRequestType) {
    this();
    setField(securityReqID);
    setField(securityRequestType);
  }

  public void set(quickfix.field.SecurityReqID value)
  {
    setField(value);
  }

  public quickfix.field.SecurityReqID get(quickfix.field.SecurityReqID  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.SecurityReqID getSecurityReqID() throws FieldNotFound
  {
    quickfix.field.SecurityReqID value = new quickfix.field.SecurityReqID();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.SecurityReqID field)
  {
    return isSetField(field);
  }

  public boolean isSetSecurityReqID()
  {
    return isSetField(320);
  }

  public void set(quickfix.field.SecurityRequestType value)
  {
    setField(value);
  }

  public quickfix.field.SecurityRequestType get(quickfix.field.SecurityRequestType  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.SecurityRequestType getSecurityRequestType() throws FieldNotFound
  {
    quickfix.field.SecurityRequestType value = new quickfix.field.SecurityRequestType();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.SecurityRequestType field)
  {
    return isSetField(field);
  }

  public boolean isSetSecurityRequestType()
  {
    return isSetField(321);
  }

  public void set(quickfix.field.Symbol value)
  {
    setField(value);
  }

  public quickfix.field.Symbol get(quickfix.field.Symbol  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.Symbol getSymbol() throws FieldNotFound
  {
    quickfix.field.Symbol value = new quickfix.field.Symbol();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.Symbol field)
  {
    return isSetField(field);
  }

  public boolean isSetSymbol()
  {
    return isSetField(55);
  }

  public void set(quickfix.field.SymbolSfx value)
  {
    setField(value);
  }

  public quickfix.field.SymbolSfx get(quickfix.field.SymbolSfx  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.SymbolSfx getSymbolSfx() throws FieldNotFound
  {
    quickfix.field.SymbolSfx value = new quickfix.field.SymbolSfx();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.SymbolSfx field)
  {
    return isSetField(field);
  }

  public boolean isSetSymbolSfx()
  {
    return isSetField(65);
  }

  public void set(quickfix.field.SecurityID value)
  {
    setField(value);
  }

  public quickfix.field.SecurityID get(quickfix.field.SecurityID  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.SecurityID getSecurityID() throws FieldNotFound
  {
    quickfix.field.SecurityID value = new quickfix.field.SecurityID();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.SecurityID field)
  {
    return isSetField(field);
  }

  public boolean isSetSecurityID()
  {
    return isSetField(48);
  }

  public void set(quickfix.field.IDSource value)
  {
    setField(value);
  }

  public quickfix.field.IDSource get(quickfix.field.IDSource  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.IDSource getIDSource() throws FieldNotFound
  {
    quickfix.field.IDSource value = new quickfix.field.IDSource();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.IDSource field)
  {
    return isSetField(field);
  }

  public boolean isSetIDSource()
  {
    return isSetField(22);
  }

  public void set(quickfix.field.SecurityType value)
  {
    setField(value);
  }

  public quickfix.field.SecurityType get(quickfix.field.SecurityType  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.SecurityType getSecurityType() throws FieldNotFound
  {
    quickfix.field.SecurityType value = new quickfix.field.SecurityType();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.SecurityType field)
  {
    return isSetField(field);
  }

  public boolean isSetSecurityType()
  {
    return isSetField(167);
  }

  public void set(quickfix.field.MaturityMonthYear value)
  {
    setField(value);
  }

  public quickfix.field.MaturityMonthYear get(quickfix.field.MaturityMonthYear  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.MaturityMonthYear getMaturityMonthYear() throws FieldNotFound
  {
    quickfix.field.MaturityMonthYear value = new quickfix.field.MaturityMonthYear();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.MaturityMonthYear field)
  {
    return isSetField(field);
  }

  public boolean isSetMaturityMonthYear()
  {
    return isSetField(200);
  }

  public void set(quickfix.field.MaturityDay value)
  {
    setField(value);
  }

  public quickfix.field.MaturityDay get(quickfix.field.MaturityDay  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.MaturityDay getMaturityDay() throws FieldNotFound
  {
    quickfix.field.MaturityDay value = new quickfix.field.MaturityDay();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.MaturityDay field)
  {
    return isSetField(field);
  }

  public boolean isSetMaturityDay()
  {
    return isSetField(205);
  }

  public void set(quickfix.field.PutOrCall value)
  {
    setField(value);
  }

  public quickfix.field.PutOrCall get(quickfix.field.PutOrCall  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.PutOrCall getPutOrCall() throws FieldNotFound
  {
    quickfix.field.PutOrCall value = new quickfix.field.PutOrCall();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.PutOrCall field)
  {
    return isSetField(field);
  }

  public boolean isSetPutOrCall()
  {
    return isSetField(201);
  }

  public void set(quickfix.field.StrikePrice value)
  {
    setField(value);
  }

  public quickfix.field.StrikePrice get(quickfix.field.StrikePrice  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.StrikePrice getStrikePrice() throws FieldNotFound
  {
    quickfix.field.StrikePrice value = new quickfix.field.StrikePrice();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.StrikePrice field)
  {
    return isSetField(field);
  }

  public boolean isSetStrikePrice()
  {
    return isSetField(202);
  }

  public void set(quickfix.field.OptAttribute value)
  {
    setField(value);
  }

  public quickfix.field.OptAttribute get(quickfix.field.OptAttribute  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.OptAttribute getOptAttribute() throws FieldNotFound
  {
    quickfix.field.OptAttribute value = new quickfix.field.OptAttribute();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.OptAttribute field)
  {
    return isSetField(field);
  }

  public boolean isSetOptAttribute()
  {
    return isSetField(206);
  }

  public void set(quickfix.field.ContractMultiplier value)
  {
    setField(value);
  }

  public quickfix.field.ContractMultiplier get(quickfix.field.ContractMultiplier  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.ContractMultiplier getContractMultiplier() throws FieldNotFound
  {
    quickfix.field.ContractMultiplier value = new quickfix.field.ContractMultiplier();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.ContractMultiplier field)
  {
    return isSetField(field);
  }

  public boolean isSetContractMultiplier()
  {
    return isSetField(231);
  }

  public void set(quickfix.field.CouponRate value)
  {
    setField(value);
  }

  public quickfix.field.CouponRate get(quickfix.field.CouponRate  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.CouponRate getCouponRate() throws FieldNotFound
  {
    quickfix.field.CouponRate value = new quickfix.field.CouponRate();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.CouponRate field)
  {
    return isSetField(field);
  }

  public boolean isSetCouponRate()
  {
    return isSetField(223);
  }

  public void set(quickfix.field.SecurityExchange value)
  {
    setField(value);
  }

  public quickfix.field.SecurityExchange get(quickfix.field.SecurityExchange  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.SecurityExchange getSecurityExchange() throws FieldNotFound
  {
    quickfix.field.SecurityExchange value = new quickfix.field.SecurityExchange();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.SecurityExchange field)
  {
    return isSetField(field);
  }

  public boolean isSetSecurityExchange()
  {
    return isSetField(207);
  }

  public void set(quickfix.field.Issuer value)
  {
    setField(value);
  }

  public quickfix.field.Issuer get(quickfix.field.Issuer  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.Issuer getIssuer() throws FieldNotFound
  {
    quickfix.field.Issuer value = new quickfix.field.Issuer();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.Issuer field)
  {
    return isSetField(field);
  }

  public boolean isSetIssuer()
  {
    return isSetField(106);
  }

  public void set(quickfix.field.EncodedIssuerLen value)
  {
    setField(value);
  }

  public quickfix.field.EncodedIssuerLen get(quickfix.field.EncodedIssuerLen  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.EncodedIssuerLen getEncodedIssuerLen() throws FieldNotFound
  {
    quickfix.field.EncodedIssuerLen value = new quickfix.field.EncodedIssuerLen();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.EncodedIssuerLen field)
  {
    return isSetField(field);
  }

  public boolean isSetEncodedIssuerLen()
  {
    return isSetField(348);
  }

  public void set(quickfix.field.EncodedIssuer value)
  {
    setField(value);
  }

  public quickfix.field.EncodedIssuer get(quickfix.field.EncodedIssuer  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.EncodedIssuer getEncodedIssuer() throws FieldNotFound
  {
    quickfix.field.EncodedIssuer value = new quickfix.field.EncodedIssuer();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.EncodedIssuer field)
  {
    return isSetField(field);
  }

  public boolean isSetEncodedIssuer()
  {
    return isSetField(349);
  }

  public void set(quickfix.field.SecurityDesc value)
  {
    setField(value);
  }

  public quickfix.field.SecurityDesc get(quickfix.field.SecurityDesc  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.SecurityDesc getSecurityDesc() throws FieldNotFound
  {
    quickfix.field.SecurityDesc value = new quickfix.field.SecurityDesc();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.SecurityDesc field)
  {
    return isSetField(field);
  }

  public boolean isSetSecurityDesc()
  {
    return isSetField(107);
  }

  public void set(quickfix.field.EncodedSecurityDescLen value)
  {
    setField(value);
  }

  public quickfix.field.EncodedSecurityDescLen get(quickfix.field.EncodedSecurityDescLen  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.EncodedSecurityDescLen getEncodedSecurityDescLen() throws FieldNotFound
  {
    quickfix.field.EncodedSecurityDescLen value = new quickfix.field.EncodedSecurityDescLen();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.EncodedSecurityDescLen field)
  {
    return isSetField(field);
  }

  public boolean isSetEncodedSecurityDescLen()
  {
    return isSetField(350);
  }

  public void set(quickfix.field.EncodedSecurityDesc value)
  {
    setField(value);
  }

  public quickfix.field.EncodedSecurityDesc get(quickfix.field.EncodedSecurityDesc  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.EncodedSecurityDesc getEncodedSecurityDesc() throws FieldNotFound
  {
    quickfix.field.EncodedSecurityDesc value = new quickfix.field.EncodedSecurityDesc();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.EncodedSecurityDesc field)
  {
    return isSetField(field);
  }

  public boolean isSetEncodedSecurityDesc()
  {
    return isSetField(351);
  }

  public void set(quickfix.field.Currency value)
  {
    setField(value);
  }

  public quickfix.field.Currency get(quickfix.field.Currency  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.Currency getCurrency() throws FieldNotFound
  {
    quickfix.field.Currency value = new quickfix.field.Currency();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.Currency field)
  {
    return isSetField(field);
  }

  public boolean isSetCurrency()
  {
    return isSetField(15);
  }

  public void set(quickfix.field.Text value)
  {
    setField(value);
  }

  public quickfix.field.Text get(quickfix.field.Text  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.Text getText() throws FieldNotFound
  {
    quickfix.field.Text value = new quickfix.field.Text();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.Text field)
  {
    return isSetField(field);
  }

  public boolean isSetText()
  {
    return isSetField(58);
  }

  public void set(quickfix.field.EncodedTextLen value)
  {
    setField(value);
  }

  public quickfix.field.EncodedTextLen get(quickfix.field.EncodedTextLen  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.EncodedTextLen getEncodedTextLen() throws FieldNotFound
  {
    quickfix.field.EncodedTextLen value = new quickfix.field.EncodedTextLen();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.EncodedTextLen field)
  {
    return isSetField(field);
  }

  public boolean isSetEncodedTextLen()
  {
    return isSetField(354);
  }

  public void set(quickfix.field.EncodedText value)
  {
    setField(value);
  }

  public quickfix.field.EncodedText get(quickfix.field.EncodedText  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.EncodedText getEncodedText() throws FieldNotFound
  {
    quickfix.field.EncodedText value = new quickfix.field.EncodedText();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.EncodedText field)
  {
    return isSetField(field);
  }

  public boolean isSetEncodedText()
  {
    return isSetField(355);
  }

  public void set(quickfix.field.TradingSessionID value)
  {
    setField(value);
  }

  public quickfix.field.TradingSessionID get(quickfix.field.TradingSessionID  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.TradingSessionID getTradingSessionID() throws FieldNotFound
  {
    quickfix.field.TradingSessionID value = new quickfix.field.TradingSessionID();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.TradingSessionID field)
  {
    return isSetField(field);
  }

  public boolean isSetTradingSessionID()
  {
    return isSetField(336);
  }

  public void set(quickfix.field.NoRelatedSym value)
  {
    setField(value);
  }

  public quickfix.field.NoRelatedSym get(quickfix.field.NoRelatedSym  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.NoRelatedSym getNoRelatedSym() throws FieldNotFound
  {
    quickfix.field.NoRelatedSym value = new quickfix.field.NoRelatedSym();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.NoRelatedSym field)
  {
    return isSetField(field);
  }

  public boolean isSetNoRelatedSym()
  {
    return isSetField(146);
  }

  public static class NoRelatedSym extends Group {
    static final long serialVersionUID = 20050617;
    public NoRelatedSym() {
        super(146, 311,
            new int[] {311, 312, 309, 305, 310, 313, 314, 315, 316, 317, 436, 435, 308, 306, 362, 363, 307, 364, 365, 319, 54, 318,  0 } );
    }

  public void set(quickfix.field.UnderlyingSymbol value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingSymbol get(quickfix.field.UnderlyingSymbol  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingSymbol getUnderlyingSymbol() throws FieldNotFound
  {
    quickfix.field.UnderlyingSymbol value = new quickfix.field.UnderlyingSymbol();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingSymbol field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingSymbol()
  {
    return isSetField(311);
  }

  public void set(quickfix.field.UnderlyingSymbolSfx value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingSymbolSfx get(quickfix.field.UnderlyingSymbolSfx  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingSymbolSfx getUnderlyingSymbolSfx() throws FieldNotFound
  {
    quickfix.field.UnderlyingSymbolSfx value = new quickfix.field.UnderlyingSymbolSfx();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingSymbolSfx field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingSymbolSfx()
  {
    return isSetField(312);
  }

  public void set(quickfix.field.UnderlyingSecurityID value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingSecurityID get(quickfix.field.UnderlyingSecurityID  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingSecurityID getUnderlyingSecurityID() throws FieldNotFound
  {
    quickfix.field.UnderlyingSecurityID value = new quickfix.field.UnderlyingSecurityID();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingSecurityID field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingSecurityID()
  {
    return isSetField(309);
  }

  public void set(quickfix.field.UnderlyingIDSource value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingIDSource get(quickfix.field.UnderlyingIDSource  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingIDSource getUnderlyingIDSource() throws FieldNotFound
  {
    quickfix.field.UnderlyingIDSource value = new quickfix.field.UnderlyingIDSource();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingIDSource field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingIDSource()
  {
    return isSetField(305);
  }

  public void set(quickfix.field.UnderlyingSecurityType value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingSecurityType get(quickfix.field.UnderlyingSecurityType  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingSecurityType getUnderlyingSecurityType() throws FieldNotFound
  {
    quickfix.field.UnderlyingSecurityType value = new quickfix.field.UnderlyingSecurityType();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingSecurityType field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingSecurityType()
  {
    return isSetField(310);
  }

  public void set(quickfix.field.UnderlyingMaturityMonthYear value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingMaturityMonthYear get(quickfix.field.UnderlyingMaturityMonthYear  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingMaturityMonthYear getUnderlyingMaturityMonthYear() throws FieldNotFound
  {
    quickfix.field.UnderlyingMaturityMonthYear value = new quickfix.field.UnderlyingMaturityMonthYear();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingMaturityMonthYear field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingMaturityMonthYear()
  {
    return isSetField(313);
  }

  public void set(quickfix.field.UnderlyingMaturityDay value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingMaturityDay get(quickfix.field.UnderlyingMaturityDay  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingMaturityDay getUnderlyingMaturityDay() throws FieldNotFound
  {
    quickfix.field.UnderlyingMaturityDay value = new quickfix.field.UnderlyingMaturityDay();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingMaturityDay field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingMaturityDay()
  {
    return isSetField(314);
  }

  public void set(quickfix.field.UnderlyingPutOrCall value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingPutOrCall get(quickfix.field.UnderlyingPutOrCall  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingPutOrCall getUnderlyingPutOrCall() throws FieldNotFound
  {
    quickfix.field.UnderlyingPutOrCall value = new quickfix.field.UnderlyingPutOrCall();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingPutOrCall field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingPutOrCall()
  {
    return isSetField(315);
  }

  public void set(quickfix.field.UnderlyingStrikePrice value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingStrikePrice get(quickfix.field.UnderlyingStrikePrice  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingStrikePrice getUnderlyingStrikePrice() throws FieldNotFound
  {
    quickfix.field.UnderlyingStrikePrice value = new quickfix.field.UnderlyingStrikePrice();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingStrikePrice field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingStrikePrice()
  {
    return isSetField(316);
  }

  public void set(quickfix.field.UnderlyingOptAttribute value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingOptAttribute get(quickfix.field.UnderlyingOptAttribute  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingOptAttribute getUnderlyingOptAttribute() throws FieldNotFound
  {
    quickfix.field.UnderlyingOptAttribute value = new quickfix.field.UnderlyingOptAttribute();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingOptAttribute field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingOptAttribute()
  {
    return isSetField(317);
  }

  public void set(quickfix.field.UnderlyingContractMultiplier value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingContractMultiplier get(quickfix.field.UnderlyingContractMultiplier  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingContractMultiplier getUnderlyingContractMultiplier() throws FieldNotFound
  {
    quickfix.field.UnderlyingContractMultiplier value = new quickfix.field.UnderlyingContractMultiplier();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingContractMultiplier field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingContractMultiplier()
  {
    return isSetField(436);
  }

  public void set(quickfix.field.UnderlyingCouponRate value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingCouponRate get(quickfix.field.UnderlyingCouponRate  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingCouponRate getUnderlyingCouponRate() throws FieldNotFound
  {
    quickfix.field.UnderlyingCouponRate value = new quickfix.field.UnderlyingCouponRate();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingCouponRate field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingCouponRate()
  {
    return isSetField(435);
  }

  public void set(quickfix.field.UnderlyingSecurityExchange value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingSecurityExchange get(quickfix.field.UnderlyingSecurityExchange  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingSecurityExchange getUnderlyingSecurityExchange() throws FieldNotFound
  {
    quickfix.field.UnderlyingSecurityExchange value = new quickfix.field.UnderlyingSecurityExchange();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingSecurityExchange field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingSecurityExchange()
  {
    return isSetField(308);
  }

  public void set(quickfix.field.UnderlyingIssuer value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingIssuer get(quickfix.field.UnderlyingIssuer  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingIssuer getUnderlyingIssuer() throws FieldNotFound
  {
    quickfix.field.UnderlyingIssuer value = new quickfix.field.UnderlyingIssuer();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingIssuer field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingIssuer()
  {
    return isSetField(306);
  }

  public void set(quickfix.field.EncodedUnderlyingIssuerLen value)
  {
    setField(value);
  }

  public quickfix.field.EncodedUnderlyingIssuerLen get(quickfix.field.EncodedUnderlyingIssuerLen  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.EncodedUnderlyingIssuerLen getEncodedUnderlyingIssuerLen() throws FieldNotFound
  {
    quickfix.field.EncodedUnderlyingIssuerLen value = new quickfix.field.EncodedUnderlyingIssuerLen();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.EncodedUnderlyingIssuerLen field)
  {
    return isSetField(field);
  }

  public boolean isSetEncodedUnderlyingIssuerLen()
  {
    return isSetField(362);
  }

  public void set(quickfix.field.EncodedUnderlyingIssuer value)
  {
    setField(value);
  }

  public quickfix.field.EncodedUnderlyingIssuer get(quickfix.field.EncodedUnderlyingIssuer  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.EncodedUnderlyingIssuer getEncodedUnderlyingIssuer() throws FieldNotFound
  {
    quickfix.field.EncodedUnderlyingIssuer value = new quickfix.field.EncodedUnderlyingIssuer();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.EncodedUnderlyingIssuer field)
  {
    return isSetField(field);
  }

  public boolean isSetEncodedUnderlyingIssuer()
  {
    return isSetField(363);
  }

  public void set(quickfix.field.UnderlyingSecurityDesc value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingSecurityDesc get(quickfix.field.UnderlyingSecurityDesc  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingSecurityDesc getUnderlyingSecurityDesc() throws FieldNotFound
  {
    quickfix.field.UnderlyingSecurityDesc value = new quickfix.field.UnderlyingSecurityDesc();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingSecurityDesc field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingSecurityDesc()
  {
    return isSetField(307);
  }

  public void set(quickfix.field.EncodedUnderlyingSecurityDescLen value)
  {
    setField(value);
  }

  public quickfix.field.EncodedUnderlyingSecurityDescLen get(quickfix.field.EncodedUnderlyingSecurityDescLen  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.EncodedUnderlyingSecurityDescLen getEncodedUnderlyingSecurityDescLen() throws FieldNotFound
  {
    quickfix.field.EncodedUnderlyingSecurityDescLen value = new quickfix.field.EncodedUnderlyingSecurityDescLen();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.EncodedUnderlyingSecurityDescLen field)
  {
    return isSetField(field);
  }

  public boolean isSetEncodedUnderlyingSecurityDescLen()
  {
    return isSetField(364);
  }

  public void set(quickfix.field.EncodedUnderlyingSecurityDesc value)
  {
    setField(value);
  }

  public quickfix.field.EncodedUnderlyingSecurityDesc get(quickfix.field.EncodedUnderlyingSecurityDesc  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.EncodedUnderlyingSecurityDesc getEncodedUnderlyingSecurityDesc() throws FieldNotFound
  {
    quickfix.field.EncodedUnderlyingSecurityDesc value = new quickfix.field.EncodedUnderlyingSecurityDesc();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.EncodedUnderlyingSecurityDesc field)
  {
    return isSetField(field);
  }

  public boolean isSetEncodedUnderlyingSecurityDesc()
  {
    return isSetField(365);
  }

  public void set(quickfix.field.RatioQty value)
  {
    setField(value);
  }

  public quickfix.field.RatioQty get(quickfix.field.RatioQty  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.RatioQty getRatioQty() throws FieldNotFound
  {
    quickfix.field.RatioQty value = new quickfix.field.RatioQty();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.RatioQty field)
  {
    return isSetField(field);
  }

  public boolean isSetRatioQty()
  {
    return isSetField(319);
  }

  public void set(quickfix.field.Side value)
  {
    setField(value);
  }

  public quickfix.field.Side get(quickfix.field.Side  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.Side getSide() throws FieldNotFound
  {
    quickfix.field.Side value = new quickfix.field.Side();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.Side field)
  {
    return isSetField(field);
  }

  public boolean isSetSide()
  {
    return isSetField(54);
  }

  public void set(quickfix.field.UnderlyingCurrency value)
  {
    setField(value);
  }

  public quickfix.field.UnderlyingCurrency get(quickfix.field.UnderlyingCurrency  value) throws FieldNotFound
  {
    getField(value);
    return value;
  }

  public quickfix.field.UnderlyingCurrency getUnderlyingCurrency() throws FieldNotFound
  {
    quickfix.field.UnderlyingCurrency value = new quickfix.field.UnderlyingCurrency();
    getField(value);
    return value;
  }

  public boolean isSet(quickfix.field.UnderlyingCurrency field)
  {
    return isSetField(field);
  }

  public boolean isSetUnderlyingCurrency()
  {
    return isSetField(318);
  }

  }

}


text:
class Dmd < Formula
  desc "D programming language compiler for OS X"
  homepage "https://dlang.org/"

  stable do
    url "https://github.com/D-Programming-Language/dmd/archive/v2.070.1.tar.gz"
    sha256 "a84c64bc46582fa5f010b1ec3daa7c48d54cc70dbc921df7834b44bfd41fd75c"

    resource "druntime" do
      url "https://github.com/D-Programming-Language/druntime/archive/v2.070.1.tar.gz"
      sha256 "4c37ede418443f64c84f94b3384fb908acc06410d477392fca3083c75052c031"
    end

    resource "phobos" do
      url "https://github.com/D-Programming-Language/phobos/archive/v2.070.1.tar.gz"
      sha256 "a755d75ed4cc008ea32eeb45c9cb78a9c21054384ed085d1c3b243a4e473482d"
    end

    resource "tools" do
      url "https://github.com/D-Programming-Language/tools/archive/v2.070.1.tar.gz"
      sha256 "ccab0941487b0d5589d3c87ecccf42623f361f47e922c5f5bb552a549a90804b"
    end
  end

  bottle do
    sha256 "28945c524db59ec04d43eb39d65e754e52c5dc78e9001fb2d810160bf4bf1274" => :el_capitan
    sha256 "681c51f57ec912e0831420ca7c31586e5de92c5cec6bef8e90cc860586ace73f" => :yosemite
    sha256 "c685a2c946fee33a41b59a01244b2cd44f690929a4987a950eeb3c9a6b4fee7a" => :mavericks
  end

  head do
    url "https://github.com/D-Programming-Language/dmd.git"

    resource "druntime" do
      url "https://github.com/D-Programming-Language/druntime.git"
    end

    resource "phobos" do
      url "https://github.com/D-Programming-Language/phobos.git"
    end

    resource "tools" do
      url "https://github.com/D-Programming-Language/tools.git"
    end
  end

  def install
    make_args = ["INSTALL_DIR=#{prefix}", "MODEL=#{Hardware::CPU.bits}", "-f", "posix.mak"]

    system "make", "SYSCONFDIR=#{etc}", "TARGET_CPU=X86", "AUTO_BOOTSTRAP=1", "RELEASE=1", *make_args

    bin.install "src/dmd"
    prefix.install "samples"
    man.install Dir["docs/man/*"]

    # A proper dmd.conf is required for later build steps:
    conf = buildpath/"dmd.conf"
    # Can't use opt_include or opt_lib here because dmd won't have been
    # linked into opt by the time this build runs:
    conf.write <<-EOS.undent
        [Environment]
        DFLAGS=-I#{include}/dlang/dmd -L-L#{lib}
        EOS
    etc.install conf
    install_new_dmd_conf

    make_args.unshift "DMD=#{bin}/dmd"

    (buildpath/"druntime").install resource("druntime")
    (buildpath/"phobos").install resource("phobos")

    system "make", "-C", "druntime", *make_args
    system "make", "-C", "phobos", "VERSION=#{buildpath}/VERSION", *make_args

    (include/"dlang/dmd").install Dir["druntime/import/*"]
    cp_r ["phobos/std", "phobos/etc"], include/"dlang/dmd"
    lib.install Dir["druntime/lib/*", "phobos/**/libphobos2.a"]

    resource("tools").stage do
      inreplace "posix.mak", "install: $(TOOLS) $(CURL_TOOLS)", "install: $(TOOLS) $(ROOT)/dustmite"
      system "make", "install", *make_args
    end
  end

  # Previous versions of this formula may have left in place an incorrect
  # dmd.conf.  If it differs from the newly generated one, move it out of place
  # and warn the user.
  # This must be idempotent because it may run from both install() and
  # post_install() if the user is running `brew install --build-from-source`.
  def install_new_dmd_conf
    conf = etc/"dmd.conf"

    # If the new file differs from conf, etc.install drops it here:
    new_conf = etc/"dmd.conf.default"
    # Else, we're already using the latest version:
    return unless new_conf.exist?

    backup = etc/"dmd.conf.old"
    opoo "An old dmd.conf was found and will be moved to #{backup}."
    mv conf, backup
    mv new_conf, conf
  end

  def post_install
    install_new_dmd_conf
  end

  test do
    system bin/"dmd", prefix/"samples/hello.d"
    system "./hello"
  end
end

redpajama_set_name: RedPajamaGithub


text:
{-# OPTIONS_HADDOCK show-extensions #-}

{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RoleAnnotations #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}

{- |
   Copyright  : Copyright (C) 2006-2018 Bjorn Buckwalter
   License    : BSD3

   Maintainer : bjorn@buckwalter.se
   Stability  : Stable
   Portability: GHC only

= Summary

In this module we provide data types for performing arithmetic with
physical quantities and units. Information about the physical
dimensions of the quantities/units is embedded in their types and
the validity of operations is verified by the type checker at compile
time. The wrapping and unwrapping of numerical values as quantities is
done by multiplication and division of units, of which an incomplete
set is provided.

We limit ourselves to \"Newtonian\" physics. We do not attempt to
accommodate relativistic physics in which e.g. addition of length
and time would be valid.

As far as possible and/or practical the conventions and guidelines
of NIST's "Guide for the Use of the International System of Units
(SI)" <#note1 [1]> are followed. Occasionally we will reference specific
sections from the guide and deviations will be explained.

== Disclaimer

Merely an engineer, the author doubtlessly uses a language and
notation that makes mathematicians and physicists cringe. He does
not mind constructive criticism (or pull requests).

The sets of functions and units defined herein are incomplete and
reflect only the author's needs to date. Again, patches are welcome.

= Usage

== Preliminaries

This module requires GHC 8 or later. We utilize Data Kinds, TypeNats,
Closed Type Families, etc. Clients of the module are generally not
required to use these extensions.

Clients probably will want to use the @NegativeLiterals@ extension though.

== Examples

We have defined operators and units that allow us to define and
work with physical quantities. A physical quantity is defined by
multiplying a number with a unit (the type signature is optional).

> v :: Velocity Double
> v = 90 *~ (kilo meter / hour)

It follows naturally that the numerical value of a quantity is
obtained by division by a unit.

> numval :: Double
> numval = v /~ (meter / second)

The notion of a quantity as the product of a numerical value and a
unit is supported by 7.1 "Value and numerical value of a quantity" of
<#note1 [1]>. While the above syntax is fairly natural, it is unfortunate that
it must violate a number of the guidelines in <#note1 [1]>, in particular 9.3
"Spelling unit names with prefixes", 9.4 "Spelling unit names obtained
by multiplication", 9.5 "Spelling unit names obtained by division".

As a more elaborate example of how to use the module, we define a
function for calculating the escape velocity of a celestial body
<#note2 [2]>.

> escapeVelocity :: (Floating a) => Mass a -> Length a -> Velocity a
> escapeVelocity m r = sqrt (two * g * m / r)
>   where
>       two = 2 *~ one
>       g = 6.6720e-11 *~ (newton * meter ^ pos2 / kilo gram ^ pos2)

For completeness, we should also show an example of the error messages
we will get from GHC when performing invalid arithmetic. In the
best case, GHC will be able to use the type synonyms we have defined
in its error messages.

> let x = 1 *~ meter + 1 *~ second
>
> Couldn't match type 'Numeric.NumType.DK.Integers.Zero
>                with 'Numeric.NumType.DK.Integers.Pos1
> Expected type: Unit 'Metric DLength a
>   Actual type: Unit 'Metric DTime a
> In the second argument of `(*~)', namely `second'
> In the second argument of `(+)', namely `1 *~ second'

In other cases, the error messages aren't very friendly.

> let x = 1 *~ meter / (1 *~ second) + 1 *~ kilo gram
>
> Couldn't match type 'Numeric.NumType.DK.Integers.Zero
>                with 'Numeric.NumType.DK.Integers.Neg1
> Expected type: Quantity DMass a
>   Actual type: Dimensional
>                  ('DQuantity V.* 'DQuantity) (DLength / DTime) a
> In the first argument of `(+)', namely `1 *~ meter / (1 *~ second)'
> In the expression: 1 *~ meter / (1 *~ second) + 1 *~ kilo gram
> In an equation for `x':
>       x = 1 *~ meter / (1 *~ second) + 1 *~ kilo gram

It is the author's experience that the usefulness of the compiler
error messages is more often than not limited to pinpointing the
location of errors.

= Notes

== Future work

While there is an insane amount of units in use around the world
it is reasonable to provide those in relatively widespread use. Units outside
of SI will most likely be added on an as-needed basis.

Additional physics models could be implemented. See <#note3 [3]> for ideas.

== Related work

Henning Thielemann's numeric prelude has a physical units library,
however, checking of dimensions is dynamic rather than static.
Aaron Denney has created a toy example of statically checked
physical dimensions covering only length and time. HaskellWiki
has pointers <#note4 [4]> to these.

Also see Samuel Hoffstaetter's blog post <#note5 [5]> which uses techniques
similar to this library.

Libraries with similar functionality exist for other programming
languages and may serve as inspiration. The author has found the
Java library JScience <#note6 [6]> and the Fortress programming language <#note7 [7]>
particularly noteworthy.

== References

1. #note1# https://www.nist.gov/pml/special-publication-811
2. #note2# https://en.wikipedia.org/wiki/Escape_velocity
3. #note3# https://web.archive.org/web/20080905151927/http://jscience.org/api/org/jscience/physics/models/package-summary.html
4. #note4# https://wiki.haskell.org/Physical_units
5. #note5# https://liftm.wordpress.com/2007/06/03/scientificdimension-type-arithmetic-and-physical-units-in-haskell/
6. #note6# http://jscience.org/
6. #note6# https://github.com/stokito/fortress-lang

-}

module Numeric.Units.Dimensional
  (
    -- * Types
    -- $types
    Dimensional,
    Unit, Quantity,
    Metricality(..),
    -- * Physical Dimensions
    -- $dimensions
    Dimension (Dim),
    -- ** Dimension Arithmetic
    -- $dimension-arithmetic
    type (*), type (/), type (^), NRoot, Sqrt, Cbrt, Recip,
    -- ** Term Level Representation of Dimensions
    -- $dimension-terms
    Dimension' (Dim'), HasDimension(..), KnownDimension,
    -- * Dimensional Arithmetic
    (*~), (/~),
    (^), (^/), (**), (*), (/), (+), (-),
    negate, abs, signum, recip, nroot, sqrt, cbrt,
    -- ** Transcendental Functions
    exp, log, logBase, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, atan2, log1p, expm1, log1pexp, log1mexp,
    -- ** Operations on Collections
    -- $collections
    (*~~), (/~~), sum, mean, product, dimensionlessLength, nFromTo,
    -- * Dimension Synonyms
    -- $dimension-synonyms
    DOne, DLength, DMass, DTime, DElectricCurrent, DThermodynamicTemperature, DAmountOfSubstance, DLuminousIntensity,
    -- * Quantity Synonyms
    -- $quantity-synonyms
    Dimensionless, Length, Mass, Time, ElectricCurrent, ThermodynamicTemperature, AmountOfSubstance, LuminousIntensity,
    -- * Constants
    -- $constants
    _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, pi, tau,
    -- * Constructing Units
    siUnit, one, mkUnitR, mkUnitQ, mkUnitZ,
    -- * Unit Metadata
    name, exactValue, weaken, strengthen, exactify,
    -- * Pretty Printing
    showIn,
    -- * On 'Functor', and Conversion Between Number Representations
    -- $functor
    KnownVariant(dmap), changeRep, changeRepApproximate,
    -- * Lenses
    -- $lenses
    asLens
  )
  where

import Prelude
  ( Eq(..), Num, Fractional, Floating, Real, RealFloat, Functor, fmap
  , (.), flip, (++), fromIntegral, fromInteger, fromRational, error, max, succ
  , Int, Integer, Integral, ($), uncurry, realToFrac, otherwise
  )
import qualified Prelude
import Numeric.NumType.DK.Integers
  ( pos2, pos3
  , KnownTypeInt, toNum
  )
import Data.Data
import Data.ExactPi
import Data.Foldable (Foldable(foldr, length))
import Data.Maybe
import Data.Ratio
import qualified Numeric
import Numeric.Units.Dimensional.Dimensions
import Numeric.Units.Dimensional.Internal
import Numeric.Units.Dimensional.UnitNames hiding ((*), (/), (^), weaken, strengthen, product)
import qualified Numeric.Units.Dimensional.UnitNames.Internal as Name
import Numeric.Units.Dimensional.Variants hiding (type (*), type (/))
import qualified Numeric.Units.Dimensional.Variants as V

-- $setup
-- >>> :set -XFlexibleInstances
-- >>> :set -XNoImplicitPrelude
-- >>> import Test.QuickCheck.Arbitrary
-- >>> import Numeric.Units.Dimensional.Prelude
-- >>> import Numeric.Units.Dimensional.Float
-- >>> import Numeric.Units.Dimensional.NonSI
-- >>> instance Arbitrary a => Arbitrary (Quantity d a) where arbitrary = fmap Quantity arbitrary

{-
We will reuse the operators and function names from the Prelude.
To prevent unpleasant surprises we give operators the same fixity
as the Prelude.
-}

infixr 8  ^, ^/, **
infixl 7  *, /
infixl 6  +, -

{- $types
Our primary objective is to define a data type that can be used to
represent (while still differentiating between) units and quantities.
There are two reasons for consolidating units and quantities in one
data type. The first being to allow code reuse as they are largely
subject to the same operations. The second being that it allows
reuse of operators (and functions) between the two without resorting
to occasionally cumbersome type classes.

The relationship between (the value of) a 'Quantity', its numerical
value and its 'Unit' is described in 7.1 "Value and numerical value
of a quantity" of <#note1 [1]>. In short a 'Quantity' is the product of a
number and a 'Unit'. We define the '*~' operator as a convenient
way to declare quantities as such a product.

-}

-- | Extracts the 'UnitName' of a 'Unit'.
name :: Unit m d a -> UnitName m
name (Unit n _ _) = n

-- | Extracts the exact value of a 'Unit', expressed in terms of the SI coherent derived unit (see 'siUnit') of the same 'Dimension'.
--
-- Note that the actual value may in some cases be approximate, for example if the unit is defined by experiment.
exactValue :: Unit m d a -> ExactPi
exactValue (Unit _ e _) = e

-- | Discards potentially unwanted type level information about a 'Unit'.
weaken :: Unit m d a -> Unit 'NonMetric d a
weaken (Unit n e v) = Unit (Name.weaken n) e v

-- | Attempts to convert a 'Unit' which may or may not be 'Metric' to one
-- which is certainly 'Metric'.
strengthen :: Unit m d a -> Maybe (Unit 'Metric d a)
strengthen (Unit n e v) | Just n' <- Name.strengthen n = Just $ Unit n' e v
                        | otherwise                    = Nothing

-- | Forms the exact version of a 'Unit'.
exactify :: Unit m d a -> Unit m d ExactPi
exactify (Unit n e _) = Unit n e e

-- | Forms a 'Quantity' by multipliying a number and a unit.
(*~) :: (Num a) => a -> Unit m d a -> Quantity d a
x *~ (Unit _ _ y) = Quantity (x Prelude.* y)

-- | Divides a 'Quantity' by a 'Unit' of the same physical dimension, obtaining the
-- numerical value of the quantity expressed in that unit.
(/~) :: Fractional a => Quantity d a -> Unit m d a -> a
(Quantity x) /~ (Unit _ _ y) = (x Prelude./ y)

{-
We give '*~' and '/~' the same fixity as '*' and '/' defined below.
Note that this necessitates the use of parenthesis when composing
units using '*' and '/', e.g. "1 *~ (meter / second)".
-}

infixl 7  *~, /~

{- $dimensions
The phantom type variable @d@ encompasses the physical dimension of
a 'Dimensional'. As detailed in <#note5 [5]>, there are seven base dimensions,
which can be combined in integer powers to a given physical dimension.
We represent physical dimensions as the powers of the seven base
dimensions that make up the given dimension. The powers are represented
using NumTypes. For convenience, we collect all seven base dimensions
in a data kind 'Dimension'.

We could have chosen to provide type variables for the seven base
dimensions in 'Dimensional' instead of creating a new data kind
'Dimension'. However, that would have made any type signatures involving
'Dimensional' very cumbersome.  By encompassing the physical dimension
in a single type variable we can "hide" the cumbersome type arithmetic
behind convenient type classes as will be seen later.

-}

{- $dimension-synonyms
Using our 'Dimension' data kind we define some type synonyms for convenience.
We start with the base dimensions, others can be found in "Numeric.Units.Dimensional.Quantities".

-}

{- $quantity-synonyms
Using the above type synonyms we can define type synonyms for
quantities of particular physical dimensions.

Again we limit ourselves to the base dimensions, others can be found in "Numeric.Units.Dimensional.Quantities".

-}

type Dimensionless            = Quantity DOne
type Length                   = Quantity DLength
type Mass                     = Quantity DMass
type Time                     = Quantity DTime
type ElectricCurrent          = Quantity DElectricCurrent
type ThermodynamicTemperature = Quantity DThermodynamicTemperature
type AmountOfSubstance        = Quantity DAmountOfSubstance
type LuminousIntensity        = Quantity DLuminousIntensity

{- $dimension-arithmetic
When performing arithmetic on units and quantities, the arithmetics
must be applied to both the numerical values of the Dimensionals
but also to their physical dimensions. The type level arithmetic
on physical dimensions is governed by closed type families expressed
as type operators.

We could provide the 'Mul' and 'Div' classes with full functional
dependencies but that would be of limited utility as there is no
limited use for "backwards" type inference. Efforts are underway to
develop a type-checker plugin that does enable these scenarios, e.g.
for linear algebra.

-}

{-
= Arithmetic on units and quantities =

Thanks to the arithmetic on physical dimensions having been sorted
out separately a lot of the arithmetic on Dimensionals is straight
forward. In particular the type signatures are much simplified.

Multiplication, division and powers apply to both units and quantities.
-}

-- | Multiplies two 'Quantity's or two 'Unit's.
--
-- The intimidating type signature captures the similarity between these operations
-- and ensures that composite 'Unit's are 'NonMetric'.
(*) :: (KnownVariant v1, KnownVariant v2, KnownVariant (v1 V.* v2), Num a) => Dimensional v1 d1 a -> Dimensional v2 d2 a -> Dimensional (v1 V.* v2) (d1 * d2) a
(*) = liftD2 (Prelude.*) (Prelude.*) (Name.*)

-- | Divides one 'Quantity' by another or one 'Unit' by another.
--
-- The intimidating type signature captures the similarity between these operations
-- and ensures that composite 'Unit's are 'NonMetric'.
(/) :: (KnownVariant v1, KnownVariant v2, KnownVariant (v1 V./ v2), Fractional a) => Dimensional v1 d1 a -> Dimensional v2 d2 a -> Dimensional (v1 V./ v2) (d1 / d2) a
(/) = liftD2 (Prelude./) (Prelude./) (Name./)

-- | Forms the reciprocal of a 'Quantity', which has the reciprocal dimension.
--
-- >>> recip $ 47 *~ hertz
-- 2.127659574468085e-2 s
recip :: (Fractional a) => Quantity d a -> Quantity (Recip d) a
recip = liftQ Prelude.recip

-- | Raises a 'Quantity' or 'Unit' to an integer power.
--
-- Because the power chosen impacts the 'Dimension' of the result, it is necessary to supply a type-level representation
-- of the exponent in the form of a 'Proxy' to some 'TypeInt'. Convenience values 'pos1', 'pos2', 'neg1', ...
-- are supplied by the "Numeric.NumType.DK.Integers" module. The most commonly used ones are
-- also reexported by "Numeric.Units.Dimensional.Prelude".
--
-- The intimidating type signature captures the similarity between these operations
-- and ensures that composite 'Unit's are 'NonMetric'.
(^) :: (Fractional a, KnownTypeInt i, KnownVariant v, KnownVariant (Weaken v))
    => Dimensional v d1 a -> Proxy i -> Dimensional (Weaken v) (d1 ^ i) a
x ^ n = let n' = (toNum n) :: Int
         in liftD (Prelude.^^ n') (Prelude.^^ n') (Name.^ n') x

{-
A special case is that dimensionless quantities are not restricted
to integer exponents. This is accommodated by the '**' operator
defined later.

= Quantity operations =

Some additional operations obviously only make sense for quantities.
Of these, negation, addition and subtraction are particularly simple
as they are done in a single physical dimension.
-}

-- | Negates the value of a 'Quantity'.
negate :: Num a => Quantity d a -> Quantity d a
negate = liftQ Prelude.negate

-- | Adds two 'Quantity's.
(+) :: Num a => Quantity d a -> Quantity d a -> Quantity d a
(+) = liftQ2 (Prelude.+)

-- | Subtracts one 'Quantity' from another.
(-) :: Num a => Quantity d a -> Quantity d a -> Quantity d a
(-) = liftQ2 (Prelude.-)

-- | Takes the absolute value of a 'Quantity'.
abs :: Num a => Quantity d a -> Quantity d a
abs = liftQ Prelude.abs

-- | Takes the sign of a 'Quantity'. The functions 'abs' and 'signum'
-- satisy the law that:
--
-- > abs x * signum x == x
--
-- The sign is either @negate _1@ (negative), @_0@ (zero),
-- or @_1@ (positive).
signum :: Num a => Quantity d a -> Dimensionless a
signum = liftQ Prelude.signum

{-
Roots of arbitrary (integral) degree. Appears to occasionally be useful
for units as well as quantities.
-}

-- | Computes the nth root of a 'Quantity' using 'Prelude.**'.
--
-- The 'NRoot' type family will prevent application of this operator where the result would have a fractional dimension or where n is zero.
--
-- Because the root chosen impacts the 'Dimension' of the result, it is necessary to supply a type-level representation
-- of the root in the form of a 'Proxy' to some 'TypeInt'. Convenience values 'pos1', 'pos2', 'neg1', ...
-- are supplied by the "Numeric.NumType.DK.Integers" module. The most commonly used ones are
-- also reexported by "Numeric.Units.Dimensional.Prelude".
--
-- n must not be zero. Negative roots are defined such that @nroot (Proxy :: Proxy (Negate n)) x == nroot (Proxy :: Proxy n) (recip x)@.
--
-- Also available in operator form, see '^/'.
nroot :: (KnownTypeInt n, Floating a)
      => Proxy n -> Quantity d a -> Quantity (NRoot d n) a
nroot n = let n' = 1 Prelude./ toNum n
           in liftQ (Prelude.** n')

{-
We provide short-hands for the square and cube roots.
-}

-- | Computes the square root of a 'Quantity' using 'Prelude.**'.
--
-- The 'NRoot' type family will prevent application where the supplied quantity does not have a square dimension.
--
-- prop> (x :: Area Double) >= _0 ==> sqrt x == nroot pos2 x
sqrt :: Floating a => Quantity d a -> Quantity (Sqrt d) a
sqrt = nroot pos2

-- | Computes the cube root of a 'Quantity' using 'Prelude.**'.
--
-- The 'NRoot' type family will prevent application where the supplied quantity does not have a cubic dimension.
--
-- prop> (x :: Volume Double) >= _0 ==> cbrt x == nroot pos3 x
cbrt :: Floating a => Quantity d a -> Quantity (Cbrt d) a
cbrt = nroot pos3

{-
We also provide an operator alternative to nroot for those that
prefer such.
-}

-- | Computes the nth root of a 'Quantity' using 'Prelude.**'.
--
-- The 'NRoot' type family will prevent application of this operator where the result would have a fractional dimension or where n is zero.
--
-- Because the root chosen impacts the 'Dimension' of the result, it is necessary to supply a type-level representation
-- of the root in the form of a 'Proxy' to some 'TypeInt'. Convenience values 'pos1', 'pos2', 'neg1', ...
-- are supplied by the "Numeric.NumType.DK.Integers" module. The most commonly used ones are
-- also reexported by "Numeric.Units.Dimensional.Prelude".
--
-- Also available in prefix form, see 'nroot'.
(^/) :: (KnownTypeInt n, Floating a)
     => Quantity d a -> Proxy n -> Quantity (NRoot d n) a
(^/) = flip nroot

{- $collections
Here we define operators and functions to make working with homogeneous
lists of dimensionals more convenient.

We define two convenience operators for applying units to all
elements of a functor (e.g. a list).
-}

-- | Applies '*~' to all values in a functor.
(*~~) :: (Functor f, Num a) => f a -> Unit m d a -> f (Quantity d a)
xs *~~ u = fmap (*~ u) xs

-- | Applies '/~' to all values in a functor.
(/~~) :: forall f m d a.(Functor f, Fractional a) => f (Quantity d a) -> Unit m d a -> f a
xs /~~ u = fmap (/~ u) xs

infixl 7  *~~, /~~

-- | The sum of all elements in a foldable structure.
--
-- >>> sum ([] :: [Mass Double])
-- 0.0 kg
--
-- >>> sum [12.4 *~ meter, 1 *~ foot]
-- 12.7048 m
sum :: (Num a, Foldable f) => f (Quantity d a) -> Quantity d a
sum = foldr (+) _0

-- | The product of all elements in a foldable structure.
--
-- >>> product ([] :: [Dimensionless Double])
-- 1.0
--
-- >>> product [pi, _4, 0.36 *~ one]
-- 4.523893421169302
product :: (Num a, Foldable f) => f (Dimensionless a) -> Dimensionless a
product = foldr (*) _1

-- | The arithmetic mean of all elements in a foldable structure.
--
-- >>> mean [pi, _7]
-- 5.070796326794897
mean :: (Fractional a, Foldable f) => f (Quantity d a) -> Quantity d a
mean = uncurry (/) . foldr accumulate (_0, _0)
  where
    accumulate val (accum, count) = (accum + val, count + _1)

-- | The length of the foldable data structure as a 'Dimensionless'.
-- This can be useful for purposes of e.g. calculating averages.
--
-- >>> dimensionlessLength ["foo", "bar"]
-- 2
dimensionlessLength :: (Num a, Foldable f) => f b -> Dimensionless a
dimensionlessLength x = (fromIntegral $ length x) *~ one

-- | Returns a list of quantities between given bounds.
--
-- prop> n <= 0 ==> nFromTo (x :: Mass Double) (y :: Mass Double) n == [x, y]
--
-- prop> (x :: Length Double) <= (y :: Length Double) ==> all (\z -> x <= z && z <= y) (nFromTo x y n)
--
-- >>> nFromTo _0 _3 2
-- [0.0,1.0,2.0,3.0]
--
-- >>> nFromTo _1 _0 7
-- [1.0,0.875,0.75,0.625,0.5,0.375,0.25,0.125,0.0]
--
-- >>> nFromTo _0 _1 (-5)
-- [0.0,1.0]
nFromTo :: (Fractional a, Integral b) => Quantity d a -- ^ The initial value.
                                      -> Quantity d a -- ^ The final value.
                                      -> b -- ^ The number of intermediate values. If less than one, no intermediate values will result.
                                      -> [Quantity d a]
nFromTo xi xf n = fmap f [0..n'] ++ [xf]
  where
    n' = max 0 n
    f i = xi + realToFrac (i % succ n') *~ one * (xf - xi)

{-
We continue by defining elementary functions on 'Dimensionless'
that may be obviously useful.
-}

exp, log, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, log1p, expm1, log1pexp, log1mexp
  :: Floating a => Dimensionless a -> Dimensionless a
exp   = fmap Prelude.exp
log   = fmap Prelude.log
sin   = fmap Prelude.sin
cos   = fmap Prelude.cos
tan   = fmap Prelude.tan
asin  = fmap Prelude.asin
acos  = fmap Prelude.acos
atan  = fmap Prelude.atan
sinh  = fmap Prelude.sinh
cosh  = fmap Prelude.cosh
tanh  = fmap Prelude.tanh
asinh = fmap Prelude.asinh
acosh = fmap Prelude.acosh
atanh = fmap Prelude.atanh
log1p = fmap Numeric.log1p
expm1 = fmap Numeric.expm1
log1pexp = fmap Numeric.log1pexp
log1mexp = fmap Numeric.log1mexp

-- | Raises a dimensionless quantity to a dimensionless power.
(**) :: Floating a => Dimensionless a -> Dimensionless a -> Dimensionless a
(**) = liftQ2 (Prelude.**)

-- | Takes the logarithm of the second argument in the base of the first.
--
-- >>> logBase _2 _8
-- 3.0
logBase :: Floating a => Dimensionless a -> Dimensionless a -> Dimensionless a
logBase = liftQ2 Prelude.logBase

-- | The standard two argument arctangent function.
-- Since it interprets its two arguments in comparison with one another, the input may have any dimension.
--
-- >>> atan2 _0 _1
-- 0.0
--
-- >>> atan2 _1 _0
-- 1.5707963267948966
--
-- >>> atan2 _0 (negate _1)
-- 3.141592653589793
--
-- >>> atan2 (negate _1) _0
-- -1.5707963267948966
atan2 :: (RealFloat a) => Quantity d a -> Quantity d a -> Dimensionless a
atan2 = liftQ2 Prelude.atan2

{-
The only unit we will define in this module is 'one'.
-}

-- | The unit 'one' has dimension 'DOne' and is the base unit of dimensionless values.
--
-- As detailed in 7.10 "Values of quantities expressed simply as numbers:
-- the unit one, symbol 1" of <#note1 [1]>, the unit one generally does not
-- appear in expressions. However, for us it is necessary to use 'one'
-- as we would any other unit to perform the "wrapping" of dimensionless values.
one :: Num a => Unit 'NonMetric DOne a
one = Unit nOne 1 1

{- $constants
For convenience we define some constants for small integer values
that often show up in formulae. We also throw in 'pi' and 'tau' for
good measure.

-}

-- | The constant for zero is polymorphic, allowing it to express zero 'Length' or
-- 'Numeric.Units.Dimensional.Quantities.Capacitance' or 'Numeric.Units.Dimensional.Quantities.Velocity' etc,
-- in addition to the 'Dimensionless' value zero.
_0 :: Num a => Quantity d a
_0 = Quantity 0

_1, _2, _3, _4, _5, _6, _7, _8, _9 :: (Num a) => Dimensionless a
_1 = 1 *~ one
_2 = 2 *~ one
_3 = 3 *~ one
_4 = 4 *~ one
_5 = 5 *~ one
_6 = 6 *~ one
_7 = 7 *~ one
_8 = 8 *~ one
_9 = 9 *~ one

pi :: Floating a => Dimensionless a
pi = Prelude.pi *~ one

-- | Twice 'pi'.
--
-- For background on 'tau' see https://tauday.com/tau-manifesto (but also
-- feel free to review https://web.archive.org/web/20200926221249/http://www.thepimanifesto.com/).
tau :: Floating a => Dimensionless a
tau = _2 * pi

{- $functor
We intentionally decline to provide a 'Functor' instance for 'Dimensional' because its use breaks the
abstraction of physical dimensions.

If you feel your work requires this instance, it is provided as an orphan in "Numeric.Units.Dimensional.Functor".

-}

-- | Convenient conversion between numerical types while retaining dimensional information.
--
-- >>> let x = (37 :: Rational) *~ poundMass
-- >>> changeRep x :: Mass Double
-- 16.78291769 kg
changeRep :: (KnownVariant v, Real a, Fractional b) => Dimensional v d a -> Dimensional v d b
changeRep = dmap realToFrac

-- | Convenient conversion from exactly represented values while retaining dimensional information.
changeRepApproximate :: (KnownVariant v, Floating b) => Dimensional v d ExactPi -> Dimensional v d b
changeRepApproximate = dmap approximateValue

{- $lenses
These functions are compatible with the lens library.

-}

-- | Converts a 'Unit' into a lens from 'Quantity's to values.
asLens :: (Fractional a) => Unit m d a
                         -> (forall f.Functor f => (a -> f a)
                                                -> Quantity d a
                                                -> f (Quantity d a))
asLens u f q = fmap (\v' -> v' *~ u) (f (q /~ u))

{- $dimension-terms
To facilitate parsing and pretty-printing functions that may wish to operate on term-level representations of dimension,
we provide a means for converting from type-level dimensions to term-level dimensions.

-}

-- | Forms a new atomic 'Unit' by specifying its 'UnitName' and its definition as a multiple of another 'Unit'.
--
-- Use this variant when the scale factor of the resulting unit is irrational or 'Approximate'. See 'mkUnitQ' for when it is rational
-- and 'mkUnitZ' for when it is an integer.
--
-- Note that supplying zero as a definining quantity is invalid, as the library relies
-- upon units forming a group under multiplication.
--
-- Supplying negative defining quantities is allowed and handled gracefully, but is discouraged
-- on the grounds that it may be unexpected by other readers.
mkUnitR :: Floating a => UnitName m -> ExactPi -> Unit m1 d a -> Unit m d a
mkUnitR n s (Unit _ e _) | isExactZero s = error "Supplying zero as a conversion factor is not valid."
                         | otherwise     = Unit n e' x'
  where
    e' = s Prelude.* e
    x' = approximateValue e'

-- | Forms a new atomic 'Unit' by specifying its 'UnitName' and its definition as a multiple of another 'Unit'.
--
-- Use this variant when the scale factor of the resulting unit is rational. See 'mkUnitZ' for when it is an integer
-- and 'mkUnitR' for the general case.
--
-- For more information see 'mkUnitR'.
mkUnitQ :: Fractional a => UnitName m -> Rational -> Unit m1 d a -> Unit m d a
mkUnitQ n s (Unit _ e x) | s == 0    = error "Supplying zero as a conversion factor is not valid."
                         | Just x'' <- toExactRational e' = Unit n e' (fromRational x'')
                         | otherwise = Unit n e' x'
  where
    e' = fromRational s Prelude.* e
    x' = fromRational s Prelude.* x

-- | Forms a new atomic 'Unit' by specifying its 'UnitName' and its definition as a multiple of another 'Unit'.
--
-- Use this variant when the scale factor of the resulting unit is an integer. See 'mkUnitQ' for when it is rational
-- and 'mkUnitR' for the general case.
--
-- For more information see 'mkUnitR'.
mkUnitZ :: Num a => UnitName m -> Integer -> Unit m1 d a -> Unit m d a
mkUnitZ n s (Unit _ e x) | s == 0    = error "Supplying zero as a conversion factor is not valid."
                         | Just x'' <- toExactInteger e' = Unit n e' (fromInteger x'')
                         | otherwise = Unit n e' x'
  where
    e' = fromInteger s Prelude.* e
    x' = fromInteger s Prelude.* x


text:
<?php

declare(strict_types=1);

namespace AlgoWeb\PODataLaravel\OperationContext\Web\Illuminate;

use Illuminate\Http\Request;
use POData\OperationContext\IOperationContext;
use POData\OperationContext\Web\OutgoingResponse;

/**
 * Class IlluminateOperationContext.
 * @package POData\OperationContext\Web\Illuminate
 */
class IlluminateOperationContext implements IOperationContext
{
    /**
     * Object of IncomingRequest which is needed to get all the HTTP headers info.
     *
     * @var IncomingIlluminateRequest
     */
    private $incomingRequest;

    /**
     * Object of OutgoingResponse which is needed to get all the HTTP headers info.
     *
     * @var OutgoingResponse
     */
    private $outgoingResponse;

    /**
     * Initializes a new instance of the IlluminateOperationContext class.
     * This function will perform the following tasks:
     *  (1) Retrieve the current HTTP method,headers and stream.
     *  (2) Populate $_incomingRequest using these.
     *
     * @param Request $request
     */
    public function __construct(Request $request)
    {
        $this->incomingRequest  = new IncomingIlluminateRequest($request);
        $this->outgoingResponse = new OutgoingResponse();
    }

    /**
     * Gets the Web request context for the request being sent.
     *
     * @return OutgoingResponse
     */
    public function outgoingResponse(): OutgoingResponse
    {
        return $this->outgoingResponse;
    }

    /**
     * Gets the Web request context for the request being received.
     *
     * @return IncomingIlluminateRequest
     */
    public function incomingRequest(): IncomingIlluminateRequest
    {
        return $this->incomingRequest;
    }
}


text:
<?php

namespace Magento\Checkout\Setup;

use Magento\Customer\Helper\Address;
use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

/**
 * @codeCoverageIgnore
 */
class InstallData implements InstallDataInterface
{
    /**
     * EAV setup factory
     *
     * @var EavSetupFactory
     */
    private $eavSetupFactory;

    /**
     * Customer address
     *
     * @var Address
     */
    private $customerAddress;

    /**
     * Init
     *
     * @param EavSetupFactory $eavSetupFactory
     * @param Address $customerAddress
     */
    public function __construct(EavSetupFactory $eavSetupFactory, Address $customerAddress)
    {
        $this->eavSetupFactory = $eavSetupFactory;
        $this->customerAddress = $customerAddress;
    }

    /**
     * {@inheritdoc}
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
     * @SuppressWarnings(PHPMD.NPathComplexity)
     */
    public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    {
        /** @var EavSetup $eavSetup */
        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);

        $setup->startSetup();

        $connection = $setup->getConnection();

        $select = $connection->select()->from(
            $setup->getTable('core_config_data'),
            'COUNT(*)'
        )->where(
            'path=?',
            'customer/address/prefix_show'
        )->where(
            'value NOT LIKE ?',
            '0'
        );
        $showPrefix = (bool)$this->customerAddress->getConfig('prefix_show')
            || $connection->fetchOne($select) > 0;

        $select = $connection->select()->from(
            $setup->getTable('core_config_data'),
            'COUNT(*)'
        )->where(
            'path=?',
            'customer/address/middlename_show'
        )->where(
            'value NOT LIKE ?',
            '0'
        );
        $showMiddlename = (bool)$this->customerAddress->getConfig(
            'middlename_show'
        ) || $connection->fetchOne(
            $select
        ) > 0;

        $select = $connection->select()->from(
            $setup->getTable('core_config_data'),
            'COUNT(*)'
        )->where(
            'path=?',
            'customer/address/suffix_show'
        )->where(
            'value NOT LIKE ?',
            '0'
        );
        $showSuffix = (bool)$this->customerAddress->getConfig('suffix_show')
            || $connection->fetchOne($select) > 0;

        $select = $connection->select()->from(
            $setup->getTable('core_config_data'),
            'COUNT(*)'
        )->where(
            'path=?',
            'customer/address/dob_show'
        )->where(
            'value NOT LIKE ?',
            '0'
        );
        $showDob = (bool)$this->customerAddress->getConfig('dob_show')
            || $connection->fetchOne($select) > 0;

        $select = $connection->select()->from(
            $setup->getTable('core_config_data'),
            'COUNT(*)'
        )->where(
            'path=?',
            'customer/address/taxvat_show'
        )->where(
            'value NOT LIKE ?',
            '0'
        );
        $showTaxVat = (bool)$this->customerAddress->getConfig('taxvat_show')
            || $connection->fetchOne($select) > 0;

        $customerEntityTypeId = $eavSetup->getEntityTypeId('customer');
        $addressEntityTypeId = $eavSetup->getEntityTypeId('customer_address');

        /**
         *****************************************************************************
         * checkout/onepage/register
         *****************************************************************************
         */

        $connection->insert(
            $setup->getTable('eav_form_type'),
            [
                'code' => 'checkout_onepage_register',
                'label' => 'checkout_onepage_register',
                'is_system' => 1,
                'theme' => '',
                'store_id' => 0
            ]
        );
        $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type'));

        $connection->insert(
            $setup->getTable('eav_form_type_entity'),
            ['type_id' => $formTypeId, 'entity_type_id' => $customerEntityTypeId]
        );
        $connection->insert(
            $setup->getTable('eav_form_type_entity'),
            ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId]
        );

        $elementSort = 0;
        if ($showPrefix) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'),
                'sort_order' => $elementSort++
            ]
        );
        if ($showMiddlename) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'),
                'sort_order' => $elementSort++
            ]
        );
        if ($showSuffix) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'email'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'),
                'sort_order' => $elementSort++
            ]
        );
        if ($showDob) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'dob'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        if ($showTaxVat) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'taxvat'),
                    'sort_order' => $elementSort++
                ]
            );
        }

        /**
         *****************************************************************************
         * checkout/onepage/register_guest
         *****************************************************************************
         */

        $connection->insert(
            $setup->getTable('eav_form_type'),
            [
                'code' => 'checkout_onepage_register_guest',
                'label' => 'checkout_onepage_register_guest',
                'is_system' => 1,
                'theme' => '',
                'store_id' => 0
            ]
        );
        $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type'));

        $connection->insert(
            $setup->getTable('eav_form_type_entity'),
            ['type_id' => $formTypeId, 'entity_type_id' => $customerEntityTypeId]
        );
        $connection->insert(
            $setup->getTable('eav_form_type_entity'),
            ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId]
        );

        $elementSort = 0;
        if ($showPrefix) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'),
                'sort_order' => $elementSort++
            ]
        );
        if ($showMiddlename) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'),
                'sort_order' => $elementSort++
            ]
        );
        if ($showSuffix) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'email'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'),
                'sort_order' => $elementSort++
            ]
        );
        if ($showDob) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'dob'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        if ($showTaxVat) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'taxvat'),
                    'sort_order' => $elementSort++
                ]
            );
        }

        /**
         *****************************************************************************
         * checkout/onepage/billing_address
         *****************************************************************************
         */

        $connection->insert(
            $setup->getTable('eav_form_type'),
            [
                'code' => 'checkout_onepage_billing_address',
                'label' => 'checkout_onepage_billing_address',
                'is_system' => 1,
                'theme' => '',
                'store_id' => 0
            ]
        );
        $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type'));

        $connection->insert(
            $setup->getTable('eav_form_type_entity'),
            ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId]
        );

        $elementSort = 0;
        if ($showPrefix) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'),
                'sort_order' => $elementSort++
            ]
        );
        if ($showMiddlename) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'),
                'sort_order' => $elementSort++
            ]
        );
        if ($showSuffix) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'),
                'sort_order' => $elementSort++
            ]
        );

        /**
         *****************************************************************************
         * checkout/onepage/shipping_address
         *****************************************************************************
         */

        $connection->insert(
            $setup->getTable('eav_form_type'),
            [
                'code' => 'checkout_onepage_shipping_address',
                'label' => 'checkout_onepage_shipping_address',
                'is_system' => 1,
                'theme' => '',
                'store_id' => 0
            ]
        );
        $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type'));

        $connection->insert(
            $setup->getTable('eav_form_type_entity'),
            ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId]
        );

        $elementSort = 0;
        if ($showPrefix) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'),
                'sort_order' => $elementSort++
            ]
        );
        if ($showMiddlename) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'),
                'sort_order' => $elementSort++
            ]
        );
        if ($showSuffix) {
            $connection->insert(
                $setup->getTable('eav_form_element'),
                [
                    'type_id' => $formTypeId,
                    'fieldset_id' => null,
                    'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'),
                    'sort_order' => $elementSort++
                ]
            );
        }
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'),
                'sort_order' => $elementSort++
            ]
        );
        $connection->insert(
            $setup->getTable('eav_form_element'),
            [
                'type_id' => $formTypeId,
                'fieldset_id' => null,
                'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'),
                'sort_order' => $elementSort++
            ]
        );

        $table = $setup->getTable('core_config_data');

        $select = $connection->select()->from(
            $table,
            ['config_id', 'value']
        )->where(
            'path = ?',
            'checkout/options/onepage_checkout_disabled'
        );

        $data = $connection->fetchAll($select);

        if ($data) {
            try {
                $connection->beginTransaction();

                foreach ($data as $value) {
                    $bind = ['path' => 'checkout/options/onepage_checkout_enabled', 'value' => !(bool)$value['value']];
                    $where = 'config_id = ' . $value['config_id'];
                    $connection->update($table, $bind, $where);
                }

                $connection->commit();
            } catch (\Exception $e) {
                $connection->rollback();
                throw $e;
            }
        }

        $setup->endSetup();
    }
}


text:
package me.prettyprint.hector.api.query;

/**
 * Counts super column for a of a key in a super column family
 *
 * @author Ran Tavory
 */
public interface SuperCountQuery<K, SN> extends  Query<Integer>{

  SuperCountQuery<K, SN> setKey(K key);

  SuperCountQuery<K, SN> setColumnFamily(String cf);

  SuperCountQuery<K, SN> setRange(SN start, SN finish, int count);

}