text:
import java.util.*;
import static java.lang.Math.*;
import static java.lang.System.*;
import java.util.stream.*;

/*
Problem name: 11526 H(n)
Problem url: https://uva.onlinejudge.org/external/115/11526.pdf
Author: Andrey Yemelyanov
*/
public class _11526 {
  public static void main(String[] args){
    Scanner s = new Scanner(in);
    int nTests = s.nextInt();
    while(nTests-- > 0){
      int n = s.nextInt();
      System.out.println(H(n));
    }
  }

  static long H(int n){
    int k = (int)sqrt(n);
    long result = 0;
    for(int i = 1; i <= k; i++){
      result += n / i;
    }
    return 2 * result - k * k;
  }
}


text:
const path = require('path');

const gulp = require('gulp');
const del = require('del');
const filter = require('gulp-filter');
const zip = require('gulp-zip');

const conf = require('../conf/gulp.conf');

gulp.task('clean', clean);
gulp.task('other', other);
gulp.task('zip', zipApp);

function zipApp(){
  return gulp.src(path.join(conf.paths.dist,'/**'))
        .pipe(zip('dist.zip'))
        .pipe(gulp.dest('./'+conf.paths.dist));
}

function clean() {
  return del([conf.paths.dist, conf.paths.tmp]);
}

function other() {
  const fileFilter = filter(file => file.stat.isFile());

  return gulp.src([
    conf.paths.src+'/**/*',
    `!${conf.paths.src}`+'/**/*.{css,js,html}',
    `!${conf.paths.src}`+'/app/**/assets/**/*'
  ])
    .pipe(fileFilter)
    .pipe(gulp.dest(conf.paths.dist));
}

redpajama_set_name: RedPajamaGithub


text:
package org.jnosql.artemis.reflection;

import org.jnosql.artemis.ArtemisException;

/**
 * Get the exception when a class has a no arg constructor either public or default
 */
public class ConstructorException extends ArtemisException {

    public ConstructorException(Class clazz) {
        super("This class must have a no arg with either public and default visibility: " + clazz.getName());
    }
}


text:
/** \file connection.h -- The basis of connections in Dia */
#ifndef CONNECTION_H
#define CONNECTION_H

#include "diatypes.h"
#include "object.h"
#include "boundingbox.h"

/*!
 * \brief Base class for simple (straight) lines connecting object
 *
 * This is a subclass of DiaObject used to help implementing objects
 * of a line-like type.
 */
struct _Connection {
  DiaObject object; /*!< inheritance */

  Point endpoints[2]; /*!< start and end position */
  Handle endpoint_handles[2]; /*!< start and end handles */
  LineBBExtras extra_spacing; /*!< calcualted bounding box */
};

void connection_update_handles(Connection *conn);
void connection_update_boundingbox(Connection *conn);
void connection_init(Connection *conn,
		     int num_handles, int num_connections);
void connection_destroy(Connection *conn);
void connection_copy(Connection *from, Connection *to);
void connection_save(Connection *conn, ObjectNode obj_node);
void connection_load(Connection *conn, ObjectNode obj_node);
ObjectChange* connection_move_handle(Connection *conn, HandleId id,
				     Point *to, ConnectionPoint* cp,
				     HandleMoveReason reason,
				     ModifierKeys modifiers);

void connection_adjust_for_autogap(Connection *conn);

/* base property stuff... */
#define CONNECTION_COMMON_PROPERTIES \
  OBJECT_COMMON_PROPERTIES, \
  { "conn_endpoints", PROP_TYPE_ENDPOINTS, 0, "Connection endpoints", NULL}

#define CONNECTION_COMMON_PROPERTIES_OFFSETS \
  OBJECT_COMMON_PROPERTIES_OFFSETS, \
  { "conn_endpoints", PROP_TYPE_ENDPOINTS, offsetof(Connection,endpoints)}

#endif /* CONNECTION_H */


text:
#include <iostream>
#include <boost/core/demangle.hpp>
#include <boost/hana/for_each.hpp>
#include <boost/hana/ext/std/integer_sequence.hpp>

#include <boost/multiprecision/float128.hpp>
#include <boost/math/special_functions/daubechies_wavelet.hpp>
#include <quicksvg/graph_fn.hpp>
#include <quicksvg/ulp_plot.hpp>

using boost::multiprecision::float128;
constexpr const int GRAPH_WIDTH = 700;

template<typename Real, int p>
void plot_psi(int grid_refinements = -1)
{
    auto psi = boost::math::daubechies_wavelet<Real, p>();
    if (grid_refinements >= 0)
    {
        psi = boost::math::daubechies_wavelet<Real, p>(grid_refinements);
    }
    auto [a, b] = psi.support();
    std::string title = "Daubechies " + std::to_string(p) + " wavelet";
    title = "";
    std::string filename = "daubechies_" + std::to_string(p) + "_wavelet.svg";
    int samples = 1024;
    quicksvg::graph_fn daub(a, b, title, filename, samples, GRAPH_WIDTH);
    daub.set_gridlines(8, 2*p-1);
    daub.set_stroke_width(1);
    daub.add_fn(psi);
    daub.write_all();
}

template<typename Real, int p>
void plot_dpsi(int grid_refinements = -1)
{
    auto psi = boost::math::daubechies_wavelet<Real, p>();
    if (grid_refinements >= 0)
    {
        psi = boost::math::daubechies_wavelet<Real, p>(grid_refinements);
    }
    auto [a, b] = psi.support();
    std::string title = "Daubechies " + std::to_string(p) + " wavelet derivative";
    title = "";
    std::string filename = "daubechies_" + std::to_string(p) + "_wavelet_prime.svg";
    int samples = 1024;
    quicksvg::graph_fn daub(a, b, title, filename, samples, GRAPH_WIDTH);
    daub.set_stroke_width(1);
    daub.set_gridlines(8, 2*p-1);
    auto dpsi = [psi](Real x)->Real { return psi.prime(x); };
    daub.add_fn(dpsi);
    daub.write_all();
}

template<typename Real, int p>
void plot_convergence()
{
    auto psi1 = boost::math::daubechies_wavelet<Real, p>(1);
    auto [a, b] = psi1.support();
    std::string title = "Daubechies " + std::to_string(p) + " wavelet at  1 (orange), 2 (red), and 21 (blue) grid refinements";
    title = "";
    std::string filename = "daubechies_" + std::to_string(p) + "_wavelet_convergence.svg";

    quicksvg::graph_fn daub(a, b, title, filename, 1024, GRAPH_WIDTH);
    daub.set_stroke_width(1);
    daub.set_gridlines(8, 2*p-1);

    daub.add_fn(psi1, "orange");
    auto psi2 = boost::math::daubechies_wavelet<Real, p>(2);
    daub.add_fn(psi2, "red");

    auto psi21 = boost::math::daubechies_wavelet<Real, p>(21);
    daub.add_fn(psi21);

    daub.write_all();
}

template<typename Real, int p>
void plot_condition_number()
{
    using std::abs;
    using std::log;
    static_assert(p >= 3, "p = 2 is not differentiable, so condition numbers cannot be effectively evaluated.");
    auto phi = boost::math::daubechies_wavelet<Real, p>();
    Real a = phi.support().first + 1000*std::sqrt(std::numeric_limits<Real>::epsilon());
    Real b = phi.support().second - 1000*std::sqrt(std::numeric_limits<Real>::epsilon());
    std::string title = "log10 of condition number of function evaluation for Daubechies " + std::to_string(p) + " wavelet function.";
    title = "";
    std::string filename = "daubechies_" + std::to_string(p) + "_wavelet_condition_number.svg";

    quicksvg::graph_fn daub(a, b, title, filename, 2048, GRAPH_WIDTH);
    daub.set_stroke_width(1);
    daub.set_gridlines(8, 2*p-1);

    auto cond = [&phi](Real x)
    {
        Real y = phi(x);
        Real dydx = phi.prime(x);
        Real z = abs(x*dydx/y);
        using std::isnan;
        if (z==0)
        {
            return Real(-1);
        }
        if (isnan(z))
        {
            // Graphing libraries don't like nan's:
            return Real(1);
        }
        return log10(z);
    };
    daub.add_fn(cond);
    daub.write_all();
}

template<typename CoarseReal, typename PreciseReal, int p, class PsiPrecise>
void do_ulp(int coarse_refinements, PsiPrecise psi_precise)
{
    auto psi_coarse = boost::math::daubechies_wavelet<CoarseReal, p>(coarse_refinements);

    std::string title = std::to_string(p) + " vanishing moment ULP plot at " + std::to_string(coarse_refinements) + " refinements and " + boost::core::demangle(typeid(CoarseReal).name()) + " precision";
    title = "";

    std::string filename = "daubechies_" + std::to_string(p) + "_wavelet_" + boost::core::demangle(typeid(CoarseReal).name()) + "_" + std::to_string(coarse_refinements) + "_refinements.svg";
    int samples = 20000;
    int clip = 20;
    int horizontal_lines = 8;
    int vertical_lines = 2*p - 1;
    quicksvg::ulp_plot<decltype(psi_coarse), CoarseReal, decltype(psi_precise), PreciseReal>(psi_coarse, psi_precise, CoarseReal(psi_coarse.support().first), psi_coarse.support().second, title, filename, samples, GRAPH_WIDTH, clip, horizontal_lines, vertical_lines);
}

int main()
{
    boost::hana::for_each(std::make_index_sequence<18>(), [&](auto i){ plot_psi<double, i+2>(); });
    boost::hana::for_each(std::make_index_sequence<17>(), [&](auto i){ plot_dpsi<double, i+3>(); });
    boost::hana::for_each(std::make_index_sequence<17>(), [&](auto i){ plot_condition_number<double, i+3>(); });
    boost::hana::for_each(std::make_index_sequence<18>(), [&](auto i){ plot_convergence<double, i+2>(); });

    using PreciseReal = float128;
    using CoarseReal = double;
    int precise_refinements = 22;
    constexpr const int p = 9;
    std::cout << "Computing precise wavelet function in " << boost::core::demangle(typeid(PreciseReal).name()) << " precision.\n";
    auto phi_precise = boost::math::daubechies_wavelet<PreciseReal, p>(precise_refinements);
    std::cout << "Beginning comparison with functions computed in " << boost::core::demangle(typeid(CoarseReal).name()) << " precision.\n";
    for (int i = 7; i <= precise_refinements-1; ++i)
    {
        std::cout << "\tCoarse refinement " << i << "\n";
        do_ulp<CoarseReal, PreciseReal, p>(i, phi_precise);
    }
}


