text:
#include <Model/Readers/PlyReader.h>

#include <Model/Primitives/WaldTriangle.h>
#include <Model/Primitives/KenslerShirleyTriangle.h>
#include <Model/Materials/Lambertian.h>
#include <Core/Geometry/Vector.h>
#include <Core/Color/Color.h>
#include <Core/Color/RGBColor.h>
#include <Core/Exceptions/FileNotFound.h>
#include <Model/Readers/rply/rply.h>
#include <sstream>

#include <stdlib.h>

//TODO: normals?

using namespace Manta;

double maxColorValue;

bool coloredTriangleMode = false;

struct VertexData {
  Vector point;
  RGBColor color;
};

long vertices_start = 0;
VertexData vertexData;
static AffineTransform t;

static void addVertex(Mesh *mesh) {
  vertexData.point = t.multiply_point(vertexData.point);
  mesh->vertices.push_back(vertexData.point);
}

static int vertex_cb(p_ply_argument argument) {
     Mesh *mesh;
     ply_get_argument_user_data(argument, (void**) &mesh, NULL);

     const char* name;
     p_ply_property property;
     ply_get_argument_property(argument, &property, NULL, NULL);
     ply_get_property_info(property, &name, NULL, NULL, NULL);

     long vertexIndex;
     ply_get_argument_element(argument, NULL, &vertexIndex);

     if (static_cast<size_t>(vertexIndex + vertices_start) == mesh->vertices.size()+1) {
       addVertex(mesh);
     }

     if (strcmp(name, "x") == 0)
       vertexData.point[0] = ply_get_argument_value(argument);
     else if (strcmp(name, "y") == 0)
       vertexData.point[1] = ply_get_argument_value(argument);
     else if (strcmp(name, "z") == 0)
       vertexData.point[2] = ply_get_argument_value(argument);
     else if (strcmp(name, "diffuse_red") == 0)
       vertexData.color.setR(ply_get_argument_value(argument) / maxColorValue);
     else if (strcmp(name, "diffuse_green") == 0)
       vertexData.color.setG(ply_get_argument_value(argument) / maxColorValue);
     else if (strcmp(name, "diffuse_blue") == 0)
       vertexData.color.setB(ply_get_argument_value(argument) / maxColorValue);

     return 1;
}

struct face_cb_data {
  Mesh *mesh;
  WaldTriangle *WaldTris;
  KenslerShirleyTriangle *KSTris;
  size_t nextFreeTri;
  face_cb_data() : mesh(NULL), WaldTris(NULL), KSTris(NULL), nextFreeTri(0) {}
};

long firstVertexIndex, prevVertexIndex;
static int face_cb(p_ply_argument argument) {
     long length;
     long currVertexIndex;

     face_cb_data *data;
     ply_get_argument_user_data(argument, (void**) &data, NULL);

     long polyIndex, polyVertex;
     ply_get_argument_element(argument, NULL, &polyIndex);

     ply_get_argument_property(argument, NULL, &length, &polyVertex);

     //do this once only to add last vertex.
     if (polyIndex == 0 && polyVertex == -1) {
       addVertex(data->mesh);
     }

     currVertexIndex = static_cast<long>(ply_get_argument_value(argument));
//      cout <<currVertexIndex<<"\t"<<polyIndex <<"\t" << polyVertex<<"\n";

     switch (polyVertex)
     {
     case -1: return 1;
     case 0: firstVertexIndex = currVertexIndex;
       break;
     case 1: prevVertexIndex = currVertexIndex;
       break;
     default:
       data->mesh->vertex_indices.push_back(vertices_start+firstVertexIndex);
       data->mesh->vertex_indices.push_back(vertices_start+prevVertexIndex);
       data->mesh->vertex_indices.push_back(vertices_start+currVertexIndex);

       data->mesh->face_material.push_back(data->mesh->materials.size()-1);

       if (data->WaldTris)
         data->mesh->addTriangle(&data->WaldTris[data->nextFreeTri++]);
       else if (data->KSTris)
         data->mesh->addTriangle(&data->KSTris[data->nextFreeTri++]);

       if (coloredTriangleMode) {
         //TODO: handle colored triangles.
//         group->add(new VertexColoredTriangle(mat,
//                     vertices[firstVertexIndex].point,
//                     vertices[prevVertexIndex].point,
//                     vertices[currVertexIndex].point,
//                     Color(vertices[firstVertexIndex].color),
//                     Color(vertices[prevVertexIndex].color),
//                     Color(vertices[currVertexIndex].color)));
       }
       prevVertexIndex = currVertexIndex;
       break;
     }

     return 1;

}

bool
Manta::readPlyFile(const string fileName, const AffineTransform &_t,
                   Mesh *mesh, Material *m,
                   MeshTriangle::TriangleType triangleType) {
     long nVertices, nTriangles;
     size_t objs_start = mesh->size();
     unsigned int vertex_indices_start = mesh->vertex_indices.size();
     vertices_start = mesh->vertices.size();

     t = _t;

     p_ply ply = ply_open(fileName.c_str(), NULL);
     if (!ply)
     {
         ostringstream msg;
         msg << "An error occured while trying to load the following ply file: " << fileName;
         throw FileNotFound(msg.str());
     }

     if (!ply_read_header(ply)) return false;

     nVertices = ply_set_read_cb(ply, "vertex", "x", vertex_cb, mesh, 0);

     ply_set_read_cb(ply, "vertex", "y", vertex_cb,
                     mesh, 0);
     ply_set_read_cb(ply, "vertex", "z", vertex_cb,
                     mesh, 0);

     //get vertex color property
     p_ply_property property;

     //try and get diffuse RGB color property
     property = ply_find_property(ply_find_element(ply, "vertex"), "diffuse_red");

     ply_set_read_cb(ply, "vertex", "diffuse_red", vertex_cb,
                     mesh, 0);
     ply_set_read_cb(ply, "vertex", "diffuse_blue", vertex_cb,
                     mesh, 0);
     ply_set_read_cb(ply, "vertex", "diffuse_green", vertex_cb,
                     mesh, 0);

     /*if we add other color types, need to try getting their property
      *if current property is still NULL.
      */

     Material *defaultMaterial = NULL;

     if (property)
     {
       //TODO: get vertex colored triangles working again
       /*
         //TODO: we might not want to overwrite the matl passed in to us...
         defaultMaterial = new Lambertian(new TriVerTexture());
         coloredTriangleMode = true;
         e_ply_type type;
         ply_get_property_info(property,  NULL, &type, NULL, NULL);
         if (type)
         {
             switch(type)
             {
             //TODO: handle all the other types.
             case PLY_CHAR: maxColorValue=255;
                 break;
             case PLY_UCHAR: maxColorValue=511;
                 break;
             case PLY_DOUBLE:
             case PLY_FLOAT: maxColorValue=1;
                 break;
             default: maxColorValue=1; //shouldn't get here. Need to
                                       //add case for this new type
                 break;
             }
         }
       */
     }

     face_cb_data face_data;
     face_data.mesh = mesh;

     nTriangles = ply_set_read_cb(ply, "face", "vertex_indices", face_cb, &face_data, 0);

     // Note(thiago): By allocating all the triangles in an array instead of
     // one at a time, we can lower the memory overhead and allow for triangle
     // data to be contiguous in memory instead of having gaps. Lower memory
     // usage is obviously good; getting rid of the gaps between triangles is
     // also good since it can lead to more efficient cache usage and better
     // performance.  The gaps occur because new will often try to allocate
     // memory in chunks.  For instance, calling new twice to allocate a 4B
     // struct might place the second object 16B to 32B away from the first
     // instead of 4B.  The in between space is wasted.  I've verified this
     // exact behavior in test code.
     switch (triangleType) {
     case MeshTriangle::WALD_TRI:
       face_data.WaldTris = new WaldTriangle[nTriangles];
       break;
     case MeshTriangle::KENSLER_SHIRLEY_TRI:
       face_data.KSTris = new KenslerShirleyTriangle[nTriangles];
       break;
     default:
       face_data.KSTris = new KenslerShirleyTriangle[nTriangles];
     }

     if (defaultMaterial)
     { } //do nothing
     else if (m)
      defaultMaterial = m;
     else
      defaultMaterial = new Lambertian(Color(RGBColor(1,1,1)));

     mesh->materials.push_back(defaultMaterial);

     if (!ply_read(ply)) {
         //need to clean up group.
         mesh->shrinkTo(objs_start, false);
         mesh->vertices.resize(vertices_start);
         mesh->vertex_indices.resize(vertex_indices_start);
         if (!m && defaultMaterial)
             delete defaultMaterial;

         delete[] face_data.WaldTris;
         delete[] face_data.KSTris;

         return false;
     }

     ply_close(ply);

     mesh->removeDegenerateTriangles();

     return true;
}


text:
/**
 * sfchat/events/title.js: SFChat Title Events
 */
define(function() {

    "use strict";

    /**
     * SFChat API Message Events
     *
     * @type {Object}
     */
    var eventTitle =  {
        /**
         * Title pattern
         *
         * @property {Regex}
         */
        _titlePattern: /^\(\d+\)\s/,

        /**
         * Title template
         *
         * @property {String}
         */
        _titleTemplate: '(0) ',

        /**
         * Show count of messages on a title
         *
         * @param {Event} e
         * @param {Number} msgCount
         */
        showTitle: function(e, msgCount) {
            var _this             = eventTitle,
                title             = document.title,
                msgCountPattern   = /(\d+)/,
                msgCountTitle     = msgCountPattern.exec(title);

            // add message count indicator to a title
            if (!msgCountTitle) {
                title = _this._titleTemplate + title;
            }

            // update title
            msgCount        += (msgCountTitle) ? parseInt(msgCountTitle[0]): 0;
            document.title  = title.replace(msgCountPattern,  msgCount);
        },

        /**
         * Clear message count in the document title
         *
         * @param {Event} e
         */
        clearTitle: function(e) {
            var _this = eventTitle;

            if (_this._titlePattern.test(document.title) === true) {
                document.title = document.title.replace(_this._titlePattern, '');
            }
        }
    };

    // api
    return eventTitle;
});

redpajama_set_name: RedPajamaGithub


text:
class OptionSession : public Session
{
public:
    OptionSession(std::pair<bool,bool> rules);
    virtual ~OptionSession();
    virtual Session *update(Gomoku &);
    virtual void draw(Gomoku &);
private:
   // void        underlinedSelectedText(unsigned int &i,unsigned int& MouseX,unsigned int& MouseY);
   // void        cleanUnselectedText();
    bool        ActionBreakable5(const bool);
    bool        ActionDouble3(const bool);

    sf::Font _myFont;
    sf::Image _menuOptionImage;
    sf::Sprite _menuOptionSprite;
   // int     _selected;
};

#endif // OPTIONSESSION_HP


