text:
<?xml version="1.0" encoding="utf-8"?>
<Conventions>
  <!-- Zero Rates -->
  <Zero>
    <Id>EUR-ZERO-CONVENTIONS</Id>
    <TenorBased>false</TenorBased>
    <DayCounter>A365</DayCounter>
    <CompoundingFrequency>Daily</CompoundingFrequency>
  </Zero>
  <Zero>
    <Id>EUR-ZERO-CONVENTIONS-TENOR-BASED</Id>
    <TenorBased>true</TenorBased>
    <DayCounter>A365</DayCounter>
    <Compounding>Continuous</Compounding>
    <CompoundingFrequency>Daily</CompoundingFrequency>
    <TenorCalendar>TARGET</TenorCalendar>
    <SpotLag>2</SpotLag>
    <SpotCalendar>TARGET</SpotCalendar>
    <RollConvention>Following</RollConvention>
    <EOM>false</EOM>
  </Zero>
  <Zero>
    <Id>CHF-ZERO-CONVENTIONS</Id>
    <TenorBased>false</TenorBased>
    <DayCounter>A365</DayCounter>
    <CompoundingFrequency>Daily</CompoundingFrequency>
  </Zero>
  <!-- CDS -->
  <CDS>
    <Id>CDS-STANDARD-CONVENTIONS</Id>
    <SettlementDays>0</SettlementDays>
    <Calendar>WeekendsOnly</Calendar>
    <Frequency>Quarterly</Frequency>
    <PaymentConvention>ModifiedFollowing</PaymentConvention>
    <Rule>TwentiethIMM</Rule>
    <DayCounter>A360</DayCounter>
    <SettlesAccrual>true</SettlesAccrual>
    <PaysAtDefaultTime>true</PaysAtDefaultTime>
  </CDS>
  <!-- Deposits -->
  <Deposit>
    <Id>USD-LIBOR-CONVENTIONS</Id>
    <IndexBased>true</IndexBased>
    <Index>USD-LIBOR</Index>
  </Deposit>
  <Deposit>
    <Id>USD-FED-FUNDS-CONVENTIONS</Id>
    <IndexBased>true</IndexBased>
    <Index>USD-FedFunds</Index>
  </Deposit>
  <Deposit>
    <Id>CHF-LIBOR-CONVENTIONS</Id>
    <IndexBased>true</IndexBased>
    <Index>CHF-LIBOR</Index>
  </Deposit>
  <Deposit>
    <Id>CHF-TOIS-CONVENTIONS</Id>
    <IndexBased>true</IndexBased>
    <Index>CHF-TOIS</Index>
  </Deposit>
  <Deposit>
    <Id>EUR-EONIA-CONVENTIONS</Id>
    <IndexBased>true</IndexBased>
    <Index>EUR-EONIA</Index>
  </Deposit>
  <Deposit>
    <Id>EUR-EURIBOR-CONVENTIONS</Id>
    <IndexBased>true</IndexBased>
    <Index>EUR-EURIBOR</Index>
  </Deposit>
  <Deposit>
    <Id>EUR-DEPOSIT</Id>
    <IndexBased>true</IndexBased>
    <Index>EUR-EURIBOR</Index>
  </Deposit>
  <Deposit>
    <Id>GBP-DEPOSIT</Id>
    <IndexBased>true</IndexBased>
    <Index>GBP-LIBOR</Index>
  </Deposit>
  <Deposit>
    <Id>CAD-DEPOSIT</Id>
    <IndexBased>true</IndexBased>
    <Index>CAD-CDOR</Index>
  </Deposit>
  <Deposit>
    <Id>CZK-DEPOSIT</Id>
    <IndexBased>true</IndexBased>
    <Index>CZK-PRIBOR</Index>
  </Deposit>
  <Deposit>
    <Id>DKK-DEPOSIT</Id>
    <IndexBased>true</IndexBased>
    <Index>DKK-CIBOR</Index>
  </Deposit>
  <Deposit>
    <Id>NOK-DEPOSIT</Id>
    <IndexBased>true</IndexBased>
    <Index>NOK-NIBOR</Index>
  </Deposit>
  <Deposit>
    <Id>HUF-DEPOSIT</Id>
    <IndexBased>true</IndexBased>
    <Index>HUF-BUBOR</Index>
  </Deposit>
  <Deposit>
    <Id>PLN-DEPOSIT</Id>
    <IndexBased>true</IndexBased>
    <Index>PLN-WIBOR</Index>
  </Deposit>
  <Deposit>
    <Id>SGD-DEPOSIT</Id>
    <IndexBased>true</IndexBased>
    <Index>SGD-SIBOR</Index>
  </Deposit>
  <Deposit>
    <Id>NZD-DEPOSIT</Id>
    <IndexBased>true</IndexBased>
    <Index>NZD-BKBM</Index>
  </Deposit>
  <Deposit>
    <Id>JPY-LIBOR-CONVENTIONS</Id>
    <IndexBased>true</IndexBased>
    <Index>JPY-LIBOR</Index>
  </Deposit>
  <Deposit>
    <Id>JPY-TIBOR-CONVENTIONS</Id>
    <IndexBased>true</IndexBased>
    <Index>JPY-TIBOR</Index>
  </Deposit>
  <Deposit>
    <Id>AUD-BBSW-CONVENTIONS</Id>
    <IndexBased>true</IndexBased>
    <Index>AUD-BBSW</Index>
  </Deposit>
  <Deposit>
    <Id>SEK-STIBOR-CONVENTIONS</Id>
    <IndexBased>true</IndexBased>
    <Index>SEK-STIBOR</Index>
  </Deposit>
  <!-- Money Market Futures -->
  <Future>
    <Id>USD-LIBOR-3M-FUTURES-CONVENTIONS</Id>
    <Index>USD-LIBOR-3M</Index>
  </Future>
  <Future>
    <Id>EURIBOR-3M-FUTURES-CONVENTIONS</Id>
    <Index>EUR-EURIBOR-3M</Index>
  </Future>
  <Future>
    <Id>AUD-BBSW-3M-FUTURES-CONVENTIONS</Id>
    <Index>AUD-BBSW-3M</Index>
  </Future>
  <Future>
    <Id>JPY-LIBOR-3M-FUTURES-CONVENTIONS</Id>
    <Index>JPY-LIBOR-3M</Index>
  </Future>
  <Future>
    <Id>SEK-STIBOR-3M-FUTURES-CONVENTIONS</Id>
    <Index>SEK-STIBOR-3M</Index>
  </Future>
  <!-- Forward Rate Agreements -->
  <FRA>
    <Id>EUR-12M-FRA-CONVENTIONS</Id>
    <Index>EUR-EURIBOR-12M</Index>
  </FRA>
  <FRA>
    <Id>EUR-6M-FRA-CONVENTIONS</Id>
    <Index>EUR-EURIBOR-6M</Index>
  </FRA>
  <FRA>
    <Id>EUR-3M-FRA-CONVENTIONS</Id>
    <Index>EUR-EURIBOR-3M</Index>
  </FRA>
  <FRA>
    <Id>AUD-3M-FRA-CONVENTIONS</Id>
    <Index>AUD-BBSW-3M</Index>
  </FRA>
  <FRA>
    <Id>CHF-6M-FRA-CONVENTIONS</Id>
    <Index>CHF-LIBOR-6M</Index>
  </FRA>
  <FRA>
    <Id>CHF-3M-FRA-CONVENTIONS</Id>
    <Index>CHF-LIBOR-3M</Index>
  </FRA>
  <FRA>
    <Id>GBP-3M-FRA</Id>
    <Index>GBP-LIBOR-3M</Index>
  </FRA>
  <FRA>
    <Id>GBP-6M-FRA</Id>
    <Index>GBP-LIBOR-6M</Index>
  </FRA>
  <FRA>
    <Id>USD-6M-FRA-CONVENTIONS</Id>
    <Index>USD-LIBOR-6M</Index>
  </FRA>
  <FRA>
    <Id>USD-3M-FRA-CONVENTIONS</Id>
    <Index>USD-LIBOR-3M</Index>
  </FRA>
  <FRA>
    <Id>CAD-FRA-3M</Id>
    <Index>CAD-CDOR-3M</Index>
  </FRA>
  <FRA>
    <Id>CZK-6M-FRA</Id>
    <Index>CZK-PRIBOR-6M</Index>
  </FRA>
  <FRA>
    <Id>CZK-3M-FRA</Id>
    <Index>CZK-PRIBOR-3M</Index>
  </FRA>
  <FRA>
    <Id>NZD-3M-FRA</Id>
    <Index>NZD-BKBM-3M</Index>
  </FRA>
  <FRA>
    <Id>HUF-6M-FRA</Id>
    <Index>HUF-BUBOR-6M</Index>
  </FRA>
  <FRA>
    <Id>PLN-6M-FRA</Id>
    <Index>PLN-WIBOR-6M</Index>
  </FRA>
  <FRA>
    <Id>PLN-3M-FRA</Id>
    <Index>PLN-WIBOR-3M</Index>
  </FRA>
  <FRA>
    <Id>SEK-3M-FRA</Id>
    <Index>SEK-STIBOR-3M</Index>
  </FRA>
  <!-- Interest Rate Swaps -->
  <SwapIndex>
    <Id>EUR-CMS-1Y</Id>
    <Conventions>EUR-3M-SWAP-CONVENTIONS</Conventions>
  </SwapIndex>
  <SwapIndex>
    <Id>EUR-CMS-30Y</Id>
    <Conventions>EUR-6M-SWAP-CONVENTIONS</Conventions>
  </SwapIndex>
  <SwapIndex>
    <Id>USD-CMS-1Y</Id>
    <Conventions>USD-3M-SWAP-CONVENTIONS</Conventions>
  </SwapIndex>
  <SwapIndex>
    <Id>USD-CMS-30Y</Id>
    <Conventions>USD-3M-SWAP-CONVENTIONS</Conventions>
  </SwapIndex>
  <SwapIndex>
    <Id>GBP-CMS-1Y</Id>
    <Conventions>GBP-3M-SWAP-CONVENTIONS</Conventions>
  </SwapIndex>
  <SwapIndex>
    <Id>GBP-CMS-30Y</Id>
    <Conventions>GBP-6M-SWAP-CONVENTIONS</Conventions>
  </SwapIndex>
  <SwapIndex>
    <Id>CHF-CMS-1Y</Id>
    <Conventions>CHF-3M-SWAP-CONVENTIONS</Conventions>
  </SwapIndex>
  <SwapIndex>
    <Id>CHF-CMS-30Y</Id>
    <Conventions>CHF-6M-SWAP-CONVENTIONS</Conventions>
  </SwapIndex>
  <SwapIndex>
    <Id>JPY-CMS-1Y</Id>
    <Conventions>JPY-LIBOR-6M-SWAP-CONVENTIONS</Conventions>
  </SwapIndex>
  <SwapIndex>
    <Id>JPY-CMS-30Y</Id>
    <Conventions>JPY-LIBOR-6M-SWAP-CONVENTIONS</Conventions>
  </SwapIndex>
  <Swap>
    <Id>EUR-6M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>TARGET</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>EUR-EURIBOR-6M</Index>
  </Swap>
  <Swap>
    <Id>EUR-1M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>TARGET</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>EUR-EURIBOR-1M</Index>
  </Swap>
  <Swap>
    <Id>EUR-3M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>TARGET</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>EUR-EURIBOR-3M</Index>
  </Swap>
  <Swap>
    <Id>EUR-12M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>TARGET</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>EUR-EURIBOR-12M</Index>
  </Swap>
  <Swap>
    <Id>USD-3M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>US,UK</FixedCalendar>
    <FixedFrequency>Semiannual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>USD-LIBOR-3M</Index>
  </Swap>
  <Swap>
    <Id>USD-6M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>US,UK</FixedCalendar>
    <FixedFrequency>Semiannual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>USD-LIBOR-6M</Index>
  </Swap>
  <Swap>
    <Id>CHF-6M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>ZUB,UK</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>CHF-LIBOR-6M</Index>
  </Swap>
  <Swap>
    <Id>CHF-3M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>ZUB,UK</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>CHF-LIBOR-3M</Index>
  </Swap>
  <Swap>
    <Id>AUD-6M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>AU</FixedCalendar>
    <FixedFrequency>Semiannual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>A365</FixedDayCounter>
    <Index>AUD-BBSW-6M</Index>
  </Swap>
  <Swap>
    <Id>AUD-3M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>AU</FixedCalendar>
    <FixedFrequency>Quarterly</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>A365</FixedDayCounter>
    <Index>AUD-BBSW-3M</Index>
  </Swap>
  <Swap>
    <!-- for tenor = 1Y -->
    <Id>CAD-3M-SWAP-CONVENTIONS-1Y</Id>
    <FixedCalendar>CA</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>ACT/365</FixedDayCounter>
    <Index>CAD-CDOR-3M</Index>
    <FloatFrequency>Annual</FloatFrequency>
    <SubPeriodsCouponType>Compounding</SubPeriodsCouponType>
  </Swap>
  <Swap>
    <!-- for tenor >= 2Y -->
    <Id>CAD-3M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>CA</FixedCalendar>
    <FixedFrequency>Semiannual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>ACT/365</FixedDayCounter>
    <Index>CAD-CDOR-3M</Index>
    <FloatFrequency>Semiannual</FloatFrequency>
    <SubPeriodsCouponType>Compounding</SubPeriodsCouponType>
  </Swap>
  <Swap>
    <Id>DKK-6M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>DEN</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>DKK-CIBOR-6M</Index>
  </Swap>
  <Swap>
    <Id>NOK-6M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>NOK</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>NOK-NIBOR-6M</Index>
  </Swap>
  <Swap>
    <Id>JPY-LIBOR-6M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>JP,UK</FixedCalendar>
    <FixedFrequency>Semiannual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>A365</FixedDayCounter>
    <Index>JPY-LIBOR-6M</Index>
  </Swap>
  <Swap>
    <Id>JPY-TIBOR-3M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>JP</FixedCalendar>
    <FixedFrequency>Semiannual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>A365</FixedDayCounter>
    <Index>JPY-TIBOR-3M</Index>
  </Swap>
  <Swap>
    <Id>SEK-3M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>SS</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>SEK-STIBOR-3M</Index>
  </Swap>
  <Swap>
    <Id>SEK-6M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>SS</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>SEK-STIBOR-6M</Index>
  </Swap>
  <Swap>
    <Id>SGD-6M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>SGD</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>30/360</FixedDayCounter>
    <Index>SGD-SIBOR-6M</Index>
  </Swap>
  <Swap>
    <Id>GBP-6M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>UK</FixedCalendar>
    <FixedFrequency>Semiannual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>A365</FixedDayCounter>
    <Index>GBP-LIBOR-6M</Index>
  </Swap>
  <Swap>
    <Id>GBP-3M-SWAP-CONVENTIONS</Id>
    <FixedCalendar>UK</FixedCalendar>
    <FixedFrequency>Semiannual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>A365</FixedDayCounter>
    <Index>GBP-LIBOR-3M</Index>
  </Swap>
  <Swap>
    <Id>CZK-6M-SWAP</Id>
    <FixedCalendar>CZK</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>ACT/360</FixedDayCounter>
    <Index>CZK-PRIBOR-6M</Index>
  </Swap>
  <Swap>
    <Id>CZK-3M-SWAP</Id>
    <FixedCalendar>CZK</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>ACT/360</FixedDayCounter>
    <Index>CZK-PRIBOR-3M</Index>
  </Swap>
  <Swap>
    <Id>HUF-6M-SWAP</Id>
    <FixedCalendar>HUF</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>A365</FixedDayCounter>
    <Index>HUF-BUBOR-6M</Index>
  </Swap>
  <Swap>
    <Id>PLN-6M-SWAP</Id>
    <FixedCalendar>PLN</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>ACT/ACT</FixedDayCounter>
    <Index>PLN-WIBOR-6M</Index>
  </Swap>
  <Swap>
    <Id>PLN-3M-SWAP</Id>
    <FixedCalendar>PLN</FixedCalendar>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>ACT/ACT</FixedDayCounter>
    <Index>PLN-WIBOR-3M</Index>
  </Swap>
  <Swap>
    <Id>NZD-6M-SWAP</Id>
    <FixedCalendar>NZD</FixedCalendar>
    <FixedFrequency>Semiannual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>A365</FixedDayCounter>
    <Index>NZD-BKBM-6M</Index>
  </Swap>
  <Swap>
    <Id>NZD-3M-SWAP</Id>
    <FixedCalendar>NZD</FixedCalendar>
    <FixedFrequency>Semiannual</FixedFrequency>
    <FixedConvention>MF</FixedConvention>
    <FixedDayCounter>A365</FixedDayCounter>
    <Index>NZD-BKBM-3M</Index>
  </Swap>
  <!-- Overnight Index linked Swap Legs -->
  <OIS>
    <Id>EUR-OIS-CONVENTIONS</Id>
    <SpotLag>2</SpotLag>
    <Index>EUR-EONIA</Index>
    <FixedDayCounter>A360</FixedDayCounter>
    <PaymentLag>1</PaymentLag>
    <EOM>false</EOM>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>Following</FixedConvention>
    <FixedPaymentConvention>Following</FixedPaymentConvention>
    <Rule>Backward</Rule>
  </OIS>
  <OIS>
    <Id>CHF-OIS-CONVENTIONS</Id>
    <SpotLag>1</SpotLag>
    <Index>CHF-TOIS</Index>
    <FixedDayCounter>30/360</FixedDayCounter>
    <PaymentLag>2</PaymentLag>
    <EOM>false</EOM>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>Following</FixedConvention>
    <FixedPaymentConvention>Following</FixedPaymentConvention>
    <Rule>Backward</Rule>
  </OIS>
  <OIS>
    <Id>USD-OIS-CONVENTIONS</Id>
    <SpotLag>2</SpotLag>
    <Index>USD-FedFunds</Index>
    <FixedDayCounter>A360</FixedDayCounter>
    <PaymentLag>2</PaymentLag>
    <EOM>false</EOM>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>Following</FixedConvention>
    <FixedPaymentConvention>Following</FixedPaymentConvention>
    <Rule>Backward</Rule>
  </OIS>
  <AverageOIS>
    <Id>USD-AVERAGE-OIS-CONVENTIONS</Id>
    <SpotLag>2</SpotLag>
    <FixedTenor>6M</FixedTenor>
    <FixedDayCounter>30/360</FixedDayCounter>
    <FixedCalendar>US</FixedCalendar>
    <FixedConvention>MF</FixedConvention>
    <FixedPaymentConvention>MF</FixedPaymentConvention>
    <Index>USD-FedFunds</Index>
    <OnTenor>3M</OnTenor>
    <RateCutoff>2</RateCutoff>
  </AverageOIS>
  <OIS>
    <Id>GBP-OIS-CONVENTIONS</Id>
    <SpotLag>0</SpotLag>
    <Index>GBP-SONIA</Index>
    <FixedDayCounter>A365</FixedDayCounter>
    <PaymentLag>0</PaymentLag>
    <EOM>false</EOM>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>Following</FixedConvention>
    <FixedPaymentConvention>Following</FixedPaymentConvention>
    <Rule>Backward</Rule>
  </OIS>
  <OIS>
    <Id>JPY-OIS-CONVENTIONS</Id>
    <SpotLag>2</SpotLag>
    <Index>JPY-TONAR</Index>
    <FixedDayCounter>A360</FixedDayCounter>
    <PaymentLag>1</PaymentLag>
    <EOM>false</EOM>
    <FixedFrequency>Annual</FixedFrequency>
    <FixedConvention>Following</FixedConvention>
    <FixedPaymentConvention>Following</FixedPaymentConvention>
    <Rule>Backward</Rule>
  </OIS>
  <!-- Tenor Basis Swaps -->
  <TenorBasisTwoSwap>
    <Id>EURIBOR-3M-6M-BASIS-CONVENTIONS</Id>
    <Calendar>TARGET</Calendar>
    <LongFixedFrequency>Annual</LongFixedFrequency>
    <LongFixedConvention>MF</LongFixedConvention>
    <LongFixedDayCounter>30/360</LongFixedDayCounter>
    <LongIndex>EUR-EURIBOR-6M</LongIndex>
    <ShortFixedFrequency>Annual</ShortFixedFrequency>
    <ShortFixedConvention>MF</ShortFixedConvention>
    <ShortFixedDayCounter>30/360</ShortFixedDayCounter>
    <ShortIndex>EUR-EURIBOR-3M</ShortIndex>
    <LongMinusShort>true</LongMinusShort>
  </TenorBasisTwoSwap>
  <TenorBasisTwoSwap>
    <Id>EUR-EURIBOR-6M-12M-BASIS-CONVENTIONS</Id>
    <Calendar>TARGET</Calendar>
    <LongFixedFrequency>Annual</LongFixedFrequency>
    <LongFixedConvention>MF</LongFixedConvention>
    <LongFixedDayCounter>30/360</LongFixedDayCounter>
    <LongIndex>EUR-EURIBOR-12M</LongIndex>
    <ShortFixedFrequency>Annual</ShortFixedFrequency>
    <ShortFixedConvention>MF</ShortFixedConvention>
    <ShortFixedDayCounter>30/360</ShortFixedDayCounter>
    <ShortIndex>EUR-EURIBOR-6M</ShortIndex>
    <LongMinusShort>true</LongMinusShort>
  </TenorBasisTwoSwap>
  <TenorBasisSwap>
    <Id>USD-LIBOR-3M-6M-BASIS-CONVENTIONS</Id>
    <LongIndex>USD-LIBOR-6M</LongIndex>
    <ShortIndex>USD-LIBOR-3M</ShortIndex>
    <ShortPayTenor>6M</ShortPayTenor>
    <SpreadOnShort>true</SpreadOnShort>
    <IncludeSpread>false</IncludeSpread>
    <SubPeriodsCouponType>Compounding</SubPeriodsCouponType>
  </TenorBasisSwap>
  <TenorBasisSwap>
    <Id>GBP-LIBOR-3M-6M-BASIS-CONVENTIONS</Id>
    <LongIndex>GBP-LIBOR-6M</LongIndex>
    <ShortIndex>GBP-LIBOR-3M</ShortIndex>
  </TenorBasisSwap>
  <!-- FX Forwards -->
  <FX>
    <Id>GBP-USD-FX-CONVENTIONS</Id>
    <SpotDays>2</SpotDays>
    <SourceCurrency>GBP</SourceCurrency>
    <TargetCurrency>USD</TargetCurrency>
    <PointsFactor>10000</PointsFactor>
    <AdvanceCalendar>UK,US</AdvanceCalendar>
    <SpotRelative>true</SpotRelative>
    <AdditionalSettleCalendar/>
  </FX>
  <FX>
    <Id>USD-GBP-FX-CONVENTIONS</Id>
    <SpotDays>2</SpotDays>
    <SourceCurrency>USD</SourceCurrency>
    <TargetCurrency>GBP</TargetCurrency>
    <PointsFactor>10000</PointsFactor>
    <AdvanceCalendar>UK,US</AdvanceCalendar>
    <SpotRelative>true</SpotRelative>
    <AdditionalSettleCalendar/>
  </FX>
  <FX>
    <Id>EUR-USD-FX-CONVENTIONS</Id>
    <SpotDays>2</SpotDays>
    <SourceCurrency>EUR</SourceCurrency>
    <TargetCurrency>USD</TargetCurrency>
    <PointsFactor>10000</PointsFactor>
    <AdvanceCalendar>TARGET,US</AdvanceCalendar>
    <SpotRelative>true</SpotRelative>
    <AdditionalSettleCalendar/>
  </FX>
  <FX>
    <Id>CHF-USD-FX-CONVENTIONS</Id>
    <SpotDays>2</SpotDays>
    <SourceCurrency>CHF</SourceCurrency>
    <TargetCurrency>USD</TargetCurrency>
    <PointsFactor>10000</PointsFactor>
    <AdvanceCalendar>ZUB,US</AdvanceCalendar>
    <SpotRelative>true</SpotRelative>
    <AdditionalSettleCalendar/>
  </FX>
  <FX>
    <Id>USD-CHF-FX-CONVENTIONS</Id>
    <SpotDays>2</SpotDays>
    <SourceCurrency>USD</SourceCurrency>
    <TargetCurrency>CHF</TargetCurrency>
    <PointsFactor>10000</PointsFactor>
    <AdvanceCalendar>ZUB,US</AdvanceCalendar>
    <SpotRelative>true</SpotRelative>
    <AdditionalSettleCalendar/>
  </FX>
  <FX>
    <Id>EUR-GBP-FX-CONVENTIONS</Id>
    <SpotDays>2</SpotDays>
    <SourceCurrency>EUR</SourceCurrency>
    <TargetCurrency>GBP</TargetCurrency>
    <PointsFactor>10000</PointsFactor>
    <AdvanceCalendar>TARGET,UK</AdvanceCalendar>
    <SpotRelative>true</SpotRelative>
    <AdditionalSettleCalendar/>
  </FX>
  <FX>
    <Id>EUR-CHF-FX-CONVENTIONS</Id>
    <SpotDays>2</SpotDays>
    <SourceCurrency>EUR</SourceCurrency>
    <TargetCurrency>CHF</TargetCurrency>
    <PointsFactor>10000</PointsFactor>
    <AdvanceCalendar>TARGET,ZUB</AdvanceCalendar>
    <SpotRelative>true</SpotRelative>
    <AdditionalSettleCalendar/>
  </FX>
  <!-- Cross Currency Basis Swaps -->
  <CrossCurrencyBasis>
    <Id>EUR-USD-XCCY-BASIS-CONVENTIONS</Id>
    <SettlementDays>2</SettlementDays>
    <SettlementCalendar>TARGET,US,UK</SettlementCalendar>
    <RollConvention>MF</RollConvention>
    <FlatIndex>USD-LIBOR-3M</FlatIndex>
    <SpreadIndex>EUR-EURIBOR-3M</SpreadIndex>
  </CrossCurrencyBasis>
  <CrossCurrencyBasis>
    <Id>USD-GBP-XCCY-BASIS-CONVENTIONS</Id>
    <SettlementDays>2</SettlementDays>
    <SettlementCalendar>UK,US</SettlementCalendar>
    <RollConvention>MF</RollConvention>
    <FlatIndex>USD-LIBOR-3M</FlatIndex>
    <SpreadIndex>GBP-LIBOR-3M</SpreadIndex>
  </CrossCurrencyBasis>
  <CrossCurrencyBasis>
    <Id>EUR-GBP-XCCY-BASIS-CONVENTIONS</Id>
    <SettlementDays>2</SettlementDays>
    <SettlementCalendar>UK,TARGET</SettlementCalendar>
    <RollConvention>MF</RollConvention>
    <FlatIndex>EUR-EURIBOR-3M</FlatIndex>
    <SpreadIndex>GBP-LIBOR-3M</SpreadIndex>
  </CrossCurrencyBasis>
  <CrossCurrencyBasis>
    <Id>EUR-CHF-XCCY-BASIS-CONVENTIONS</Id>
    <SettlementDays>2</SettlementDays>
    <SettlementCalendar>ZUB,TARGET,UK</SettlementCalendar>
    <RollConvention>MF</RollConvention>
    <FlatIndex>EUR-EURIBOR-3M</FlatIndex>
    <SpreadIndex>CHF-LIBOR-3M</SpreadIndex>
  </CrossCurrencyBasis>
  <CrossCurrencyBasis>
    <Id>USD-CHF-XCCY-BASIS-CONVENTIONS</Id>
    <SettlementDays>2</SettlementDays>
    <SettlementCalendar>ZUB,US,UK</SettlementCalendar>
    <RollConvention>MF</RollConvention>
    <FlatIndex>USD-LIBOR-3M</FlatIndex>
    <SpreadIndex>CHF-LIBOR-3M</SpreadIndex>
  </CrossCurrencyBasis>
  <!-- Inflation Swaps -->
  <InflationSwap>
      <Id>EUHICP_INFLATIONSWAP</Id>
      <FixCalendar>TARGET</FixCalendar>
      <FixConvention>MF</FixConvention>
      <DayCounter>30/360</DayCounter>
      <Index>EUHICP</Index>
      <Interpolated>false</Interpolated>
      <ObservationLag>3M</ObservationLag>
      <AdjustInflationObservationDates>false</AdjustInflationObservationDates>
      <InflationCalendar>TARGET</InflationCalendar>
      <InflationConvention>MF</InflationConvention>
  </InflationSwap>
  <InflationSwap>
      <Id>EUHICPXT_INFLATIONSWAP</Id>
      <FixCalendar>TARGET</FixCalendar>
      <FixConvention>MF</FixConvention>
      <DayCounter>30/360</DayCounter>
      <Index>EUHICPXT</Index>
      <Interpolated>false</Interpolated>
      <ObservationLag>3M</ObservationLag>
      <AdjustInflationObservationDates>false</AdjustInflationObservationDates>
      <InflationCalendar>TARGET</InflationCalendar>
      <InflationConvention>MF</InflationConvention>
  </InflationSwap>
  <InflationSwap>
      <Id>FRHICP_INFLATIONSWAP</Id>
      <FixCalendar>TARGET</FixCalendar>
      <FixConvention>MF</FixConvention>
      <DayCounter>30/360</DayCounter>
      <Index>FRHICP</Index>
      <Interpolated>false</Interpolated>
      <ObservationLag>3M</ObservationLag>
      <AdjustInflationObservationDates>false</AdjustInflationObservationDates>
      <InflationCalendar>TARGET</InflationCalendar>
      <InflationConvention>MF</InflationConvention>
  </InflationSwap>
  <InflationSwap>
      <Id>UKRPI_INFLATIONSWAP</Id>
      <FixCalendar>UK</FixCalendar>
      <FixConvention>MF</FixConvention>
      <DayCounter>30/360</DayCounter>
      <Index>UKRPI</Index>
      <Interpolated>false</Interpolated>
      <ObservationLag>3M</ObservationLag>
      <AdjustInflationObservationDates>false</AdjustInflationObservationDates>
      <InflationCalendar>UK</InflationCalendar>
      <InflationConvention>MF</InflationConvention>
  </InflationSwap>
  <InflationSwap>
      <Id>USCPI_INFLATIONSWAP</Id>
      <FixCalendar>US</FixCalendar>
      <FixConvention>MF</FixConvention>
      <DayCounter>30/360</DayCounter>
      <Index>USCPI</Index>
      <Interpolated>false</Interpolated>
      <ObservationLag>3M</ObservationLag>
      <AdjustInflationObservationDates>false</AdjustInflationObservationDates>
      <InflationCalendar>US</InflationCalendar>
      <InflationConvention>MF</InflationConvention>
  </InflationSwap>
  <InflationSwap>
      <Id>ZACPI_INFLATIONSWAP</Id>
      <FixCalendar>ZAR</FixCalendar>
      <FixConvention>MF</FixConvention>
      <DayCounter>30/360</DayCounter>
      <Index>ZACPI</Index>
      <Interpolated>false</Interpolated>
      <ObservationLag>3M</ObservationLag>
      <AdjustInflationObservationDates>false</AdjustInflationObservationDates>
      <InflationCalendar>ZAR</InflationCalendar>
      <InflationConvention>MF</InflationConvention>
  </InflationSwap>