text:
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>Microsoft.Extensions.Configuration</name>
    </assembly>
    <members>
        <member name="T:Microsoft.Extensions.Configuration.ConfigurationBuilder">
            <summary>
            Used to build key/value based configuration settings for use in an application.
            </summary>
        </member>
        <member name="P:Microsoft.Extensions.Configuration.ConfigurationBuilder.Sources">
            <summary>
            Returns the sources used to obtain configuation values.
            </summary>
        </member>
        <member name="P:Microsoft.Extensions.Configuration.ConfigurationBuilder.Properties">
            <summary>
            Gets a key/value collection that can be used to share data between the <see cref="T:Microsoft.Extensions.Configuration.IConfigurationBuilder"/>
            and the registered <see cref="T:Microsoft.Extensions.Configuration.IConfigurationProvider"/>s.
            </summary>
        </member>
        <member name="M:Microsoft.Extensions.Configuration.ConfigurationBuilder.Add(Microsoft.Extensions.Configuration.IConfigurationSource)">
            <summary>
            Adds a new configuration source.
            </summary>
            <param name="source">The configuration source to add.</param>
            <returns>The same <see cref="T:Microsoft.Extensions.Configuration.IConfigurationBuilder"/>.</returns>
        </member>
        <member name="M:Microsoft.Extensions.Configuration.ConfigurationBuilder.Build">
            <summary>
            Builds an <see cref="T:Microsoft.Extensions.Configuration.IConfiguration"/> with keys and values from the set of providers registered in
            <see cref="P:Microsoft.Extensions.Configuration.ConfigurationBuilder.Sources"/>.
            </summary>
            <returns>An <see cref="T:Microsoft.Extensions.Configuration.IConfigurationRoot"/> with keys and values from the registered providers.</returns>
        </member>
        <member name="M:Microsoft.Extensions.Configuration.ConfigurationProvider.OnReload">
            <summary>
            Fires the Change Token
            </summary>
        </member>
        <member name="M:Microsoft.Extensions.Configuration.DefaultConfigurationBuilderExtensions.AddInMemoryCollection(Microsoft.Extensions.Configuration.IConfigurationBuilder)">
            <summary>
            Adds the memory configuration provider to <paramref name="configurationBuilder"/>.
            </summary>
            <param name="configurationBuilder">The <see cref="T:Microsoft.Extensions.Configuration.IConfigurationBuilder"/> to add to.</param>
            <returns>The <see cref="T:Microsoft.Extensions.Configuration.IConfigurationBuilder"/>.</returns>
        </member>
        <member name="M:Microsoft.Extensions.Configuration.DefaultConfigurationBuilderExtensions.AddInMemoryCollection(Microsoft.Extensions.Configuration.IConfigurationBuilder,System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{System.String,System.String}})">
            <summary>
            Adds the memory configuration provider to <paramref name="configurationBuilder"/>.
            </summary>
            <param name="configurationBuilder">The <see cref="T:Microsoft.Extensions.Configuration.IConfigurationBuilder"/> to add to.</param>
            <param name="initialData">The data to add to memory configuration provider.</param>
            <returns>The <see cref="T:Microsoft.Extensions.Configuration.IConfigurationBuilder"/>.</returns>
        </member>
        <member name="P:Microsoft.Extensions.Configuration.Resources.Error_NoSources">
            <summary>
            A configuration provider is not registered. Please register one before setting a value.
            </summary>
        </member>
        <member name="M:Microsoft.Extensions.Configuration.Resources.FormatError_NoSources">
            <summary>
            A configuration provider is not registered. Please register one before setting a value.
            </summary>
        </member>
    </members>
</doc>


text:
#ifndef __OPENSPACE_CORE___RENDERENGINE___H__
#define __OPENSPACE_CORE___RENDERENGINE___H__

#include <openspace/properties/propertyowner.h>

#include <openspace/properties/optionproperty.h>
#include <openspace/properties/list/intlistproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/intproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/vector/vec3property.h>
#include <openspace/properties/vector/vec4property.h>
#include <openspace/properties/triggerproperty.h>
#include <openspace/rendering/framebufferrenderer.h>
#include <chrono>
#include <filesystem>

namespace ghoul {
    namespace fontrendering { class Font; }
    namespace opengl {
        class ProgramObject;
        class OpenGLStateCache;
    } // namespace opengl

    class Dictionary;
    class SharedMemory;
} // ghoul

namespace openspace {

namespace scripting { struct LuaLibrary; }

class Camera;
class RaycasterManager;
class DeferredcasterManager;
class Scene;
class SceneManager;
class ScreenLog;
class ScreenSpaceRenderable;
struct ShutdownInformation;

class RenderEngine : public properties::PropertyOwner {
public:
    RenderEngine();
    virtual ~RenderEngine() override;

    void initialize();
    void initializeGL();
    void deinitializeGL();

    void setScene(Scene* scene);
    Scene* scene();
    void updateScene();

    ghoul::opengl::OpenGLStateCache& openglStateCache();

    void updateShaderPrograms();
    void updateRenderer();
    void updateScreenSpaceRenderables();
    void render(const glm::mat4& sceneMatrix, const glm::mat4& viewMatrix,
        const glm::mat4& projectionMatrix);

    bool mouseActivationCallback(const glm::dvec2& mousePosition) const;

    void renderOverlays(const ShutdownInformation& shutdownInfo);
    void renderEndscreen();
    void postDraw();

    float globalBlackOutFactor() const;
    void setGlobalBlackOutFactor(float opacity);

    float hdrExposure() const;
    bool isHdrDisabled() const;

    void addScreenSpaceRenderable(std::unique_ptr<ScreenSpaceRenderable> s);
    void removeScreenSpaceRenderable(ScreenSpaceRenderable* s);
    void removeScreenSpaceRenderable(std::string_view identifier);
    ScreenSpaceRenderable* screenSpaceRenderable(std::string_view identifier);
    std::vector<ScreenSpaceRenderable*> screenSpaceRenderables() const;

    std::unique_ptr<ghoul::opengl::ProgramObject> buildRenderProgram(
        const std::string& name, const std::filesystem::path& vsPath,
        std::filesystem::path fsPath, ghoul::Dictionary data = ghoul::Dictionary());

    std::unique_ptr<ghoul::opengl::ProgramObject> buildRenderProgram(
        const std::string& name, const std::filesystem::path& vsPath,
        std::filesystem::path fsPath, const std::filesystem::path& csPath,
        ghoul::Dictionary data = ghoul::Dictionary());

    void removeRenderProgram(ghoul::opengl::ProgramObject* program);

    /**
     * Set the camera to use for rendering
     */
    void setCamera(Camera* camera);

    /**
     * Lets the renderer update the data to be brought into the rendererer programs
     * as a 'rendererData' variable in the dictionary.
     */
    void setRendererData(ghoul::Dictionary rendererData);

    /**
    * Lets the renderer update the data to be brought into the post rendererer programs
    * as a 'resolveData' variable in the dictionary.
    */
    void setResolveData(ghoul::Dictionary resolveData);

    /**
     * Take a screenshot and store in the ${SCREENSHOTS} directory
     */
    void takeScreenshot();

    /**
     * Get the filename of the latest screenshot
     */
    unsigned int latestScreenshotNumber() const;

    /**
     * Returns the Lua library that contains all Lua functions available to affect the
     * rendering.
     */
    static scripting::LuaLibrary luaLibrary();

    glm::ivec2 renderingResolution() const;
    glm::ivec2 fontResolution() const;

    glm::mat4 globalRotation() const;
    glm::mat4 screenSpaceRotation() const;
    glm::mat4 nodeRotation() const;

    uint64_t frameNumber() const;

private:
    void renderScreenLog();
    void renderVersionInformation();
    void renderCameraInformation();
    void renderShutdownInformation(float timer, float fullTime);
    void renderDashboard();

    Camera* _camera = nullptr;
    Scene* _scene = nullptr;

    FramebufferRenderer _renderer;
    ghoul::Dictionary _rendererData;
    ghoul::Dictionary _resolveData;
    ScreenLog* _log = nullptr;

    ghoul::opengl::OpenGLStateCache* _openglStateCache = nullptr;

    properties::BoolProperty _showOverlayOnClients;
    properties::BoolProperty _showLog;
    properties::FloatProperty _verticalLogOffset;
    properties::BoolProperty _showVersionInfo;
    properties::BoolProperty _showCameraInfo;

    properties::IntListProperty _screenshotWindowIds;
    properties::BoolProperty _applyWarping;
    properties::BoolProperty _showStatistics;
    properties::BoolProperty _screenshotUseDate;
    properties::BoolProperty _showFrameInformation;
    properties::BoolProperty _disableMasterRendering;

    properties::FloatProperty _globalBlackOutFactor;

    properties::BoolProperty _enableFXAA;

    properties::BoolProperty _disableHDRPipeline;
    properties::FloatProperty _hdrExposure;
    properties::FloatProperty _gamma;

    properties::FloatProperty _hue;
    properties::FloatProperty _saturation;
    properties::FloatProperty _value;

    properties::IntProperty _framerateLimit;
    std::chrono::high_resolution_clock::time_point _lastFrameTime;
    properties::FloatProperty _horizFieldOfView;

    properties::Vec3Property _globalRotation;
    properties::Vec3Property _screenSpaceRotation;
    properties::Vec3Property _masterRotation;

    uint64_t _frameNumber = 0;
    unsigned int _latestScreenshotNumber = 0;

    std::vector<ghoul::opengl::ProgramObject*> _programs;

    std::shared_ptr<ghoul::fontrendering::Font> _fontFrameInfo;
    std::shared_ptr<ghoul::fontrendering::Font> _fontCameraInfo;
    std::shared_ptr<ghoul::fontrendering::Font> _fontVersionInfo;
    std::shared_ptr<ghoul::fontrendering::Font> _fontShutdown;
    std::shared_ptr<ghoul::fontrendering::Font> _fontLog;

    struct {
        glm::ivec4 rotation = glm::ivec4(0);
        glm::ivec4 zoom = glm::ivec4(0);
        glm::ivec4 roll = glm::ivec4(0);
    } _cameraButtonLocations;

    std::string _versionString;

    properties::Vec4Property _enabledFontColor;
    properties::Vec4Property _disabledFontColor;
};

} // namespace openspace

#endif // __OPENSPACE_CORE___RENDERENGINE___H__


text:
#import "WMFLocationManager.h"

NS_ASSUME_NONNULL_BEGIN

/**
 *  Location manger which doesn't subscribe to location updates from CLLocationManager.
 *
 *  Never asks CLLocationManager for updates, allowing tests to manually trigger events & set location
 *  and heading values.
 */
@interface WMFMockLocationManager : WMFLocationManager

- (void)setLocation:(CLLocation *)location;

- (void)setHeading:(CLHeading *)heading;

@end

NS_ASSUME_NONNULL_END


text:
namespace firebase {
namespace admob {

namespace internal {
// Forward declaration for platform-specific data, implemented in each library.
class InterstitialAdInternal;
}  // namespace internal

/// @brief Loads and displays AdMob interstitial ads.
///
/// @ref InterstitialAd is a single-use object that can load and show a
/// single AdMob interstitial ad.
///
/// InterstitialAd objects maintain a presentation state that indicates whether
/// or not they're currently onscreen, but otherwise provide information about
/// their current state through Futures. @ref Initialize, @ref LoadAd, and
/// @ref Show each have a corresponding @ref Future from which you can determine
/// result of the previous call.
///
/// In addition, applications can create their own subclasses of
/// @ref InterstitialAd::Listener, pass an instance to the @ref SetListener
/// method, and receive callbacks whenever the presentation state changes.
///
/// Here's how one might initialize, load, and show an interstitial ad while
/// checking against the result of the previous action at each step:
///
/// @code
/// namespace admob = ::firebase::admob;
/// admob::InterstitialAd* interstitial = new admob::InterstitialAd();
/// interstitial->Initialize(ad_parent, "YOUR_AD_UNIT_ID")
/// @endcode
///
/// Then, later:
///
/// @code
/// if (interstitial->InitializeLastResult().status() ==
///     ::firebase::kFutureStatusComplete &&
///     interstitial->InitializeLastResult().error() ==
///     firebase::admob::kAdMobErrorNone) {
///   interstitial->LoadAd(my_ad_request);
/// }
/// @endcode
///
/// And after that:
///
/// @code
/// if (interstitial->LoadAdLastResult().status() ==
///     ::firebase::kFutureStatusComplete &&
///     interstitial->LoadAdLastResult().error() ==
///     firebase::admob::kAdMobErrorNone)) {
///   interstitial->Show();
/// }
/// @endcode
class InterstitialAd {
 public:
  /// The presentation states of an @ref InterstitialAd.
  enum PresentationState {
    /// InterstitialAd is not currently being shown.
    kPresentationStateHidden = 0,
    /// InterstitialAd is being shown or has caused focus to leave the
    /// application (for example, when opening an external browser during a
    /// clickthrough).
    kPresentationStateCoveringUI,
  };