text:
import { BrowserModule } from '@angular/platform-browser';
import { isDevMode, NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';

import { AngularFireModule } from '@angular/fire/compat';

import {
  AngularFireAnalyticsModule,
  APP_NAME,
  APP_VERSION,
  DEBUG_MODE as ANALYTICS_DEBUG_MODE,
  ScreenTrackingService,
  UserTrackingService,
  COLLECTION_ENABLED
} from '@angular/fire/compat/analytics';

import { FirestoreComponent } from './firestore/firestore.component';
import { AngularFireDatabaseModule, USE_EMULATOR as USE_DATABASE_EMULATOR } from '@angular/fire/compat/database';
import { AngularFirestoreModule, USE_EMULATOR as USE_FIRESTORE_EMULATOR, SETTINGS as FIRESTORE_SETTINGS } from '@angular/fire/compat/firestore';
import { AngularFireStorageModule, USE_EMULATOR as USE_STORAGE_EMULATOR } from '@angular/fire/compat/storage';
import { AngularFireAuthModule, USE_DEVICE_LANGUAGE, USE_EMULATOR as USE_AUTH_EMULATOR } from '@angular/fire/compat/auth';
import { AngularFireMessagingModule, SERVICE_WORKER, VAPID_KEY } from '@angular/fire/compat/messaging';
import { AngularFireFunctionsModule, USE_EMULATOR as USE_FUNCTIONS_EMULATOR } from '@angular/fire/compat/functions';
import { AngularFireRemoteConfigModule, SETTINGS as REMOTE_CONFIG_SETTINGS, DEFAULTS as REMOTE_CONFIG_DEFAULTS } from '@angular/fire/compat/remote-config';
import { AngularFirePerformanceModule, PerformanceMonitoringService } from '@angular/fire/compat/performance';
import { AngularFireAuthGuardModule } from '@angular/fire/compat/auth-guard';

import { DatabaseComponent } from './database/database.component';
import { StorageComponent } from './storage/storage.component';
import { RemoteConfigComponent } from './remote-config/remote-config.component';
import { HomeComponent } from './home/home.component';
import { AuthComponent } from './auth/auth.component';
import { MessagingComponent } from './messaging/messaging.component';
import { FunctionsComponent } from './functions/functions.component';
import { UpboatsComponent } from './upboats/upboats.component';
import { initializeApp, provideFirebaseApp } from '@angular/fire/app';

@NgModule({
  declarations: [
    AppComponent,
    StorageComponent,
    FirestoreComponent,
    DatabaseComponent,
    RemoteConfigComponent,
    HomeComponent,
    AuthComponent,
    MessagingComponent,
    FunctionsComponent,
    UpboatsComponent,
  ],
  imports: [
    BrowserModule.withServerTransition({ appId: 'serverApp' }),
    AppRoutingModule,
    ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
    AngularFireModule.initializeApp(environment.firebase),
    AngularFireStorageModule,
    AngularFireDatabaseModule,
    AngularFirestoreModule.enablePersistence({ synchronizeTabs: true }),
    AngularFireAuthModule,
    AngularFireAuthGuardModule,
    AngularFireRemoteConfigModule,
    AngularFireMessagingModule,
    AngularFireAnalyticsModule,
    AngularFireFunctionsModule,
    AngularFirePerformanceModule,
    // provide modular style for AppCheck, see app.browser/server
    provideFirebaseApp(() => initializeApp(environment.firebase)),
  ],
  providers: [
    UserTrackingService,
    ScreenTrackingService,
    PerformanceMonitoringService,
    { provide: FIRESTORE_SETTINGS, useValue: { ignoreUndefinedProperties: true } },
    { provide: ANALYTICS_DEBUG_MODE, useValue: true },
    { provide: COLLECTION_ENABLED, useValue: true },
    { provide: USE_AUTH_EMULATOR, useValue: environment.useEmulators ? ['http://localhost:9099'] : undefined },
    { provide: USE_DATABASE_EMULATOR, useValue: environment.useEmulators ? ['localhost', 9000] : undefined },
    { provide: USE_FIRESTORE_EMULATOR, useValue: environment.useEmulators ? ['localhost', 8080] : undefined },
    { provide: USE_FUNCTIONS_EMULATOR, useValue: environment.useEmulators ? ['localhost', 5001] : undefined },
    { provide: USE_STORAGE_EMULATOR, useValue: environment.useEmulators ? ['localhost', 9199] : undefined },
    { provide: REMOTE_CONFIG_SETTINGS, useFactory: () => isDevMode() ? { minimumFetchIntervalMillis: 10_000 } : {} },
    { provide: REMOTE_CONFIG_DEFAULTS, useValue: { background_color: 'red' } },
    { provide: USE_DEVICE_LANGUAGE, useValue: true },
    { provide: VAPID_KEY, useValue: environment.vapidKey },
    { provide: SERVICE_WORKER, useFactory: () => typeof navigator !== 'undefined' && navigator.serviceWorker?.register('firebase-messaging-sw.js', { scope: '__' }) || undefined },
    { provide: APP_VERSION, useValue: '0.0.0' },
    { provide: APP_NAME, useValue: 'Angular' },
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }


text:
#ifndef TUW_NAV_MSGS_ROUTE_SEGMENT_H
#define TUW_NAV_MSGS_ROUTE_SEGMENT_H

// ROS
#include <tuw_geometry_msgs/pose.h>
#include <tuw_nav_msgs/RouteSegment.h>

namespace tuw
{
namespace ros_msgs
{
class RouteSegment : public tuw_nav_msgs::RouteSegment
{
public:
  RouteSegment();
  static const unsigned int NA = 0;
  static const unsigned int LINE = 1;
  static const unsigned int ARC = 2;
  static const unsigned int SPIROS = 3;
  static const unsigned int SPLINE = 4;
  static const unsigned int CLOCKWISE = 0;
  static const unsigned int COUNTER_CLOCKWISE = 1;
  double sample_equal_distance(std::vector<geometry_msgs::PosePtr> &poses, double distance,
                               double distance_offset) const;
  double sample_equal_angle(std::vector<geometry_msgs::PosePtr> &poses, double angle, double distance_offset) const;
};
};
};

#endif  // TUW_NAV_MSGS_ROUTE_SEGMENT_H


text:
\hypertarget{classArbolGeneral_1_1postorden__iterador}{\subsection{Referencia de la Clase Arbol\-General$<$ Tbase $>$\-:\-:postorden\-\_\-iterador}
\label{classArbolGeneral_1_1postorden__iterador}\index{Arbol\-General$<$ Tbase $>$\-::postorden\-\_\-iterador@{Arbol\-General$<$ Tbase $>$\-::postorden\-\_\-iterador}}
}

{\ttfamily \#include $<$Arbol\-General.\-hpp$>$}

\subsubsection*{Métodos públicos}
\begin{DoxyCompactItemize}
\item
\hyperlink{classArbolGeneral_1_1postorden__iterador_a2ac2dbbaf71087cf7d5964b45b4bca1e}{postorden\-\_\-iterador} ()
\begin{DoxyCompactList}\small\item\em Constructor por defecto. \end{DoxyCompactList}\item
\hyperlink{classArbolGeneral_1_1postorden__iterador_a40c1929529a5d1063e97c07a73ecb043}{postorden\-\_\-iterador} (const \hyperlink{classArbolGeneral_a12cc1b74a9095d89bc7334290d332f7a}{Nodo} \&n)
\begin{DoxyCompactList}\small\item\em Constructor con nodo. \end{DoxyCompactList}\item
\hyperlink{classArbolGeneral_1_1postorden__iterador_a07bc1d0276eb14be207144f0a69745d3}{postorden\-\_\-iterador} (const \hyperlink{classArbolGeneral_1_1postorden__iterador}{postorden\-\_\-iterador} \&n)
\begin{DoxyCompactList}\small\item\em Constructor de copia. \end{DoxyCompactList}\item
const Tbase \& \hyperlink{classArbolGeneral_1_1postorden__iterador_a7416472d2c6f1ecf02262e79887f38ee}{operator$\ast$} () const
\begin{DoxyCompactList}\small\item\em Acceso a la información del nodo. \end{DoxyCompactList}\item
Tbase \& \hyperlink{classArbolGeneral_1_1postorden__iterador_af0f0fcc363dd30b5b0d102c1b60817c3}{operator$\ast$} ()
\item
bool \hyperlink{classArbolGeneral_1_1postorden__iterador_a3c823a060b37ab5be8a950b5a79188d3}{operator==} (const \hyperlink{classArbolGeneral_1_1postorden__iterador}{postorden\-\_\-iterador} \&n)
\begin{DoxyCompactList}\small\item\em Operación de igualdad entre dos posiciones. \end{DoxyCompactList}\item
bool \hyperlink{classArbolGeneral_1_1postorden__iterador_a15ce3ad6eded0487e0b2b5a49abde5ce}{operator!=} (const \hyperlink{classArbolGeneral_1_1postorden__iterador}{postorden\-\_\-iterador} \&n)
\begin{DoxyCompactList}\small\item\em Operación de desigualdad entre dos posiciones. \end{DoxyCompactList}\item
\hyperlink{classArbolGeneral_1_1postorden__iterador}{postorden\-\_\-iterador} \hyperlink{classArbolGeneral_1_1postorden__iterador_a939b113299035ac4f56c1ebc8c7de763}{padre} ()
\begin{DoxyCompactList}\small\item\em Nodo del padre. \end{DoxyCompactList}\item
\hyperlink{classArbolGeneral_1_1postorden__iterador}{postorden\-\_\-iterador} \hyperlink{classArbolGeneral_1_1postorden__iterador_a41de2f17fa6fd5f76654770858d4f3b2}{izquierda} ()
\begin{DoxyCompactList}\small\item\em Nodo hijo. \end{DoxyCompactList}\item
\hyperlink{classArbolGeneral_1_1postorden__iterador}{postorden\-\_\-iterador} \hyperlink{classArbolGeneral_1_1postorden__iterador_ae2b24cd3445cac918c67574c0879b189}{derecha} ()
\begin{DoxyCompactList}\small\item\em Nodo hermano. \end{DoxyCompactList}\item
bool \hyperlink{classArbolGeneral_1_1postorden__iterador_a68390390c83bf6e26d9ea74d547f1b2c}{nulo} ()
\begin{DoxyCompactList}\small\item\em Dice si un nodo es nulo. \end{DoxyCompactList}\item
\hyperlink{classArbolGeneral_1_1postorden__iterador}{postorden\-\_\-iterador} \& \hyperlink{classArbolGeneral_1_1postorden__iterador_a3b2f2622714676de99e67aa27a410b68}{operator++} ()
\begin{DoxyCompactList}\small\item\em Siguiente elemento en postorden. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsubsection*{Atributos privados}
\begin{DoxyCompactItemize}
\item
\hyperlink{classArbolGeneral_a12cc1b74a9095d89bc7334290d332f7a}{Nodo} \hyperlink{classArbolGeneral_1_1postorden__iterador_ae269432023776674c7633eadeb8c30e0}{p}
\end{DoxyCompactItemize}
\subsubsection*{Amigas}
\begin{DoxyCompactItemize}
\item
class \hyperlink{classArbolGeneral_1_1postorden__iterador_a9c06e31b7c3e0d4ee5b03003d32935a5}{Arbol\-General}
\end{DoxyCompactItemize}

\subsubsection{Documentación del constructor y destructor}
\hypertarget{classArbolGeneral_1_1postorden__iterador_a2ac2dbbaf71087cf7d5964b45b4bca1e}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!postorden\-\_\-iterador@{postorden\-\_\-iterador}}
\index{postorden\-\_\-iterador@{postorden\-\_\-iterador}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{postorden\-\_\-iterador}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::postorden\-\_\-iterador (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classArbolGeneral_1_1postorden__iterador_a2ac2dbbaf71087cf7d5964b45b4bca1e}

Constructor por defecto.

\hypertarget{classArbolGeneral_1_1postorden__iterador_a40c1929529a5d1063e97c07a73ecb043}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!postorden\-\_\-iterador@{postorden\-\_\-iterador}}
\index{postorden\-\_\-iterador@{postorden\-\_\-iterador}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{postorden\-\_\-iterador}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::postorden\-\_\-iterador (
\begin{DoxyParamCaption}
\item[{const {\bf Nodo} \&}]{n}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classArbolGeneral_1_1postorden__iterador_a40c1929529a5d1063e97c07a73ecb043}

Constructor con nodo.

\begin{DoxyParams}{Parámetros}
{\em n} & nodo fuente. \\
\hline
\end{DoxyParams}
\hypertarget{classArbolGeneral_1_1postorden__iterador_a07bc1d0276eb14be207144f0a69745d3}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!postorden\-\_\-iterador@{postorden\-\_\-iterador}}
\index{postorden\-\_\-iterador@{postorden\-\_\-iterador}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{postorden\-\_\-iterador}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::postorden\-\_\-iterador (
\begin{DoxyParamCaption}
\item[{const {\bf postorden\-\_\-iterador} \&}]{n}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classArbolGeneral_1_1postorden__iterador_a07bc1d0276eb14be207144f0a69745d3}

Constructor de copia.

\begin{DoxyParams}{Parámetros}
{\em n} & nodo fuente. \\
\hline
\end{DoxyParams}

\subsubsection{Documentación de las funciones miembro}
\hypertarget{classArbolGeneral_1_1postorden__iterador_ae2b24cd3445cac918c67574c0879b189}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!derecha@{derecha}}
\index{derecha@{derecha}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{derecha}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ {\bf postorden\-\_\-iterador} {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::derecha (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classArbolGeneral_1_1postorden__iterador_ae2b24cd3445cac918c67574c0879b189}

Nodo hermano.

\begin{DoxyReturn}{Devuelve}
Devuelve un nodo apuntando al hermano derecha.
\end{DoxyReturn}
\hypertarget{classArbolGeneral_1_1postorden__iterador_a41de2f17fa6fd5f76654770858d4f3b2}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!izquierda@{izquierda}}
\index{izquierda@{izquierda}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{izquierda}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ {\bf postorden\-\_\-iterador} {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::izquierda (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classArbolGeneral_1_1postorden__iterador_a41de2f17fa6fd5f76654770858d4f3b2}

Nodo hijo.

\begin{DoxyReturn}{Devuelve}
devuelve un nodo apuntando al hijo más a la izquierda.
\end{DoxyReturn}
\hypertarget{classArbolGeneral_1_1postorden__iterador_a68390390c83bf6e26d9ea74d547f1b2c}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!nulo@{nulo}}
\index{nulo@{nulo}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{nulo}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ bool {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::nulo (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classArbolGeneral_1_1postorden__iterador_a68390390c83bf6e26d9ea74d547f1b2c}

Dice si un nodo es nulo.

\begin{DoxyReturn}{Devuelve}
true si es nulo, false en caso contrario.
\end{DoxyReturn}
\hypertarget{classArbolGeneral_1_1postorden__iterador_a15ce3ad6eded0487e0b2b5a49abde5ce}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!operator!=@{operator!=}}
\index{operator!=@{operator!=}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{operator!=}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ bool {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::operator!= (
\begin{DoxyParamCaption}
\item[{const {\bf postorden\-\_\-iterador} \&}]{n}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classArbolGeneral_1_1postorden__iterador_a15ce3ad6eded0487e0b2b5a49abde5ce}

Operación de desigualdad entre dos posiciones.

\begin{DoxyParams}{Parámetros}
{\em n} & nodo con el que se compara. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Devuelve}
true si son desiguales false en caso contrario.
\end{DoxyReturn}
\hypertarget{classArbolGeneral_1_1postorden__iterador_a7416472d2c6f1ecf02262e79887f38ee}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!operator$\ast$@{operator$\ast$}}
\index{operator$\ast$@{operator$\ast$}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{operator$\ast$}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ const Tbase\& {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::operator$\ast$ (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily [inline]}}}\label{classArbolGeneral_1_1postorden__iterador_a7416472d2c6f1ecf02262e79887f38ee}

Acceso a la información del nodo.

\hypertarget{classArbolGeneral_1_1postorden__iterador_af0f0fcc363dd30b5b0d102c1b60817c3}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!operator$\ast$@{operator$\ast$}}
\index{operator$\ast$@{operator$\ast$}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{operator$\ast$}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ Tbase\& {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::operator$\ast$ (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classArbolGeneral_1_1postorden__iterador_af0f0fcc363dd30b5b0d102c1b60817c3}
\hypertarget{classArbolGeneral_1_1postorden__iterador_a3b2f2622714676de99e67aa27a410b68}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!operator++@{operator++}}
\index{operator++@{operator++}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{operator++}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ {\bf Arbol\-General}$<$ Tbase $>$\-::{\bf postorden\-\_\-iterador} \& {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::operator++ (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{classArbolGeneral_1_1postorden__iterador_a3b2f2622714676de99e67aa27a410b68}

Siguiente elemento en postorden.

\begin{DoxyReturn}{Devuelve}
Devuelve un iterador al siguiente elemento en postorden.
\end{DoxyReturn}
\hypertarget{classArbolGeneral_1_1postorden__iterador_a3c823a060b37ab5be8a950b5a79188d3}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!operator==@{operator==}}
\index{operator==@{operator==}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{operator==}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ bool {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::operator== (
\begin{DoxyParamCaption}
\item[{const {\bf postorden\-\_\-iterador} \&}]{n}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classArbolGeneral_1_1postorden__iterador_a3c823a060b37ab5be8a950b5a79188d3}

Operación de igualdad entre dos posiciones.

\begin{DoxyParams}{Parámetros}
{\em n} & nodo con el que se compara. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Devuelve}
true si son iguales false en caso opuesto.
\end{DoxyReturn}
\hypertarget{classArbolGeneral_1_1postorden__iterador_a939b113299035ac4f56c1ebc8c7de763}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!padre@{padre}}
\index{padre@{padre}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{padre}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ {\bf postorden\-\_\-iterador} {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::padre (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{classArbolGeneral_1_1postorden__iterador_a939b113299035ac4f56c1ebc8c7de763}

Nodo del padre.

\begin{DoxyReturn}{Devuelve}
devuelve un nodo apuntando al padre.
\end{DoxyReturn}

\subsubsection{Documentación de las funciones relacionadas y clases amigas}
\hypertarget{classArbolGeneral_1_1postorden__iterador_a9c06e31b7c3e0d4ee5b03003d32935a5}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!Arbol\-General@{Arbol\-General}}
\index{Arbol\-General@{Arbol\-General}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{Arbol\-General}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ friend class {\bf Arbol\-General}\hspace{0.3cm}{\ttfamily [friend]}}}\label{classArbolGeneral_1_1postorden__iterador_a9c06e31b7c3e0d4ee5b03003d32935a5}

\subsubsection{Documentación de los datos miembro}
\hypertarget{classArbolGeneral_1_1postorden__iterador_ae269432023776674c7633eadeb8c30e0}{\index{Arbol\-General\-::postorden\-\_\-iterador@{Arbol\-General\-::postorden\-\_\-iterador}!p@{p}}
\index{p@{p}!ArbolGeneral::postorden_iterador@{Arbol\-General\-::postorden\-\_\-iterador}}
\paragraph[{p}]{\setlength{\rightskip}{0pt plus 5cm}template$<$class Tbase$>$ {\bf Nodo} {\bf Arbol\-General}$<$ Tbase $>$\-::postorden\-\_\-iterador\-::p\hspace{0.3cm}{\ttfamily [private]}}}\label{classArbolGeneral_1_1postorden__iterador_ae269432023776674c7633eadeb8c30e0}

La documentación para esta clase fue generada a partir del siguiente fichero\-:\begin{DoxyCompactItemize}
\item
include/\hyperlink{ArbolGeneral_8hpp}{Arbol\-General.\-hpp}\end{DoxyCompactItemize}


text:
using System;
using System.Threading.Tasks;
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;

namespace TableStorage
{
    public class Common
    {
        /// <summary>
        /// Validate the connection string information in app.config and throws an exception if it looks like
        /// the user hasn't updated this to valid values.
        /// </summary>
        /// <param name="storageConnectionString">Connection string for the storage service or the emulator</param>
        /// <returns>CloudStorageAccount object</returns>
        public static CloudStorageAccount CreateStorageAccountFromConnectionString(string storageConnectionString)
        {
            CloudStorageAccount storageAccount;
            try
            {
                storageAccount = CloudStorageAccount.Parse(storageConnectionString);
            }
            catch (FormatException)
            {
                Console.WriteLine("Invalid storage account information provided. Please confirm the AccountName and AccountKey are valid in the app.config file - then restart the application.");
                throw;
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Invalid storage account information provided. Please confirm the AccountName and AccountKey are valid in the app.config file - then restart the sample.");
                Console.ReadLine();
                throw;
            }

            return storageAccount;
        }

        /// <summary>
        /// Create a table for the sample application to process messages in.
        /// </summary>
        /// <returns>A CloudTable object</returns>
        public static async Task<CloudTable> CreateTableAsync(string tableName)
        {
            // Retrieve storage account information from connection string.
            CloudStorageAccount storageAccount = CreateStorageAccountFromConnectionString(CloudConfigurationManager.GetSetting("StorageConnectionString"));

            // Create a table client for interacting with the table service
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            Console.WriteLine("Create a Table for the demo");

            // Create a table client for interacting with the table service
            CloudTable table = tableClient.GetTableReference(tableName);
            try
            {
                if (await table.CreateIfNotExistsAsync())
                {
                    Console.WriteLine("Created Table named: {0}", tableName);
                }
                else
                {
                    Console.WriteLine("Table {0} already exists", tableName);
                }
            }
            catch (StorageException)
            {
                Console.WriteLine("If you are running with the default configuration please make sure you have started the storage emulator. Press the Windows key and type Azure Storage to select and run it from the list of applications - then restart the sample.");
                Console.ReadLine();
                throw;
            }

            Console.WriteLine();
            return table;
        }

    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="3dp">

        <lecho.lib.hellocharts.view.ColumnChartView
            android:id="@+id/column_chart"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </android.support.v7.widget.CardView>
</FrameLayout>


text:
printf "\nRunning unit tests in PHP ${PHP_VERSION}\n"
./vendor/bin/phpspec run


text:
from setuptools import setup
import distutils.cmd
import subprocess

class TarCommand(distutils.cmd.Command):

    """ Tar the project. """

    description = 'Tar the project'
    user_options = [('with-data', None, 'Whether to tar data')]

    def initialize_options(self):
        self.with_data = False

    def finalize_options(self):
        pass

    def run(self):
        command=['/bin/tar', 'czf', 'hrnn.tar.gz', 'hrnn4sim', 'LICENSE', 'README.md', 'setup.py']
        if self.with_data:
            command += ['data/training_set.feather', 'data/valid_set.feather']
            self.announce('Taring the project with data ...')
        else:
            self.announce('Taring the project with NO data ...')
        subprocess.check_call(command)

REQUIRED_PACKAGES = [
    'keras(>=2.0.6)',
    'tensorflow(>=1.2)',
    'nltk(>=3.2.4)',
    'numpy(>=1.13.1)',
    'pandas(>=0.20.3)',
    'dask(>=0.15.3)',
    'h5py(>=2.7.1)',
    'click(>=6.7)',
    'feather-format(>=0.4.0)'
]

setup(
    name='hrnn4sim',
    version='0.1',
    #requires=REQUIRED_PACKAGES,
    install_requires=REQUIRED_PACKAGES,
    packages=['hrnn4sim', 'hrnn4sim.example'],
    description='HRNN for text similarity',
    cmdclass={
        'tar': TarCommand
    }
)


text:
using Newtonsoft.Json;
using System.Text;
using Windows.UI;
using Windows.UI.Text;
using Windows.UI.Xaml.Media;

namespace Monaco.Helpers
{
    /// <summary>
    /// Inline styles modify the text style itself and are useful for manipulating the colors and styles of text to indicate conditions.
    /// </summary>
    [JsonConverter(typeof(CssStyleConverter))]
    public sealed class CssInlineStyle : ICssStyle
    {
        public TextDecoration TextDecoration { get; set; }

        public FontWeight? FontWeight { get; set; }

        public FontStyle FontStyle { get; set; }

        // TODO: Provide Cursor: https://developer.mozilla.org/en-US/docs/Web/CSS/cursor

        // Setting a background inline will override any CssLineStyle.
        public Color? BackgroundColor { get; set; }

        public Color? ForegroundColor { get; set; }

        public uint Id { get; }

        public string Name { get; }

        public CssInlineStyle()
        {
            Id = CssStyleBroker.Register(this);
            Name = "generated-style-" + Id;
        }

        public string ToCss()
        {
            StringBuilder output = new StringBuilder(40);
            if (TextDecoration != TextDecoration.None)
            {
                string text = TextDecoration.ToString().ToLower();
                if (TextDecoration == TextDecoration.LineThrough)
                {
                    text = "line-through";
                }

                output.AppendLine(string.Format("text-decoration: {0};", text));
            }

            if (FontWeight != null && FontWeight.HasValue)
            {
                output.AppendLine(string.Format("font-weight: {0};", FontWeight.Value.Weight));
            }

            if (FontStyle != FontStyle.Normal)
            {
                output.AppendLine(string.Format("font-style: {0};", FontStyle.ToString().ToLower()));
            }

            if (BackgroundColor.HasValue)
            {
                output.AppendLine(string.Format("background: rgba({0:d},{1:d},{2:d},{3:f});", BackgroundColor.Value.R,
                                                                                BackgroundColor.Value.G,
                                                                                BackgroundColor.Value.B,
                                                                                BackgroundColor.Value.A / 255f));
            }

            if (ForegroundColor.HasValue)
            {
                output.AppendLine(string.Format("color: rgba({0:d},{1:d},{2:d},{3:f}) !important;", ForegroundColor.Value.R,
                                                                                ForegroundColor.Value.G,
                                                                                ForegroundColor.Value.B,
                                                                                ForegroundColor.Value.A / 255f));
            }

            return this.WrapCssClassName(output.ToString());
        }
    }
}


text:
<!DOCTYPE html>

<title>How do I reply to a forum post (i.e. conversation)?</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="sakai.forums" name="description">
<meta content="Forum, Topic, Conversation, post message, reply" name="search">
<link href="/library/skin/tool_base.css" media="screen" rel="stylesheet" type="text/css" charset="utf-8">
<link href="/library/skin/neo-default/tool.css" media="screen" rel="stylesheet" type="text/css" charset="utf-8">
<link href="/library/skin/neo-default/help.css" media="screen" rel="stylesheet" type="text/css" charset="utf-8">
<link href="/library/js/jquery/featherlight/0.4.0/featherlight.min.css" media="screen" rel="stylesheet" type="text/css" charset="utf-8">

How do I reply to a forum post (i.e. conversation)?

Go to Forums.

Select the Forums tool from Tool Menu in your site.

Choose a topic within a forum.

              Zoom

Click on the title of the topic to enter the topic.

Note: The message indicator text next to the topic title will tell you how many messages have been posted within that topic, and how many of them are new or unread.

Click on the title of an existing post to view the conversation.

              Zoom

Click reply.

              Zoom

You have two different options for replying to the post within the Forums tool.

Click Reply to Initial Message at the top of the conversation to reply to the first message in the conversation or thread.

Click the Reply link within the message itself to reply to the item you are currently viewing. This is the option you want to use if you would like to reply to someone else's reply.

Compose your message.

              Zoom

The message you are replying to will be displayed at the top. You can hide the message by clicking on the small downward arrow next to "Hide the message you are replying to".

Edit the reply title. (Optional)

The title will be taken from the initial message and prefilled for you, but you may modify it if you wish.

Enter your message.

              Zoom

Use the Rich Text Editor to compose your response.

Note: You may optionally click on the Insert original text link above the editor area to include the original message along with your reply.

Add attachment. (Optional)

Click the Add attachments button if you would like to browse for and attach a file.

Click Post.

After you have finished your reply, click Post to add your message to the conversation.


text:
import Ember from 'ember';

var RoundButtonComponent = Ember.Component.extend({
	 click: function() {
    this.sendAction();
  }
});

export default RoundButtonComponent;


text:
package com.s4game.core.enum_;

import java.lang.reflect.Array;

/**
 *
 * @author zeusgoogogle@gmail.com
 * @sine 2016年9月24日 下午8:44:14
 *
 */
public class EnumUtils {

	private static final int MAX_INDEX = 9999;

	/**
	 * 将实现{@link IntEnum}接口的枚举转成数组,数组下标取{@link IntEnum#getValue()}的值。
	 *
	 * @param enums
	 * @return
	 */
	public static <E extends IntEnum> E[] toArray(E[] enums) {
		int maxIndex = 0;
		for (E e : enums) {
			int curIdx = e.getId();

			if (curIdx < 0) {
				throw new IndexOutOfBoundsException("Enum index cannot be negative: Type=" + e.getClass() + ", index=" + curIdx);
			}

			if (curIdx > MAX_INDEX) {
				throw new IllegalStateException("Enum index is too big: Type=" + e.getClass() + ", index=" + curIdx);
			}

			if (curIdx > maxIndex) {
				maxIndex = curIdx;
			}

		}

		@SuppressWarnings("unchecked")
		E[] enumArray = (E[]) Array.newInstance(enums.getClass().getComponentType(), maxIndex + 1);
		for (E e : enums) {
			int curIdx = e.getId();

			E oldenum = enumArray[curIdx];
			if (oldenum != null) {
				throw new IllegalStateException("Enum has duplicate index: Type=" + e.getClass() + ", index=" + curIdx);
			}
			enumArray[curIdx] = e;
		}
		return enumArray;
	}

}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="generator" content="Hugo 0.25.1">
    <meta name="theme" content="Tranquilpeak 0.3.1-BETA">
    <title>Categories</title>
    <meta name="author" content="Daniel Abban">
    <meta name="keywords" content="">

    <link rel="icon" href="https://danielabban.github.io/favicon.png">

      <link rel="alternate" type="application/rss+xml" title="RSS" href="https://danielabban.github.io/categories/index.xml">

    <meta name="description" content="Cool Data Stuff">
    <meta property="og:description" content="Cool Data Stuff">
    <meta property="og:type" content="blog">
    <meta property="og:title" content="Categories">
    <meta property="og:url" content="/categories/">
    <meta property="og:site_name" content="Cool Data Stuff">
    <meta name="twitter:card" content="summary">
    <meta name="twitter:title" content="Cool Data Stuff">
    <meta name="twitter:description" content="Cool Data Stuff">

      <meta name="twitter:creator" content="@danabban">

      <meta property="og:image" content="//www.gravatar.com/avatar/46fd6c88483f8d5b7f603978bc7f45a9?s=640">

    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.css" />
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/helpers/jquery.fancybox-thumbs.min.css" />

    <link rel="stylesheet" href="https://danielabban.github.io/css/style-u6mk0ojoywresbx8iepslrmmhl4stuhrsxuwhkpwrkrx7mryjcaimasnk4pi.min.css" />

    Cool Data Stuff

Daniel Abban

I’m a data scientist and enjoy doing really cool stuff with data

      Categories

      Tags

      Archives

      About

      Home

      GitHub

      RSS

          <form id="filter-form" action="##">
            <input name="category" type="text" class="form-control input--xlarge"
                   placeholder="Search category" autofocus="autofocus">
          </form>

                  eda

                  model

                  r

                  tranquilpeak

       / features

                  visualization

                    eda (1)

                        Grocery Odering Prediction -
  August 28, 2017

                    model (1)

                        Predicting the Success of Bank Telemarketing -
  April 11, 2017

                    r (1)

                        Hello R Markdown -
  July 23, 2015

                    tranquilpeak (2)

                        Cover image showcase -
  May 13, 2015

                        Elements showcase -
  May 28, 2015

    features (2)

        Cover image showcase -
  May 13, 2015

        Elements showcase -
  May 28, 2015

                    visualization (2)

                        Visualizing Data from HR -
  August 1, 2017

                        Word cloud on President Nana Akufo-Addo's Inaugural Speech -
  August 10, 2017

    © 2017 Daniel Abban. All Rights Reserved

Daniel Abban

I’m a data scientist and enjoy doing really cool stuff with data

        Data Scientist

        Ghana


text:
/**
 * @fileoverview Interpolator for key frame animation
 * @author Tony Parisi
 */
goog.provide('Vizi.Interpolator');
goog.require('Vizi.EventDispatcher');

//Interpolator class
//Construction/initialization
Vizi.Interpolator = function(param)
{
	Vizi.EventDispatcher.call(param);

	param = param || {};

	this.keys = param.keys || [];
	this.values = param.values || [];
	this.target = param.target ? param.target : null;
	this.running = false;
}

goog.inherits(Vizi.Interpolator, Vizi.EventDispatcher);

Vizi.Interpolator.prototype.realize = function()
{
	if (this.keys && this.values)
	{
		this.setValue(this.keys, this.values);
	}
}

Vizi.Interpolator.prototype.setValue = function(keys, values)
{
	this.keys = [];
	this.values = [];
	if (keys && keys.length && values && values.length)
	{
		this.copyKeys(keys, this.keys);
		this.copyValues(values, this.values);
	}
}

//Copying helper functions
Vizi.Interpolator.prototype.copyKeys = function(from, to)
{
	var i = 0, len = from.length;
	for (i = 0; i < len; i++)
	{
		to[i] = from[i];
	}
}

Vizi.Interpolator.prototype.copyValues = function(from, to)
{
	var i = 0, len = from.length;
	for (i = 0; i < len; i++)
	{
		var val = {};
		this.copyValue(from[i], val);
		to[i] = val;
	}
}

Vizi.Interpolator.prototype.copyValue = function(from, to)
{
	for ( var property in from ) {

		if ( from[ property ] === null ) {
		continue;
		}

		to[ property ] = from[ property ];
	}
}

//Interpolation and tweening methods
Vizi.Interpolator.prototype.interp = function(fract)
{
	var value;
	var i, len = this.keys.length;
	if (fract == this.keys[0])
	{
		value = this.values[0];
	}
	else if (fract >= this.keys[len - 1])
	{
		value = this.values[len - 1];
	}

	for (i = 0; i < len - 1; i++)
	{
		var key1 = this.keys[i];
		var key2 = this.keys[i + 1];

		if (fract >= key1 && fract <= key2)
		{
			var val1 = this.values[i];
			var val2 = this.values[i + 1];
			value = this.tween(val1, val2, (fract - key1) / (key2 - key1));
		}
	}

	if (this.target)
	{
		this.copyValue(value, this.target);
	}
	else
	{
		this.publish("value", value);
	}
}

Vizi.Interpolator.prototype.tween = function(from, to, fract)
{
	var value = {};
	for ( var property in from ) {

		if ( from[ property ] === null ) {
		continue;
		}

		var range = to[property] - from[property];
		var delta = range * fract;
		value[ property ] = from[ property ] + delta;
	}

	return value;
}


text:
<?php

declare(strict_types=1);

namespace App\IqrfAppModule\Forms;

use App\Forms\FormFactory;
use App\IqrfAppModule\Model\IqrfNetManager;
use Nette;
use Nette\Application\UI\Form;
use Nette\Forms\Controls\SubmitButton;

/**
 * IQMESH Bonding form factory.
 */
class IqrfNetBondingFormFactory {

	use Nette\SmartObject;

	/**
	 * @var IqrfNetManager IQMESH Network manager
	 */
	private $manager;

	/**
	 * @var FormFactory Generic form factory
	 */
	private $factory;

	/**
	 * Constructor
	 * @param FormFactory $factory Generic form factory
	 * @param IqrfNetManager $manager IQMESH Network manager
	 */
	public function __construct(FormFactory $factory, IqrfNetManager $manager) {
		$this->factory = $factory;
		$this->manager = $manager;
	}

	/**
	 * Create IQMESH bonding form
	 * @return Form IQMESH bonding form
	 */
	public function create(): Form {
		$form = $this->factory->create();
		$form->setTranslator($form->getTranslator()->domain('iqrfapp.network-manager.bonding'));
		$form->addCheckbox('autoAddress', 'autoAddress');
		$form->addText('address', 'address')->setDefaultValue('01')
				->addConditionOn($form['autoAddress'], Form::EQUAL, false)
				->addRule(Form::PATTERN, 'messages.address', '[0-9a-fA-F]{1,2}')
				->setRequired('messages.address');
		$form->addSubmit('bond', 'bondNode')->onClick[] = [$this, 'bondNode'];
		$form->addSubmit('rebond', 'rebondNode')->onClick[] = [$this, 'rebondNode'];
		$form->addSubmit('remove', 'removeNode')->onClick[] = [$this, 'removeNode'];
		$form->addSubmit('clear', 'clearAllBonds')->onClick[] = [$this, 'clearAllBonds'];
		$form->addProtection('core.errors.form-timeout');
		return $form;
	}

	/**
	 * Bond new node
	 * @param SubmitButton $button Submit button for bonding
	 */
	public function bondNode(SubmitButton $button) {
		$values = $button->getForm()->getValues();
		$address = $values['autoAddress'] ? '00' : $values['address'];
		$this->manager->bondNode($address);
	}

	/**
	 * Clear all bonds
	 * @param SubmitButton $button Submit button for cleaning all bonds
	 */
	public function clearAllBonds(SubmitButton $button) {
		$this->manager->clearAllBonds();
	}

	/**
	 * Rebond node
	 * @param SubmitButton $button Submit button for rebonding
	 */
	public function rebondNode(SubmitButton $button) {
		$values = $button->getForm()->getValues();
		$this->manager->rebondNode($values['address']);
	}

	/**
	 * Remove node
	 * @param SubmitButton $button Submit button for removing node
	 */
	public function removeNode(SubmitButton $button) {
		$values = $button->getForm()->getValues();
		$this->manager->removeNode($values['address']);
	}

}


text:
static NSString *const kCellIdentifier  = @"fieldSelectionMultipleCell";

static NSString *const kSeparatorValue  = @", ";

@interface ROFilterFieldSelection ()

@end

@implementation ROFilterFieldSelection

- (instancetype)initWithFieldLabel:(NSString *)fieldLabel
                         fieldName:(NSString *)fieldName
                    formController:(ROFilterViewController *)formController
                            single:(BOOL)single
{
    self = [super init];
    if (self) {
        _fieldLabel = fieldLabel;
        _fieldName = fieldName;
        _formController = formController;
        _single = single;
        _required = NO;
    }
    return self;
}

+ (instancetype)fieldLabel:(NSString *)fieldLabel
                 fieldName:(NSString *)fieldName
            formController:(ROFilterViewController *)formController
                    single:(BOOL)single
{
    return [[self alloc] initWithFieldLabel:fieldLabel
                                  fieldName:fieldName
                             formController:formController
                                     single:single];
}

- (NSString *)placeholder
{
    if (!_placeholder) {
        _placeholder = NSLocalizedString(@"Select option", nil);
    }
    return _placeholder;
}

- (NSString *)fieldValue
{
    if (self.optionsSelected && [self.optionsSelected count] != 0) {
        return [self.optionsSelected componentsJoinedByString:kSeparatorValue];
    }
    return nil;
}

- (id<RODatasource>)datasource {

    if (!_datasource) {
        _datasource = self.formController.dataLoader.datasource;
    }
    return _datasource;
}

- (void)setFieldValue:(NSString *)fieldValue
{
    if (fieldValue) {
        self.optionsSelected = [[fieldValue componentsSeparatedByString:kSeparatorValue] mutableCopy];
    } else {
        [self.optionsSelected removeAllObjects];
        self.optionsSelected = nil;
    }
}

- (id<ROFilter>)filter
{
    if (self.optionsSelected && [self.optionsSelected count] != 0) {
        return [ROStringListFilter create:self.fieldName values:self.optionsSelected];
    }
    return nil;
}

- (void)reset
{
    [self.optionsSelected removeAllObjects];
    self.optionsSelected = nil;
}

- (id)value
{
    return self.optionsSelected;
}

#pragma mark - UI

- (NSInteger)numberOfRows
{
    return 1;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    return self.fieldLabel;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCellIdentifier];

        UIView *selectecedView = [[UIView alloc] init];
        selectecedView.backgroundColor = [[ROStyle sharedInstance] selectedColor];
        cell.selectedBackgroundView = selectecedView;

        cell.backgroundColor = [[[ROStyle sharedInstance] backgroundColor] colorWithAlphaComponent:0.5f];
        cell.textLabel.font = [[ROStyle sharedInstance] font];
        cell.textLabel.textColor = [[ROStyle sharedInstance] foregroundColor];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    cell.textLabel.text = self.optionsSelected ? [self.optionsSelected componentsJoinedByString:kSeparatorValue] : self.placeholder;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    ROOptionsViewController *optionsViewController = [ROOptionsViewController new];
    optionsViewController.formFieldSelection = self;
    optionsViewController.dataLoader = self.formController.dataLoader;
    [self.formController.navigationController pushViewController:optionsViewController animated:YES];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return [[[ROStyle sharedInstance] tableViewCellHeightMin] floatValue];
}

@end


text:
package menu;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import abstracts.Item;
import abstracts.SubMenu;
import common.Debug;
import common.Tileable;
import dialogue.Dialogue;
import entity.Player;
import enums.ItemCategories;
import item.Bicycle;
import item.KeyItem;
import item.ModdedItem;
import item.ReturnMenu;
import level.WorldConstants;
import main.Game;
import main.MainComponent;
import main.StateManager;
import main.StateManager.GameState;
import resources.Art;
import screen.Scene;
import utility.DialogueBuilder;

public class Inventory extends SubMenu {

	private enum InventoryState {
		SELECTION,
		MENU,
		USE,
		TOSS,
		SET
	}

	private final List<Map.Entry<Item, Integer>> potions;
	private final List<Map.Entry<Item, Integer>> keyItems;
	private final List<Map.Entry<Item, Integer>> pokéballs;
	private final List<Map.Entry<Item, Integer>> TMs_HMs;
	private final List<Map.Entry<Item, Integer>> unsortedItems;
	private final List<String> selectionMenu;
	private int itemCursor;
	private int arrowPosition;
	private int itemListSpan = 0;
	private ItemCategories category;
	private byte tick = (byte) 0x0;
	private InventoryState state;
	private int stateArrowPosition = 0;
	private int amountToToss = 0;
	private int set_tokenIterator = 0;
	private boolean set_end;
	private int set_subStringIterator = 0;
	private final List<String> set_completedLines;
	private Thread inventoryDialogueThread;
	private Dialogue inventoryDialogue;

	private Game game;

	public static final String MENU_USE = "USE";
	public static final String MENU_SET = "SET";
	public static final String MENU_TOSS = "TOSS";
	public static final String MENU_CANCEL = "CANCEL";

	/**
	 * Creates the Inventory submenu, with all the default settings.
	 *
	 * @param name
	 *            The submenu title that is to be displayed in the start menu.
	 * @param enabled
	 *            The description that is to be shown when the submenu is activated/enabled.
	 * @param disabled
	 *            The description that is to be shown when the submenu is deactivated/disabled.
	 * @param game
	 *            The Game object that controls most of the actions/events the player has done when
	 *            managing/using the Inventory.
	 * @return Nothing. It's a constructor after all.
	 */
	public Inventory(Game game) {
		super(WorldConstants.MENU_ITEM_NAME_INVENTORY, WorldConstants.MENU_ITEM_DESC_INVENTORY, GameState.INVENTORY);
		this.game = game;
		this.itemCursor = 0;
		this.potions = new ArrayList<>();
		this.keyItems = new ArrayList<>();
		this.pokéballs = new ArrayList<>();
		this.TMs_HMs = new ArrayList<>();
		this.unsortedItems = new ArrayList<>();
		this.selectionMenu = new ArrayList<>();

		Item returnExit = new ReturnMenu("RETURN", "Close inventory.", null, 0);
		returnExit.setReturnMenu(true);

		this.potions.add(Map.entry(returnExit, Integer.MAX_VALUE));
		this.keyItems.add(Map.entry(returnExit, Integer.MAX_VALUE));
		this.pokéballs.add(Map.entry(returnExit, Integer.MAX_VALUE));
		this.TMs_HMs.add(Map.entry(returnExit, Integer.MAX_VALUE));
		this.unsortedItems.add(Map.entry(returnExit, Integer.MAX_VALUE));
		this.arrowPosition = 0;
		this.category = ItemCategories.POTIONS;
		this.state = InventoryState.SELECTION;
		this.set_completedLines = new ArrayList<>();
		this.inventoryDialogue = new Dialogue();
		this.needsFlashingAnimation = true;
		this.exitsToGame = false;
	}

	public void addItem(Item item) {
		Map.Entry<Item, Integer> returnItem = null;
		List<Map.Entry<Item, Integer>> categoryList = this.getItemCategoryList(item);
		switch (item.getCategory()) {
			case KEYITEMS: {
				// De-duplicate any key items
				for (Iterator<Map.Entry<Item, Integer>> it = categoryList.iterator(); it.hasNext();) {
					Map.Entry<Item, Integer> entry = it.next();
					Item entryItem = entry.getKey();
					if (entryItem.isReturnMenu()) {
						returnItem = entry;
						continue;
					}
					int count = entry.getValue().intValue();
					if (count > 1 || count < 0 || entryItem.equals(item)) {
						it.remove();
					}
				}

				// Add the key item.
				item.setInventory(this);
				categoryList.add(Map.entry(item, 1));
				break;
			}
			case ALL:
			case POKEBALLS:
			case POTIONS:
			case TM_HM: {
				boolean hasAdded = false;
				for (Map.Entry<Item, Integer> entry : categoryList) {
					Item entryItem = entry.getKey();
					if (entryItem.isReturnMenu()) {
						returnItem = entry;
						continue;
					}
					if (entryItem.equals(item)) {
						entry.setValue(entry.getValue() + 1);
						hasAdded = true;
						break;
					}
				}
				if (!hasAdded) {
					item.setInventory(this);
					categoryList.add(Map.entry(item, 1));
				}
				break;
			}
			default: {
				// Ignore
				break;
			}
		}

		// In order to maintain the order of items, and always put the RETURN menu at the very end, we need
		// to remove the RETURN from the list, then re-add the item back in.
		categoryList.remove(returnItem);
		categoryList.add(returnItem);
	}

	/**
	 * Adds an item with its text description into the Inventory, being categorized into its relevant
	 * "pocket" of the player's bag.
	 *
	 * @param itemText
	 *            The item description of the item that is to be added into the Inventory.
	 * @param item
	 *            The item object that is to be added into the Inventory.
	 * @return Nothing.
	 */
	public void addItem(ModdedItem itemText) {
		boolean heldItemExists = false;
		List<Map.Entry<Item, Integer>> list = this.getItemCategoryList(itemText);
		CHECK_LOOP:
		for (int i = 0; i < list.size(); i++) {
			Map.Entry<Item, Integer> entry = list.get(i);
			if (entry.getKey().getID() == itemText.id) {
				switch (entry.getKey().getCategory()) {
					case KEYITEMS: {
						if (entry.getValue() < 1) {
							heldItemExists = false;
							break CHECK_LOOP;
						}
						break;
					}
					case ALL:
					case POKEBALLS:
					case POTIONS:
					case TM_HM:
						entry.setValue(entry.getValue().intValue() + 1);
						break;
					default: {
						// Ignore
						break;
					}
				}
				heldItemExists = true;
				break;
			}
		}
		if (!heldItemExists) {
			Item item = null;
			switch (itemText.type) {
				case DUMMY:
					item = new ReturnMenu(itemText);
					list.add(0, new AbstractMap.SimpleEntry<>(item, 1));
					break;
				case ACTION: {
					// Action items must have ID, else it would be a dummy item.
					switch (itemText.id) {
						case WorldConstants.ITEM_BICYCLE:
							item = new Bicycle(itemText);
							list.add(0, new AbstractMap.SimpleEntry<>(item, 1));
							break;
						default:
							// Dummy item creation.
							item = new ReturnMenu(itemText);
							list.add(0, new AbstractMap.SimpleEntry<>(item, 1));
							break;
					}
					break;
				}
				default:
					// Nothing to see here.
					break;
			}

		}
	}

	public void removeItem(Item item) {
		// If the item is a "Return" menu, we do not remove it.
		if (item.isReturnMenu() || (item.getCategory() == ItemCategories.KEYITEMS))
			// Cannot remove key items, therefore, this does nothing.
			return;

		List<Map.Entry<Item, Integer>> categoryList = this.getItemCategoryList(item);
		switch (item.getCategory()) {
			case KEYITEMS: {
				Debug.error("Removing Key Items - This is impossible to reach here.");
				break;
			}
			case ALL:
			case POKEBALLS:
			case POTIONS:
			case TM_HM: {
				for (Iterator<Map.Entry<Item, Integer>> it = categoryList.iterator(); it.hasNext();) {
					Map.Entry<Item, Integer> entry = it.next();
					if (entry.getKey().equals(item)) {
						if (entry.getValue() - 1 <= 0) {
							it.remove();
						}
						else {
							entry.setValue(entry.getValue() - 1);
						}
						break;
					}
				}
				break;
			}
			default: {
				// Ignore
				break;
			}
		}
	}

	/**
	 * Initializes the Inventory with the inputs.
	 *
	 *

	 * Does not initialize anything else.
	 *
	 * @param keys
	 *            The input keys the player is using.
	 * @return Itself.
	 */
	/*
	@Override
	public SubMenu initialize(Keys keys) {
		// TODO: Add new inventory art for background.
		this.keys = keys;
		return Inventory.this;
	}
	*/

	/**
	 * Renders the Inventory to the screen.
	 *
	 *

	 * Note that it doesn't render the {@link screen.Scene#getBufferedImage() BufferedImage} to the
	 * actual {@link main.MainComponent#getBufferStrategy() BufferStrategy}.
	 *
	 * @param output
	 *            The display that is to be rendered.
	 * @param graphics
	 *            The Graphics object that the main component creates using
	 *            {@link java.awt.Canvas#getBufferStrategy() BufferStrategy} object.
	 * @return Nothing.
	 */
	@Override
	public void render(Scene output, Graphics graphics) {
		// WARNING: Due to the way it was rendered, the most direct method of rendering
		// is used.
		// Do not edit the order or shorten it into multiple calls of private methods,
		// it has been done before, and has made this problem even harder to solve.
		switch (this.state) {
			default: {
				output.blit(Art.inventory_gui, 0, 0);
				this.inventoryDialogue.renderInformationBox(output, 0, 6, 9, 2);
				this.renderListBox(output, 3, 1, 7, 5);
				output.blit(
					Art.dialogue_pointer, 18 * MainComponent.GAME_SCALE,
					((Tileable.HEIGHT * this.arrowPosition)) + 12
				);
				switch (this.category) {
					case POTIONS:
					default:
						output.blit(Art.inventory_backpack_potions, 0, 8);
						output.blit(Art.inventory_tag_potions, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case KEYITEMS:
						output.blit(Art.inventory_backpack_keyItems, 0, 8);
						output.blit(Art.inventory_tag_keyItems, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case POKEBALLS:
						output.blit(Art.inventory_backpack_pokeballs, 0, 8);
						output.blit(Art.inventory_tag_pokeballs, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case TM_HM:
						output.blit(Art.inventory_backpack_TM_HM, 0, 8);
						output.blit(Art.inventory_tag_TM_HM, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case ALL:
						output.blit(Art.inventory_backpack_unsorted, 0, 8);
						output.blit(Art.inventory_tag_unsorted, 0, Tileable.HEIGHT * 4 + 3);
						break;
				}
				Graphics2D g2d = output.getBufferedImage().createGraphics();
				this.renderText(g2d);
				g2d.dispose();
				break;
			}
			case MENU: {
				output.blit(Art.inventory_gui, 0, 0);
				this.inventoryDialogue.renderInformationBox(output, 0, 6, 9, 2);
				this.renderListBox(output, 3, 1, 7, 5);
				output.blit(
					Art.dialogue_pointer, 18 * MainComponent.GAME_SCALE,
					((Tileable.HEIGHT * this.arrowPosition)) + 12
				);
				switch (this.category) {
					case POTIONS:
					default:
						output.blit(Art.inventory_backpack_potions, 0, 8);
						output.blit(Art.inventory_tag_potions, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case KEYITEMS:
						output.blit(Art.inventory_backpack_keyItems, 0, 8);
						output.blit(Art.inventory_tag_keyItems, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case POKEBALLS:
						output.blit(Art.inventory_backpack_pokeballs, 0, 8);
						output.blit(Art.inventory_tag_pokeballs, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case TM_HM:
						output.blit(Art.inventory_backpack_TM_HM, 0, 8);
						output.blit(Art.inventory_tag_TM_HM, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case ALL:
						output.blit(Art.inventory_backpack_unsorted, 0, 8);
						output.blit(Art.inventory_tag_unsorted, 0, Tileable.HEIGHT * 4 + 3);
						break;
				}
				BufferedImage old = output.getBufferedImage();
				Graphics2D g2d = old.createGraphics();
				this.renderText(g2d);
				if (!this.selectionMenu.isEmpty()) {
					this.inventoryDialogue.renderInformationBox(
						output, 5, 5 - (this.selectionMenu.size() - 1), 4,
						this.selectionMenu.size() - 1
					);
					output.blit(
						Art.dialogue_pointer, 30 * MainComponent.GAME_SCALE,
						(12 * this.stateArrowPosition + Tileable.HEIGHT * (7 - this.selectionMenu.size())) - 8
					);
					List<Map.Entry<Item, Integer>> list = this.getCurrentList();
					this.renderItemMenuText(list, g2d);
				}
				g2d.dispose();
				break;
			}
			case TOSS: {
				output.blit(Art.inventory_gui, 0, 0);
				this.inventoryDialogue.renderInformationBox(output, 0, 6, 9, 2);
				this.renderListBox(output, 3, 1, 7, 5);
				output.blit(
					Art.dialogue_pointer, 18 * MainComponent.GAME_SCALE,
					((Tileable.HEIGHT * this.arrowPosition)) + 12
				);
				this.inventoryDialogue.renderInformationBox(output, 5, 4, 4, 1);
				switch (this.category) {
					case POTIONS:
					default:
						output.blit(Art.inventory_backpack_potions, 0, 8);
						output.blit(Art.inventory_tag_potions, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case KEYITEMS:
						output.blit(Art.inventory_backpack_keyItems, 0, 8);
						output.blit(Art.inventory_tag_keyItems, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case POKEBALLS:
						output.blit(Art.inventory_backpack_pokeballs, 0, 8);
						output.blit(Art.inventory_tag_pokeballs, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case TM_HM:
						output.blit(Art.inventory_backpack_TM_HM, 0, 8);
						output.blit(Art.inventory_tag_TM_HM, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case ALL:
						output.blit(Art.inventory_backpack_unsorted, 0, 8);
						output.blit(Art.inventory_tag_unsorted, 0, Tileable.HEIGHT * 4 + 3);
						break;
				}
				BufferedImage old = output.getBufferedImage();
				Graphics2D g2d = old.createGraphics();
				this.renderText(g2d);
				List<Map.Entry<Item, Integer>> list = this.getCurrentList();
				this.renderItemMenuText(list, g2d);
				g2d.dispose();
				break;
			}
			case SET: {
				output.blit(Art.inventory_gui, 0, 0);
				this.inventoryDialogue.renderInformationBox(output, 0, 6, 9, 2);
				this.renderListBox(output, 3, 1, 7, 5);
				output.blit(
					Art.dialogue_pointer, 18 * MainComponent.GAME_SCALE,
					((Tileable.HEIGHT * this.arrowPosition)) + 12
				);
				switch (this.category) {
					case POTIONS:
					default:
						output.blit(Art.inventory_backpack_potions, 0, 8);
						output.blit(Art.inventory_tag_potions, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case KEYITEMS:
						output.blit(Art.inventory_backpack_keyItems, 0, 8);
						output.blit(Art.inventory_tag_keyItems, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case POKEBALLS:
						output.blit(Art.inventory_backpack_pokeballs, 0, 8);
						output.blit(Art.inventory_tag_pokeballs, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case TM_HM:
						output.blit(Art.inventory_backpack_TM_HM, 0, 8);
						output.blit(Art.inventory_tag_TM_HM, 0, Tileable.HEIGHT * 4 + 3);
						break;
					case ALL:
						output.blit(Art.inventory_backpack_unsorted, 0, 8);
						output.blit(Art.inventory_tag_unsorted, 0, Tileable.HEIGHT * 4 + 3);
						break;
				}
				Graphics2D g2d = output.getBufferedImage().createGraphics();
				this.renderText(g2d);
				g2d.dispose();
				break;
			}
		}
	}

	/**
	 * Resets the position of the pointer that points to the items.
	 *
	 * @return Nothing.
	 */
	public void resetCursor() {
		this.itemCursor = 0;
		this.arrowPosition = 0;
		this.itemListSpan = 0;
		this.resetSelectionCursor();
		this.category = ItemCategories.POTIONS;
		this.state = InventoryState.SELECTION;
	}

	/**
	 * Resets the position of the pointer and delete the selection menu commands of the item that the
	 * player is allowed to do.
	 *
	 * @return Nothing.
	 */
	public void resetSelectionCursor() {
		this.selectionMenu.clear();
		this.stateArrowPosition = 0;
	}

	/**
	 * Updates the Inventory each tick.
	 *
	 * @return Nothing.
	 */
	@Override
	public void tick() {
		switch (this.state) {
			// This state is when the player is selecting from the list of items in the Inventory.
			case SELECTION: {
				if (Game.keys.isUpPressed()) {
					Game.keys.upReceived();
					if (this.itemCursor > 0) {
						this.itemCursor--;
						if (this.arrowPosition > 0)
							this.arrowPosition--;
					}
				}
				else if (Game.keys.isDownPressed()) {
					Game.keys.downReceived();
					List<Map.Entry<Item, Integer>> list = this.getCurrentList();
					if (this.itemCursor < list.size() - 1) {
						this.itemCursor++;
						if (this.arrowPosition < 4)
							this.arrowPosition++;
					}
				}
				else if (Game.keys.isLeftPressed()) {
					Game.keys.leftReceived();
					this.category = ItemCategories.getWrapped(this.category.getID() - 1);
					this.tick = 0x0;
					this.itemCursor = this.arrowPosition = 0;
				}
				else if (Game.keys.isRightPressed()) {
					Game.keys.rightReceived();
					this.category = ItemCategories.getWrapped(this.category.getID() + 1);
					this.tick = 0x0;
					this.itemCursor = this.arrowPosition = 0;
				}
				else if (Game.keys.isSecondaryPressed()) {
					Game.keys.secondaryReceived();

					// Exiting the Inventory.
					this.resetCursor();
					this.exit();
				}
				else if (Game.keys.isPrimaryPressed()) {
					Game.keys.primaryReceived();

					// This state is used when the player has selected an item, and wants to do
					// something to the item.
					// Example, using the item, tossing the item, etc.
					List<Map.Entry<Item, Integer>> list = this.getCurrentList();
					Map.Entry<Item, Integer> entry = list.get(this.itemCursor);
					if (entry.getKey().getCategory() == null && entry.getValue() == Integer.MAX_VALUE) {
						// If getCategory() returns null, it is not an item.

						// Return option is selected.
						this.resetCursor();
						this.exit();
						break;
					}
					this.state = InventoryState.MENU;
					this.resetSelectionCursor();
					if (this.selectionMenu.isEmpty()) {
						Item item = list.get(this.itemCursor).getKey();
						if (item != null && list.get(this.itemCursor).getValue() != Integer.MAX_VALUE) {
							switch (item.getCategory()) {
								case ALL:
								case POTIONS:
								case POKEBALLS:
								case TM_HM:
									this.selectionMenu.addAll(item.getAvailableCommands());
									break;
								case KEYITEMS:
									this.selectionMenu.addAll(item.getAvailableCommands());
									break;
							}
						}
					}
				}
				break;
			}
			// This state is when the player is interacting with the menu after selecting an item from the list
			// of items.
			case MENU: {
				if (Game.keys.isUpPressed()) {
					Game.keys.upReceived();
					if (this.stateArrowPosition > 0)
						this.stateArrowPosition--;
				}
				else if (Game.keys.isDownPressed()) {
					Game.keys.downReceived();
					if (this.stateArrowPosition < this.selectionMenu.size() - 1)
						this.stateArrowPosition++;
				}
				else if (Game.keys.isSecondaryPressed()) {
					Game.keys.secondaryReceived();
					this.state = InventoryState.SELECTION;
					this.resetSelectionCursor();
				}
				else if (Game.keys.isPrimaryPressed()) {
					Game.keys.primaryReceived();
					String command = this.selectionMenu.get(this.stateArrowPosition);
					if (command.equals(Inventory.MENU_CANCEL)) {
						this.state = InventoryState.SELECTION;
						this.resetSelectionCursor();
					}
					else if (command.equals(Inventory.MENU_TOSS)) {
						this.state = InventoryState.TOSS;
						this.resetSelectionCursor();
					}
					else if (command.equals(Inventory.MENU_USE)) {
						this.state = InventoryState.USE;
						this.resetSelectionCursor();
					}
					else if (command.equals(Inventory.MENU_SET)) {
						this.state = InventoryState.SET;
						this.resetSelectionCursor();
						this.set_end = false;
						this.set_tokenIterator = 0;
						this.set_subStringIterator = 0;
						this.set_completedLines.clear();
					}
				}
				break;
			}
			// This is the state when the player chooses the USE menu action.
			case USE: {
				List<Map.Entry<Item, Integer>> list = this.getCurrentList();
				Map.Entry<Item, Integer> entry = list.get(this.itemCursor);
				entry.getKey().doAction(this.game);
				this.resetCursor();
				break;
			}
			// This is the state when the player chooses the TOSS menu action.
			case TOSS: {
				if (Game.keys.isUpPressed()) {
					Game.keys.upReceived();
					List<Map.Entry<Item, Integer>> list = this.getCurrentList();
					Map.Entry<Item, Integer> entry = list.get(this.itemCursor);
					if (entry.getValue() > this.amountToToss)
						this.amountToToss++;
				}
				else if (Game.keys.isDownPressed()) {
					Game.keys.downReceived();
					if (this.amountToToss > 0)
						this.amountToToss--;
				}
				else if (Game.keys.isSecondaryPressed()) {
					Game.keys.secondaryReceived();
					this.resetSelectionCursor();
					this.state = InventoryState.MENU;
					if (this.selectionMenu.isEmpty()) {
						List<Map.Entry<Item, Integer>> list = this.getCurrentList();
						Item item = list.get(this.itemCursor).getKey();
						if (item != null && list.get(this.itemCursor).getValue() != Integer.MAX_VALUE) {
							switch (item.getCategory()) {
								case ALL:
								case POTIONS:
								case POKEBALLS:
								case TM_HM:
									this.selectionMenu.addAll(item.getAvailableCommands());
									break;
								case KEYITEMS:
									this.selectionMenu.addAll(item.getAvailableCommands());
									break;
							}
						}
					}
				}
				else if (Game.keys.isPrimaryPressed()) {
					Game.keys.primaryReceived();
					for (int i = 0; i < this.amountToToss; i++) {
						this.tossItem();
					}
					this.resetSelectionCursor();
					this.state = InventoryState.SELECTION;
				}
				break;
			}
			// This is the state when the players chooses the SET menu action.
			case SET: {
				Map.Entry<Item, Integer> entry = this.getCurrentList().get(this.itemCursor);
				KeyItem actionItem = (KeyItem) entry.getKey();
				if (!this.game.itemHasBeenRegistered(actionItem)) {
					this.game.setRegisteredItem(actionItem);
				}
				if (this.set_end && Game.keys.isPrimaryPressed()) {
					Game.keys.primaryReceived();
					this.resetSelectionCursor();
					this.state = InventoryState.SELECTION;
				}
				break;
			}
		}

		if (this.itemCursor >= (this.itemListSpan + 5)) {
			this.itemListSpan++;
		}
		else if (this.itemCursor < this.itemListSpan) {
			this.itemListSpan--;
		}
		if (this.tick < 0xE)
			this.tick++;
	}

	/**
	 * Toss away an item.
	 *
	 *

	 * Can be put in a loop to toss away multiple items at the same time.
	 *
	 * @return Nothing.
	 */
	public void tossItem() {
		List<Map.Entry<Item, Integer>> list = this.getCurrentList();
		Map.Entry<Item, Integer> entry = list.get(this.itemCursor);
		if (entry.getValue() - 1 <= 0)
			list.remove(this.itemCursor);
		else
			entry.setValue(entry.getValue().intValue() - 1);
	}

	/**
	 * List given in order:
	 *

	 * Potions -> KeyItems -> Pokéballs -> TMs_HMs.
	 *
	 * @return
	 */
	public List<List<Map.Entry<Item, Integer>>> getAllItemsList() {
		List<List<Map.Entry<Item, Integer>>> result = new ArrayList<>();
		result.add(this.potions);
		result.add(this.keyItems);
		result.add(this.pokéballs);
		result.add(this.TMs_HMs);
		result.add(this.unsortedItems);
		return result;
	}

	/**
	 * List given in any order, so as long as the key strings match:
	 *

	 *
Potions
	 *
KeyItems
	 *
Pokéballs
	 *
TMs_HMs.
	 *

	 *
	 * @return
	 */
	public Map<ItemCategories, List<Map.Entry<Item, Integer>>> getAllMappedItemsList() {
		Map<ItemCategories, List<Map.Entry<Item, Integer>>> result = new HashMap<>();
		result.put(ItemCategories.POTIONS, this.potions);
		result.put(ItemCategories.KEYITEMS, this.keyItems);
		result.put(ItemCategories.POKEBALLS, this.pokéballs);
		result.put(ItemCategories.TM_HM, this.TMs_HMs);
		result.put(ItemCategories.ALL, this.unsortedItems);
		return result;
	}

	public List<Map.Entry<Item, Integer>> getPotions() {
		return this.potions;
	}

	public List<Map.Entry<Item, Integer>> getKeyItems() {
		return this.keyItems;
	}

	public List<Map.Entry<Item, Integer>> getPokeballs() {
		return this.pokéballs;
	}

	public List<Map.Entry<Item, Integer>> getTM_HM() {
		return this.TMs_HMs;
	}

	public Player getPlayer() {
		return this.game.getPlayer();
	}

	public StateManager getStateManager() {
		return this.game.getStateManager();
	}

	// -----------------------------------------
	// PRIVATE METHODS
	// -----------------------------------------

	/**
	 * Obtains the list of items the player is currently browsing in the Inventory.
	 *
	 * @return A list of all the items and their corresponding amount of the items that the player is
	 *         currently browsing in.
	 */
	private List<Map.Entry<Item, Integer>> getCurrentList() {
		List<Map.Entry<Item, Integer>> result = null;
		switch (this.category) {
			case POTIONS:
				result = this.potions;
				break;
			case KEYITEMS:
				result = this.keyItems;
				break;
			case POKEBALLS:
				result = this.pokéballs;
				break;
			case TM_HM:
				result = this.TMs_HMs;
				break;
			case ALL:
				result = this.unsortedItems;
				break;
		}
		return result;
	}

	/**
	 * Obtains the list of items of the category the item belongs to in the Inventory.
	 *
	 * @param itemText
	 *            The ItemText object that holds information for obtaining the list of items that it
	 *            belongs to.
	 * @return A list of all the items and their corresponding amount of the items that the targeted
	 *         item belongs to.
	 */
	private List<Map.Entry<Item, Integer>> getItemCategoryList(ModdedItem itemText) {
		List<Map.Entry<Item, Integer>> result = null;
		switch (itemText.category) {
			case POTIONS:
				result = this.potions;
				break;
			case KEYITEMS:
				result = this.keyItems;
				break;
			case POKEBALLS:
				result = this.pokéballs;
				break;
			case TM_HM:
				result = this.TMs_HMs;
				break;
			case ALL:
				result = this.unsortedItems;
				break;
		}
		return result;
	}

	/**
	 * Obtains the list of items of the category the item belongs to in the Inventory.
	 *
	 * @param item
	 *            The target item that is used to get the list of items that the targeted item belongs
	 *            to.
	 * @return A list of all the items and their corresponding amount of the items that the targeted
	 *         item belongs to.
	 */
	private List<Map.Entry<Item, Integer>> getItemCategoryList(Item item) {
		List<Map.Entry<Item, Integer>> result = null;
		switch (item.getCategory()) {
			case POTIONS:
				result = this.potions;
				break;
			case KEYITEMS:
				result = this.keyItems;
				break;
			case POKEBALLS:
				result = this.pokéballs;
				break;
			case TM_HM:
				result = this.TMs_HMs;
				break;
			case ALL:
				result = this.unsortedItems;
				break;
		}
		return result;
	}

	/**
	 * Retrieves the list of available commands the item allows from the given list of items.
	 *
	 * @param list
	 *            The list of all the items that is currently being active and browsed by the player.
	 *
	 * @param graphics
	 *            The Graphics object that renders the custom font to the screen.
	 *
	 * @return Nothing.
	 */
	private void renderItemMenuText(List<Map.Entry<Item, Integer>> list, Graphics graphics) {
		switch (this.state) {
			case TOSS: {
				Item item = list.get(this.itemCursor).getKey();
				if (item.getCategory() == null)
					break;
				if (item != null && list.get(this.itemCursor).getValue() != Integer.MAX_VALUE
					&& list.get(this.itemCursor).getValue() > 0 && this.selectionMenu.isEmpty()) {
					this.selectionMenu.add(0, "TOSS*");
				}

				graphics.setFont(Art.font.deriveFont(8f));
				graphics.setColor(Color.black);

				try {
					String tossAmount = this.amountToToss < 10 ? "0" + Integer.toString(this.amountToToss)
						: Integer.toString(this.amountToToss);
					graphics.drawString(
						this.selectionMenu.get(0), (4 * Tileable.WIDTH + (3 * (Tileable.WIDTH / 2))),
						(Tileable.HEIGHT * 5 + 6)
					);
					graphics.drawString(
						tossAmount, (4 * Tileable.WIDTH + ((11 - tossAmount.length()) * (Tileable.WIDTH / 2))),
						(Tileable.HEIGHT * 5 + 6)
					);
				}
				catch (Exception e) {}
				// This needs to be separated, else if there's a problem, the latter won't
				// render anything.
				break;
			}
			case MENU: {
				Item item = list.get(this.itemCursor).getKey();
				if (item.getCategory() == null)
					break;
				if (item != null && list.get(this.itemCursor).getValue() != Integer.MAX_VALUE) {
					graphics.setFont(Art.font.deriveFont(8f));
					graphics.setColor(Color.black);
					try {
						for (int i = 0; i < this.selectionMenu.size(); i++) {
							graphics.drawString(
								this.selectionMenu.get(i), (Tileable.WIDTH * 6 + 4),
								((12 * i) + Tileable.HEIGHT * (7 - this.selectionMenu.size()))
							);
						}
					}
					catch (Exception e) {}
					// This needs to be separated, else if there's a problem, the latter won't
					// render anything.
					break;
				}
			}
			default:
				break;
		}
		try {
			Map.Entry<Item, Integer> entry = list.get(this.itemCursor);
			List<Map.Entry<String, Boolean>> tokens = DialogueBuilder.toLines(
				entry.getKey().getDescription(),
				Dialogue.MAX_STRING_LENGTH
			);
			graphics.drawString(tokens.get(0).getKey(), 8, 144 - 32 + 7);
			graphics.drawString(tokens.get(1).getKey(), 8, 144 - 16 + 7);
		}
		catch (Exception e) {}
	}

	/**
	 * Renders the background of the Inventory, which its rendering area is where the list of items are
	 * to be drawn on top of.
	 *
	 * @param output
	 *            The screen that the game used to draw for the player to see.
	 * @param x
	 *            The X coordinates of where the text is to be drawn at.
	 * @param y
	 *            The Y coordinates of where the text is to be drawn at.
	 * @param width
	 *            The width of the list box that is to be drawn.
	 * @param height
	 *            The height of the lsit box that is too be drawn
	 *
	 * @return Nothing.
	 */
	private void renderListBox(Scene output, int x, int y, int width, int height) {
		for (int j = 0; j < height; j++) {
			for (int i = 0; i < width; i++) {
				output.blit(
					Art.dialogue_background, (x * Tileable.WIDTH) + (i * Tileable.WIDTH),
					(y * Tileable.HEIGHT - 7) + (j * Tileable.HEIGHT)
				);
			}
		}
		for (int k = 0; k < width; k++)
			output.blit(Art.dialogue_background, (x * Tileable.WIDTH) + (k * Tileable.WIDTH), (height * Tileable.HEIGHT));
	}

	/**
	 * Sets the inventory state.
	 *
	 * @return Nothing.
	 */
	private void setState(InventoryState value) {
		this.state = value;
	}

	/**
	 * Renders all the texts that are to be drawn to the screen.
	 *
	 *

	 * Does not draw text for the dialogues.
	 *
	 * @param g
	 *            The Graphics object that is passed to draw the text messages. It can be a Graphics
	 *            object that is created from a BufferedImage, or a Graphics object that is created from
	 *            a BufferStrategy().
	 *
	 * @return Nothing.
	 */
	private void renderText(Graphics g) {
		g.setFont(Art.font.deriveFont(8f));
		g.setColor(Color.black);
		List<Map.Entry<Item, Integer>> list = this.getCurrentList();
		switch (this.state) {
			default: {
				if (this.tick >= (byte) 0x4) {
					try {
						for (int i = 0; i < 5; i++) {
							if (i >= list.size())
								break;
							Map.Entry<Item, Integer> entry = list.get(this.itemListSpan + i);
							g.drawString(
								entry.getKey().getName(), 8 * (Tileable.WIDTH / 2),
								((Tileable.HEIGHT) + (Tileable.HEIGHT * i)) + 3
							);
							int value = entry.getValue().intValue();
							if (value != Integer.MAX_VALUE && entry.getKey().getCategory() != null
								&& this.category != ItemCategories.KEYITEMS) {
								String string = "*" + Integer.toString(value);
								g.drawString(
									string, 8 * (Tileable.WIDTH / 2) + ((12 - string.length()) * (Tileable.WIDTH / 2)),
									((Tileable.HEIGHT) + (Tileable.HEIGHT * i)) + 4
								);
							}
						}
					}
					catch (Exception e) {}
					// This needs to be separated, else if there's a problem, the latter won't
					// render anything.
					try {
						Map.Entry<Item, Integer> entry = list.get(this.itemCursor);
						List<Map.Entry<String, Boolean>> tokens = DialogueBuilder.toLines(
							entry.getKey().getDescription(),
							Dialogue.MAX_STRING_LENGTH
						);
						g.drawString(tokens.get(0).getKey(), 8, 144 - 32 + 7);
						g.drawString(tokens.get(1).getKey(), 8, 144 - 16 + 7);
					}
					catch (Exception e) {
						// e.printStackTrace();
					}
				}
				break;
			}
			case SET: {
				try {
					for (int i = 0; i < 5; i++) {
						if (i >= list.size())
							break;
						Map.Entry<Item, Integer> entry = list.get(this.itemListSpan + i);
						g.drawString(
							entry.getKey().getName(), 8 * (Tileable.WIDTH / 2),
							((Tileable.HEIGHT) + (Tileable.HEIGHT * i)) + 3
						);
						int value = entry.getValue().intValue();
						if (value != Integer.MAX_VALUE && entry.getKey().getCategory() != null
							&& this.category != ItemCategories.KEYITEMS) {
							String string = "*" + Integer.toString(value);
							g.drawString(
								string, 8 * (Tileable.WIDTH / 2) + ((12 - string.length()) * (Tileable.WIDTH / 2)),
								((Tileable.HEIGHT) + (Tileable.HEIGHT * i)) + 4
							);
						}
					}
				}
				catch (Exception e) {}
				try {
					Map.Entry<Item, Integer> entry = list.get(this.itemCursor);
					List<Map.Entry<String, Boolean>> tokens = DialogueBuilder.toLines(entry.getKey().getName() + " has been registered.", Dialogue.MAX_STRING_LENGTH);
					switch (this.set_completedLines.size()) {
						case 0:
							g.drawString(
								tokens.get(this.set_tokenIterator).getKey().substring(0, this.set_subStringIterator), 8,
								144 - 32 + 7
							);
							break;
						case 1:
							g.drawString(this.set_completedLines.get(0), 8, 144 - 32 + 7);
							g.drawString(
								tokens.get(this.set_tokenIterator).getKey().substring(0, this.set_subStringIterator), 8,
								144 - 16 + 7
							);
							break;
						case 2:
							g.drawString(this.set_completedLines.get(0), 8, 144 - 32 + 7);
							g.drawString(this.set_completedLines.get(1), 8, 144 - 16 + 7);
							break;
					}
					if (this.set_completedLines.size() < 2) {
						this.set_subStringIterator++;
						if (this.set_subStringIterator > tokens.get(this.set_tokenIterator).getKey().length()) {
							this.set_completedLines.add(tokens.get(this.set_tokenIterator).getKey());
							this.set_subStringIterator = 0;
							this.set_tokenIterator++;
						}
					}
					else {
						if (this.inventoryDialogueThread != null
							&& this.inventoryDialogueThread.getState() == Thread.State.TERMINATED) {
							this.inventoryDialogueThread = null;
							this.set_end = true;
							return;
						}
						if (this.inventoryDialogueThread == null) {
							this.inventoryDialogueThread = new Thread(() -> {
								Player.lockMovements();
								try {
									Thread.sleep(1500);
								}
								catch (InterruptedException e) {}
								Inventory.this.setState(InventoryState.SELECTION);
								Inventory.this.set_end = true;
								Player.unlockMovements();
							});
							this.inventoryDialogueThread.setName("Inventory Dialogue Thread");
						}
						if (this.inventoryDialogueThread.getState() == Thread.State.NEW)
							this.inventoryDialogueThread.start();
					}
					break;
				}
				catch (Exception e) {
					if (this.inventoryDialogueThread != null
						&& this.inventoryDialogueThread.getState() == Thread.State.TERMINATED) {
						this.inventoryDialogueThread = null;
						this.set_end = true;
						return;
					}
					if (this.inventoryDialogueThread == null) {
						this.inventoryDialogueThread = new Thread(() -> {
							Player.lockMovements();
							try {
								Thread.sleep(2000);
							}
							catch (InterruptedException e1) {}
							Inventory.this.setState(InventoryState.SELECTION);
							Inventory.this.set_end = true;
							Player.unlockMovements();
						});
						this.inventoryDialogueThread.setName("Inventory Dialogue Thread");
					}
					if (this.inventoryDialogueThread.getState() == Thread.State.NEW)
						this.inventoryDialogueThread.start();
				}
			}
		}
	}
}


text:
module.exports = function(server) {
	return function(request, response) {
		//request trigger
		server.trigger('request-end', request, response);

		//if response isn't processing
		if(!response.processing && typeof response.message === 'undefined') {
			response.message = '';
			response.state = 404;
			server.trigger('response', request, response);
		}
	};
};


text:
package message

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestMarshal(t *testing.T) {
	type testCase struct {
		m      Message
		result string
	}
	cases := []testCase{
		testCase{
			Message{Command: "join", Options: []string{"#golang"}},
			"JOIN #golang\r\n",
		},
		testCase{
			Message{Command: "ping", Options: []string{"chat.freenode.net"}},
			"PING chat.freenode.net\r\n",
		},
		testCase{
			Message{Command: "user", Options: []string{"name", "name", "irc.freenode.net", "Some Cool Name"}},
			"USER name name irc.freenode.net :Some Cool Name\r\n",
		},
	}

	for _, c := range cases {
		result := Marshal(c.m)
		assert.Equal(t, c.result, result)
	}
}

func TestUnmarshal(t *testing.T) {
	type testCase struct {
		input string
		m     Message
		err   error
	}

	cases := []testCase{
		testCase{
			"JOIN #golang\r\n",
			Message{Command: "JOIN", Options: []string{"#golang"}},
			nil,
		},
		testCase{
			"PING chat.freenode.net\r\n",
			Message{Command: "PING", Options: []string{"chat.freenode.net"}},
			nil,
		},
		testCase{
			"USER name name irc.freenode.net :Some Cool Name\r\n",
			Message{Command: "USER", Options: []string{"name", "name", "irc.freenode.net", "Some Cool Name"}},
			nil,
		},
		testCase{
			":aaa!bbb@ccc/ddd PRIVMSG #golang :Some cool message!",
			Message{Prefix: ":aaa!bbb@ccc/ddd", Command: "PRIVMSG", Options: []string{"#golang", "Some cool message!"}},
			nil,
		},
	}

	for _, c := range cases {
		m, err := Unmarshal(c.input)
		assert.Nil(t, c.err, err)
		assert.Equal(t, c.m, m)
	}
}


text:
<?php

namespace FOS\MessageBundle\Twig\Extension;

use FOS\MessageBundle\Security\ParticipantProviderInterface;
use FOS\MessageBundle\Model\ReadableInterface;
use FOS\MessageBundle\Provider\ProviderInterface;
use FOS\MessageBundle\Model\ThreadInterface;
use FOS\MessageBundle\Security\AuthorizerInterface;

class MessageExtension extends \Twig_Extension
{
    protected $participantProvider;
    protected $provider;
    protected $authorizer;

    protected $nbUnreadMessagesCache;

    public function __construct(ParticipantProviderInterface $participantProvider, ProviderInterface $provider, AuthorizerInterface $authorizer)
    {
        $this->participantProvider = $participantProvider;
        $this->provider = $provider;
        $this->authorizer = $authorizer;
    }

    /**
     * Returns a list of global functions to add to the existing list.
     *
     * @return array An array of global functions
     */
    public function getFunctions()
    {
        return array(
            'fos_message_is_read'  => new \Twig_Function_Method($this, 'isRead'),
            'fos_message_nb_unread' => new \Twig_Function_Method($this, 'getNbUnread'),
            'fos_message_can_delete_thread' => new \Twig_Function_Method($this, 'canDeleteThread'),
            'fos_message_deleted_by_participant' => new \Twig_Function_Method($this, 'isThreadDeletedByParticipant')
        );
    }

    /**
     * Tells if this readable (thread or message) is read by the current user
     *
     * @return boolean
     */
    public function isRead(ReadableInterface $readable)
    {
        return $readable->isReadByParticipant($this->getAuthenticatedParticipant());
    }

    /**
     * Checks if the participant can mark a thread as deleted
     *
     * @param ThreadInterface $thread
     *
     * @return boolean true if participant can mark a thread as deleted, false otherwise
     */
    public function canDeleteThread(ThreadInterface $thread)
    {
        return $this->authorizer->canDeleteThread($thread);
    }

    /**
     * Checks if the participant has marked the thread as deleted
     *
     * @param ThreadInterface $thread
     *
     * @return boolean true if participant has marked the thread as deleted, false otherwise
     */
    public function isThreadDeletedByParticipant(ThreadInterface $thread)
    {
       return $thread->isDeletedByParticipant($this->getAuthenticatedParticipant());
    }

    /**
     * Gets the number of unread messages for the current user
     *
     * @return int
     */
    public function getNbUnread()
    {
        if (null === $this->nbUnreadMessagesCache) {
            $this->nbUnreadMessagesCache = $this->provider->getNbUnreadMessages();
        }

        return $this->nbUnreadMessagesCache;
    }

    /**
     * Gets the current authenticated user
     *
     * @return ParticipantInterface
     */
    protected function getAuthenticatedParticipant()
    {
        return $this->participantProvider->getAuthenticatedParticipant();
    }

    /**
     * Returns the name of the extension.
     *
     * @return string The extension name
     */
    public function getName()
    {
        return 'fos_message';
    }
}