</Conventions>


text:
package com.zwh.mvparms.eyepetizer.mvp.ui.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.DownloadListener;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ProgressBar;

import com.jess.arms.di.component.AppComponent;
import com.zwh.mvparms.eyepetizer.R;

import butterknife.BindView;

/**
 * Created by Administrator on 2017/11/7 0007.
 */

public class BaseWebActivity extends BaseActivity {
    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.appbar)
    AppBarLayout appbar;
    @BindView(R.id.webview_container)
    FrameLayout mWebViewContainer;
    @BindView(R.id.webview_progressbar)
    ProgressBar mProgressBar;

    protected WebView mWebView;

    @Override
    public void setupActivityComponent(AppComponent appComponent) {

    }

    @Override
    public int initView(Bundle savedInstanceState) {
        return R.layout.activity_base_webview;
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        configWebView();
        setWebViewProgress();
    }

    protected void configWebView() {
        mWebView = new WebView(getApplicationContext());
        mWebViewContainer.addView(mWebView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
        WebSettings settings = mWebView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setDefaultTextEncodingName("UTF-8");
        settings.setSupportZoom(false);
        settings.setPluginState(WebSettings.PluginState.ON);
        mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    }

    private void setWebViewProgress() {
        mWebView.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                super.onProgressChanged(view, newProgress);
                if (newProgress == 100) {
                    mProgressBar.setVisibility(View.GONE);
                } else {
                    mProgressBar.setVisibility(View.VISIBLE);
                    mProgressBar.setProgress(newProgress);
                }
            }
        });

        mWebView.setWebViewClient(new WebViewClient() {
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(view, url);
            }
        });

        mWebView.setDownloadListener(new DownloadListener() {
            @Override
            public void onDownloadStart(String s, String s1, String s2, String s3, long l) {
                Uri uri = Uri.parse(s);
                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                startActivity(intent);
            }
        });
    }

    @Override
    protected void onDestroy() {
        mWebViewContainer.removeAllViews();
        mWebView.destroy();
        mWebView = null;
        super.onDestroy();
    }

    @Override
    protected boolean isDisplayHomeAsUpEnabled() {
        return true;
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php
/**
 * Store only User id in the Storage instead of the serialized User entity (not recommended)
 */

namespace Application\Service\Auth\Adapter;

use Zend\Authentication\Adapter\Exception;
use Zend\Authentication\Result as AuthenticationResult;

class ObjectRepository extends \DoctrineModule\Authentication\Adapter\ObjectRepository
{
    protected function validateIdentity($identity)
    {
        $credentialProperty = $this->options->getCredentialProperty();
        $getter = 'get' . ucfirst($credentialProperty);
        $documentCredential = null;

        if (method_exists($identity, $getter)) {
            $documentCredential = $identity->$getter();
        } elseif (property_exists($identity, $credentialProperty)) {
            $documentCredential = $identity->{$credentialProperty};
        } else {
            throw new Exception\UnexpectedValueException(
                sprintf(
                    'Property (%s) in (%s) is not accessible. You should implement %s::%s()',
                    $credentialProperty,
                    get_class($identity),
                    get_class($identity),
                    $getter
                )
            );
        }

        $credentialValue = $this->credential;
        $callable = $this->options->getCredentialCallable();
        if ($callable) {
            $credentialValue = call_user_func($callable, $identity, $credentialValue);
        }

        if (password_verify($credentialValue, $documentCredential)) {
            $this->authenticationResultInfo['code'] = AuthenticationResult::SUCCESS;
            $this->authenticationResultInfo['identity'] = $identity;
            $this->authenticationResultInfo['messages'][] = 'Authentication successful.';
        } else {
            $this->authenticationResultInfo['code'] = AuthenticationResult::FAILURE_CREDENTIAL_INVALID;
            $this->authenticationResultInfo['messages'][] = 'Supplied credential is invalid.';
        }

        return $this->createAuthenticationResult();
    }

    /**
     * @inheritdoc
     */
    protected function createAuthenticationResult()
    {
        if ($this->authenticationResultInfo['identity'] instanceof \Application\Entity\User) {
            $this->authenticationResultInfo['identity'] = $this->authenticationResultInfo['identity']->getId();
        }

        return parent::createAuthenticationResult();
    }
}


text:
<?php

namespace Fxp\Component\RequireAsset\Tests\Twig\Extension;

use Fxp\Component\RequireAsset\Exception\Twig\RequireTagException;
use Twig\Error\SyntaxError;

/**
 * Require Asset Extension Tests.
 *
 * @author François Pluchino <francois.pluchino@gmail.com>
 *
 * @internal
 */
final class RequireAssetExtensionTest extends AbstractAssetExtensionTest
{
    public function getRequireTwigTemplates()
    {
        $tests = [];

        foreach ($this->getRequireTwigTags() as $arguments) {
            foreach ($this->getRequireTwigTemplateConfigs() as $configArguments) {
                $tests[] = array_merge($arguments, $configArguments);
            }
        }

        return $tests;
    }

    /**
     * @dataProvider getRequireTwigTemplates
     *
     * @param string $tag
     * @param string $testFile
     * @param string $exceptionClass
     * @param string $exceptionMessage
     */
    public function testTwigTags($tag, $testFile, $exceptionClass = null, $exceptionMessage = null): void
    {
        if (null !== $exceptionClass) {
            $this->expectException($exceptionClass);
        }

        if (null !== $exceptionMessage) {
            if (0 === strpos($exceptionMessage, '/')) {
                $this->expectExceptionMessageRegExp($exceptionMessage);
            } else {
                $this->expectExceptionMessage($exceptionMessage);
            }
        }

        $this->replacementManager->addReplacement('@virtual_asset/js/asset.js', '@webpack/asset');
        $this->replacementManager->addReplacement('@virtual_asset/css/asset.css', '@webpack/asset');

        $this->doValidTagTest($tag, $testFile);
    }

    protected function getRequireTwigTemplateConfigs()
    {
        return [
            ['test'],
            ['test_multi_asset'],
            ['test_without_asset', SyntaxError::class, '/The twig tag "(\w+)" require a lest one asset/'],
            ['test_replacement_asset'],
            ['test_optional_asset'],
            ['invalid_webpack_asset', RequireTagException::class, 'is not managed by the Webpack Require Asset Manager'],
        ];
    }
}


text:
package org.jtransfo.object;

import org.jtransfo.DomainClass;
import org.jtransfo.MapOnlies;
import org.jtransfo.MapOnly;
import org.jtransfo.MappedBy;

import java.util.Date;

/**
 * Person transfer object.
 */
@DomainClass(domainClass = PersonDomain.class)
public class TaggedPersonTo {

    @MapOnlies({
        @MapOnly("create"),
        @MapOnly(value =  "update", readOnly = true)
    })
    private String name;

    @MapOnly("create")
    @MapOnlies({
            @MapOnly(value =  "*", readOnly = true)
    })
    @MappedBy(readOnly = true) // should not make a difference, overwritten by the ReadOnlies
    private String gender;

    @MapOnlies({
        @MapOnly({"create", "addressPolice"}),
        @MapOnly(value = "update", typeConverter = "always2")
    })
    private AddressTo address;

    @MappedBy(readOnly = true)
    private Date lastChanged;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public AddressTo getAddress() {
        return address;
    }

    public void setAddress(AddressTo address) {
        this.address = address;
    }

    public Date getLastChanged() {
        return lastChanged;
    }

    public void setLastChanged(Date lastChanged) {
        this.lastChanged = lastChanged;
    }
}


text:
package com.mapswithme.maps.bookmarks.data;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mapswithme.maps.widget.placepage.PlacePageData;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class ElevationInfo implements PlacePageData
{
  private final long mId;
  @Nullable
  private final String mServerId;
  @NonNull
  private final String mName;
  @NonNull
  private final List<Point> mPoints;
  private final int mAscent;
  private final int mDescent;
  private final int mMinAltitude;
  private final int mMaxAltitude;
  private final int mDifficulty;
  private final long mDuration;

  public ElevationInfo(long trackId, @Nullable String serverId, @NonNull String name,
                       @NonNull Point[] points, int ascent, int descent, int minAltitude,
                       int maxAltitude, int difficulty, long duration)
  {
    mId = trackId;
    mServerId = serverId;
    mName = name;
    mPoints = Arrays.asList(points);
    mAscent = ascent;
    mDescent = descent;
    mMinAltitude = minAltitude;
    mMaxAltitude = maxAltitude;
    mDifficulty = difficulty;
    mDuration = duration;
  }

  protected ElevationInfo(Parcel in)
  {
    mId = in.readLong();
    mServerId = in.readString();
    mName = in.readString();
    mAscent = in.readInt();
    mDescent = in.readInt();
    mMinAltitude = in.readInt();
    mMaxAltitude = in.readInt();
    mDifficulty = in.readInt();
    mDuration = in.readLong();
    mPoints = readPoints(in);
  }

  @NonNull
  private static List<Point> readPoints(@NonNull Parcel in)
  {
    List<Point> points = new ArrayList<>();
    in.readTypedList(points, Point.CREATOR);
    return points;
  }

  public long getId()
  {
    return mId;
  }

  @Nullable
  public String getServerId()
  {
    return mServerId;
  }

  @NonNull
  public String getName()
  {
    return mName;
  }

  @NonNull
  public List<Point> getPoints()
  {
    return Collections.unmodifiableList(mPoints);
  }

  public int getAscent()
  {
    return mAscent;
  }

  public int getDescent()
  {
    return mDescent;
  }

  public int getMinAltitude()
  {
    return mMinAltitude;
  }

  public int getMaxAltitude()
  {
    return mMaxAltitude;
  }

  public int getDifficulty()
  {
    return mDifficulty;
  }

  public long getDuration()
  {
    return mDuration;
  }

  @Override
  public int describeContents()
  {
    return 0;
  }

  @Override
  public void writeToParcel(Parcel dest, int flags)
  {
    dest.writeLong(mId);
    dest.writeString(mServerId);
    dest.writeString(mName);
    dest.writeInt(mAscent);
    dest.writeInt(mDescent);
    dest.writeInt(mMinAltitude);
    dest.writeInt(mMaxAltitude);
    dest.writeInt(mDifficulty);
    dest.writeLong(mDuration);
    // All collections are deserialized AFTER non-collection and primitive type objects,
    // so collections must be always serialized at the end.
    dest.writeTypedList(mPoints);
  }

  public static class Point implements Parcelable
  {
    private final double mDistance;
    private final int mAltitude;

    public Point(double distance, int altitude)
    {
      mDistance = distance;
      mAltitude = altitude;
    }

    protected Point(Parcel in)
    {
      mDistance = in.readDouble();
      mAltitude = in.readInt();
    }

    public static final Creator<Point> CREATOR = new Creator<Point>()
    {
      @Override
      public Point createFromParcel(Parcel in)
      {
        return new Point(in);
      }

      @Override
      public Point[] newArray(int size)
      {
        return new Point[size];
      }
    };

    public double getDistance()
    {
      return mDistance;
    }

    public int getAltitude()
    {
      return mAltitude;
    }

    @Override
    public int describeContents()
    {
      return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags)
    {
      dest.writeDouble(mDistance);
      dest.writeInt(mAltitude);
    }
  }

  public static final Creator<ElevationInfo> CREATOR = new Creator<ElevationInfo>()
  {
    @Override
    public ElevationInfo createFromParcel(Parcel in)
    {
      return new ElevationInfo(in);
    }

    @Override
    public ElevationInfo[] newArray(int size)
    {
      return new ElevationInfo[size];
    }
  };
}


text:
require "vagrant/util/retryable"
require "vagrant/util/subprocess"

require "vagrant-lxc/errors"
require "vagrant-lxc/driver/cli"

require "etc"

module Vagrant
  module LXC
    class Driver
      # This is raised if the container can't be found when initializing it with
      # a name.
      class ContainerNotFound < StandardError; end

      # Root folder where container configs are stored
      CONTAINERS_PATH = '/var/lib/lxc'

      attr_reader :container_name,
                  :customizations

      def initialize(container_name, sudo_wrapper, cli = nil)
        @container_name = container_name
        @sudo_wrapper   = sudo_wrapper
        @cli            = cli || CLI.new(sudo_wrapper, container_name)
        @logger         = Log4r::Logger.new("vagrant::provider::lxc::driver")
        @customizations = []
      end

      def validate!
        raise ContainerNotFound if @container_name && ! @cli.list.include?(@container_name)
      end

      def base_path
        Pathname.new("#{CONTAINERS_PATH}/#{@container_name}")
      end

      def rootfs_path
        Pathname.new(config_string.match(/^lxc\.rootfs\s+=\s+(.+)$/)[1])
      end

      def mac_address
        @mac_address ||= config_string.match(/^lxc\.network\.hwaddr\s+=\s+(.+)$/)[1]
      end

      def config_string
        @sudo_wrapper.run('cat', base_path.join('config').to_s)
      end

      def create(name, template_path, config_file, template_options = {})
        @cli.name = @container_name = name

        import_template(template_path) do |template_name|
          @logger.debug "Creating container..."
          @cli.create template_name, config_file, template_options
        end
      end

      def share_folders(folders)
        folders.each do |folder|
          guestpath = rootfs_path.join(folder[:guestpath].gsub(/^\//, ''))
          unless guestpath.directory?
            begin
              @logger.debug("Guest path doesn't exist, creating: #{guestpath}")
              @sudo_wrapper.run('mkdir', '-p', guestpath.to_s)
            rescue Errno::EACCES
              raise Vagrant::Errors::SharedFolderCreateFailed, :path => guestpath.to_s
            end
          end

          @customizations << ['mount.entry', "#{folder[:hostpath]} #{guestpath} none bind 0 0"]
        end
      end

      def start(customizations)
        @logger.info('Starting container...')

        if ENV['LXC_START_LOG_FILE']
          extra = ['-o', ENV['LXC_START_LOG_FILE'], '-l', 'DEBUG']
        end

        prune_customizations
        write_customizations(customizations + @customizations)

        @cli.start(extra)
      end

      def forced_halt
        @logger.info('Shutting down container...')
        @cli.transition_to(:stopped) { |c| c.shutdown }
      # REFACTOR: Do not use exception to control the flow
      rescue CLI::TargetStateNotReached, CLI::ShutdownNotSupported
        @cli.transition_to(:stopped) { |c| c.stop }
      end

      def destroy
        @cli.destroy
      end

      def attach(*command)
        @cli.attach(*command)
      end

      def version
        @version ||= @cli.version
      end

      # TODO: This needs to be reviewed and specs needs to be written
      def compress_rootfs
        # TODO: Pass in tmpdir so we can clean up from outside
        target_path    = "#{Dir.mktmpdir}/rootfs.tar.gz"

        @logger.info "Compressing '#{rootfs_path}' rootfs to #{target_path}"
        # "vagrant package" will copy the existing lxc-template in the new box file
        # To keep this function backwards compatible with existing boxes, the path
        # included in the tarball needs to have the same amount of path components (2)
        # that will be stripped before extraction, hence the './.'
        # TODO: This should be reviewed before 1.0
        cmds = [
          "cd #{base_path}",
          "rm -f rootfs.tar.gz",
          "tar --numeric-owner -czf #{target_path} -C #{rootfs_path} './.'"
        ]
        @sudo_wrapper.su_c(cmds.join(' && '))

        @logger.info "Changing rootfs tarball owner"
        user_details = Etc.getpwnam(Etc.getlogin)
        @sudo_wrapper.run('chown', "#{user_details.uid}:#{user_details.gid}", target_path)

        target_path
      end

      def state
        if @container_name
          @cli.state
        end
      end

      def prune_customizations
        # Use sed to just strip out the block of code which was inserted by Vagrant
        @logger.debug 'Prunning vagrant-lxc customizations'
        @sudo_wrapper.su_c("sed -e '/^# VAGRANT-BEGIN/,/^# VAGRANT-END/ d' -ibak #{base_path.join('config')}")
      end

      protected

      def write_customizations(customizations)
        customizations = customizations.map do |key, value|
          "lxc.#{key}=#{value}"
        end
        customizations.unshift '# VAGRANT-BEGIN'
        customizations      << '# VAGRANT-END'

        config_file = base_path.join('config').to_s
        customizations.each do |line|
          @sudo_wrapper.su_c("echo '#{line}' >> #{config_file}")
        end
      end

      def import_template(path)
        template_name     = "vagrant-tmp-#{@container_name}"
        tmp_template_path = templates_path.join("lxc-#{template_name}").to_s

        @logger.info 'Copying LXC template into place'
        @sudo_wrapper.run('cp', path, tmp_template_path)
        @sudo_wrapper.run('chmod', '+x', tmp_template_path)

        yield template_name
      ensure
        @logger.info 'Removing LXC template'
        if tmp_template_path
          @sudo_wrapper.run('rm', tmp_template_path)
        end
      end

      TEMPLATES_PATH_LOOKUP = %w(
        /usr/share/lxc/templates
        /usr/lib/lxc/templates
        /usr/lib64/lxc/templates
        /usr/local/lib/lxc/templates
      )
      def templates_path
        return @templates_path if @templates_path

        path = TEMPLATES_PATH_LOOKUP.find { |candidate| File.directory?(candidate) }
        if !path
          raise Errors::TemplatesDirMissing.new paths: TEMPLATES_PATH_LOOKUP.inspect
        end

        @templates_path = Pathname(path)
      end
    end
  end
end


text:
<?php

/**
 * @file Vote.php
 * @brief This file contains the Vote class.
 * @details
 * @author Filippo F. Fadda
 */

namespace ReIndex\Doc;

use EoC\Doc\Doc;

/**
 * @brief This class is used to keep trace of the user votes.
 * @nosubgrouping
 */
final class Vote extends Doc {

  /**
   * @brief Creates an instance of Vote class.
   * @param[in] string $itemId The ID of the document the vote refers.
   * @param[in] string $voterId The ID of the member who has voted.
   * @param[in] int $value The vote's value.
   * @param[in] string $reason (optional) The reason for the vote's preference.
   */
  public static function cast($itemId, $voterId, $value = 1, $reason = '') {
    $instance = new self();

    $instance->meta["itemId"] = $itemId;
    $instance->meta["voterId"] = $voterId;
    $instance->meta["value"] = $value;
    $instance->meta["reason"] = $reason;
    $instance->meta["timestamp"] = time();

    return $instance;
  }

  //! @cond HIDDEN_SYMBOLS

  public function getValue() {
    return $this->meta['value'];
  }

  public function issetValue() {
    return isset($this->meta['value']);
  }

  public function setValue($value) {
    $this->meta['value'] = $value;
  }

  public function unsetValue() {
    if ($this->isMetadataPresent('value'))
      unset($this->meta['value']);
  }

  public function getReason() {
    return $this->meta['reason'];
  }

  public function issetReason() {
    return isset($this->meta['reason']);
  }

  public function setReason($reason) {
    $this->meta['reason'] = $reason;
  }

  public function unsetReason() {
    if ($this->isMetadataPresent('reason'))
      unset($this->meta['reason']);
  }

  public function getTimestamp() {
    return $this->meta['timestamp'];
  }

  public function issetTimestamp() {
    return isset($this->meta['timestamp']);
  }

  public function setTimestamp($timestamp) {
    $this->meta['timestamp'] = $timestamp;
  }

  public function unsetTimestamp() {
    if ($this->isMetadataPresent('timestamp'))
      unset($this->meta['timestamp']);
  }

  //! @endcond

}


text:
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { Github } from '../shared/github';

@Component({
  selector: 'repo-browser',
  templateUrl: './repo-browser.html',
  styleUrls: ['./repo-browser.css']
})
export class RepoBrowser {

  constructor(private router: Router, private github: Github) {
  }

  searchForOrg(orgName: string) {
    this.github.getOrg(orgName)
      .subscribe(({name}) => {
        console.log(name);
        this.router.navigate(['/github', orgName]);
      });
  }

}


text:
package seava.ad.business.ext.system.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import seava.j4e.api.descriptor.ISysParamDefinition;
import seava.j4e.api.descriptor.ISysParamDefinitions;
import seava.j4e.api.exceptions.BusinessException;
import seava.ad.business.api.system.IParamService;
import seava.ad.domain.impl.system.Param;

/**
 * Business extensions specific for {@link Param} domain entity.
 *
 */
public class Param_Service extends
		seava.ad.business.impl.system.Param_Service implements
		IParamService {

	@Override
	@Transactional
	public void doSynchronizeCatalog() throws BusinessException {

		List<ISysParamDefinitions> defs = this.getSettings()
				.getParamDefinitions();
		List<Param> entities = new ArrayList<Param>();
		for (ISysParamDefinitions def : defs) {
			for (ISysParamDefinition d : def.getSysParamDefinitions()) {
				Param e = new Param();
				e.setActive(true);
				e.setCode(d.getName());
				e.setName(d.getTitle());
				e.setDefaultValue(d.getDefaultValue());
				e.setListOfValues(d.getListOfValues());
				e.setDescription(d.getDescription());
				entities.add(e);
			}
		}

		this.update("delete from " + Param.class.getSimpleName(), null);
		this.insert(entities);
	}

}


text:
package org.apache.servicecomb.demo.pojo.server.same.pk2;

import org.apache.servicecomb.provider.pojo.RpcSchema;
import org.springframework.stereotype.Component;

import io.swagger.annotations.SwaggerDefinition;

@RpcSchema(schemaId = "SameService2")
@Component("SameService2")
@SwaggerDefinition(basePath = "/SameService2")
public class SameService {
  public String sayHello(String name) {
    return "pk2-svc-" + name;
  }
}


text:
{-|
Module      : Control.Concurrent.Throttle
Description : Limit the number of IO actions per second
Copyright   : (c) 2014, Rodrigo Setti
License     : MIT
Maintainer  : rodrigosetti@gmail.com
Stability   : experimental
Portability : POSIX
-}
module Control.Concurrent.Throttle (throttle) where

import           Control.Concurrent
import           Control.Concurrent.MSemN
import qualified Control.Concurrent.Thread as Thread
import           Control.Exception
import           Control.Monad

-- | Limit the number of @tasks@ started per second. @throttle@ will run all
--   actions concurrently but only starting a certain number per second. It
--   will wait for all tasks and return the results in a list.
throttle :: Int     -- ^ number of tasks per second (TPS)
         -> [IO a]  -- ^ the tasks to run concurrently but limited by TPS
         -> IO [a]  -- ^ the tasks results
throttle tps tasks =
    do sem   <- new tps
       let runTask task    = liftM snd $ wait sem 1 >> Thread.forkIO task
           timeResetWorker = forever $ threadDelay 1000000 >> signalF sem (\i -> (tps-i, ()))
           runAllTasks     = mapM runTask tasks
       mapM Thread.result =<< sequence =<< bracket (forkIO timeResetWorker)
                                                   killThread
                                                   (const runAllTasks)


text:
#include "Application.h"
#include "ViewCameraWindow.h"
#include "Font.h"

#define WORK_QUEUE_INDEX 0
#define GRAPHICS_QUEUE_INDEX 1

class TessellationShaderWindow : public ViewCameraWindow
{
public:
	TessellationShaderWindow() :
		m_pVertShaderModule(nullptr),
		m_pTescShaderModule(nullptr),
		m_pTeseShaderModule(nullptr),
		m_pGeomShaderModule(nullptr),
		m_pFragShaderModule(nullptr),
		m_pDescriptorSetLayout(nullptr),
		m_pPipelineLayout(nullptr),
		m_pMeshBuffer(nullptr),
		m_VertexOffset(0),
		m_IndexOffset(0),
		m_pImageView(nullptr),
		m_pSampler(nullptr),
		m_pDescriptorSet(nullptr),
		m_pDepthStencilImage(nullptr),
		m_pDepthStencilImageView(nullptr),
		m_pRenderPass(nullptr),
		m_IndexCount(0),
		m_PipelineType(TessellationShaderWindow::PIPELINE_TYPE_SOLID),
		m_Height(3.0f),
		m_Level(3)
	{
	}

	virtual ~TessellationShaderWindow() {}

protected:
	virtual bool OnInitialize() override
	{
		// ----------------------------------------------------------------------------------------------------
		// ƒtƒHƒ"ƒg'ð‰Šú‰»
		// ----------------------------------------------------------------------------------------------------

		if (m_Font.Initialize(Application::GetDevice(), GetWorkQueue(), GetWorkCommandBuffer(), GetWorkFence(), L"Arial", 16, 400) == false)
		{
			return false;
		}

		// ----------------------------------------------------------------------------------------------------
		// ƒVƒF[ƒ_[ƒ'ƒWƒ…[ƒ‹'ðì¬
		// ----------------------------------------------------------------------------------------------------

		{
			std::wstring srcFilePath;
			std::wstring dstFilePath;

			// vert
			CreateFilePath(L"shader\\source\\tessAndGeomShader.vert", srcFilePath);
			CreateFilePath(L"shader\\tessAndGeomShader.vert.spv", dstFilePath);
			if (CompileShaderFromFile(COMPILE_SHADER_SPIR_V_BINARY_VULKAN, srcFilePath.c_str(), dstFilePath.c_str()) != V3D_OK)
			{
				return false;
			}

			V3D_RESULT result = CreateShaderModuleFromFile(Application::GetDevice(), dstFilePath.c_str(), &m_pVertShaderModule);
			if (result != V3D_OK)
			{
				return false;
			}

			// tesc
			CreateFilePath(L"shader\\source\\tessAndGeomShader.tesc", srcFilePath);
			CreateFilePath(L"shader\\tessAndGeomShader.tesc.spv", dstFilePath);
			if (CompileShaderFromFile(COMPILE_SHADER_SPIR_V_BINARY_VULKAN, srcFilePath.c_str(), dstFilePath.c_str()) != V3D_OK)
			{
				return false;
			}

			result = CreateShaderModuleFromFile(Application::GetDevice(), dstFilePath.c_str(), &m_pTescShaderModule);
			if (result != V3D_OK)
			{
				return false;
			}

			// tese
			CreateFilePath(L"shader\\source\\tessAndGeomShader.tese", srcFilePath);
			CreateFilePath(L"shader\\tessAndGeomShader.tese.spv", dstFilePath);
			if (CompileShaderFromFile(COMPILE_SHADER_SPIR_V_BINARY_VULKAN, srcFilePath.c_str(), dstFilePath.c_str()) != V3D_OK)
			{
				return false;
			}

			result = CreateShaderModuleFromFile(Application::GetDevice(), dstFilePath.c_str(), &m_pTeseShaderModule);
			if (result != V3D_OK)
			{
				return false;
			}

			// geom
			CreateFilePath(L"shader\\source\\tessAndGeomShader.geom", srcFilePath);
			CreateFilePath(L"shader\\tessAndGeomShader.geom.spv", dstFilePath);
			if (CompileShaderFromFile(COMPILE_SHADER_SPIR_V_BINARY_VULKAN, srcFilePath.c_str(), dstFilePath.c_str()) != V3D_OK)
			{
				return false;
			}

			result = CreateShaderModuleFromFile(Application::GetDevice(), dstFilePath.c_str(), &m_pGeomShaderModule);
			if (result != V3D_OK)
			{
				return false;
			}

			// frag
			CreateFilePath(L"shader\\source\\tessAndGeomShader.frag", srcFilePath);
			CreateFilePath(L"shader\\tessAndGeomShader.frag.spv", dstFilePath);
			if (CompileShaderFromFile(COMPILE_SHADER_SPIR_V_BINARY_VULKAN, srcFilePath.c_str(), dstFilePath.c_str()) != V3D_OK)
			{
				return false;
			}

			result = CreateShaderModuleFromFile(Application::GetDevice(), dstFilePath.c_str(), &m_pFragShaderModule);
			if (result != V3D_OK)
			{
				return false;
			}
		}

		// ----------------------------------------------------------------------------------------------------
		// ƒfƒXƒNƒŠƒvƒ^ƒZƒbƒgƒŒƒCƒAƒEƒg'ðì¬
		// ----------------------------------------------------------------------------------------------------

		{
			Array1<V3DDescriptorDesc, 1> descriptors =
			{
				{ 0, V3D_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, V3D_SHADER_STAGE_GEOMETRY }
			};

			V3D_RESULT result = Application::GetDevice()->CreateDescriptorSetLayout(TO_UI32(descriptors.size()), descriptors.data(), 1, 1, &m_pDescriptorSetLayout);
			if (result != V3D_OK)
			{
				return false;
			}
		}

		// ----------------------------------------------------------------------------------------------------
		// ƒpƒCƒvƒ‰ƒCƒ"ƒŒƒCƒAƒEƒg'ðì¬
		// ----------------------------------------------------------------------------------------------------

		{
			Array1<V3DConstantDesc, 3> constants =
			{
				{
					{ V3D_SHADER_STAGE_TESSELLATION_CONTROL,   0, sizeof(TessellationShaderWindow::TescConstant) },
					{ V3D_SHADER_STAGE_GEOMETRY,              16, sizeof(TessellationShaderWindow::GeomConstant) },
					{ V3D_SHADER_STAGE_FRAGMENT,             160, sizeof(TessellationShaderWindow::FragConstant) },
				}
			};

			Array1<IV3DDescriptorSetLayout*, 1> descriptorSetLayouts =
			{
				m_pDescriptorSetLayout
			};

			V3D_RESULT result = Application::GetDevice()->CreatePipelineLayout(TO_UI32(constants.size()), constants.data(), TO_UI32(descriptorSetLayouts.size()), descriptorSetLayouts.data(), &m_pPipelineLayout);
			if (result != V3D_OK)
			{
				return false;
			}
		}

		// ----------------------------------------------------------------------------------------------------
		// ƒo[ƒeƒbƒNƒXƒoƒbƒtƒ@['ðì¬
		// ----------------------------------------------------------------------------------------------------

		{
			uint16_t planeDivCount = 8;
			uint16_t rowIndexCount = planeDivCount + 1;

			float planeWidth = 20.0f;
			float halfPlaneWidth = planeWidth * 0.5f;

			float planePosStep = planeWidth / TO_F32(planeDivCount);
			float planeUVStep = 1.0f / TO_F32(planeDivCount);

			std::vector<TessellationShaderWindow::Vertex> vertices;
			vertices.reserve(rowIndexCount * rowIndexCount);

			for (uint16_t z = 0; z < rowIndexCount; z++)
			{
				TessellationShaderWindow::Vertex vertex;

				vertex.pos.z = -halfPlaneWidth + planePosStep * TO_F32(z);
				vertex.normal.Set(0.0f, -1.0f, 0.0f);
				vertex.uv.y = planeUVStep * TO_F32(z);

				for (uint16_t x = 0; x < rowIndexCount; x++)
				{
					vertex.pos.x = -halfPlaneWidth + planePosStep * TO_F32(x);
					vertex.uv.x = planeUVStep * TO_F32(x);

					vertices.push_back(vertex);
				}
			}

			std::vector<uint16_t> indices;
			indices.reserve(planeDivCount * planeDivCount * 3);

			for (uint16_t y = 0; y < planeDivCount; y++)
			{
				uint16_t firstIndex = rowIndexCount * y;
				for (uint16_t x = 0; x < planeDivCount; x++)
				{
					uint16_t i0 = firstIndex + x;
					uint16_t i1 = i0 + rowIndexCount;
					uint16_t i2 = i1 + 1;

					indices.push_back(i0);
					indices.push_back(i1);
					indices.push_back(i2);

					uint16_t i3 = i2;
					uint16_t i4 = i2 - rowIndexCount;
					uint16_t i5 = i0;

					indices.push_back(i3);
					indices.push_back(i4);
					indices.push_back(i5);
				}
			}

			m_IndexCount = TO_UI32(indices.size());

			uint64_t vertexBufferSize = sizeof(TessellationShaderWindow::Vertex) * vertices.size();
			uint64_t indexBufferSize = sizeof(uint16_t) * indices.size();

			Array1<BufferSubresourceDesc, 2> meshSubresources;
			meshSubresources[0].usageFlags = V3D_BUFFER_USAGE_VERTEX;
			meshSubresources[0].size = vertexBufferSize;
			meshSubresources[0].count = 1;
			meshSubresources[1].usageFlags = V3D_BUFFER_USAGE_INDEX;
			meshSubresources[1].size = indexBufferSize;
			meshSubresources[1].count = 1;

			Array1<BufferMemoryLayout, 2> meshMemoryLayouts;
			uint64_t meshMemorySize;

			CalcBufferMemoryLayout(Application::GetDevice(), V3D_MEMORY_PROPERTY_HOST_VISIBLE, TO_UI32(meshSubresources.size()), meshSubresources.data(), meshMemoryLayouts.data(), &meshMemorySize);

			V3DBufferDesc meshBufferDesc{};
			meshBufferDesc.usageFlags = V3D_BUFFER_USAGE_VERTEX | V3D_BUFFER_USAGE_INDEX;
			meshBufferDesc.size = meshMemorySize;

			V3D_RESULT result = Application::GetDevice()->CreateBuffer(meshBufferDesc, &m_pMeshBuffer);
			if (result != V3D_OK)
			{
				return false;
			}

			Array1<IV3DResource*, 1> resources = { m_pMeshBuffer };

			V3DFlags memoryPropertyFlags = V3D_MEMORY_PROPERTY_HOST_VISIBLE | V3D_MEMORY_PROPERTY_HOST_COHERENT;
			if (Application::GetDevice()->CheckResourceMemoryProperty(memoryPropertyFlags, TO_UI32(resources.size()), resources.data()) != V3D_OK)
			{
				memoryPropertyFlags = V3D_MEMORY_PROPERTY_HOST_VISIBLE;
			}

			result = Application::GetDevice()->AllocateResourceMemoryAndBind(memoryPropertyFlags, m_pMeshBuffer);
			if (result != V3D_OK)
			{
				return false;
			}

			uint8_t* pMemory;
			result = m_pMeshBuffer->Map(0, 0, reinterpret_cast<void**>(&pMemory));
			if (result == V3D_OK)
			{
				// ƒo[ƒeƒbƒNƒX'ð''«ž'Þ
				MemCopy(pMemory + meshMemoryLayouts[0].offset, meshMemoryLayouts[0].stride, vertices.data(), vertexBufferSize);

				// ƒCƒ"ƒfƒbƒNƒX'ð''«ž'Þ
				MemCopy(pMemory + meshMemoryLayouts[1].offset, meshMemoryLayouts[1].stride, indices.data(), indexBufferSize);

				result = m_pMeshBuffer->Unmap();
				if (result != V3D_OK)
				{
					return false;
				}
			}

			m_VertexOffset = meshMemoryLayouts[0].offset;
			m_IndexOffset = meshMemoryLayouts[1].offset;
		}

		// ----------------------------------------------------------------------------------------------------
		// ƒCƒ[ƒW'ðì¬
		// ----------------------------------------------------------------------------------------------------

		{
			std::wstring srcFilePath;
			CreateFilePath(L"image\\tessAndGeomShader.dds", srcFilePath);

			V3D_RESULT result = CreateImageFromFile(Application::GetDevice(), GetWorkQueue(), GetWorkCommandBuffer(), GetWorkFence(), srcFilePath.c_str(), false, V3D_PIPELINE_STAGE_GEOMETRY_SHADER, &m_pImageView);
			if (result != V3D_OK)
			{
				return false;
			}
		}

		// ----------------------------------------------------------------------------------------------------
		// ƒTƒ"ƒvƒ‰['ðì¬
		// ----------------------------------------------------------------------------------------------------

		{
			V3DSamplerDesc samplerDesc{};
			samplerDesc.magFilter = V3D_FILTER_LINEAR;
			samplerDesc.minFilter = V3D_FILTER_LINEAR;
			samplerDesc.mipmapMode = V3D_MIPMAP_MODE_LINEAR;
			samplerDesc.addressModeU = V3D_ADDRESS_MODE_REPEAT;
			samplerDesc.addressModeV = V3D_ADDRESS_MODE_REPEAT;
			samplerDesc.addressModeW = V3D_ADDRESS_MODE_REPEAT;
			samplerDesc.mipLodBias = 0.0f;
			samplerDesc.anisotropyEnable = false;
			samplerDesc.maxAnisotropy = 0.0f;
			samplerDesc.compareEnable = false;
			samplerDesc.compareOp = V3D_COMPARE_OP_ALWAYS;
			samplerDesc.minLod = 0.0f;
			samplerDesc.maxLod = 0.0f;
			samplerDesc.borderColor = V3D_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;

			V3D_RESULT result = Application::GetDevice()->CreateSampler(samplerDesc, &m_pSampler);
			if (result != V3D_OK)
			{
				return false;
			}
		}

		// ----------------------------------------------------------------------------------------------------
		// ƒfƒXƒNƒŠƒvƒ^ƒZƒbƒg'ðì¬
		// ----------------------------------------------------------------------------------------------------

		V3D_RESULT result = Application::GetDevice()->CreateDescriptorSet(m_pDescriptorSetLayout, &m_pDescriptorSet);
		if (result != V3D_OK)
		{
			return false;
		}

		result = m_pDescriptorSet->SetImageViewAndSampler(0, m_pImageView, V3D_IMAGE_LAYOUT_SHADER_READ_ONLY, m_pSampler);
		if (result != V3D_OK)
		{
			return false;
		}

		m_pDescriptorSet->Update();

		// ----------------------------------------------------------------------------------------------------
		// ƒXƒƒbƒvƒ`ƒFƒCƒ"'ÉŠÖŒW'·'éƒCƒ"ƒ^[ƒtƒF[ƒX'ðì¬
		// ----------------------------------------------------------------------------------------------------

		if (OnRestoreSwapChain() == false)
		{
			return false;
		}

		// ----------------------------------------------------------------------------------------------------

		SetCameraRotation(Vector3(1.0f, 1.0f, 0.0f).ToNormalize(), DEG_TO_RAD(45.0f));
		SetCameraDistance(20.0f);

		return true;
	}

	virtual void OnFinalize() override
	{
		OnLostSwapChain();

		SAFE_RELEASE(m_pDescriptorSet);
		SAFE_RELEASE(m_pSampler);
		SAFE_RELEASE(m_pImageView);
		SAFE_RELEASE(m_pMeshBuffer);
		SAFE_RELEASE(m_pPipelineLayout);
		SAFE_RELEASE(m_pDescriptorSetLayout);
		SAFE_RELEASE(m_pFragShaderModule);
		SAFE_RELEASE(m_pGeomShaderModule);
		SAFE_RELEASE(m_pTeseShaderModule);
		SAFE_RELEASE(m_pTescShaderModule);
		SAFE_RELEASE(m_pVertShaderModule);

		m_Font.Dispose();
	}

	virtual bool OnIdle() override
	{
		// ----------------------------------------------------------------------------------------------------
		// ƒeƒLƒXƒg
		// ----------------------------------------------------------------------------------------------------

		m_Font.Reset();

		wchar_t text[128];

		swprintf_s(text, L"Fps %f", Application::GetAverageFpsPreSec());
		m_Font.AddText(16, 16, text);

		wchar_t polygonMode[5];
		switch (m_PipelineType)
		{
		case 0:
			wcscpy_s(polygonMode, L"Fill");
			break;
		case 1:
			wcscpy_s(polygonMode, L"Line");
			break;
		}

		swprintf_s(text, L"A - S : Height %.1f\nZ - X : Level %u\nSpace : PolygonMode %s", m_Height, m_Level, polygonMode);
		m_Font.AddText(16, 48, text);

		if (m_Font.Bake() == false)
		{
			return false;
		}

		// ----------------------------------------------------------------------------------------------------
		// ƒJƒƒ‰'ðXV
		// ----------------------------------------------------------------------------------------------------

		ViewCameraWindow::OnIdle();

		// ----------------------------------------------------------------------------------------------------
		// '萔'ð€"õ
		// ----------------------------------------------------------------------------------------------------

		TessellationShaderWindow::TescConstant tescConstant{};
		tescConstant.level = TO_F32(m_Level);

		TessellationShaderWindow::GeomConstant geomConstant{};
		geomConstant.height = m_Height;
		geomConstant.worldMatrix = Matrix4x4::Identity();
		geomConstant.worldViewProjectionMatrix = GetCamera()->GetViewProjectionMatrix() * geomConstant.worldMatrix;

		TessellationShaderWindow::FragConstant fragConstant{};
		fragConstant.lightDirection = GetCamera()->GetEye().ToNormalize();

		// ----------------------------------------------------------------------------------------------------
		// •`‰æ
		// ----------------------------------------------------------------------------------------------------

		IV3DFrameBuffer* pFrameBuffer = m_FrameBuffers[GetSwapChain()->GetCurrentImageIndex()];
		const V3DSwapChainDesc& swapChainDesc = GetSwapChain()->GetDesc();

		IV3DCommandBuffer* pCommandBufer = BeginGraphics();
		if (pCommandBufer == nullptr)
		{
			return false;
		}

		// ƒŒƒ"ƒ_[ƒpƒX'ðŠJŽn
		pCommandBufer->BeginRenderPass(pFrameBuffer, true);

		// ƒTƒuƒpƒX 0 - ƒƒbƒVƒ…'Ì•`‰æ
		V3DViewport viewport{};
		viewport.rect.width = swapChainDesc.imageWidth;
		viewport.rect.height = swapChainDesc.imageHeight;
		viewport.minDepth = 0.0f;
		viewport.maxDepth = 1.0f;
		pCommandBufer->SetViewport(0, 1, &viewport);

		V3DRectangle2D scissor{};
		scissor.width = swapChainDesc.imageWidth;
		scissor.height = swapChainDesc.imageHeight;
		pCommandBufer->SetScissor(0, 1, &scissor);

		pCommandBufer->PushConstant(m_pPipelineLayout, 0, &tescConstant);
		pCommandBufer->PushConstant(m_pPipelineLayout, 1, &geomConstant);
		pCommandBufer->PushConstant(m_pPipelineLayout, 2, &fragConstant);

		pCommandBufer->BindPipeline(m_pPipelines[m_PipelineType]);
		pCommandBufer->BindDescriptorSet(V3D_PIPELINE_TYPE_GRAPHICS, m_pPipelineLayout, 0, m_pDescriptorSet);
		pCommandBufer->BindVertexBuffer(0, m_pMeshBuffer, m_VertexOffset);
		pCommandBufer->BindIndexBuffer(m_pMeshBuffer, m_IndexOffset, V3D_INDEX_TYPE_UINT16);
		pCommandBufer->DrawIndexed(m_IndexCount, 1, 0, 0, 0);

		// ƒTƒuƒpƒX 1 - ƒeƒLƒXƒg'Ì•`‰æ
		pCommandBufer->NextSubpass();
		m_Font.Flush(pCommandBufer);

		// ƒŒƒ"ƒ_[ƒpƒX'ðI—¹
		pCommandBufer->EndRenderPass();

		if (EndGraphics() == false)
		{
			return false;
		}

		return true;
	}

	virtual void OnLostSwapChain() override
	{
		m_Font.Lost();

		for (size_t i = 0; i < m_pPipelines.size(); i++)
		{
			SAFE_RELEASE(m_pPipelines[i]);
		}

		if (m_FrameBuffers.empty() == false)
		{
			for (size_t i = 0; i < m_FrameBuffers.size(); i++)
			{
				SAFE_RELEASE(m_FrameBuffers[i]);
			}
			m_FrameBuffers.clear();
		}

		SAFE_RELEASE(m_pRenderPass);

		SAFE_RELEASE(m_pDepthStencilImageView);
		SAFE_RELEASE(m_pDepthStencilImage);
	}

	virtual bool OnRestoreSwapChain() override
	{
		const V3DSwapChainDesc& swapChainDesc = GetSwapChain()->GetDesc();

		// ----------------------------------------------------------------------------------------------------
		// ƒfƒvƒXƒXƒeƒ"ƒVƒ‹ƒCƒ[ƒW'ðì¬
		// ----------------------------------------------------------------------------------------------------

		{
			V3DImageDesc imageDesc{};
			imageDesc.type = V3D_IMAGE_TYPE_2D;
			imageDesc.width = swapChainDesc.imageWidth;
			imageDesc.height = swapChainDesc.imageHeight;
			imageDesc.depth = 1;
			imageDesc.levelCount = 1;
			imageDesc.layerCount = 1;
			imageDesc.samples = V3D_SAMPLE_COUNT_1;
			imageDesc.tiling = V3D_IMAGE_TILING_OPTIMAL;
			imageDesc.usageFlags = V3D_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT;

			// ƒtƒH[ƒ}ƒbƒg'ªŽg—p'Å'«'é'©ƒ`ƒFƒbƒN'·'é
			imageDesc.format = V3D_FORMAT_D24_UNORM_S8_UINT;
			if (Application::GetDevice()->GetImageFormatDesc(imageDesc.format, imageDesc.type, imageDesc.tiling, imageDesc.usageFlags, nullptr) != V3D_OK)
			{
				imageDesc.format = V3D_FORMAT_D16_UNORM;
				if (Application::GetDevice()->GetImageFormatDesc(imageDesc.format, imageDesc.type, imageDesc.tiling, imageDesc.usageFlags, nullptr) != V3D_OK)
				{
					imageDesc.format = V3D_FORMAT_D16_UNORM_S8_UINT;
					if (Application::GetDevice()->GetImageFormatDesc(imageDesc.format, imageDesc.type, imageDesc.tiling, imageDesc.usageFlags, nullptr) != V3D_OK)
					{
						return false;
					}
				}
			}

			V3D_RESULT result = Application::GetDevice()->CreateImage(imageDesc, V3D_IMAGE_LAYOUT_UNDEFINED, &m_pDepthStencilImage);
			if (result != V3D_OK)
			{
				return false;
			}

			result = Application::GetDevice()->AllocateResourceMemoryAndBind(V3D_MEMORY_PROPERTY_DEVICE_LOCAL, m_pDepthStencilImage);
			if (result != V3D_OK)
			{
				return false;
			}
		}

		// ----------------------------------------------------------------------------------------------------
		// ƒfƒvƒXƒXƒeƒ"ƒVƒ‹ƒCƒ[ƒWƒrƒ…['ðì¬
		// ----------------------------------------------------------------------------------------------------

		{
			V3DImageViewDesc imageViewDesc{};
			imageViewDesc.type = V3D_IMAGE_VIEW_TYPE_2D;
			imageViewDesc.baseLevel = 0;
			imageViewDesc.levelCount = 1;
			imageViewDesc.baseLayer = 0;
			imageViewDesc.layerCount = 1;

			V3D_RESULT result = Application::GetDevice()->CreateImageView(m_pDepthStencilImage, imageViewDesc, &m_pDepthStencilImageView);
			if (result != V3D_OK)
			{
				return false;
			}

			IV3DCommandBuffer* pCommandBuffer = BeginWork();
			if (pCommandBuffer == nullptr)
			{
				return false;
			}

			V3DPipelineBarrier pipelineBarrier{};
			pipelineBarrier.srcStageMask = V3D_PIPELINE_STAGE_TOP_OF_PIPE;
			pipelineBarrier.dstStageMask = V3D_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS | V3D_PIPELINE_STAGE_LATE_FRAGMENT_TESTS;

			V3DImageViewMemoryBarrier memoryBarrier{};
			memoryBarrier.srcAccessMask = 0;
			memoryBarrier.dstAccessMask = V3D_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE;
			memoryBarrier.srcQueueFamily = V3D_QUEUE_FAMILY_IGNORED;
			memoryBarrier.dstQueueFamily = V3D_QUEUE_FAMILY_IGNORED;
			memoryBarrier.srcLayout = V3D_IMAGE_LAYOUT_UNDEFINED;
			memoryBarrier.dstLayout = V3D_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT;
			memoryBarrier.pImageView = m_pDepthStencilImageView;
			pCommandBuffer->Barrier(pipelineBarrier, memoryBarrier);

			EndWork();
		}

		// ----------------------------------------------------------------------------------------------------
		// ƒŒƒ"ƒ_[ƒpƒX'ðì¬
		// ----------------------------------------------------------------------------------------------------

		/******************/
		/* ƒAƒ^ƒbƒ`ƒƒ"ƒg */
		/******************/

		std::array<V3DAttachmentDesc, 2> attachments;

		// ƒJƒ‰[
		attachments[0].format = swapChainDesc.imageFormat;
		attachments[0].samples = V3D_SAMPLE_COUNT_1;
		attachments[0].loadOp = V3D_ATTACHMENT_LOAD_OP_CLEAR;
		attachments[0].storeOp = V3D_ATTACHMENT_STORE_OP_STORE;
		attachments[0].stencilLoadOp = V3D_ATTACHMENT_LOAD_OP_UNDEFINED;
		attachments[0].stencilStoreOp = V3D_ATTACHMENT_STORE_OP_UNDEFINED;
		attachments[0].initialLayout = V3D_IMAGE_LAYOUT_PRESENT_SRC;
		attachments[0].finalLayout = V3D_IMAGE_LAYOUT_PRESENT_SRC;
		attachments[0].clearValue.color.float32[0] = 0.1f;
		attachments[0].clearValue.color.float32[1] = 0.1f;
		attachments[0].clearValue.color.float32[2] = 0.1f;
		attachments[0].clearValue.color.float32[3] = 0.1f;

		// ƒfƒvƒXƒXƒeƒ"ƒVƒ‹
		attachments[1].format = m_pDepthStencilImage->GetDesc().format;
		attachments[1].samples = V3D_SAMPLE_COUNT_1;
		attachments[1].loadOp = V3D_ATTACHMENT_LOAD_OP_CLEAR;
		attachments[1].storeOp = V3D_ATTACHMENT_STORE_OP_STORE;
		attachments[1].stencilLoadOp = V3D_ATTACHMENT_LOAD_OP_UNDEFINED;
		attachments[1].stencilStoreOp = V3D_ATTACHMENT_STORE_OP_UNDEFINED;
		attachments[1].initialLayout = V3D_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT;
		attachments[1].finalLayout = V3D_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT;
		attachments[1].clearValue.depthStencil.depth = 1.0f;
		attachments[1].clearValue.depthStencil.stencil = 0;

		/**************/
		/* ƒTƒuƒpƒX 0 */
		/**************/

		std::array<V3DSubpassDesc, 2> subpasses;

		// ƒJƒ‰[
		std::array<V3DAttachmentReference, 1> colorAttachments0;
		colorAttachments0[0].attachment = 0;
		colorAttachments0[0].layout = V3D_IMAGE_LAYOUT_COLOR_ATTACHMENT;

		// ƒfƒvƒXƒXƒeƒ"ƒVƒ‹
		V3DAttachmentReference depthStencilAttachment0;
		depthStencilAttachment0.attachment = 1;
		depthStencilAttachment0.layout = V3D_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT;

		subpasses[0].inputAttachmentCount = 0;
		subpasses[0].pInputAttachments = nullptr;
		subpasses[0].colorAttachmentCount = static_cast<uint32_t>(colorAttachments0.size());
		subpasses[0].pColorAttachments = colorAttachments0.data();
		subpasses[0].pResolveAttachments = nullptr;
		subpasses[0].pDepthStencilAttachment = &depthStencilAttachment0;
		subpasses[0].preserveAttachmentCount = 0;
		subpasses[0].pPreserveAttachments = nullptr;

		/**************/
		/* ƒTƒuƒpƒX 1 */
		/**************/

		// ƒJƒ‰[
		std::array<V3DAttachmentReference, 1> colorAttachments1;
		colorAttachments1[0].attachment = 0;
		colorAttachments1[0].layout = V3D_IMAGE_LAYOUT_COLOR_ATTACHMENT;

		subpasses[1].inputAttachmentCount = 0;
		subpasses[1].pInputAttachments = nullptr;
		subpasses[1].colorAttachmentCount = static_cast<uint32_t>(colorAttachments1.size());
		subpasses[1].pColorAttachments = colorAttachments1.data();
		subpasses[1].pResolveAttachments = nullptr;
		subpasses[1].pDepthStencilAttachment = nullptr;
		subpasses[1].preserveAttachmentCount = 0;
		subpasses[1].pPreserveAttachments = nullptr;

		/********************/
		/* ƒTƒuƒpƒX'̈ˑ¶« */
		/********************/

		Array1<V3DSubpassDependencyDesc, 3> subpassDependencies;

		subpassDependencies[0].srcSubpass = V3D_SUBPASS_EXTERNAL;
		subpassDependencies[0].dstSubpass = 0;
		subpassDependencies[0].srcStageMask = V3D_PIPELINE_STAGE_TOP_OF_PIPE;
		subpassDependencies[0].dstStageMask = V3D_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT;
		subpassDependencies[0].srcAccessMask = V3D_ACCESS_MEMORY_READ;
		subpassDependencies[0].dstAccessMask = V3D_ACCESS_COLOR_ATTACHMENT_WRITE;
		subpassDependencies[0].dependencyFlags = 0;

		subpassDependencies[1].srcSubpass = 0;
		subpassDependencies[1].dstSubpass = 1;
		subpassDependencies[1].srcStageMask = V3D_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT;
		subpassDependencies[1].dstStageMask = V3D_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT;
		subpassDependencies[1].srcAccessMask = V3D_ACCESS_COLOR_ATTACHMENT_WRITE;
		subpassDependencies[1].dstAccessMask = V3D_ACCESS_COLOR_ATTACHMENT_WRITE;
		subpassDependencies[1].dependencyFlags = V3D_DEPENDENCY_BY_REGION;

		subpassDependencies[2].srcSubpass = 1;
		subpassDependencies[2].dstSubpass = V3D_SUBPASS_EXTERNAL;
		subpassDependencies[2].srcStageMask = V3D_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT;
		subpassDependencies[2].dstStageMask = V3D_PIPELINE_STAGE_BOTTOM_OF_PIPE;
		subpassDependencies[2].srcAccessMask = V3D_ACCESS_COLOR_ATTACHMENT_WRITE;
		subpassDependencies[2].dstAccessMask = V3D_ACCESS_MEMORY_READ;
		subpassDependencies[2].dependencyFlags = 0;

		V3D_RESULT result = Application::GetDevice()->CreateRenderPass(
			TO_UI32(attachments.size()), attachments.data(),
			TO_UI32(subpasses.size()), subpasses.data(),
			TO_UI32(subpassDependencies.size()), subpassDependencies.data(),
			&m_pRenderPass);

		// ----------------------------------------------------------------------------------------------------
		// ƒtƒŒ[ƒ€ƒoƒbƒtƒ@'ðì¬
		// ----------------------------------------------------------------------------------------------------

		m_FrameBuffers.resize(swapChainDesc.imageCount);

		for (uint32_t i = 0; i < swapChainDesc.imageCount; i++)
		{
			IV3DImageView* pImageView;
			if (CreateImageView(i, &pImageView) == false)
			{
				return false;
			}

			Array1<IV3DImageView*, 2> attachments =
			{
				pImageView,
				m_pDepthStencilImageView,
			};

			IV3DFrameBuffer* pFrameBuffer = nullptr;
			result = Application::GetDevice()->CreateFrameBuffer(m_pRenderPass, TO_UI32(attachments.size()), attachments.data(), &m_FrameBuffers[i]);
			if (result != V3D_OK)
			{
				SAFE_RELEASE(pImageView);
				return false;
			}

			SAFE_RELEASE(pImageView);
		}

		// ----------------------------------------------------------------------------------------------------
		// ƒOƒ‰ƒtƒBƒbƒNƒXƒpƒCƒvƒ‰ƒCƒ"'ðì¬
		// ----------------------------------------------------------------------------------------------------

		Array1<V3DPipelineVertexElement, 3> vertexElements =
		{
			{
				{ 0,  0, V3D_FORMAT_R32G32B32_SFLOAT }, // position
				{ 1, 12, V3D_FORMAT_R32G32B32_SFLOAT }, // normal
				{ 2, 24, V3D_FORMAT_R32G32_SFLOAT },    // uv
			}
		};

		Array1<V3DPipelineVertexLayout, 1> vertexLayouts =
		{
			{ 0, sizeof(TessellationShaderWindow::Vertex), 0, TO_UI32(vertexElements.size()) },
		};

		Array1<V3DPipelineColorBlendAttachment, 1> colorBlendAttachments =
		{
			{ true, V3D_BLEND_FACTOR_ONE, V3D_BLEND_FACTOR_ZERO, V3D_BLEND_OP_ADD, V3D_BLEND_FACTOR_ONE, V3D_BLEND_FACTOR_ZERO, V3D_BLEND_OP_ADD, V3D_COLOR_COMPONENT_ALL }
		};

		V3DGraphicsPipelineDesc pipelineDesc{};
		pipelineDesc.vertexShader.pModule = m_pVertShaderModule;
		pipelineDesc.vertexShader.pEntryPointName = "main";
		pipelineDesc.tessellationControlShader.pModule = m_pTescShaderModule;
		pipelineDesc.tessellationControlShader.pEntryPointName = "main";
		pipelineDesc.tessellationEvaluationShader.pModule = m_pTeseShaderModule;
		pipelineDesc.tessellationEvaluationShader.pEntryPointName = "main";
		pipelineDesc.geometryShader.pModule = m_pGeomShaderModule;
		pipelineDesc.geometryShader.pEntryPointName = "main";
		pipelineDesc.fragmentShader.pModule = m_pFragShaderModule;
		pipelineDesc.fragmentShader.pEntryPointName = "main";
		pipelineDesc.vertexInput.elementCount = TO_UI32(vertexElements.size());
		pipelineDesc.vertexInput.pElements = vertexElements.data();
		pipelineDesc.vertexInput.layoutCount = TO_UI32(vertexLayouts.size());
		pipelineDesc.vertexInput.pLayouts = vertexLayouts.data();
		pipelineDesc.primitiveTopology = V3D_PRIMITIVE_TOPOLOGY_PATCH_LIST;
		pipelineDesc.tessellation.patchControlPoints = 3;
		pipelineDesc.rasterization.polygonMode = V3D_POLYGON_MODE_FILL;
		pipelineDesc.rasterization.cullMode = V3D_CULL_MODE_NONE;
		pipelineDesc.depthStencil.depthTestEnable = true;
		pipelineDesc.depthStencil.depthWriteEnable = true;
		pipelineDesc.depthStencil.depthCompareOp = V3D_COMPARE_OP_LESS;
		pipelineDesc.multisample.rasterizationSamples = V3D_SAMPLE_COUNT_1;
		pipelineDesc.colorBlend.attachmentCount = TO_UI32(colorBlendAttachments.size());
		pipelineDesc.colorBlend.pAttachments = colorBlendAttachments.data();
		pipelineDesc.pRenderPass = m_pRenderPass;
		pipelineDesc.subpass = 0;

		// ƒ\ƒŠƒbƒh
		result = Application::GetDevice()->CreateGraphicsPipeline(m_pPipelineLayout, pipelineDesc, &m_pPipelines[TessellationShaderWindow::PIPELINE_TYPE_SOLID]);
		if (result != V3D_OK)
		{
			return false;
		}

		// ƒƒCƒ"[
		pipelineDesc.rasterization.polygonMode = V3D_POLYGON_MODE_LINE;
		result = Application::GetDevice()->CreateGraphicsPipeline(m_pPipelineLayout, pipelineDesc, &m_pPipelines[TessellationShaderWindow::PIPELINE_TYPE_WIRE]);
		if (result != V3D_OK)
		{
			return false;
		}

		// ----------------------------------------------------------------------------------------------------
		// ƒtƒHƒ"ƒg'𕜋A
		// ----------------------------------------------------------------------------------------------------

		m_Font.Restore(m_pRenderPass, 1, swapChainDesc.imageWidth, swapChainDesc.imageHeight);

		// ----------------------------------------------------------------------------------------------------

		return true;
	}

	virtual bool OnKeyDown(WPARAM keyCode, uint16_t repeatCount, uint8_t scanCode, bool extendedKey, bool prevKeyState) override
	{
		if ((keyCode == VK_SPACE) && (repeatCount == 1))
		{
			m_PipelineType = (m_PipelineType + 1) % TessellationShaderWindow::PIPELINE_TYPE_COUNT;
		}

		if (keyCode == 'A')
		{
			if (m_Height > 0.0f)
			{
				m_Height -= 0.1f;
			}
		}
		else if (keyCode == 'S')
		{
			if (m_Height <= 10.0f)
			{
				m_Height += 0.1f;
			}
		}

		if (keyCode == 'Z')
		{
			if (m_Level > 1)
			{
				m_Level -= 1;
			}
		}
		else if (keyCode == 'X')
		{
			if (m_Level < Application::GetDevice()->GetCaps().maxTessellationGenerationLevel)
			{
				m_Level += 1;
			}
		}

		return true;
	}

private:
	struct Vertex
	{
		Vector3 pos;
		Vector3 normal;
		Vector2 uv;
	};

	struct TescConstant
	{
		float level;
		float reserve[3];
	};

	struct GeomConstant
	{
		float height;
		float reserve[3];

		Matrix4x4 worldMatrix;
		Matrix4x4 worldViewProjectionMatrix;
	};

	struct FragConstant
	{
		Vector3 lightDirection;
		float reseve[1];
	};

	enum PIPELINE_TYPE
	{
		PIPELINE_TYPE_SOLID = 0,
		PIPELINE_TYPE_WIRE = 1,
	};

	static auto constexpr PIPELINE_TYPE_COUNT = 2;

	Font m_Font;

	IV3DShaderModule* m_pVertShaderModule;
	IV3DShaderModule* m_pTescShaderModule;
	IV3DShaderModule* m_pTeseShaderModule;
	IV3DShaderModule* m_pGeomShaderModule;
	IV3DShaderModule* m_pFragShaderModule;

	IV3DDescriptorSetLayout* m_pDescriptorSetLayout;
	IV3DPipelineLayout* m_pPipelineLayout;

	IV3DBuffer* m_pMeshBuffer;
	uint64_t m_VertexOffset;
	uint64_t m_IndexOffset;

	IV3DImageView* m_pImageView;
	IV3DSampler* m_pSampler;
	IV3DDescriptorSet* m_pDescriptorSet;

	IV3DRenderPass* m_pRenderPass;
	IV3DImage* m_pDepthStencilImage;
	IV3DImageView* m_pDepthStencilImageView;
	std::vector<IV3DFrameBuffer*> m_FrameBuffers;
	Array1<IV3DPipeline*, TessellationShaderWindow::PIPELINE_TYPE_COUNT> m_pPipelines;

	uint32_t m_IndexCount;
	uint32_t m_PipelineType;
	float m_Height;
	uint32_t m_Level;
};

class TessellationShaderApp : public Application
{
public:
	virtual ~TessellationShaderApp() {}

	virtual void OnPreCreate(ApplicationDesc& desc) override
	{
		desc.fps = 0;
	}

	virtual bool OnInitialize() override
	{
		uint32_t queueFamily = Application::FindQueueFamily(V3D_QUEUE_GRAPHICS, 2);
		if (queueFamily == ~0U)
		{
			return false;
		}

		IV3DQueue* pWorkQueue;
		Application::GetDevice()->GetQueue(queueFamily, WORK_QUEUE_INDEX, &pWorkQueue);

		IV3DQueue* pGraphicsQueue;
		Application::GetDevice()->GetQueue(queueFamily, GRAPHICS_QUEUE_INDEX, &pGraphicsQueue);

		if (m_Window.Initialize(L"tessellationShader", 1024, 768, false, WINDOW_BUFFERING_TYPE_FAKE, pWorkQueue, pGraphicsQueue) == false)
		{
			SAFE_RELEASE(pGraphicsQueue);
			SAFE_RELEASE(pWorkQueue);
			return false;
		}

		SAFE_RELEASE(pGraphicsQueue);
		SAFE_RELEASE(pWorkQueue);

		return true;
	}

private:
	TessellationShaderWindow m_Window;
};

int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow)
{
#ifdef _DEBUG
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif //_DEBUG

	TessellationShaderApp app;
	return app.Execute();
}