  /// A listener class that developers can extend and pass to an
  /// @ref InterstitialAd object's @ref SetListener method to be notified of
  /// presentation state changes. This is useful for changes caused by user
  /// interaction, such as when the user closes an interstitial.
  class Listener {
   public:
    /// This method is called when the @ref InterstitialAd object's presentation
    /// state changes.
    /// @param[in] interstitial_ad The interstitial ad whose presentation state
    ///                            changed.
    /// @param[in] state The new presentation state.
    virtual void OnPresentationStateChanged(InterstitialAd* interstitial_ad,
                                            PresentationState state) = 0;
    virtual ~Listener();
  };

  /// Creates an uninitialized @ref InterstitialAd object.
  /// @ref Initialize must be called before the object is used.
  InterstitialAd();

  ~InterstitialAd();

  /// Initialize the @ref InterstitialAd object.
  /// @param[in] parent The platform-specific UI element that will host the ad.
  /// @param[in] ad_unit_id The ad unit ID to use in loading the ad.
  Future<void> Initialize(AdParent parent, const char* ad_unit_id);

  /// Returns a @ref Future containing the status of the last call to
  /// @ref Initialize.
  Future<void> InitializeLastResult() const;

  /// Begins an asynchronous request for an ad. The
  /// @ref InterstitialAd::presentation_state method can be used to track the
  /// progress of the request.
  /// @param[in] request An AdRequest struct with information about the request
  ///                    to be made (such as targeting info).
  Future<void> LoadAd(const AdRequest& request);

  /// Returns a @ref Future containing the status of the last call to
  /// @ref LoadAd.
  Future<void> LoadAdLastResult() const;

  /// Shows the @ref InterstitialAd. This should not be called unless an ad has
  /// already been loaded.
  Future<void> Show();

  /// Returns a @ref Future containing the status of the last call to @ref Show.
  Future<void> ShowLastResult() const;

  /// Returns the current presentation state of the @ref InterstitialAd.
  ///
  /// @return The current presentation state.
  PresentationState presentation_state() const;

  /// Returns the current presentation state of the @ref InterstitialAd.
  ///
  /// @return The current presentation state.
  ///
  /// @deprecated Renamed to presentation_state().
  FIREBASE_DEPRECATED PresentationState GetPresentationState() const {
    return presentation_state();
  }

  /// Sets the @ref Listener for this @ref InterstitialAd.
  /// @param[in] listener A valid InterstititalAd::Listener to receive
  ///                     callbacks.
  void SetListener(Listener* listener);

 private:
  // An internal, platform-specific implementation object that this class uses
  // to interact with the Google Mobile Ads SDKs for iOS and Android.
  internal::InterstitialAdInternal* internal_;
};

}  // namespace admob
}  // namespace firebase

#endif  // FIREBASE_ADMOB_CLIENT_CPP_INCLUDE_FIREBASE_ADMOB_INTERSTITIAL_AD_H_


text:
package org.drools.core.rule;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Collection;
import java.util.PriorityQueue;

import org.drools.core.common.EventFactHandle;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.common.InternalWorkingMemory;
import org.drools.core.common.WorkingMemoryAction;
import org.drools.core.marshalling.impl.MarshallerReaderContext;
import org.drools.core.marshalling.impl.MarshallerWriteContext;
import org.drools.core.marshalling.impl.PersisterEnums;
import org.drools.core.marshalling.impl.ProtobufMessages;
import org.drools.core.marshalling.impl.ProtobufMessages.ActionQueue.Action;
import org.drools.core.marshalling.impl.ProtobufMessages.Timers.Timer;
import org.drools.core.marshalling.impl.TimersInputMarshaller;
import org.drools.core.marshalling.impl.TimersOutputMarshaller;
import org.drools.core.phreak.PropagationEntry;
import org.drools.core.reteoo.ObjectTypeNode;
import org.drools.core.reteoo.WindowNode;
import org.drools.core.reteoo.WindowNode.WindowMemory;
import org.drools.core.spi.PropagationContext;
import org.drools.core.time.Job;
import org.drools.core.time.JobContext;
import org.drools.core.time.JobHandle;
import org.drools.core.time.TimerService;
import org.drools.core.time.impl.PointInTimeTrigger;

import static org.drools.core.common.PhreakPropagationContextFactory.createPropagationContextForFact;

public class SlidingTimeWindow
        implements
        Externalizable,
        Behavior {

    protected long size;
    // stateless job
    private static final BehaviorJob job = new BehaviorJob();

    protected int nodeId;

    public SlidingTimeWindow() {
        this( 0 );
    }

    public SlidingTimeWindow(final long size) {
        super();
        this.size = size;
    }

    /**
     * @inheritDoc
     *
     * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
     */
    public void readExternal(final ObjectInput in) throws IOException,
                                                          ClassNotFoundException {
        this.size = in.readLong();
        this.nodeId = in.readInt();
    }

    /**
     * @inheritDoc
     *
     * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
     */
    public void writeExternal(final ObjectOutput out) throws IOException {
        out.writeLong( this.size );
        out.writeInt( this.nodeId );
    }

    public BehaviorType getType() {
        return BehaviorType.TIME_WINDOW;
    }

    public void setWindowNode(WindowNode windowNode) {
        this.nodeId = windowNode.getId();
    }

    /**
     * @return the size
     */
    public long getSize() {
        return size;
    }

    /**
     * @param size the size to set
     */
    public void setSize(final long size) {
        this.size = size;
    }

    public Behavior.Context createContext() {
        return new SlidingTimeWindowContext();
    }

    public boolean assertFact(final Object context,
                              final InternalFactHandle fact,
                              final PropagationContext pctx,
                              final InternalWorkingMemory workingMemory) {
        final SlidingTimeWindowContext queue = (SlidingTimeWindowContext) context;
        final EventFactHandle handle = (EventFactHandle) fact;
        long currentTime = workingMemory.getTimerService().getCurrentTime();
        if ( isExpired( currentTime, handle ) ) {
            return false;
        }

        queue.add( handle );
        if ( queue.peek() == handle ) {
            // update next expiration time
            updateNextExpiration( handle,
                                  workingMemory,
                                  queue,
                                  nodeId );
        }

        return true;
    }

    public void retractFact(final Object context,
                            final InternalFactHandle fact,
                            final PropagationContext pctx,
                            final InternalWorkingMemory workingMemory) {
        final SlidingTimeWindowContext queue = (SlidingTimeWindowContext) context;
        final EventFactHandle handle = (EventFactHandle) fact;
        // it may be a call back to expire the tuple that is already being expired
        if ( queue.getExpiringHandle() != handle ) {
            if ( queue.peek() == handle ) {
                // it was the head of the queue
                queue.poll();
                // update next expiration time
                updateNextExpiration( queue.peek(),
                                      workingMemory,
                                      queue,
                                      nodeId);
            } else {
                queue.remove( handle );
                if ( queue.isEmpty() && queue.getJobHandle() != null ) {
                    workingMemory.getTimerService().removeJob( queue.getJobHandle() );
                }
            }
        }
    }

    public void expireFacts(final Object context,
                            final PropagationContext pctx,
                            final InternalWorkingMemory workingMemory) {
        TimerService clock = workingMemory.getTimerService();
        long currentTime = clock.getCurrentTime();
        SlidingTimeWindowContext queue = (SlidingTimeWindowContext) context;

        EventFactHandle handle = queue.peek();
        while ( handle != null && isExpired( currentTime,
                                             handle ) ) {
            queue.setExpiringHandle( handle );
            queue.remove();
            if( handle.isValid()) {
                // if not expired yet, expire it
                final PropagationContext expiresPctx = createPropagationContextForFact( workingMemory, handle, PropagationContext.Type.EXPIRATION );
                ObjectTypeNode.doRetractObject(handle, expiresPctx, workingMemory);
            }
            queue.setExpiringHandle( null );
            handle = queue.peek();
        }
        // update next expiration time
        updateNextExpiration( handle,
                              workingMemory,
                              queue,
                              nodeId );
    }

    protected boolean isExpired(final long currentTime,
                                final EventFactHandle handle) {
        return handle.getStartTimestamp() + this.size <= currentTime;
    }

    protected void updateNextExpiration(final InternalFactHandle fact,
                                        final InternalWorkingMemory workingMemory,
                                        final Behavior.Context context,
                                        final int nodeId) {
        TimerService clock = workingMemory.getTimerService();
        if ( fact != null ) {
            long nextTimestamp = ((EventFactHandle) fact).getStartTimestamp() + getSize();
            if ( nextTimestamp < clock.getCurrentTime() ) {
                // Past and out-of-order events should not be insert,
                // but the engine silently accepts them anyway, resulting in possibly undesirable behaviors
                workingMemory.queueWorkingMemoryAction(new BehaviorExpireWMAction(nodeId, this, context));
            } else {
                JobContext jobctx = new BehaviorJobContext( nodeId, workingMemory, this, context);
                JobHandle handle = clock.scheduleJob( job,
                                                      jobctx,
                                                      PointInTimeTrigger.createPointInTimeTrigger( nextTimestamp, null ) );
                jobctx.setJobHandle( handle );
            }
        }
    }

    public long getExpirationOffset() {
        return this.size;
    }

    public String toString() {
        return "SlidingTimeWindow( size=" + size + " )";
    }

    public static class SlidingTimeWindowContext
            implements
            Behavior.Context,
            Externalizable {

        private PriorityQueue<EventFactHandle> queue;
        private EventFactHandle                expiringHandle;
        private JobHandle                      jobHandle;

        public SlidingTimeWindowContext() {
            this.queue = new PriorityQueue<EventFactHandle>( 16 ); // arbitrary size... can we improve it?
        }

        public JobHandle getJobHandle() {
            return this.jobHandle;
        }

        public void setJobHandle(JobHandle jobHandle) {
            this.jobHandle = jobHandle;
        }

        @SuppressWarnings("unchecked")
        public void readExternal(ObjectInput in) throws IOException,
                                                        ClassNotFoundException {
            this.queue = (PriorityQueue<EventFactHandle>) in.readObject();
            this.expiringHandle = (EventFactHandle) in.readObject();
        }

        public void writeExternal(ObjectOutput out) throws IOException {
            out.writeObject( this.queue );
            out.writeObject( this.expiringHandle );
        }

        public EventFactHandle getExpiringHandle() {
            return expiringHandle;
        }

        public void setExpiringHandle( EventFactHandle expiringHandle ) {
            this.expiringHandle = expiringHandle;
        }

        public void setExpiringTuple(EventFactHandle expiringHandle) {
            this.expiringHandle = expiringHandle;
        }

        public void add(EventFactHandle handle) {
            queue.add( handle );
        }

        public void remove(EventFactHandle handle) {
            queue.remove( handle );
        }

        public boolean isEmpty() {
            return queue.isEmpty();
        }

        public EventFactHandle peek() {
            return queue.peek( );
        }

        public EventFactHandle poll() {
            return queue.poll( );
        }

        public EventFactHandle remove() {
            return queue.remove( );
        }

        public Collection<EventFactHandle> getFactHandles() {
            return queue;
        }
    }

    public static class BehaviorJobContextTimerOutputMarshaller implements TimersOutputMarshaller {
        public void write(JobContext jobCtx,
                          MarshallerWriteContext outputCtx) throws IOException {
            outputCtx.writeShort( PersisterEnums.BEHAVIOR_TIMER );
            // BehaviorJob, no state
            BehaviorJobContext bjobCtx = ( BehaviorJobContext ) jobCtx;

            // write out SlidingTimeWindowContext
            SlidingTimeWindowContext slCtx = ( SlidingTimeWindowContext ) bjobCtx.behaviorContext;

            EventFactHandle handle = slCtx.peek();
            outputCtx.writeInt( handle.getId() );
        }

        public Timer serialize(JobContext jobCtx,
                               MarshallerWriteContext outputCtx) {
            // BehaviorJob, no state
            BehaviorJobContext bjobCtx = ( BehaviorJobContext ) jobCtx;
            // write out SlidingTimeWindowContext
            SlidingTimeWindowContext slCtx = ( SlidingTimeWindowContext ) bjobCtx.behaviorContext;

            EventFactHandle handle = slCtx.peek();

            return ProtobufMessages.Timers.Timer.newBuilder()
                                                .setType( ProtobufMessages.Timers.TimerType.BEHAVIOR )
                                                .setBehavior( ProtobufMessages.Timers.BehaviorTimer.newBuilder()
                                                                                .setHandleId( handle.getId() )
                                                                                .build() )
                                                .build();
        }
    }

    public static class BehaviorJobContextTimerInputMarshaller implements TimersInputMarshaller {
        public void read(MarshallerReaderContext inCtx) throws IOException, ClassNotFoundException {
            int sinkId = inCtx.readInt();
            WindowNode windowNode = (WindowNode) inCtx.sinks.get( sinkId );

            WindowMemory memory = inCtx.wm.getNodeMemory( windowNode );

            Object[] behaviorContext = ( Object[]  ) memory.behaviorContext;

            int i = inCtx.readInt();
        }

        public void deserialize(MarshallerReaderContext inCtx,
                                Timer _timer) throws ClassNotFoundException {
            int i = _timer.getBehavior().getHandleId();
        }
    }

    public static class BehaviorJobContext
            implements
            JobContext,
            Externalizable {
        public InternalWorkingMemory workingMemory;
        public int                   nodeId;
        public Behavior              behavior;
        public Behavior.Context      behaviorContext;

        public BehaviorJobContext(int                   nodeId,
                                  InternalWorkingMemory workingMemory,
                                  Behavior behavior,
                                  Behavior.Context behaviorContext) {
            super();
            this.nodeId = nodeId;
            this.workingMemory = workingMemory;
            this.behavior = behavior;
            this.behaviorContext = behaviorContext;
        }

        public JobHandle getJobHandle() {
            return behaviorContext.getJobHandle();
        }

        public void setJobHandle(JobHandle jobHandle) {
            behaviorContext.setJobHandle( jobHandle );
        }

        public void readExternal(ObjectInput in) throws IOException,
                                                        ClassNotFoundException {
            //this.behavior = (O)
        }

        public void writeExternal(ObjectOutput out) throws IOException {
            // TODO Auto-generated method stub
        }

        @Override
        public InternalWorkingMemory getWorkingMemory() {
            return workingMemory;
        }
    }

    public static class BehaviorJob
            implements
            Job {

        public void execute(JobContext ctx) {
            BehaviorJobContext context = (BehaviorJobContext) ctx;
            context.workingMemory.queueWorkingMemoryAction( new BehaviorExpireWMAction( context.nodeId,
                                                                                context.behavior,
                                                                                context.behaviorContext ) );
        }

    }

    public static class BehaviorExpireWMAction
            extends PropagationEntry.AbstractPropagationEntry
            implements WorkingMemoryAction {
        private final Behavior behavior;
        private final Behavior.Context context;
        private final int nodeId;

        public BehaviorExpireWMAction(final int nodeId,
                                      Behavior behavior,
                                      Behavior.Context context) {
            super();
            this.nodeId = nodeId;
            this.behavior = behavior;
            this.context = context;
        }

        public BehaviorExpireWMAction(MarshallerReaderContext inCtx) throws IOException {
            nodeId = inCtx.readInt();
            WindowNode windowNode = (WindowNode) inCtx.sinks.get( nodeId );

            WindowMemory memory = inCtx.wm.getNodeMemory( windowNode );

            Behavior.Context[] behaviorContext = memory.behaviorContext;

            int i = inCtx.readInt();

            this.behavior = windowNode.getBehaviors()[i];
            this.context = behaviorContext[i];
        }

        public BehaviorExpireWMAction(MarshallerReaderContext context,
                                      Action _action) {
            nodeId =_action.getBehaviorExpire().getNodeId();
            WindowNode windowNode = (WindowNode) context.sinks.get( nodeId );

            WindowMemory memory = context.wm.getNodeMemory( windowNode );

            Behavior.Context[] behaviorContext = memory.behaviorContext;

            int i = 0; //  <==== this needs fixing

            this.behavior = windowNode.getBehaviors()[i];
            this.context = behaviorContext[i];
        }

        public void execute(InternalWorkingMemory workingMemory) {
            this.behavior.expireFacts( context,
                                       null,
                                       workingMemory );
        }

        public ProtobufMessages.ActionQueue.Action serialize(MarshallerWriteContext outputCtx) {
            ProtobufMessages.ActionQueue.BehaviorExpire _be = ProtobufMessages.ActionQueue.BehaviorExpire.newBuilder()
                                                                                .setNodeId( nodeId )
                                                                                .build();

            return ProtobufMessages.ActionQueue.Action.newBuilder()
                                                      .setType( ProtobufMessages.ActionQueue.ActionType.BEHAVIOR_EXPIRE )
                                                      .setBehaviorExpire( _be )
                                                      .build();

        }
    }
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Annls Sci. Nat. , Bot. , sér. 4 12: 293 (1859)

#### Original name
Parmelia paleacea Fr.

### Remarks
null


text:
package org.wso2.carbon.identity.oauth.scope.endpoint.impl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.cxf.jaxrs.impl.UriInfoImpl;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.PhaseInterceptorChain;
import org.wso2.carbon.base.MultitenantConstants;
import org.wso2.carbon.identity.core.util.IdentityUtil;
import org.wso2.carbon.identity.oauth.scope.endpoint.ScopesApiService;
import org.wso2.carbon.identity.oauth.scope.endpoint.dto.ScopeDTO;
import org.wso2.carbon.identity.oauth.scope.endpoint.dto.ScopeToUpdateDTO;
import org.wso2.carbon.identity.oauth.scope.endpoint.util.ScopeUtils;
import org.wso2.carbon.identity.oauth2.IdentityOAuth2ScopeClientException;
import org.wso2.carbon.identity.oauth2.IdentityOAuth2ScopeException;
import org.wso2.carbon.identity.oauth2.Oauth2ScopeConstants;
import org.wso2.carbon.identity.oauth2.bean.Scope;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.Set;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;

import static org.wso2.carbon.identity.oauth.common.OAuthConstants.TENANT_NAME_FROM_CONTEXT;
import static org.wso2.carbon.identity.oauth.scope.endpoint.Constants.SERVER_API_PATH_COMPONENT;
import static org.wso2.carbon.identity.oauth.scope.endpoint.Constants.TENANT_CONTEXT_PATH_COMPONENT;

/**
 * ScopesApiServiceImpl is used to handling scope bindings
 */
public class ScopesApiServiceImpl extends ScopesApiService {

    private static final Log LOG = LogFactory.getLog(ScopesApiServiceImpl.class);

    /**
     * Register a scope with the bindings
     *
     * @param scope details of the scope to be registered
     * @return Response with the status of the registration
     */
    @Override
    public Response registerScope(ScopeDTO scope) {

        Scope registeredScope = null;
        try {
            registeredScope = ScopeUtils.getOAuth2ScopeService().registerScope(ScopeUtils.getScope(scope));
        } catch (IdentityOAuth2ScopeClientException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Client Error while registering scope \n" + scope.toString(), e);
            }
            if (Oauth2ScopeConstants.ErrorMessages.ERROR_CODE_CONFLICT_REQUEST_EXISTING_SCOPE.getCode()
                    .equals(e.getErrorCode())) {
                ScopeUtils.handleErrorResponse(Response.Status.CONFLICT,
                        Response.Status.CONFLICT.getReasonPhrase(), e, false, LOG);
            } else {
                ScopeUtils.handleErrorResponse(Response.Status.BAD_REQUEST,
                        Response.Status.BAD_REQUEST.getReasonPhrase(), e, false, LOG);
            }
        } catch (IdentityOAuth2ScopeException e) {
            ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
                    Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), e, true, LOG);
        } catch (Throwable throwable) {
            ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
                    Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), throwable, true, LOG);
        }
        return Response.status(Response.Status.CREATED).location(buildURIForHeader(scope.getName())).
                entity(registeredScope).build();
    }

    /**
     * Retrieve the scope of the given scope name
     *
     * @param name Name of the scope which need to get retrieved
     * @return Response with the retrieved scope/ retrieval status
     */
    @Override
    public Response getScope(String name) {

        Scope scope = null;

        try {
            scope = ScopeUtils.getOAuth2ScopeService().getScope(name);
        } catch (IdentityOAuth2ScopeClientException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Client Error while getting scope " + name, e);
            }
            if (Oauth2ScopeConstants.ErrorMessages.ERROR_CODE_NOT_FOUND_SCOPE.getCode().equals(e.getErrorCode())) {
                ScopeUtils.handleErrorResponse(Response.Status.NOT_FOUND,
                        Response.Status.NOT_FOUND.getReasonPhrase(), e, false, LOG);
            } else {
                ScopeUtils.handleErrorResponse(Response.Status.BAD_REQUEST,
                        Response.Status.BAD_REQUEST.getReasonPhrase(), e, false, LOG);
            }

        } catch (IdentityOAuth2ScopeException e) {
            ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
                    Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), e, true, LOG);
        } catch (Throwable throwable) {
            ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
                    Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), throwable, true, LOG);
        }
        return Response.status(Response.Status.OK).entity(ScopeUtils.getScopeDTO(scope)).build();
    }

    /**
     * Retrieve the available scope list.
     *
     * @param startIndex        Start Index of the result set to enforce pagination.
     * @param count             Number of elements in the result set to enforce pagination
     * @param includeOIDCScopes Include OIDC scopes as well.
     * @param requestedScopes   Requested set of scopes to be return in the response.
     * @return Response with the retrieved scopes retrieval status.
     */
    @Override
    public Response getScopes(Integer startIndex, Integer count, Boolean includeOIDCScopes, String requestedScopes) {

        Set<Scope> scopes = null;

        try {
            scopes =
                    ScopeUtils.getOAuth2ScopeService().getScopes(startIndex, count, includeOIDCScopes, requestedScopes);
        } catch (IdentityOAuth2ScopeException e) {
            ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
                    Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), e, true, LOG);
        } catch (Throwable throwable) {
            ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
                    Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), throwable, true, LOG);
        }
        return Response.status(Response.Status.OK).entity(ScopeUtils.getScopeDTOs(scopes)).build();
    }

    /**
     * Retrieve the available scope list.
     *
     * @param startIndex Start Index of the result set to enforce pagination.
     * @param count      Number of elements in the result set to enforce pagination.
     * @return Response with the retrieved scopes/ retrieval status
     * @deprecated use {@link #getScopes(Integer, Integer, Boolean, String)} instead.
     */
    public Response getScopes(Integer startIndex, Integer count) {

        return getScopes(startIndex, count, false, null);
    }

    /**
     * Check the existence of a scope
     *
     * @param name Name of the scope
     * @return Response with the indication whether the scope exists or not
     */
    @Override
    public Response isScopeExists(String name) {

        boolean isScopeExists = false;

        try {
            isScopeExists = ScopeUtils.getOAuth2ScopeService().isScopeExists(name);
        } catch (IdentityOAuth2ScopeClientException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Client Error while getting scope existence of scope name " + name, e);
            }
            ScopeUtils.handleErrorResponse(Response.Status.BAD_REQUEST,
                    Response.Status.BAD_REQUEST.getReasonPhrase(), e, false, LOG);

        } catch (IdentityOAuth2ScopeException e) {
            ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
                    Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), e, true, LOG);
        } catch (Throwable throwable) {
            ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
                    Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), throwable, true, LOG);
        }

        if (isScopeExists) {
            return Response.status(Response.Status.OK).build();
        }
        return Response.status(Response.Status.NOT_FOUND).build();
    }

    /**
     * Update a scope
     *
     * @param scope details of the scope to be updated
     * @param name  name of the scope to be updated
     * @return
     */
    @Override
    public Response updateScope(ScopeToUpdateDTO scope, String name) {

        ScopeDTO updatedScope = null;
        try {
            updatedScope = ScopeUtils.getScopeDTO(ScopeUtils.getOAuth2ScopeService()
                    .updateScope(ScopeUtils.getUpdatedScope(scope, name)));
        } catch (IdentityOAuth2ScopeClientException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Client Error while updating scope \n" + scope.toString(), e);
            }
            if (Oauth2ScopeConstants.ErrorMessages.ERROR_CODE_NOT_FOUND_SCOPE.getCode()
                    .equals(e.getErrorCode())) {
                ScopeUtils.handleErrorResponse(Response.Status.NOT_FOUND,
                        Response.Status.NOT_FOUND.getReasonPhrase(), e, false, LOG);
            } else {
                ScopeUtils.handleErrorResponse(Response.Status.BAD_REQUEST,
                        Response.Status.BAD_REQUEST.getReasonPhrase(), e, false, LOG);
            }
        } catch (IdentityOAuth2ScopeException e) {
            ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
                    Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), e, true, LOG);
        } catch (Throwable throwable) {
            ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
                    Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), throwable, true, LOG);
        }
        return Response.status(Response.Status.OK).entity(updatedScope).build();
    }

    /**
     * Delete the scope for the given scope name
     *
     * @param name Name of the scope which need to get deleted
     * @return Response with the status of scope deletion
     */
    @Override
    public Response deleteScope(String name) {

        try {
            ScopeUtils.getOAuth2ScopeService().deleteScope(name);
        } catch (IdentityOAuth2ScopeClientException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Client Error while deleting scope " + name, e);
            }
            if (Oauth2ScopeConstants.ErrorMessages.ERROR_CODE_NOT_FOUND_SCOPE.getCode()
                    .equals(e.getErrorCode())) {
                ScopeUtils.handleErrorResponse(Response.Status.NOT_FOUND,
                        Response.Status.NOT_FOUND.getReasonPhrase(), e, false, LOG);
            } else {
                ScopeUtils.handleErrorResponse(Response.Status.BAD_REQUEST,
                        Response.Status.BAD_REQUEST.getReasonPhrase(), e, false, LOG);
            }
        } catch (IdentityOAuth2ScopeException e) {
            ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
                    Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), e, true, LOG);
        } catch (Throwable throwable) {
            ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
                    Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), throwable, true, LOG);
        }
        return Response.status(Response.Status.OK).build();
    }

    /**
     * Build the complete URI to the location of the resource.
     * Ex: https://localhost:9443/t/<tenant-domain>/identity/oauth2/v1.0/scopes/name/<scope_name>
     *
     * @param scopeName Name of the scope.
     * @return Fully qualified and complete URI.
     */
    private static URI buildURIForHeader(String scopeName) {

        String tenantQualifiedRelativePath =
                String.format(TENANT_CONTEXT_PATH_COMPONENT, getTenantDomainFromContext()) + SERVER_API_PATH_COMPONENT;
        String url = IdentityUtil.getEndpointURIPath(tenantQualifiedRelativePath + scopeName, false, true);

        URI location = URI.create(url);
        if (!location.isAbsolute()) {
            Message currentMessage = PhaseInterceptorChain.getCurrentMessage();
            if (currentMessage != null) {
                UriInfo ui = new UriInfoImpl(currentMessage.getExchange().getInMessage(), null);
                try {
                    return new URI(ui.getBaseUri().getScheme(), ui.getBaseUri().getAuthority(), url, null, null);
                } catch (URISyntaxException e) {
                    LOG.error("Server encountered an error while building the location URL with scheme: " +
                            ui.getBaseUri().getScheme() + ", authority: " + ui.getBaseUri().getAuthority() +
                            ", url: " + url, e);
                }
            }
        }
        return location;
    }

    /**
     * Retrieves loaded tenant domain from carbon context.
     *
     * @return tenant domain of the request being served.
     */
    private static String getTenantDomainFromContext() {

        String tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME;
        if (IdentityUtil.threadLocalProperties.get().get(TENANT_NAME_FROM_CONTEXT) != null) {
            tenantDomain = (String) IdentityUtil.threadLocalProperties.get().get(TENANT_NAME_FROM_CONTEXT);
        }
        return tenantDomain;
    }
}


text:
package com.training.data.artisans.taxi;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class TaxiRideCleansingParameterParserTest {

	private TaxiRideCleansingParameterParser parser;

	@Before
	public void setUp(){
		parser = new TaxiRideCleansingParameterParser();
	}

	@Test
	public void testWhenHasHelpParameterOthersParamsAreIgnored() throws Exception {
		String[] args = {"--help", "--input", "/this/path/should/not/be/read"};

		boolean wasHelpPrinted = parser.parseParams(args);

		Assert.assertTrue(wasHelpPrinted);
		Assert.assertNull(parser.getDataFilePath());
	}

	@Test(expected = Exception.class)
	public void testInputArgumentRequired() throws Exception {
		String[] args = {"--path", "/this/path/should/not/be/read"};

		parser.parseParams(args);
		Assert.fail("--input argument is required. An exception was expected");
	}

	@Test
	public void testPassingAllParametersHappyPath() throws Exception {
		final String expectedInput = "/this/path/should/not/be/read";

		String[] args = {"--input", expectedInput};

		boolean wasHelpPrinted = parser.parseParams(args);
		Assert.assertFalse(wasHelpPrinted);

		Assert.assertEquals(expectedInput, parser.getDataFilePath());
	}
}


text:
static GLushort *hemiindices = NULL;
static vec *hemiverts = NULL;
static int heminumverts = 0, heminumindices = 0;
static GLuint hemivbuf = 0, hemiebuf = 0;

static void subdivide(int depth, int face);

static void genface(int depth, int i1, int i2, int i3)
{
    int face = heminumindices; heminumindices += 3;
    hemiindices[face]   = i1;
    hemiindices[face+1] = i2;
    hemiindices[face+2] = i3;
    subdivide(depth, face);
}

static void subdivide(int depth, int face)
{
    if(depth-- <= 0) return;
    int idx[6];
    loopi(3) idx[i] = hemiindices[face+i];
    loopi(3)
    {
        int vert = heminumverts++;
        hemiverts[vert] = vec(hemiverts[idx[i]]).add(hemiverts[idx[(i+1)%3]]).normalize(); //push on to unit sphere
        idx[3+i] = vert;
        hemiindices[face+i] = vert;
    }
    subdivide(depth, face);
    loopi(3) genface(depth, idx[i], idx[3+i], idx[3+(i+2)%3]);
}

//subdiv version wobble much more nicely than a lat/longitude version
static void inithemisphere(int hres, int depth)
{
    const int tris = hres << (2*depth);
    heminumverts = heminumindices = 0;
    DELETEA(hemiverts);
    DELETEA(hemiindices);
    hemiverts = new vec[tris+1];
    hemiindices = new GLushort[tris*3];
    hemiverts[heminumverts++] = vec(0.0f, 0.0f, 1.0f); //build initial 'hres' sided pyramid
    loopi(hres) hemiverts[heminumverts++] = vec(sincos360[(360*i)/hres], 0.0f);
    loopi(hres) genface(depth, 0, i+1, 1+(i+1)%hres);

    if(hasVBO)
    {
        if(renderpath!=R_FIXEDFUNCTION)
        {
            if(!hemivbuf) glGenBuffers_(1, &hemivbuf);
            glBindBuffer_(GL_ARRAY_BUFFER_ARB, hemivbuf);
            glBufferData_(GL_ARRAY_BUFFER_ARB, heminumverts*sizeof(vec), hemiverts, GL_STATIC_DRAW_ARB);
            DELETEA(hemiverts);
        }

        if(!hemiebuf) glGenBuffers_(1, &hemiebuf);
        glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, hemiebuf);
        glBufferData_(GL_ELEMENT_ARRAY_BUFFER_ARB, heminumindices*sizeof(GLushort), hemiindices, GL_STATIC_DRAW_ARB);
        DELETEA(hemiindices);
    }
}

static GLuint expmodtex[2] = {0, 0};
static GLuint lastexpmodtex = 0;

static GLuint createexpmodtex(int size, float minval)
{
    uchar *data = new uchar[size*size], *dst = data;
    loop(y, size) loop(x, size)
    {
        float dx = 2*float(x)/(size-1) - 1, dy = 2*float(y)/(size-1) - 1;
        float z = max(0.0f, 1.0f - dx*dx - dy*dy);
        if(minval) z = sqrtf(z);
        else loopk(2) z *= z;
        *dst++ = uchar(max(z, minval)*255);
    }
    GLuint tex = 0;
    glGenTextures(1, &tex);
    createtexture(tex, size, size, data, 3, 2, GL_ALPHA);
    delete[] data;
    return tex;
}

static struct expvert
{
    vec pos;
    float u, v, s, t;
} *expverts = NULL;
static GLuint expvbuf = 0;

static void animateexplosion()
{
    static int lastexpmillis = 0;
    if(expverts && lastexpmillis == lastmillis)
    {
        if(hasVBO) glBindBuffer_(GL_ARRAY_BUFFER_ARB, expvbuf);
        return;
    }
    lastexpmillis = lastmillis;
    vec center = vec(13.0f, 2.3f, 7.1f);  //only update once per frame! - so use the same center for all...
    if(!expverts) expverts = new expvert[heminumverts];
    loopi(heminumverts)
    {
        expvert &e = expverts[i];
        vec &v = hemiverts[i];
        //texgen - scrolling billboard
        e.u = v.x*0.5f + 0.0004f*lastmillis;
        e.v = v.y*0.5f + 0.0004f*lastmillis;
        //ensure the mod texture is wobbled
        e.s = v.x*0.5f + 0.5f;
        e.t = v.y*0.5f + 0.5f;
        //wobble - similar to shader code
        float wobble = v.dot(center) + 0.002f*lastmillis;
        wobble -= floor(wobble);
        wobble = 1.0f + fabs(wobble - 0.5f)*0.5f;
        e.pos = vec(v).mul(wobble);
    }

    if(hasVBO)
    {
        if(!expvbuf) glGenBuffers_(1, &expvbuf);
        glBindBuffer_(GL_ARRAY_BUFFER_ARB, expvbuf);
        glBufferData_(GL_ARRAY_BUFFER_ARB, heminumverts*sizeof(expvert), expverts, GL_STREAM_DRAW_ARB);
    }
}

static struct spherevert
{
    vec pos;
    float s, t;
} *sphereverts = NULL;
static GLushort *sphereindices = NULL;
static int spherenumverts = 0, spherenumindices = 0;
static GLuint spherevbuf = 0, sphereebuf = 0;

static void initsphere(int slices, int stacks)
{
    DELETEA(sphereverts);
    spherenumverts = (stacks+1)*(slices+1);
    sphereverts = new spherevert[spherenumverts];
    float ds = 1.0f/slices, dt = 1.0f/stacks, t = 1.0f;
    loopi(stacks+1)
    {
        float rho = M_PI*(1-t), s = 0.0f;
        loopj(slices+1)
        {
            float theta = j==slices ? 0 : 2*M_PI*s;
            spherevert &v = sphereverts[i*(slices+1) + j];
            v.pos = vec(-sin(theta)*sin(rho), cos(theta)*sin(rho), cos(rho));
            v.s = s;
            v.t = t;
            s += ds;
        }
        t -= dt;
    }

    DELETEA(sphereindices);
    spherenumindices = stacks*slices*3*2;
    sphereindices = new ushort[spherenumindices];
    GLushort *curindex = sphereindices;
    loopi(stacks)
    {
        loopk(slices)
        {
            int j = i%2 ? slices-k-1 : k;

            *curindex++ = i*(slices+1)+j;
            *curindex++ = (i+1)*(slices+1)+j;
            *curindex++ = i*(slices+1)+j+1;

            *curindex++ = i*(slices+1)+j+1;
            *curindex++ = (i+1)*(slices+1)+j;
            *curindex++ = (i+1)*(slices+1)+j+1;
        }
    }

    if(hasVBO)
    {
        if(!spherevbuf) glGenBuffers_(1, &spherevbuf);
        glBindBuffer_(GL_ARRAY_BUFFER_ARB, spherevbuf);
        glBufferData_(GL_ARRAY_BUFFER_ARB, spherenumverts*sizeof(spherevert), sphereverts, GL_STATIC_DRAW_ARB);
        DELETEA(sphereverts);

        if(!sphereebuf) glGenBuffers_(1, &sphereebuf);
        glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, sphereebuf);
        glBufferData_(GL_ELEMENT_ARRAY_BUFFER_ARB, spherenumindices*sizeof(GLushort), sphereindices, GL_STATIC_DRAW_ARB);
        DELETEA(sphereindices);
    }
}

VARP(explosion2d, 0, 0, 1);

static void setupexplosion()
{
    if(renderpath!=R_FIXEDFUNCTION || maxtmus>=2)
    {
        if(!expmodtex[0]) expmodtex[0] = createexpmodtex(64, 0);
        if(!expmodtex[1]) expmodtex[1] = createexpmodtex(64, 0.25f);
        lastexpmodtex = 0;
    }

    if(renderpath!=R_FIXEDFUNCTION)
    {
        if(glaring)
        {
            if(explosion2d) SETSHADER(explosion2dglare); else SETSHADER(explosion3dglare);
        }
        else if(!reflecting && !refracting && depthfx && depthfxtex.rendertex && numdepthfxranges>0)
        {
            if(depthfxtex.target==GL_TEXTURE_RECTANGLE_ARB)
            {
                if(!depthfxtex.highprecision())
                {
                    if(explosion2d) SETSHADER(explosion2dsoft8rect); else SETSHADER(explosion3dsoft8rect);
                }
                else if(explosion2d) SETSHADER(explosion2dsoftrect); else SETSHADER(explosion3dsoftrect);
            }
            else
            {
                if(!depthfxtex.highprecision())
                {
                    if(explosion2d) SETSHADER(explosion2dsoft8); else SETSHADER(explosion3dsoft8);
                }
                else if(explosion2d) SETSHADER(explosion2dsoft); else SETSHADER(explosion3dsoft);
            }
        }
        else if(explosion2d) SETSHADER(explosion2d); else SETSHADER(explosion3d);
    }

    if(renderpath==R_FIXEDFUNCTION || explosion2d)
    {
        if(!hemiverts && !hemivbuf) inithemisphere(5, 2);
        if(renderpath==R_FIXEDFUNCTION) animateexplosion();
        if(hasVBO)
        {
            if(renderpath!=R_FIXEDFUNCTION) glBindBuffer_(GL_ARRAY_BUFFER_ARB, hemivbuf);
            glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, hemiebuf);
        }

        expvert *verts = renderpath==R_FIXEDFUNCTION ? (hasVBO ? 0 : expverts) : (expvert *)hemiverts;

        glEnableClientState(GL_VERTEX_ARRAY);
        glVertexPointer(3, GL_FLOAT, renderpath==R_FIXEDFUNCTION ? sizeof(expvert) : sizeof(vec), verts);

        if(renderpath==R_FIXEDFUNCTION)
        {
            glEnableClientState(GL_TEXTURE_COORD_ARRAY);
            glTexCoordPointer(2, GL_FLOAT, sizeof(expvert), &verts->u);

            if(maxtmus>=2)
            {
                setuptmu(0, "C * T", "= Ca");

                glActiveTexture_(GL_TEXTURE1_ARB);
                glClientActiveTexture_(GL_TEXTURE1_ARB);

                glEnable(GL_TEXTURE_2D);
                setuptmu(1, "P * Ta x 4", "Pa * Ta x 4");
                glEnableClientState(GL_TEXTURE_COORD_ARRAY);
                glTexCoordPointer(2, GL_FLOAT, sizeof(expvert), &verts->s);

                glActiveTexture_(GL_TEXTURE0_ARB);
                glClientActiveTexture_(GL_TEXTURE0_ARB);
            }
        }
    }
    else
    {
        if(!sphereverts && !spherevbuf) initsphere(12, 6);

        if(hasVBO)
        {
            glBindBuffer_(GL_ARRAY_BUFFER_ARB, spherevbuf);
            glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, sphereebuf);
        }

        glEnableClientState(GL_VERTEX_ARRAY);
        glEnableClientState(GL_TEXTURE_COORD_ARRAY);
        glVertexPointer(3, GL_FLOAT, sizeof(spherevert), &sphereverts->pos);
        glTexCoordPointer(2, GL_FLOAT, sizeof(spherevert), &sphereverts->s);
    }
}

static void drawexpverts(int numverts, int numindices, GLushort *indices)
{
    if(hasDRE) glDrawRangeElements_(GL_TRIANGLES, 0, numverts-1, numindices, GL_UNSIGNED_SHORT, indices);
    else glDrawElements(GL_TRIANGLES, numindices, GL_UNSIGNED_SHORT, indices);
    xtraverts += numindices;
    glde++;
}

static void drawexplosion(bool inside, uchar r, uchar g, uchar b, uchar a)
{
    if((renderpath!=R_FIXEDFUNCTION || maxtmus>=2) && lastexpmodtex != expmodtex[inside ? 1 : 0])
    {
        glActiveTexture_(GL_TEXTURE1_ARB);
        lastexpmodtex = expmodtex[inside ? 1 :0];
        glBindTexture(GL_TEXTURE_2D, lastexpmodtex);
        glActiveTexture_(GL_TEXTURE0_ARB);
    }
    int passes = !reflecting && !refracting && inside ? 2 : 1;
    if(renderpath!=R_FIXEDFUNCTION && !explosion2d)
    {
        if(inside) glScalef(1, 1, -1);
        loopi(passes)
        {
            glColor4ub(r, g, b, i ? a/2 : a);
            if(i) glDepthFunc(GL_GEQUAL);
            drawexpverts(spherenumverts, spherenumindices, sphereindices);
            if(i) glDepthFunc(GL_LESS);
        }
        return;
    }
    loopi(passes)
    {
        glColor4ub(r, g, b, i ? a/2 : a);
        if(i)
        {
            glScalef(1, 1, -1);
            glDepthFunc(GL_GEQUAL);
        }
        if(inside)
        {
            if(passes >= 2)
            {
                glCullFace(GL_FRONT);
                drawexpverts(heminumverts, heminumindices, hemiindices);
                glCullFace(GL_BACK);
            }
            glScalef(1, 1, -1);
        }
        drawexpverts(heminumverts, heminumindices, hemiindices);
        if(i) glDepthFunc(GL_LESS);
    }
}

static void cleanupexplosion()
{
    glDisableClientState(GL_VERTEX_ARRAY);
    if(renderpath==R_FIXEDFUNCTION)
    {
        glDisableClientState(GL_TEXTURE_COORD_ARRAY);

        if(maxtmus>=2)
        {
            resettmu(0);

            glActiveTexture_(GL_TEXTURE1_ARB);
            glClientActiveTexture_(GL_TEXTURE1_ARB);

            glDisable(GL_TEXTURE_2D);
            resettmu(1);
            glDisableClientState(GL_TEXTURE_COORD_ARRAY);

            glActiveTexture_(GL_TEXTURE0_ARB);
            glClientActiveTexture_(GL_TEXTURE0_ARB);
        }
    }
    else
    {
        if(!explosion2d) glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    }

    if(hasVBO)
    {
        glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0);
        glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
    }
}

static void deleteexplosions()
{
    loopi(2) if(expmodtex[i]) { glDeleteTextures(1, &expmodtex[i]); expmodtex[i] = 0; }
    if(hemivbuf) { glDeleteBuffers_(1, &hemivbuf); hemivbuf = 0; }
    if(hemiebuf) { glDeleteBuffers_(1, &hemiebuf); hemiebuf = 0; }
    DELETEA(hemiverts);
    DELETEA(hemiindices);
    if(expvbuf) { glDeleteBuffers_(1, &expvbuf); expvbuf = 0; }
    DELETEA(expverts);
    if(spherevbuf) { glDeleteBuffers_(1, &spherevbuf); spherevbuf = 0; }
    if(sphereebuf) { glDeleteBuffers_(1, &sphereebuf); sphereebuf = 0; }
    DELETEA(sphereverts);
    DELETEA(sphereindices);
}

static const float WOBBLE = 1.25f;

struct fireballrenderer : listrenderer
{
    fireballrenderer(const char *texname)
        : listrenderer(texname, 0, PT_FIREBALL|PT_GLARE)
    {}

    void startrender()
    {
        setupexplosion();
    }

    void endrender()
    {
        cleanupexplosion();
        particleshader->set();
    }

    void cleanup()
    {
        deleteexplosions();
    }

    int finddepthfxranges(void **owners, float *ranges, int numranges, int maxranges, vec &bbmin, vec &bbmax)
    {
        static struct fireballent : physent
        {
            fireballent()
            {
                type = ENT_CAMERA;
            }
        } e;

        for(listparticle *p = list; p; p = p->next)
        {
            int ts = p->fade <= 5 ? 1 : lastmillis-p->millis;
            float pmax = p->val,
                  size = p->fade ? float(ts)/p->fade : 1,
                  psize = (p->size + pmax * size)*WOBBLE;
            if(2*(p->size + pmax)*WOBBLE < depthfxblend ||
               (!depthfxtex.highprecision() && !depthfxtex.emulatehighprecision() && psize > depthfxscale - depthfxbias) ||
               isfoggedsphere(psize, p->o)) continue;

            e.o = p->o;
            e.radius = e.xradius = e.yradius = e.eyeheight = e.aboveeye = psize;
            if(!::collide(&e, vec(0, 0, 0), 0, false)) continue;

            if(depthfxscissor==2 && !depthfxtex.addscissorbox(p->o, psize)) continue;

            vec dir = camera1->o;
            dir.sub(p->o);
            float dist = dir.magnitude();
            dir.mul(psize/dist).add(p->o);
            float depth = depthfxtex.eyedepth(dir);

            loopk(3)
            {
                bbmin[k] = min(bbmin[k], p->o[k] - psize);
                bbmax[k] = max(bbmax[k], p->o[k] + psize);
            }

            int pos = numranges;
            loopi(numranges) if(depth < ranges[i]) { pos = i; break; }
            if(pos >= maxranges) continue;

            if(numranges > pos)
            {
                int moved = min(numranges-pos, maxranges-(pos+1));
                memmove(&ranges[pos+1], &ranges[pos], moved*sizeof(float));
                memmove(&owners[pos+1], &owners[pos], moved*sizeof(void *));
            }
            if(numranges < maxranges) numranges++;

            ranges[pos] = depth;
            owners[pos] = p;
        }

        return numranges;
    }

    void seedemitter(particleemitter &pe, const vec &o, const vec &d, int fade, float size, int gravity)
    {
        pe.maxfade = max(pe.maxfade, fade);
        pe.extendbb(o, (size+1+pe.ent->attr2)*WOBBLE);
    }

    void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts, uchar *color)
    {
        float pmax = p->val,
              size = p->fade ? float(ts)/p->fade : 1,
              psize = p->size + pmax * size;

        if(isfoggedsphere(psize*WOBBLE, p->o)) return;

        glPushMatrix();
        glTranslatef(o.x, o.y, o.z);

        bool inside = o.dist(camera1->o) <= psize*WOBBLE;
        vec oc(o);
        oc.sub(camera1->o);
        if(reflecting) oc.z = o.z - reflectz;

        float yaw = inside ? camera1->yaw : atan2(oc.y, oc.x)/RAD - 90,
        pitch = (inside ? camera1->pitch : asin(oc.z/oc.magnitude())/RAD) - 90;
        vec rotdir;
        if(renderpath==R_FIXEDFUNCTION || explosion2d)
        {
            glRotatef(yaw, 0, 0, 1);
            glRotatef(pitch, 1, 0, 0);
            rotdir = vec(0, 0, 1);
        }
        else
        {
            vec s(1, 0, 0), t(0, 1, 0);
            s.rotate(pitch*RAD, vec(-1, 0, 0));
            s.rotate(yaw*RAD, vec(0, 0, -1));
            t.rotate(pitch*RAD, vec(-1, 0, 0));
            t.rotate(yaw*RAD, vec(0, 0, -1));

            rotdir = vec(-1, 1, -1).normalize();
            s.rotate(-lastmillis/7.0f*RAD, rotdir);
            t.rotate(-lastmillis/7.0f*RAD, rotdir);

            setlocalparamf("texgenS", SHPARAM_VERTEX, 2, 0.5f*s.x, 0.5f*s.y, 0.5f*s.z, 0.5f);
            setlocalparamf("texgenT", SHPARAM_VERTEX, 3, 0.5f*t.x, 0.5f*t.y, 0.5f*t.z, 0.5f);
        }

        if(renderpath!=R_FIXEDFUNCTION)
        {
            setlocalparamf("center", SHPARAM_VERTEX, 0, o.x, o.y, o.z);
            setlocalparamf("animstate", SHPARAM_VERTEX, 1, size, psize, pmax, float(lastmillis));
            binddepthfxparams(depthfxblend, inside ? blend/(2*255.0f) : 0, 2*(p->size + pmax)*WOBBLE >= depthfxblend, p);
        }

        glRotatef(lastmillis/7.0f, -rotdir.x, rotdir.y, -rotdir.z);
        glScalef(-psize, psize, -psize);
        drawexplosion(inside, color[0], color[1], color[2], blend);

        glPopMatrix();
    }
};
static fireballrenderer fireballs("packages/particles/explosion.png"), bluefireballs("packages/particles/plasma.png");


text:
.class Lcom/marvell/fmradio/a/r;
.super Ljava/lang/Object;
.source "SourceFile"

# interfaces
.implements Landroid/text/TextWatcher;

# instance fields
.field final synthetic bM:Lcom/marvell/fmradio/a/j;

# direct methods
.method constructor <init>(Lcom/marvell/fmradio/a/j;)V
    .locals 0
    .parameter

    .prologue
    .line 201
    iput-object p1, p0, Lcom/marvell/fmradio/a/r;->bM:Lcom/marvell/fmradio/a/j;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public afterTextChanged(Landroid/text/Editable;)V
    .locals 0
    .parameter

    .prologue
    .line 251
    return-void
.end method

.method public beforeTextChanged(Ljava/lang/CharSequence;III)V
    .locals 0
    .parameter
    .parameter
    .parameter
    .parameter

    .prologue
    .line 244
    return-void
.end method

.method public onTextChanged(Ljava/lang/CharSequence;III)V
    .locals 4
    .parameter
    .parameter
    .parameter
    .parameter

    .prologue
    const/4 v3, 0x0

    .line 205
    iget-object v0, p0, Lcom/marvell/fmradio/a/r;->bM:Lcom/marvell/fmradio/a/j;

    invoke-virtual {v0}, Landroid/app/DialogFragment;->getDialog()Landroid/app/Dialog;

    move-result-object v0

    if-nez v0, :cond_1

    .line 236
    :cond_0
    :goto_0
    return-void

    .line 208
    :cond_1
    iget-object v0, p0, Lcom/marvell/fmradio/a/r;->bM:Lcom/marvell/fmradio/a/j;

    invoke-static {v0}, Lcom/marvell/fmradio/a/j;->b(Lcom/marvell/fmradio/a/j;)Lcom/yulong/android/view/edittext/EditTextEx;

    move-result-object v0

    invoke-virtual {v0}, Lcom/yulong/android/view/edittext/RichEdit;->getText()Landroid/text/Editable;

    move-result-object v1

    .line 209
    const/4 v0, 0x0

    .line 211
    :try_start_0
    invoke-virtual {v1}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Ljava/lang/Float;->parseFloat(Ljava/lang/String;)F
    :try_end_0
    .catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0

    move-result v0

    .line 217
    :goto_1
    const/high16 v1, 0x42c8

    mul-float/2addr v0, v1

    invoke-static {v0}, Ljava/lang/Math;->round(F)I

    move-result v1

    .line 218
    iget-object v0, p0, Lcom/marvell/fmradio/a/r;->bM:Lcom/marvell/fmradio/a/j;

    invoke-virtual {v0}, Landroid/app/DialogFragment;->getDialog()Landroid/app/Dialog;

    move-result-object v0

    check-cast v0, Landroid/app/AlertDialog;

    const/4 v2, -0x1

    invoke-virtual {v0, v2}, Landroid/app/AlertDialog;->getButton(I)Landroid/widget/Button;

    move-result-object v0

    .line 222
    rem-int/lit8 v1, v1, 0x5

    if-nez v1, :cond_2

    .line 223
    if-eqz v0, :cond_0

    .line 224
    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setEnabled(Z)V

    goto :goto_0

    .line 212
    :catch_0
    move-exception v1

    .line 213
    invoke-virtual {v1}, Ljava/lang/Throwable;->printStackTrace()V

    goto :goto_1

    .line 228
    :cond_2
    if-eqz v0, :cond_3

    .line 229
    invoke-virtual {v0, v3}, Landroid/widget/TextView;->setEnabled(Z)V

    .line 231
    :cond_3
    iget-object v0, p0, Lcom/marvell/fmradio/a/r;->bM:Lcom/marvell/fmradio/a/j;

    invoke-virtual {v0}, Landroid/app/Fragment;->getActivity()Landroid/app/Activity;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/ContextWrapper;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    .line 232
    const v1, 0x7f050069

    invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1, v3}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

    move-result-object v0

    invoke-virtual {v0}, Landroid/widget/Toast;->show()V

    goto :goto_0
.end method


text:
using System.Buffers;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;

namespace System.Data.SqlClient.SNI
{
    internal sealed partial class SNIPacket
    {
        private int _dataLength; // the length of the data in the data segment, advanced by Append-ing data, does not include smux header length
        private int _dataCapacity; // the total capacity requested, if the array is rented this may be less than the _data.Length, does not include smux header length
        private int _dataOffset; // the start point of the data in the data segment, advanced by Take-ing data
        private int _headerLength; // the amount of space at the start of the array reserved for the smux header, this is zeroed in SetHeader
                                   // _headerOffset is not needed because it is always 0
        private byte[] _data;
        private SNIAsyncCallback _completionCallback;

        public SNIPacket(int headerSize, int dataSize)
        {
            Allocate(headerSize, dataSize);
        }

        /// <summary>
        /// Length of data left to process
        /// </summary>
        public int DataLeft => (_dataLength - _dataOffset);

        /// <summary>
        /// Length of data
        /// </summary>
        public int Length => _dataLength;

        /// <summary>
        /// Packet validity
        /// </summary>
        public bool IsInvalid => _data is null;

        public bool HasCompletionCallback => !(_completionCallback is null);

        /// <summary>
        /// Packet data
        /// </summary>
        public void Dispose() => Release();

        public int ReservedHeaderSize => _headerLength;

        /// <summary>
        /// Set async completion callback
        /// </summary>
        /// <param name="completionCallback">Completion callback</param>
        public void SetCompletionCallback(SNIAsyncCallback completionCallback)
        {
            _completionCallback = completionCallback;
        }

        /// <summary>
        /// Invoke the completion callback
        /// </summary>
        /// <param name="sniErrorCode">SNI error</param>
        public void InvokeCompletionCallback(uint sniErrorCode)
        {
            _completionCallback(this, sniErrorCode);
        }

        /// <summary>
        /// Allocate space for data
        /// </summary>
        /// <param name="dataLength">Length of byte array to be allocated</param>
        private void Allocate(int headerLength, int dataLength)
        {
            _data = ArrayPool<byte>.Shared.Rent(headerLength + dataLength);
            _dataCapacity = dataLength;
            _dataLength = 0;
            _dataOffset = 0;
            _headerLength = headerLength;
        }

        /// <summary>
        /// Read packet data into a buffer without removing it from the packet
        /// </summary>
        /// <param name="buffer">Buffer</param>
        /// <param name="dataSize">Number of bytes read from the packet into the buffer</param>
        public void GetData(byte[] buffer, ref int dataSize)
        {
            Buffer.BlockCopy(_data, _headerLength, buffer, 0, _dataLength); // read from
            dataSize = _dataLength;
        }

        /// <summary>
        /// Take data from another packet
        /// </summary>
        /// <param name="packet">Packet</param>
        /// <param name="size">Data to take</param>
        /// <returns>Amount of data taken</returns>
        public int TakeData(SNIPacket packet, int size)
        {
            int dataSize = TakeData(packet._data, packet._headerLength + packet._dataLength, size);
            packet._dataLength += dataSize;
            return dataSize;
        }

        /// <summary>
        /// Append data
        /// </summary>
        /// <param name="data">Data</param>
        /// <param name="size">Size</param>
        public void AppendData(byte[] data, int size)
        {
            Buffer.BlockCopy(data, 0, _data, _headerLength + _dataLength, size);
            _dataLength += size;
        }

        /// <summary>
        /// Read data from the packet into the buffer at dataOffset for zize and then remove that data from the packet
        /// </summary>
        /// <param name="buffer">Buffer</param>
        /// <param name="dataOffset">Data offset to write data at</param>
        /// <param name="size">Number of bytes to read from the packet into the buffer</param>
        /// <returns></returns>
        public int TakeData(byte[] buffer, int dataOffset, int size)
        {
            if (_dataOffset >= _dataLength)
            {
                return 0;
            }

            if (_dataOffset + size > _dataLength)
            {
                size = _dataLength - _dataOffset;
            }

            Buffer.BlockCopy(_data, _headerLength + _dataOffset, buffer, dataOffset, size);
            _dataOffset += size;
            return size;
        }

        public Span<byte> GetHeaderBuffer(int headerSize)
        {
            Debug.Assert(_dataOffset == 0, "requested packet header buffer from partially consumed packet");
            Debug.Assert(headerSize > 0, "requested packet header buffer of 0 length");
            Debug.Assert(_headerLength == headerSize, "requested packet header of headerSize which is not equal to the _headerSize reservation");
            return _data.AsSpan(0, headerSize);
        }

        public void SetHeaderActive()
        {
            Debug.Assert(_headerLength > 0, "requested to set header active when it is not reserved or is already active");
            _dataCapacity += _headerLength;
            _dataLength += _headerLength;
            _headerLength = 0;
        }

        /// <summary>
        /// Release packet
        /// </summary>
        public void Release()
        {
            if (_data != null)
            {
                Array.Clear(_data, 0, _headerLength + _dataLength);
                ArrayPool<byte>.Shared.Return(_data, clearArray: false);
                _data = null;
                _dataCapacity = 0;
            }
            _dataLength = 0;
            _dataOffset = 0;
            _headerLength = 0;
            _completionCallback = null;
        }

        /// <summary>
        /// Read data from a stream synchronously
        /// </summary>
        /// <param name="stream">Stream to read from</param>
        public void ReadFromStream(Stream stream)
        {
            _dataLength = stream.Read(_data, _headerLength, _dataCapacity);
        }

        /// <summary>
        /// Write data to a stream synchronously
        /// </summary>
        /// <param name="stream">Stream to write to</param>
        public void WriteToStream(Stream stream)
        {
            stream.Write(_data, _headerLength, _dataLength);
        }

    }

}


text:
package org.procrastinationpatients.tts.source;

import javafx.geometry.Point2D;
import org.apache.commons.io.FileUtils;
import org.procrastinationpatients.tts.entities.*;
import org.procrastinationpatients.tts.utils.LaneUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;

public class EntityLoader {
    private Node root;
    private Document doc;
    private File xmlFile;
    private HashMap<Integer, Cross> crossCache;
    private HashMap<Integer, Margin> marginCache;
    private HashMap<Integer, Link> linkCache;
    private HashMap<Integer, Barrier> barrierCache;

    public EntityLoader(File xmlFile) throws IOException {
        this.xmlFile = xmlFile;
        if (!xmlFile.exists()) {
            throw new IOException("File not exists");
        }
        this.linkCache = new HashMap<>();
        this.marginCache = new HashMap<>();
        this.crossCache = new HashMap<>();
        this.barrierCache = new HashMap<>();

    }

    private void resolveLink() {
        NodeList links = ((Element) root).getElementsByTagName("Link");
        for (int i = 0; i < links.getLength(); i++) {
            Element element = ((Element) links.item(i).getChildNodes());
            Integer linkID = Integer.valueOf(element.getElementsByTagName("ObjectID").item(0).getTextContent());
            Character type = Character.valueOf(element.getElementsByTagName("Type").item(0).getTextContent().charAt(0));
            switch (type) {
                case 'R':
                    this.linkCache.put(linkID, new Road(linkID));
                    break;
                case 'S':
                    this.linkCache.put(linkID, new Street(linkID));
                    break;
                default:
                    throw new RuntimeException("Type out of expect!");
            }
        }
    }

    private void resolveMargin() {
        NodeList margins = ((Element) root).getElementsByTagName("MarginalPoint");
        for (int i = 0; i < margins.getLength(); i++) {
            Element element = ((Element) margins.item(i).getChildNodes());
            Integer marginID = Integer.valueOf(element.getElementsByTagName("ObjectID").item(0).getTextContent());
            Character type = Character.valueOf(element.getElementsByTagName("Type").item(0).getTextContent().charAt(0));
            Double positionX = Double.valueOf(element.getElementsByTagName("x").item(0).getTextContent());
            Double positionY = Double.valueOf(element.getElementsByTagName("y").item(0).getTextContent());
            Margin margin = new Margin(marginID, new Point2D(positionX, positionY));
            switch (type) {
                case 'A': {
                    margin.setFirstInputLaneIndex(3);
                    break;
                }
                case 'B': {
                    margin.setFirstInputLaneIndex(0);
                    break;
                }
                default:
                    throw new RuntimeException("Type out of expect!");
            }
            this.marginCache.put(marginID, margin);
        }
    }

    private void resolveCross() {
        NodeList cross = ((Element) root).getElementsByTagName("Cross");
        for (int i = 0; i < cross.getLength(); i++) {
            Element element = ((Element) cross.item(i).getChildNodes());
            Integer crossID = Integer.valueOf(element.getElementsByTagName("ObjectID").item(0).getTextContent());
            Double positionX = Double.valueOf(element.getElementsByTagName("x").item(0).getTextContent());
            Double positionY = Double.valueOf(element.getElementsByTagName("y").item(0).getTextContent());
            this.crossCache.put(crossID, new Cross(crossID, new Point2D(positionX, positionY)));
        }
    }

    private void connectObjs() {
        NodeList links = ((Element) root).getElementsByTagName("Link");
        for (int i = 0; i < links.getLength(); i++) {
            Element element = ((Element) links.item(i).getChildNodes());
            Integer linkID = Integer.valueOf(element.getElementsByTagName("ObjectID").item(0).getTextContent());
            Character type = Character.valueOf(element.getElementsByTagName("Type").item(0).getTextContent().charAt(0));
            Dot dotA, dotB;
            Character tagA = ((Element) element.getElementsByTagName("ConnectA").item(0)).getElementsByTagName("Type").item(0).getTextContent().toUpperCase().charAt(0);
            Integer idA = Integer.valueOf(((Element) element.getElementsByTagName("ConnectA").item(0)).getElementsByTagName("ObjectID").item(0).getTextContent());
            Character tagB = ((Element) element.getElementsByTagName("ConnectB").item(0)).getElementsByTagName("Type").item(0).getTextContent().toUpperCase().charAt(0);
            Integer idB = Integer.valueOf(((Element) element.getElementsByTagName("ConnectB").item(0)).getElementsByTagName("ObjectID").item(0).getTextContent());
            dotA = tagA == 'M' ? this.marginCache.get(idA) : this.crossCache.get(idA);
            dotB = tagB == 'M' ? this.marginCache.get(idB) : this.crossCache.get(idB);

            this.linkCache.get(linkID).setA(dotA);
            this.linkCache.get(linkID).setB(dotB);

            if (dotA instanceof Margin) {
                ((Margin) dotA).setConnectedLink(linkCache.get(linkID));
            } else if (dotA instanceof Cross) {
                if (linkCache.get(linkID) instanceof Road) {
                    ((Cross) dotA).setSouthRoad((Road) linkCache.get(linkID));
                } else {
                    ((Cross) dotA).setEastStreet((Street) linkCache.get(linkID));
                }
            }

            if (dotB instanceof Margin) {
                ((Margin) dotB).setConnectedLink(this.linkCache.get(linkID));
            } else if (dotB instanceof Cross) {

                if (linkCache.get(linkID) instanceof Road) {
                    ((Cross) dotB).setNorthRoad((Road) linkCache.get(linkID));
                } else {
                    ((Cross) dotB).setWestStreet((Street) linkCache.get(linkID));
                }
            }
        }
    }

    private  void  insertBarrier()
    {
        NodeList barriers = ((Element) root).getElementsByTagName("Barrier");
        for (int i = 0; i < barriers.getLength(); i++) {
            Element element = ((Element) barriers.item(i).getChildNodes());
            Integer barrierID = Integer.valueOf(element.getElementsByTagName("ObjectID").item(0).getTextContent());
            Integer linkID = Integer.valueOf(element.getElementsByTagName("LinkID").item(0).getTextContent());
            Integer laneID = Integer.valueOf(element.getElementsByTagName("LaneIndex").item(0).getTextContent());
            Integer start = Integer.valueOf(element.getElementsByTagName("Start").item(0).getTextContent());
            Integer end = Integer.valueOf(element.getElementsByTagName("End").item(0).getTextContent());
            Link recptorLink = this.linkCache.get(linkID);
			recptorLink.getLanes()[laneID].addBarrier(new Barrier(barrierID,start,end));
        }
    }

    private void connectLanes() {
        for (Cross cross : this.crossCache.values()) {
            //North input
            LaneUtils.connectLane(cross.getNorthRoad().getLanes()[3], cross.getNorthLanes()[0], cross.getWestStreet().getLanes()[2]);
            LaneUtils.connectLane(cross.getNorthRoad().getLanes()[3], cross.getNorthLanes()[1], cross.getWestStreet().getLanes()[1]);
            LaneUtils.connectLane(cross.getNorthRoad().getLanes()[3], cross.getNorthLanes()[2], cross.getWestStreet().getLanes()[0]);

            LaneUtils.connectLane(cross.getNorthRoad().getLanes()[4], cross.getNorthLanes()[3], cross.getSouthRoad().getLanes()[4]);

            LaneUtils.connectLane(cross.getNorthRoad().getLanes()[5], cross.getNorthLanes()[4], cross.getEastStreet().getLanes()[3]);
            LaneUtils.connectLane(cross.getNorthRoad().getLanes()[5], cross.getNorthLanes()[5], cross.getEastStreet().getLanes()[4]);
            LaneUtils.connectLane(cross.getNorthRoad().getLanes()[5], cross.getNorthLanes()[6], cross.getEastStreet().getLanes()[5]);

            //East input
            LaneUtils.connectLane(cross.getEastStreet().getLanes()[2], cross.getEastLanes()[0], cross.getNorthRoad().getLanes()[2]);
            LaneUtils.connectLane(cross.getEastStreet().getLanes()[2], cross.getEastLanes()[1], cross.getNorthRoad().getLanes()[1]);
            LaneUtils.connectLane(cross.getEastStreet().getLanes()[2], cross.getEastLanes()[2], cross.getNorthRoad().getLanes()[0]);

            LaneUtils.connectLane(cross.getEastStreet().getLanes()[1], cross.getEastLanes()[3], cross.getWestStreet().getLanes()[1]);

            LaneUtils.connectLane(cross.getEastStreet().getLanes()[0], cross.getEastLanes()[4], cross.getSouthRoad().getLanes()[3]);
            LaneUtils.connectLane(cross.getEastStreet().getLanes()[0], cross.getEastLanes()[5], cross.getSouthRoad().getLanes()[4]);
            LaneUtils.connectLane(cross.getEastStreet().getLanes()[0], cross.getEastLanes()[6], cross.getSouthRoad().getLanes()[5]);

            //South input
            LaneUtils.connectLane(cross.getSouthRoad().getLanes()[2], cross.getSouthLanes()[0], cross.getEastStreet().getLanes()[3]);
            LaneUtils.connectLane(cross.getSouthRoad().getLanes()[2], cross.getSouthLanes()[1], cross.getEastStreet().getLanes()[4]);
            LaneUtils.connectLane(cross.getSouthRoad().getLanes()[2], cross.getSouthLanes()[2], cross.getEastStreet().getLanes()[5]);

            LaneUtils.connectLane(cross.getSouthRoad().getLanes()[1], cross.getSouthLanes()[3], cross.getNorthRoad().getLanes()[1]);

            LaneUtils.connectLane(cross.getSouthRoad().getLanes()[0], cross.getSouthLanes()[4], cross.getWestStreet().getLanes()[2]);
            LaneUtils.connectLane(cross.getSouthRoad().getLanes()[0], cross.getSouthLanes()[5], cross.getWestStreet().getLanes()[1]);
            LaneUtils.connectLane(cross.getSouthRoad().getLanes()[0], cross.getSouthLanes()[6], cross.getWestStreet().getLanes()[0]);

            //West input
            LaneUtils.connectLane(cross.getWestStreet().getLanes()[3], cross.getWestLanes()[0], cross.getSouthRoad().getLanes()[3]);
            LaneUtils.connectLane(cross.getWestStreet().getLanes()[3], cross.getWestLanes()[1], cross.getSouthRoad().getLanes()[4]);
            LaneUtils.connectLane(cross.getWestStreet().getLanes()[3], cross.getWestLanes()[2], cross.getSouthRoad().getLanes()[5]);

            LaneUtils.connectLane(cross.getWestStreet().getLanes()[4], cross.getWestLanes()[3], cross.getEastStreet().getLanes()[4]);

            LaneUtils.connectLane(cross.getWestStreet().getLanes()[5], cross.getWestLanes()[4], cross.getNorthRoad().getLanes()[2]);
            LaneUtils.connectLane(cross.getWestStreet().getLanes()[5], cross.getWestLanes()[5], cross.getNorthRoad().getLanes()[1]);
            LaneUtils.connectLane(cross.getWestStreet().getLanes()[5], cross.getWestLanes()[6], cross.getNorthRoad().getLanes()[0]);
        }
    }

    public void LoadFromFile() throws ParserConfigurationException, IOException, SAXException {

        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        dbFactory.setIgnoringComments(true);
        dbFactory.setIgnoringElementContentWhitespace(true);
        dbFactory.setValidating(false);
        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
        doc = dBuilder.parse(FileUtils.openInputStream(this.xmlFile));
        doc.getDocumentElement().normalize();
        root = doc.getElementsByTagName("Data").item(0);

        this.resolveLink();
        this.resolveMargin();
        this.resolveCross();
        this.connectObjs();
        this.connectLanes();
        this.insertBarrier();
    }

    public Cross[] getCrosses() {
        return crossCache.values().toArray(new Cross[]{});
    }

    public Margin[] getMargins() {
        return marginCache.values().toArray(new Margin[]{});
    }

    public Link[] getLinks() {
        return this.linkCache.values().toArray(new Link[]{});
    }

    public Barrier[] getBarriers() {
        return this.barrierCache.values().toArray(new Barrier[]{});
    }
}